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

* { box-sizing: border-box; }

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;
}

#canvas { display: block; max-width: 100%; max-height: 100%; }

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

#dropzone {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    border: 1px dashed var(--line);
}
#dropzone:hover { background: rgba(255,255,255,0.02); }
.dz-inner { text-align: center; }
.dz-title { font-size: 26px; letter-spacing: .34em; text-transform: uppercase; margin-bottom: 12px; }
.dz-sub { color: var(--dim); }
.dz-hint { color: #4b5563; font-size: 11px; margin-top: 6px; }

#analysing { text-align: center; min-width: 260px; }
.an-title { letter-spacing: .3em; text-transform: uppercase; color: var(--dim); }
.an-step { margin: 8px 0; color: var(--text); }
.an-bar { height: 3px; background: var(--line); overflow: hidden; margin-top: 8px; }
.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;
}

#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;
}
#controls .spacer { flex: 1; }
#time-display, #section-display { color: var(--dim); font-size: 12px; }

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; }
.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;
}
#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-feature { color: #6b8afd; }
.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;
    }
}
