:root {
    color-scheme: dark;
    --bg: #07080c;
    --panel: #0e1016;
    --line: #1c2029;
    --text: #d6dae3;
    --dim: #7d8698;
    --accent: #4ade80;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
    overflow: hidden;
}

#app {
    display: grid;
    grid-template-columns: 1fr 300px;
    grid-template-rows: 1fr auto;
    grid-template-areas: "stage panel" "transport panel";
    height: 100vh;
    gap: 1px;
    background: var(--line);
}

#stage {
    grid-area: stage;
    position: relative;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

#dropzone {
    padding: 32px 48px;
    border-radius: 12px;
    background: rgba(14, 16, 22, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
#dropzone:hover {
    background: rgba(20, 24, 34, 0.95);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.7);
}
.dz-inner { text-align: center; }
.dz-title { font-size: 22px; font-weight: 700; letter-spacing: .28em; text-transform: uppercase; margin-bottom: 8px; color: #fff; }
.dz-sub { color: var(--dim); font-size: 13px; }
.dz-hint { color: #5a6478; font-size: 11px; margin-top: 8px; }

.an-bar { height: 3px; background: var(--line); overflow: hidden; margin-top: 4px; border-radius: 2px; }
.an-fill { height: 100%; width: 0; background: var(--accent); transition: width .12s linear; }

#hud {
    position: absolute; top: 10px; left: 10px;
    background: rgba(7,8,12,0.82);
    border: 1px solid var(--line);
    padding: 8px 10px;
    font-size: 11px; line-height: 1.65;
    color: #9aa3b4;
    pointer-events: none;
}

/* Export failures used to land only in a status line inside a panel the user
   may not be looking at — a lost render deserves to interrupt. */
#toast {
    position: absolute; bottom: 16px; left: 50%;
    transform: translateX(-50%);
    max-width: min(680px, calc(100% - 32px));
    background: rgba(7,8,12,0.94);
    border: 1px solid #7f1d1d;
    border-left: 3px solid #ef4444;
    padding: 10px 34px 10px 12px;
    font-size: 12px; line-height: 1.6;
    color: var(--text);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    cursor: pointer;
}
#toast.ok { border-color: #14532d; border-left-color: var(--accent); }
#toast::after {
    content: '×';
    position: absolute; top: 6px; right: 10px;
    color: var(--dim); font-size: 14px;
}

#transport { grid-area: transport; background: var(--panel); }
#timeline { height: 46px; }
#timeline-canvas { width: 100%; height: 46px; display: block; cursor: pointer; }

#controls {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 10px;
    border-top: 1px solid var(--line);
    flex-wrap: wrap;
}
#time-display, #section-display { color: var(--dim); font-size: 12px; }

/* Both readouts change length while the song plays, and the row wraps. Left to
   themselves they push the buttons onto a second line mid-track — the clock
   when it crosses ten minutes, the section label whenever the scene name is
   long or a crossfade appears. Neither is allowed to influence the layout:
   the clock is fixed-width with tabular figures, and the section label lays
   out at zero width and ellipsises into whatever space is left over. */
#time-display {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    min-width: 9ch;
    text-align: center;
}
#section-display {
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    text-align: center;
}

button, select {
    background: #171a22;
    color: var(--text);
    border: 1px solid var(--line);
    padding: 5px 10px;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}
button:hover, select:hover { background: #1f232d; }
button.primary { border-color: #2f6f4a; color: var(--accent); }
button.wide { width: 100%; margin-top: 12px; }
#controls button.on { border-color: rgba(74,222,128,0.55); color: var(--accent); background: rgba(74,222,128,0.08); }
.ctl { color: var(--dim); display: flex; align-items: center; gap: 5px; }

#panel {
    grid-area: panel;
    background: var(--panel);
    display: flex; flex-direction: column;
    overflow: hidden;
}
#track-header {
    padding: 12px 14px;
    background: #090b10;
    border-bottom: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.th-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.th-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex: 1;
}
.th-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .14em;
    color: var(--dim);
    font-weight: 500;
}
.th-name {
    font-weight: 600;
    font-size: 12px;
    color: var(--accent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}
.th-btn {
    background: rgba(74, 222, 128, 0.1);
    border: 1px solid rgba(74, 222, 128, 0.3);
    color: var(--accent);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}
.th-btn:hover {
    background: rgba(74, 222, 128, 0.25);
    border-color: var(--accent);
}
.th-progress {
    margin-top: 4px;
}
.th-step {
    font-size: 11px;
    color: var(--dim);
}
#panel-tabs { display: flex; border-bottom: 1px solid var(--line); }
#panel-tabs button { flex: 1; border: 0; border-right: 1px solid var(--line); background: transparent; color: var(--dim); }
#panel-tabs button.active { color: var(--text); background: #141821; }
#panel-body { flex: 1; overflow-y: auto; padding: 10px; }

.pp-heading { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.pp-name { font-size: 14px; }
.pp-family { color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
.pp-sub { color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: .12em; margin: 14px 0 6px; }

.pp-row { display: grid; grid-template-columns: 84px 1fr 46px; gap: 8px; align-items: center; margin-bottom: 5px; }
.pp-label { color: var(--dim); font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.pp-value { color: var(--text); font-size: 11px; text-align: right; }
.pp-input { width: 100%; }
input[type=range] { accent-color: var(--accent); background: transparent; }

.pp-reactive { margin-top: 12px; }
.pp-react-row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; font-size: 11px; color: var(--dim); }
.pp-react-row.current { color: var(--text); }
.pp-feature { color: #6b8afd; }
.dim { color: #4b5563; font-style: normal; font-size: 10px; }
.pp-amount { color: var(--text); }

.kv { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; padding: 2px 0; }
.kv span { color: var(--dim); }
.kv b { font-weight: 500; text-align: right; }
.kv.current { background: rgba(74,222,128,0.08); margin: 0 -4px; padding: 2px 4px; }

.swatches { display: flex; gap: 3px; margin: 10px 0; }
.sw { flex: 1; height: 26px; border: 1px solid rgba(0,0,0,0.4); }

.hint { color: #4b5563; font-size: 11px; margin-top: 8px; line-height: 1.5; }

@media (max-width: 900px) {
    #app {
        grid-template-columns: 1fr;
        grid-template-areas: "stage" "transport" "panel";
        grid-template-rows: auto auto 1fr;
    }
}

/* Single-scene gate output (checks.html?scene=Name). Monospaced so the
   PASS/FAIL column lines up and the whole verdict reads in one glance. */
.scene-gate {
    font: 12px/1.7 ui-monospace, monospace;
    color: var(--text);
    background: #0e1016;
    padding: 14px 16px;
    margin: 0;
    white-space: pre;
    overflow-x: auto;
}
