/* 与 TreePix 主站启动页一致；自举阶段与 React 加载态共用，主题加载后消费工作台语义 token。 */
:root {
    --treepix-loading-background: #f5f5f7;
    --treepix-loading-accent: #047857;
    --treepix-loading-text: #1d1d1f;
    --treepix-loading-muted: #86868b;
}

html.dark {
    --treepix-loading-background: #1c1c1e;
    --treepix-loading-accent: #05a867;
    --treepix-loading-text: #f5f5f7;
    --treepix-loading-muted: #98989d;
}

.treepix-loader,
.treepix-loader-content {
    --treepix-loading-active: var(--workspace-accent, var(--treepix-loading-accent));
    --treepix-loading-foreground: var(--foreground, var(--treepix-loading-text));
}

.treepix-loader {
    position: fixed;
    inset: 0;
    z-index: var(--loader-z, 100);
    display: grid;
    min-height: 100dvh;
    place-items: center;
    overflow: hidden;
    color: var(--treepix-loading-foreground);
    background: radial-gradient(circle at 50% 44%, color-mix(in srgb, var(--treepix-loading-active) 13%, transparent), transparent 30%), var(--workspace-page, var(--treepix-loading-background));
}

.treepix-loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    padding: 24px;
    transform: translateY(-2vh);
    font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif);
    text-align: center;
}

.treepix-loader-brand {
    color: var(--treepix-loading-active);
    font-size: 30px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.8px;
}

.treepix-loader-indicator {
    box-sizing: border-box;
    position: relative;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    border: 2px solid color-mix(in srgb, var(--treepix-loading-foreground) 10%, transparent);
    border-top-color: var(--treepix-loading-active);
    border-right-color: color-mix(in srgb, var(--treepix-loading-active) 55%, transparent);
    border-radius: 50%;
    animation: treepix-loading-spin 780ms linear infinite;
}

.treepix-loader-indicator::after {
    content: "";
    position: absolute;
    inset: 8px;
    border-radius: inherit;
    background: color-mix(in srgb, var(--treepix-loading-active) 14%, transparent);
    animation: treepix-loading-breathe 1.25s ease-in-out infinite;
}

.treepix-loader-label {
    color: var(--muted-foreground, var(--treepix-loading-muted));
    font-size: 13px;
    line-height: 1.4;
    letter-spacing: 0.2px;
}

.treepix-loader-content.is-inline .treepix-loader-brand { font-size: 20px; }
.treepix-loader-content.is-inline .treepix-loader-indicator { width: 28px; height: 28px; }
.treepix-loader-content.is-inline .treepix-loader-indicator::after { inset: 5px; }

@keyframes treepix-loading-spin { to { transform: rotate(360deg); } }
@keyframes treepix-loading-breathe { 50% { opacity: 0.35; transform: scale(0.72); } }

@media (prefers-reduced-motion: reduce) {
    .treepix-loader-indicator,
    .treepix-loader-indicator::after { animation: none; }
}
