/* Hollow Labs: the engine playground (lab.html). Dark glass over the live picture. */
@font-face { font-family: HollowPixel; src: url('/fonts/hollow-pixel.ttf') format('truetype'); font-display: swap; }

:root {
    color-scheme: dark;
    --ink: #07090a;
    --glass: rgba(13, 17, 16, 0.78);
    --glass-2: rgba(22, 28, 26, 0.86);
    --glass-3: rgba(32, 40, 37, 0.9);
    --line: rgba(238, 232, 211, 0.09);
    --line-2: rgba(238, 232, 211, 0.16);
    --paper: #eee8d3;
    --text: #d9d6c8;
    --muted: #8f9a8e;
    --faint: #5f6a60;
    --gold: #e7c47c;
    --gold-2: #f3d79c;
    --gold-ink: #2a1f0b;
    --red: #e05a46;
    --sky: #8fc2e8;
    --leaf: #9fcf7f;
    --flesh: #d99a7b;
    --radius: 10px;
    --panel-w: 344px;
    --rail-w: 64px;
    --mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
    --pixel: HollowPixel, ui-monospace, monospace;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--ink); }
body {
    color: var(--text);
    font: 12.5px/1.45 system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
    touch-action: none;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
svg { display: block; }
a { color: var(--gold); }

#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; image-rendering: pixelated; cursor: grab; }
#view.dragging { cursor: grabbing; }
#view.fly { cursor: crosshair; }

#ui { position: fixed; inset: 0; pointer-events: none; transition: opacity 0.25s; }
#ui > * { pointer-events: auto; }
body.clean #ui { opacity: 0; }
body.clean #ui > * { pointer-events: none; }

.glass {
    background: var(--glass);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    backdrop-filter: blur(16px) saturate(1.2);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

/* ---------------------------------------------------------------- top bar */
.topbar {
    position: absolute; top: 12px; left: 12px; right: 12px;
    display: flex; align-items: center; gap: 10px; pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brand {
    display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 14px 0 10px;
    text-decoration: none; color: var(--paper); border-radius: var(--radius);
    background: var(--glass); border: 1px solid var(--line); box-shadow: var(--shadow);
    -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
}
.brand-mark {
    width: 22px; height: 22px; flex: none; position: relative;
    background:
        linear-gradient(var(--gold), var(--gold)) 9px 2px / 4px 4px no-repeat,
        linear-gradient(var(--gold), var(--gold)) 5px 6px / 12px 4px no-repeat,
        linear-gradient(var(--gold), var(--gold)) 3px 10px / 16px 4px no-repeat,
        linear-gradient(var(--red), var(--red)) 7px 14px / 8px 6px no-repeat;
    image-rendering: pixelated;
}
.brand-mark.big { width: 44px; height: 44px; transform: scale(1); background-size: auto; }
.brand-mark.big {
    background:
        linear-gradient(var(--gold), var(--gold)) 18px 4px / 8px 8px no-repeat,
        linear-gradient(var(--gold), var(--gold)) 10px 12px / 24px 8px no-repeat,
        linear-gradient(var(--gold), var(--gold)) 6px 20px / 32px 8px no-repeat,
        linear-gradient(var(--red), var(--red)) 14px 28px / 16px 12px no-repeat;
}
.brand-text { display: grid; line-height: 1.05; white-space: nowrap; }
.brand-text b { font: 15px/1 var(--pixel); letter-spacing: 0.06em; color: var(--paper); }
.brand-text small { font-size: 10px; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; margin-top: 3px; }

.scene-button {
    display: grid; grid-template-columns: auto 12px; grid-template-rows: auto auto; column-gap: 12px; align-items: center;
    height: 44px; min-width: 210px; padding: 0 14px; text-align: left; border-radius: var(--radius);
    background: var(--glass); border: 1px solid var(--line); box-shadow: var(--shadow);
    -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
}
.scene-button:hover { border-color: var(--line-2); background: var(--glass-2); }
.scene-eyebrow { grid-column: 1; font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.scene-name { grid-column: 1; font-weight: 600; color: var(--paper); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.scene-button svg { grid-column: 2; grid-row: 1 / 3; width: 12px; height: 12px; fill: none; stroke: var(--muted); stroke-width: 1.6; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; margin-right: calc(var(--panel-w) + 2px); transition: margin 0.25s; }
body.panel-hidden .topbar-right { margin-right: 0; }
.stats {
    display: flex; gap: 12px; height: 32px; align-items: center; padding: 0 12px; border-radius: 8px;
    background: rgba(8, 11, 10, 0.6); border: 1px solid var(--line); font: 11px var(--mono); color: var(--muted);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.stats:empty { display: none; }
.stats b { color: var(--paper); font-weight: 500; }
.camtools {
    display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--glass); border: 1px solid var(--line); box-shadow: var(--shadow);
    -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
}
.camtools .dock-btn { width: 36px; height: 36px; border-radius: 8px; }
.camtools .dock-btn[data-tip]:hover::after { bottom: auto; top: calc(100% + 10px); }
.play-link {
    height: 32px; display: flex; align-items: center; padding: 0 12px; border-radius: 8px; text-decoration: none;
    font-size: 11.5px; font-weight: 600; color: var(--gold-ink); background: var(--gold); border: 1px solid var(--gold-2);
}
.play-link:hover { background: var(--gold-2); }

/* ---------------------------------------------------------------- tool rail */
.rail {
    position: absolute; left: 12px; top: 68px; width: var(--rail-w);
    display: flex; flex-direction: column; gap: 4px; padding: 6px; border-radius: 14px;
    background: var(--glass); border: 1px solid var(--line); box-shadow: var(--shadow);
    -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
}
.rail-button {
    position: relative; display: grid; justify-items: center; gap: 4px; padding: 9px 0 7px; border-radius: 9px;
    background: transparent; border: 1px solid transparent; color: var(--muted);
    font-size: 9.5px; letter-spacing: 0.04em;
}
.rail-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.rail-button:hover { color: var(--paper); background: rgba(238, 232, 211, 0.05); }
.rail-button[aria-pressed="true"] { color: var(--gold); background: rgba(231, 196, 124, 0.1); border-color: rgba(231, 196, 124, 0.25); }
.rail-button[aria-pressed="true"]::before { content: ''; position: absolute; left: -7px; top: 12px; bottom: 12px; width: 3px; border-radius: 2px; background: var(--gold); }
.rail-sep { height: 1px; margin: 4px 8px; background: var(--line); }

/* ---------------------------------------------------------------- inspector */
.inspector {
    position: absolute; top: 12px; right: 12px; bottom: 12px; width: var(--panel-w);
    display: flex; flex-direction: column; border-radius: 14px; overflow: hidden;
    background: var(--glass); border: 1px solid var(--line); box-shadow: var(--shadow);
    -webkit-backdrop-filter: blur(18px) saturate(1.2); backdrop-filter: blur(18px) saturate(1.2);
    transition: transform 0.25s, opacity 0.25s;
}
body.panel-hidden .inspector { transform: translateX(calc(100% + 24px)); opacity: 0; pointer-events: none; }
.inspector-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 16px 14px 8px 18px; }
.eyebrow { font-size: 9.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); }
.inspector h1 { margin: 3px 0 0; font: 22px/1.1 var(--pixel); color: var(--paper); letter-spacing: 0.02em; }
.icon-button {
    width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px;
    background: transparent; border: 1px solid transparent; color: var(--muted);
}
.icon-button:hover { color: var(--paper); background: rgba(238, 232, 211, 0.06); border-color: var(--line); }
.icon-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.inspector-open {
    position: absolute; right: 12px; top: 68px; width: 34px; height: 44px; border-radius: 10px; display: grid; place-items: center;
    background: var(--glass); border: 1px solid var(--line); color: var(--muted); box-shadow: var(--shadow);
}
.inspector-open svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }

.filter {
    display: flex; align-items: center; gap: 8px; margin: 4px 14px 10px; padding: 0 10px; height: 34px; border-radius: 9px;
    background: rgba(0, 0, 0, 0.28); border: 1px solid var(--line);
}
.filter:focus-within { border-color: rgba(231, 196, 124, 0.5); }
.filter svg { width: 14px; height: 14px; flex: none; fill: none; stroke: var(--muted); stroke-width: 1.5; }
.filter input { flex: 1; min-width: 0; height: 100%; background: transparent; border: 0; outline: 0; font-size: 12.5px; }
.filter input::placeholder { color: var(--faint); }
.filter input::-webkit-search-cancel-button { filter: grayscale(1); }
kbd { font: 10px var(--mono); color: var(--muted); padding: 1px 5px; border: 1px solid var(--line-2); border-radius: 4px; }

.sections { flex: 1; overflow-y: auto; padding: 0 8px 24px; scrollbar-width: thin; scrollbar-color: #3a443d transparent; }
.sections::-webkit-scrollbar { width: 8px; }
.sections::-webkit-scrollbar-thumb { background: #2f3832; border-radius: 4px; border: 2px solid transparent; background-clip: padding-box; }

.section { margin: 0 0 6px; border-radius: 11px; border: 1px solid transparent; }
.section.open { background: rgba(238, 232, 211, 0.025); border-color: var(--line); }
.section-head {
    width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 10px; border: 0; background: transparent;
    text-align: left; border-radius: 10px;
}
.section-head:hover { background: rgba(238, 232, 211, 0.04); }
.section-icon { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 7px; background: rgba(238, 232, 211, 0.05); color: var(--section, var(--gold)); }
.section-icon svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.section-title { flex: 1; min-width: 0; }
.section-title b { display: block; font-weight: 600; font-size: 12.5px; color: var(--paper); }
.section-title small { display: block; font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.section-badge { font: 9.5px var(--mono); color: var(--muted); padding: 2px 6px; border-radius: 4px; background: rgba(238, 232, 211, 0.05); }
.section-chevron { width: 12px; height: 12px; fill: none; stroke: var(--muted); stroke-width: 1.6; transition: transform 0.2s; }
.section.open .section-chevron { transform: rotate(180deg); }
.section-body { display: none; padding: 2px 12px 12px; }
.section.open .section-body { display: block; }
.section-note { margin: 0 0 10px; font-size: 11px; color: var(--muted); line-height: 1.5; }
.section-note b { color: var(--text); font-weight: 600; }

.group-label {
    display: flex; align-items: center; gap: 8px; margin: 14px 0 6px; font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted);
}
.group-label::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.group-label:first-child { margin-top: 2px; }

.more {
    width: 100%; display: flex; align-items: center; justify-content: center; gap: 6px; margin: 10px 0 0; padding: 6px; border-radius: 7px;
    background: transparent; border: 1px dashed var(--line-2); color: var(--muted); font-size: 11px;
}
.more:hover { color: var(--paper); border-color: rgba(231, 196, 124, 0.4); }
.more svg { width: 10px; height: 10px; fill: none; stroke: currentColor; stroke-width: 1.8; transition: transform 0.2s; }
.more[aria-expanded="true"] svg { transform: rotate(180deg); }
.advanced { display: none; }
.advanced.shown { display: block; }

/* A control row: label, the control, its value. */
.ctl { display: grid; grid-template-columns: 96px 1fr 50px; align-items: center; gap: 10px; min-height: 30px; position: relative; }
.ctl.wide { grid-template-columns: 96px 1fr; }
.ctl.full { grid-template-columns: 1fr; }
.ctl.chips { grid-template-columns: repeat(3, 1fr); }
.ctl.chips.two { grid-template-columns: repeat(2, 1fr); }
.ctl.chips.four { grid-template-columns: repeat(4, 1fr); }
.ctl.btns { display: flex; }
.ctl.readout, .ctl.meters, .ctl.roster { display: grid; }
.ctl-label { font-size: 11.5px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: default; }
.ctl-label.changed::after { content: ''; display: inline-block; width: 5px; height: 5px; margin: 0 0 1px 6px; border-radius: 50%; background: var(--gold); vertical-align: middle; }
.ctl-value {
    font: 11px var(--mono); color: var(--paper); text-align: right; background: transparent; border: 1px solid transparent; border-radius: 5px;
    padding: 2px 4px; width: 100%; min-width: 0;
}
.ctl-value:hover { border-color: var(--line-2); }
.ctl-value:focus { outline: 0; border-color: rgba(231, 196, 124, 0.55); background: rgba(0, 0, 0, 0.3); }
.ctl.hidden-by-filter, .section.hidden-by-filter { display: none; }
.ctl.mark .ctl-label { color: var(--gold-2); }
.ctl.disabled { opacity: 0.4; pointer-events: none; }

input[type=range] {
    -webkit-appearance: none; appearance: none; width: 100%; height: 22px; margin: 0; background: transparent; cursor: pointer;
    --p: 50%;
}
input[type=range]::-webkit-slider-runnable-track {
    height: 4px; border-radius: 3px;
    background: linear-gradient(90deg, var(--track, var(--gold)) 0 var(--p), rgba(238, 232, 211, 0.12) var(--p) 100%);
}
input[type=range]::-moz-range-track { height: 4px; border-radius: 3px; background: rgba(238, 232, 211, 0.12); }
input[type=range]::-moz-range-progress { height: 4px; border-radius: 3px; background: var(--track, var(--gold)); }
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%;
    background: #f5efdc; border: 2px solid #121715; box-shadow: 0 0 0 1px rgba(238, 232, 211, 0.4), 0 2px 6px rgba(0, 0, 0, 0.5);
}
input[type=range]::-moz-range-thumb {
    width: 10px; height: 10px; border-radius: 50%; background: #f5efdc; border: 2px solid #121715; box-shadow: 0 0 0 1px rgba(238, 232, 211, 0.4);
}
input[type=range]:hover::-webkit-slider-thumb { transform: scale(1.12); }
input[type=range]:focus-visible { outline: 0; }
input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px rgba(231, 196, 124, 0.55); }

select.ctl-select {
    -webkit-appearance: none; appearance: none; width: 100%; height: 28px; padding: 0 26px 0 9px; border-radius: 7px;
    background: rgba(0, 0, 0, 0.3) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12"><path d="M3 4.5 6 7.5 9 4.5" fill="none" stroke="%238f9a8e" stroke-width="1.6"/></svg>') right 8px center / 11px no-repeat;
    border: 1px solid var(--line-2); font-size: 12px;
}
select.ctl-select:hover { border-color: rgba(238, 232, 211, 0.28); }
select.ctl-select option, select.ctl-select optgroup { background: #151b19; color: var(--text); }

.toggle { position: relative; width: 34px; height: 20px; flex: none; justify-self: end; }
.toggle input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.toggle i { position: absolute; inset: 0; border-radius: 11px; background: rgba(238, 232, 211, 0.14); transition: background 0.15s; pointer-events: none; }
.toggle i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #cfcab9; transition: transform 0.15s, background 0.15s; }
.toggle input:checked + i { background: var(--gold); }
.toggle input:checked + i::after { transform: translateX(14px); background: #1b160b; }
.toggle input:focus-visible + i { box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--gold); }

.seg { display: flex; padding: 2px; gap: 2px; border-radius: 8px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line); }
.seg button {
    flex: 1; min-width: 0; height: 26px; padding: 0 6px; border-radius: 6px; border: 0; background: transparent;
    color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    display: flex; align-items: center; justify-content: center; gap: 5px;
}
.seg button svg { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.seg button:hover { color: var(--paper); }
.seg button[aria-pressed="true"] { background: var(--glass-3); color: var(--paper); box-shadow: inset 0 0 0 1px var(--line-2); }
.seg.tall button { height: 48px; flex-direction: column; gap: 3px; font-size: 10.5px; }
.seg.tall button svg { width: 18px; height: 18px; }

.color { display: flex; align-items: center; gap: 8px; }
.color input[type=color] { width: 30px; height: 24px; padding: 0; border: 1px solid var(--line-2); border-radius: 6px; background: transparent; cursor: pointer; }
.color input[type=color]::-webkit-color-swatch-wrapper { padding: 2px; }
.color input[type=color]::-webkit-color-swatch { border: 0; border-radius: 4px; }
.color .clear { font-size: 10.5px; padding: 3px 7px; border-radius: 5px; background: transparent; border: 1px solid var(--line); color: var(--muted); }
.color .clear:hover { color: var(--paper); }
.color.unset input[type=color] { opacity: 0.35; }

.btns { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; }
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 8px;
    background: rgba(238, 232, 211, 0.06); border: 1px solid var(--line-2); color: var(--paper); font-size: 11.5px; font-weight: 500;
}
.btn:hover { background: rgba(238, 232, 211, 0.1); border-color: rgba(238, 232, 211, 0.26); }
.btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.btn.primary { background: var(--gold); color: var(--gold-ink); border-color: var(--gold-2); }
.btn.primary:hover { background: var(--gold-2); }
.btn.danger { color: #ffb4a6; border-color: rgba(224, 90, 70, 0.4); background: rgba(224, 90, 70, 0.08); }
.btn.grow { flex: 1; }

/* Cards: presets, chips, a picker of things to spawn. */
.chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 2px 0 6px; }
.chips.two { grid-template-columns: repeat(2, 1fr); }
.chips.four { grid-template-columns: repeat(4, 1fr); }
.chip {
    position: relative; display: grid; gap: 4px; justify-items: start; text-align: left; padding: 8px 9px; border-radius: 9px; min-width: 0;
    background: rgba(0, 0, 0, 0.25); border: 1px solid var(--line); color: var(--text); font-size: 11px;
}
.chip b { font-weight: 600; color: var(--paper); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.chip small { color: var(--muted); font-size: 10px; line-height: 1.3; }
.chip svg { width: 18px; height: 18px; fill: none; stroke: var(--chip, var(--gold)); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.chip:hover { border-color: var(--line-2); background: rgba(238, 232, 211, 0.05); }
.chip[aria-pressed="true"] { border-color: rgba(231, 196, 124, 0.6); background: rgba(231, 196, 124, 0.09); box-shadow: inset 0 0 0 1px rgba(231, 196, 124, 0.25); }
.chip .swatch { width: 100%; height: 6px; border-radius: 3px; }

.readout { margin: 6px 0 2px; padding: 9px 10px; border-radius: 8px; background: rgba(0, 0, 0, 0.28); border: 1px solid var(--line); font: 10.5px/1.6 var(--mono); color: var(--muted); }
.readout b { color: var(--paper); font-weight: 500; }
.meters { display: grid; gap: 6px; margin: 4px 0 8px; }
.meter { display: grid; grid-template-columns: 70px 1fr 34px; align-items: center; gap: 8px; font-size: 10.5px; color: var(--muted); }
.meter span:last-child { font: 10.5px var(--mono); color: var(--paper); text-align: right; }
.meter-bar { height: 4px; border-radius: 3px; background: rgba(238, 232, 211, 0.1); overflow: hidden; }
.meter-bar i { display: block; height: 100%; width: var(--v, 0%); background: var(--c, var(--sky)); border-radius: 3px; transition: width 0.2s; }

textarea.code {
    width: 100%; height: 110px; resize: vertical; padding: 8px; border-radius: 8px; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line);
    font: 10.5px/1.5 var(--mono); color: #cfc8b8;
}

/* The list of what's spawned. */
.roster { display: grid; gap: 4px; margin: 4px 0 6px; max-height: 210px; overflow-y: auto; }
.roster:empty::before { content: 'Nothing spawned yet.'; color: var(--faint); font-size: 11px; padding: 6px 2px; }
.roster-item {
    display: grid; grid-template-columns: 8px 1fr auto auto; align-items: center; gap: 8px; padding: 6px 6px 6px 9px; border-radius: 8px;
    background: rgba(0, 0, 0, 0.22); border: 1px solid var(--line); cursor: pointer; text-align: left;
}
.roster-item i { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--gold)); }
.roster-item span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roster-item small { color: var(--muted); font-size: 10px; }
.roster-item[aria-pressed="true"] { border-color: rgba(231, 196, 124, 0.6); background: rgba(231, 196, 124, 0.08); }
.roster-item .x { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 5px; border: 0; background: transparent; color: var(--muted); }
.roster-item .x:hover { color: #ffb4a6; background: rgba(224, 90, 70, 0.1); }
.roster-item .x svg { width: 10px; height: 10px; stroke: currentColor; stroke-width: 1.8; }

/* ---------------------------------------------------------------- the dock */
.dock {
    position: absolute; left: 50%; bottom: 14px; transform: translateX(calc(-50% - var(--panel-w) / 2 + var(--rail-w) / 2));
    display: flex; align-items: stretch; gap: 0; padding: 6px; border-radius: 16px; max-width: calc(100vw - var(--panel-w) - var(--rail-w) - 60px);
    background: var(--glass); border: 1px solid var(--line); box-shadow: var(--shadow);
    -webkit-backdrop-filter: blur(18px) saturate(1.2); backdrop-filter: blur(18px) saturate(1.2);
    transition: transform 0.25s;
}
body.panel-hidden .dock { transform: translateX(calc(-50% + var(--rail-w) / 2)); max-width: calc(100vw - var(--rail-w) - 60px); }
.dock-group { display: flex; align-items: center; gap: 4px; padding: 0 8px; }
.dock-group + .dock-group { border-left: 1px solid var(--line); }
.dock-label { font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-right: 4px; writing-mode: vertical-rl; transform: rotate(180deg); }
.dock-btn {
    position: relative; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; border: 1px solid transparent;
    background: transparent; color: var(--muted);
}
.dock-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.dock-btn:hover { color: var(--paper); background: rgba(238, 232, 211, 0.06); }
.dock-btn[aria-pressed="true"] { color: var(--gold); background: rgba(231, 196, 124, 0.12); border-color: rgba(231, 196, 124, 0.3); }
.dock-btn[data-tip]:hover::after {
    content: attr(data-tip); position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%); white-space: nowrap;
    padding: 4px 8px; border-radius: 6px; background: #0c100f; border: 1px solid var(--line-2); color: var(--paper); font-size: 11px; pointer-events: none;
}

.clock { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px; width: 270px; padding: 0 6px; }
.clock-face { display: grid; line-height: 1.05; min-width: 64px; }
.clock-face b { font: 19px var(--mono); color: var(--paper); letter-spacing: -0.02em; }
.clock-face small { font-size: 10px; color: var(--muted); letter-spacing: 0.04em; }
.day-track { position: relative; height: 38px; }
.day-track input { position: absolute; inset: 0; height: 38px; z-index: 2; opacity: 0; cursor: ew-resize; }
.day-sky {
    position: absolute; left: 0; right: 0; top: 12px; height: 14px; border-radius: 7px; overflow: hidden;
    background: linear-gradient(90deg, #0b1630 0%, #13234a 18%, #e48a5a 25%, #8cc1ec 32%, #9dd0f2 50%, #8cc1ec 64%, #f2a35c 71%, #b4506a 75%, #1a2350 82%, #0b1630 100%);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.day-ticks { position: absolute; left: 0; right: 0; top: 29px; display: flex; justify-content: space-between; font: 8.5px var(--mono); color: var(--faint); padding: 0 1px; pointer-events: none; }
.day-thumb {
    position: absolute; top: 7px; width: 24px; height: 24px; margin-left: -12px; border-radius: 50%; left: var(--t, 50%);
    background: radial-gradient(circle at 50% 50%, #fff7d6 0 30%, #ffd57a 31% 52%, transparent 54%);
    box-shadow: 0 0 0 2px rgba(10, 12, 12, 0.8), 0 0 14px rgba(255, 210, 120, 0.55); pointer-events: none;
}
.day-thumb.moon { background: radial-gradient(circle at 40% 40%, #f1f3fa 0 46%, transparent 48%); box-shadow: 0 0 0 2px rgba(10, 12, 12, 0.8), 0 0 12px rgba(180, 200, 255, 0.45); }
.speed { height: 26px; padding: 0 6px; border-radius: 7px; border: 1px solid var(--line-2); background: rgba(0, 0, 0, 0.3); font: 11px var(--mono); color: var(--paper); }
.speed option { background: #151b19; }

/* ---------------------------------------------------------------- scenes */
.scenes { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; background: rgba(4, 6, 6, 0.55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); z-index: 20; }
.scenes-card {
    width: min(980px, 100%); max-height: calc(100vh - 48px); overflow-y: auto; padding: 20px 22px 22px; border-radius: 16px;
    background: rgba(13, 17, 16, 0.94); border: 1px solid var(--line-2); box-shadow: var(--shadow);
}
.scenes-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.scenes h2 { margin: 3px 0 0; font: 26px/1 var(--pixel); color: var(--paper); }
.scene-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.scene-card {
    display: grid; grid-template-rows: auto auto; text-align: left; padding: 0; overflow: hidden; border-radius: 12px;
    background: #101614; border: 1px solid var(--line); color: var(--text);
}
.scene-card:hover { border-color: rgba(231, 196, 124, 0.45); transform: translateY(-1px); }
.scene-card[aria-current="true"] { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.scene-thumb { aspect-ratio: 16 / 9; width: 100%; display: block; object-fit: cover; image-rendering: pixelated; background: #1a2320; }
.scene-meta { padding: 10px 12px 12px; display: grid; gap: 3px; }
.scene-meta b { color: var(--paper); font-size: 13px; }
.scene-meta small { color: var(--muted); font-size: 11px; line-height: 1.4; }
.scene-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.scene-tags span { font-size: 9.5px; letter-spacing: 0.06em; text-transform: uppercase; padding: 2px 6px; border-radius: 4px; color: var(--muted); background: rgba(238, 232, 211, 0.06); }

/* ---------------------------------------------------------------- loader, toast, hint */
.loader { position: fixed; inset: 0; display: grid; place-items: center; z-index: 30; background: radial-gradient(ellipse at 50% 40%, rgba(20, 30, 26, 0.75), rgba(6, 8, 8, 0.92)); transition: opacity 0.4s; }
.loader.done { opacity: 0; pointer-events: none; }
.loader.over { background: rgba(6, 8, 8, 0.55); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.loader-card { display: grid; justify-items: center; gap: 12px; width: min(360px, 80vw); text-align: center; }
.loader-title { margin: 6px 0 0; font: 22px var(--pixel); color: var(--paper); }
.loader-bar { width: 100%; height: 4px; border-radius: 3px; background: rgba(238, 232, 211, 0.1); overflow: hidden; }
.loader-bar i { display: block; height: 100%; width: var(--p, 0%); background: linear-gradient(90deg, var(--gold), var(--red)); transition: width 0.3s; }
.loader-step { margin: 0; color: var(--muted); font-size: 11.5px; min-height: 1.4em; }

.toast {
    position: absolute; left: 50%; top: 70px; transform: translate(-50%, -8px); padding: 8px 14px; border-radius: 9px; opacity: 0;
    background: rgba(10, 13, 12, 0.88); border: 1px solid var(--line-2); color: var(--paper); font-size: 12px; transition: opacity 0.2s, transform 0.2s; pointer-events: none;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.hint {
    position: absolute; left: 14px; bottom: 16px; width: calc(var(--rail-w) + 40px); font-size: 10.5px; color: rgba(238, 232, 211, 0.6);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8); pointer-events: none; display: grid; gap: 5px;
}
#ui > .hint { pointer-events: none; }
.hint kbd { color: rgba(238, 232, 211, 0.7); background: rgba(0, 0, 0, 0.35); border-color: rgba(238, 232, 211, 0.2); }
.nogl { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; z-index: 40; background: var(--ink); }
.nogl p { max-width: 420px; color: var(--text); }

/* Labels over the picture, on what's spawned. */
#ui > .tags { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.tag {
    position: absolute; left: 0; top: 0; transform: translate(-50%, -100%); padding: 3px 7px; border-radius: 6px; pointer-events: none;
    background: rgba(10, 13, 12, 0.82); border: 1px solid var(--line-2); color: var(--paper); font-size: 10.5px; white-space: nowrap;
}
.tag.sel { border-color: var(--gold); color: var(--gold-2); }

/* ---------------------------------------------------------------- narrow screens */
@media (max-width: 1360px) {
    .hint, .play-link { display: none; }
}
@media (max-width: 1180px) {
    :root { --panel-w: 316px; }
    .clock { width: 210px; }
    .dock-label { display: none; }
    .dock-btn { width: 34px; height: 34px; }
    .stats { display: none; }
}
@media (max-width: 820px) {
    :root { --panel-w: 0px; --rail-w: 0px; }
    .topbar { top: max(8px, env(safe-area-inset-top)); left: 8px; right: 8px; gap: 6px; }
    .brand { height: 40px; padding: 0 10px 0 8px; }
    .brand-text small { display: none; }
    .scene-button { min-width: 0; flex: 1; height: 40px; }
    .scene-name { max-width: 40vw; }
    .stats, .play-link, .camtools .dock-btn:nth-child(3) { display: none; }
    .camtools { position: fixed; right: 8px; top: calc(max(8px, env(safe-area-inset-top)) + 100px); flex-direction: column; }
    .camtools .dock-btn { width: 38px; height: 38px; }
    .camtools .dock-btn[data-tip]:hover::after { display: none; }
    .topbar-right { margin-right: 0; }
    .rail {
        top: auto; left: 8px; right: 8px; bottom: max(8px, env(safe-area-inset-bottom)); width: auto; flex-direction: row; justify-content: space-around; padding: 4px;
    }
    .rail-sep { display: none; }
    .rail-button { flex: 1; padding: 6px 0 5px; }
    .rail-button[aria-pressed="true"]::before { left: 18px; right: 18px; top: -5px; bottom: auto; width: auto; height: 3px; }
    .inspector {
        top: auto; left: 8px; right: 8px; bottom: calc(max(8px, env(safe-area-inset-bottom)) + 70px); width: auto; height: min(52vh, 460px);
    }
    body.panel-hidden .inspector { transform: translateY(calc(100% + 90px)); }
    .inspector-open { top: auto; bottom: calc(max(8px, env(safe-area-inset-bottom)) + 74px); right: 8px; width: 44px; height: 34px; }
    .inspector-open svg { transform: rotate(90deg); }
    #inspector-close svg { transform: rotate(90deg); }
    .inspector-head { padding: 10px 10px 4px 14px; }
    .inspector h1 { font-size: 18px; }
    .dock {
        left: 8px; right: 8px; bottom: auto; top: calc(max(8px, env(safe-area-inset-top)) + 48px); transform: none; max-width: none;
        overflow-x: auto; padding: 4px; border-radius: 12px; scrollbar-width: none;
    }
    body.panel-hidden .dock { transform: none; max-width: none; }
    .dock::-webkit-scrollbar { display: none; }
    .dock-label { display: none; }
    .dock-group { padding: 0 4px; }
    .clock { width: 190px; gap: 6px; }
    .clock-face b { font-size: 15px; }
    .dock-btn { width: 34px; height: 34px; }
    .toast { top: 110px; }
    .scenes { padding: 10px; }
    .scenes-card { padding: 14px; }
    .scene-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .scene-meta small { display: none; }
}
