:root {
    --bg: #020304;
    --panel: rgba(14,18,24,0.62);
    --panel-2: rgba(255,255,255,0.05);
    --ink: #eef2f7;
    --muted: #8b93a0;
    --line: rgba(255,255,255,0.09);
    --accent: #5cb3ff;
    --glow: 0 8px 40px rgba(0,0,0,0.55);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--ink);
    font: 300 13px/1.5 -apple-system, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

.glass {
    background: var(--panel);
    backdrop-filter: blur(18px) saturate(1.4);
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
    border: 1px solid var(--line);
    box-shadow: var(--glow);
}

/* -- explorer layout (viewport + side panels) --------------------------- */
#app {
    display: grid;
    grid-template-columns: 240px 1fr 320px;
    height: 100vh;
    overflow: hidden;
}
#app.narrow { grid-template-columns: 1fr 320px; }
#app.story-layout { grid-template-columns: 320px 1fr 300px; }

#viewport { position: relative; background: #000000; }
#viewport canvas { display: block; }

.panel {
    background: var(--panel);
    backdrop-filter: blur(18px) saturate(1.4);
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
    border-right: 1px solid var(--line);
    padding: 16px;
    overflow-y: auto;
}
#inspector { border-right: none; border-left: 1px solid var(--line); }

h1 { font-size: 14px; font-weight: 600; margin: 0 0 4px; }
.sub { color: var(--muted); font-size: 11px; margin-bottom: 16px; }
h2 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
     color: var(--muted); margin: 18px 0 8px; }
h2:first-of-type { margin-top: 0; }

label.row {
    display: flex; align-items: center; gap: 8px;
    padding: 5px 0; cursor: pointer; font-size: 12.5px;
}
label.row input { accent-color: var(--accent); }

#inspector .empty { color: var(--muted); font-size: 12px; margin-top: 8px; }
#inspector .field { margin-bottom: 10px; }
#inspector .field .k { color: var(--muted); font-size: 10.5px; text-transform: uppercase; }
#inspector .field .v { font-size: 13px; }
#inspector .prov { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line);
                    color: var(--muted); font-size: 11.5px; line-height: 1.5; }
#inspector canvas.chart { width: 100%; height: 90px; margin-top: 6px; background: var(--panel-2); border-radius: 4px; }

#hint { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); font-size: 10.5px;
        color: var(--muted); z-index: 1; letter-spacing: .02em; opacity: .5; pointer-events: none; }
#err { display: none; position: absolute; inset: 0; padding: 20px; color: #ff8080;
       font: 12px/1.5 monospace; white-space: pre-wrap; overflow: auto; z-index: 3; background: rgba(5,7,10,0.92); }

.back-link { display: inline-block; margin-bottom: 12px; font-size: 12px; color: var(--muted); text-decoration: none; }
.back-link:hover { color: var(--ink); }

/* -- compact inspector/detail card (badge-first, not prose) -------------- */
.layer-title { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.prov-badge {
    display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600;
    color: var(--c); background: color-mix(in srgb, var(--c) 16%, transparent);
    border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
    padding: 4px 10px; border-radius: 999px; margin-bottom: 8px;
}
.prov-badge .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.prov-pair { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.prov-pair .prov-badge { margin-bottom: 0; }
#parts-legend { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 2px; }
#parts-legend:empty { margin: 0; }
#parts-legend .prov-badge { margin-bottom: 0; }
.prov-desc { font-size: 11px; color: var(--muted); line-height: 1.5; margin-bottom: 12px; }
.layer-note { font-size: 12px; line-height: 1.55; margin-bottom: 10px; }
code.src { display: inline-block; font-size: 10.5px; color: var(--ink); background: var(--panel-2);
           padding: 4px 8px; border-radius: 4px; }

/* -- guided assembly step control (bottom-left, nullschool-minimal) ------ */
#step-panel { position: absolute; left: 24px; bottom: 24px; z-index: 2; width: 340px; }
#step-dots { display: flex; gap: 7px; margin-bottom: 12px; }
.step-dot { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,0.18); cursor: pointer; transition: all .2s; }
.step-dot.done { background: var(--muted); }
.step-dot.active { background: var(--accent); box-shadow: 0 0 8px var(--accent); transform: scale(1.4); }
.step-dot.future { background: transparent; border: 1px solid rgba(255,255,255,0.15); cursor: default; }
#step-card {
    background: var(--panel);
    backdrop-filter: blur(20px) saturate(1.5);
    -webkit-backdrop-filter: blur(20px) saturate(1.5);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 18px 20px;
    box-shadow: var(--glow);
}
#step-title { font-size: 16px; font-weight: 400; letter-spacing: .01em; margin-bottom: 6px; }
#step-kid { font-size: 12.5px; color: var(--muted); line-height: 1.55; margin-bottom: 12px; font-weight: 300; }
details summary { list-style: none; }
details summary::-webkit-details-marker { display: none; }
details summary:hover { color: var(--ink) !important; }
#step-detail-body { margin-top: 10px; }
#step-detail-body ul, #step-detail-body ol { margin: 6px 0; padding-left: 18px; }
#step-detail-body li { margin: 2px 0; }
#step-limitation { font-size: 11px; color: var(--muted); line-height: 1.55; margin-top: 10px;
                    padding-top: 10px; border-top: 1px solid var(--line); }
#step-nav { display: flex; gap: 8px; margin-top: 14px; }
#step-nav button {
    background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: 20px;
    padding: 7px 14px; font-size: 11.5px; cursor: pointer; transition: all .15s;
}
#step-nav button:hover { border-color: var(--accent); color: var(--ink); }
#river-detail { display: none; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
#river-detail .k { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
#river-detail canvas.chart { width: 100%; height: 70px; background: var(--panel-2); border-radius: 4px; }

#argo-detail { display: none; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
#argo-detail .k { font-size: 11px; color: var(--muted); margin-bottom: 8px; }
#argo-detail canvas.chart { width: 100%; height: 140px; background: var(--panel-2); border-radius: 4px; margin-top: 8px; }

/* -- run-forward step: play button + day slider, same visual language as
   the other field-buttons rows -------------------------------------------- */
.frames-controls { align-items: center; }
.frames-controls button.play-btn {
    background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: 20px;
    padding: 5px 14px; font-size: 11px; cursor: pointer; transition: all .15s; flex: 0 0 auto;
}
.frames-controls button.play-btn:hover { border-color: var(--accent); color: var(--ink); }
.frames-controls input[type="range"] {
    flex: 1 1 auto; min-width: 60px; accent-color: var(--accent); cursor: pointer;
}
.frames-controls span#frames-day-label {
    flex: 0 0 auto; font-size: 11px; color: var(--muted); white-space: nowrap; min-width: 68px; text-align: right;
}

/* -- overlay-field switchers (meteo drape, boundary temp/salt), nullschool
   "Overlay:" row style -- shared by any #-id div with this class ---------- */
.field-buttons { display: none; gap: 6px; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.field-buttons.visible { display: flex; }
.field-buttons button {
    background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: 20px;
    padding: 5px 12px; font-size: 11px; cursor: pointer; transition: all .15s;
}
.field-buttons button:hover { border-color: var(--accent); color: var(--ink); }
.field-buttons button.active { background: color-mix(in srgb, var(--accent) 18%, transparent); border-color: var(--accent); color: var(--ink); }
/* toggle (not a field option) appended to the boundary row -- dashed border
   + left gap mark it as a different kind of control ------------------------ */
.field-buttons button.source-toggle-btn { margin-left: 10px; border-style: dashed; }
.field-buttons button.source-toggle-btn.active { background: color-mix(in srgb, var(--accent) 18%, transparent); border-color: var(--accent); border-style: dashed; color: var(--ink); }
.field-buttons select {
    width: 100%; background: var(--panel-2); color: var(--ink); border: 1px solid var(--line); border-radius: 20px;
    padding: 6px 12px; font-size: 11.5px; cursor: pointer;
}
.field-buttons select:hover, .field-buttons select:focus { border-color: var(--accent); outline: none; }
.field-buttons select option { background: #12161d; color: var(--ink); }

/* -- "The parts" step: clickable piece labels (CSS2DRenderer) beside the
   floating forcing pieces -- colour is set per-label from PROV ----------- */

/* Source attribution reads as a note, alongside the component it describes. */
.prov-badge {
    display:inline-flex; gap:6px; padding:0; border:0; border-radius:0;
    background:none; color:var(--muted); font-size:11px; font-weight:400;
    letter-spacing:0; margin-bottom:6px;
}
.prov-badge .dot { display:none; }
.prov-pair { align-items:baseline; gap:8px 12px; }
code.src { padding:0; background:none; border-radius:0; font-size:10px; }
#parts-legend { gap:18px; margin:8px 0; }

#parts-legend { color:var(--muted); font:400 11px/1.5 system-ui,sans-serif; }
