:root {
  color-scheme: dark;
  --bg: #101615;
  --panel: #18211e;
  --line: #2e3e37;
  --text: #ecf1ec;
  --muted: #a1b4aa;
  --accent: #a6f2ad;
  --danger: #ffae96;
  font-family: "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button:disabled { opacity: .55; cursor: wait; }
h1, h2, h3, p { margin: 0; }
h2 { font-size: 1.05rem; }
h3 { font-size: .98rem; }
p { line-height: 1.5; }
.topbar { min-height: 72px; padding: .8rem clamp(1rem, 3vw, 2.5rem); display: flex; gap: 1rem; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: #141d1a; }
.brand { display: flex; align-items: center; gap: .65rem; text-decoration: none; color: var(--text); font-weight: 800; letter-spacing: .15em; line-height: 1.2; }
.brand small { display: block; color: var(--muted); font: 600 .72rem ui-monospace, monospace; letter-spacing: .08em; }
.mark { display: grid; place-items: center; width: 39px; aspect-ratio: 1; border-radius: 9px; background: var(--accent); color: #10271a; font-size: 1.5rem; }
.clock, .speed, .toolbar { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; }
.clock { gap: .8rem; }
#day, .eyebrow, .site-label, .scene-label, time { font: 600 .78rem ui-monospace, "Cascadia Mono", monospace; letter-spacing: .07em; text-transform: uppercase; }
#day { color: var(--accent); }
.speed button, .secondary, .primary { border: 1px solid #405247; background: #202b26; border-radius: 7px; padding: .58rem .8rem; font-weight: 650; font-size: .875rem; }
.speed button { min-width: 36px; padding: .35rem; }
.speed button[aria-pressed="true"], .primary { background: var(--accent); color: #13281a; border-color: var(--accent); }
button:hover { filter: brightness(1.15); }
.layout { display: grid; grid-template-columns: 218px minmax(0, 1fr); min-height: calc(100vh - 72px); }
.sidebar { border-right: 1px solid var(--line); padding: 1.85rem 1rem; background: #141d1a; }
.site-label { color: var(--muted); display: flex; justify-content: space-between; margin-bottom: .55rem; }
.site-label span, .done { color: var(--accent); }
.sidebar h2 { margin-bottom: 1.35rem; }
nav { display: grid; gap: .3rem; }
nav button { text-align: left; padding: .68rem .7rem; background: transparent; border-radius: 7px; border: 1px solid transparent; font-size: .9rem; }
nav button span { margin-right: .45rem; color: var(--accent); }
nav button[aria-current="page"] { border-color: #3a5344; background: #23352b; }
.mission { margin-top: 1.8rem; border-top: 1px solid var(--line); padding-top: 1.2rem; }
.mission p:not(.eyebrow), .save-status { color: var(--muted); font-size: .85rem; margin-top: .55rem; }
.save-status { margin-top: 1.75rem; }
main { padding: clamp(1rem, 3vw, 2.5rem); width: 100%; max-width: 1550px; margin: 0 auto; }
.heading, .panel-heading, .row, .floor-footer { display: flex; align-items: center; justify-content: space-between; gap: .8rem; }
.heading { margin-bottom: 1.25rem; }
.eyebrow { color: var(--muted); }
h1 { font-size: clamp(1.9rem, 4vw, 3.1rem); line-height: 1.04; letter-spacing: -.05em; margin-top: .42rem; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.metric, .panel, dialog { border: 1px solid var(--line); border-radius: 11px; background: var(--panel); }
.metric { padding: .95rem; display: grid; gap: .45rem; }
.metric strong { font-size: clamp(1.2rem, 2.45vw, 1.9rem); letter-spacing: -.04em; }
.metric small { font-size: .85rem; color: var(--muted); letter-spacing: 0; }
.metric > span, .panel-body p, .floor-footer { color: var(--muted); font-size: .9rem; }
.negative, .panel-body .negative { color: var(--danger) !important; }
.floor-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, .45fr); gap: 1rem; }
.panel-heading { padding: .8rem 1rem; border-bottom: 1px solid var(--line); min-height: 56px; }
.panel-body { padding: 1rem; }
#content > .panel + .panel { margin-top: 1rem; }
.scene { position: relative; background: radial-gradient(ellipse at 50% 68%, #293e34, #121c19 74%); }
.scene canvas { display: block; width: 100%; height: clamp(320px, 46vh, 530px); cursor: pointer; }
.scene-label { position: absolute; top: 1rem; left: 1rem; pointer-events: none; color: var(--muted); }
.floor-footer { border-top: 1px solid var(--line); padding: .65rem 1rem; flex-wrap: wrap; }
.floor-footer label { display: flex; align-items: center; gap: .5rem; }
.slots { display: grid; gap: .4rem; margin: .8rem 0 1rem; }
.slot { display: flex; justify-content: space-between; align-items: center; gap: .35rem; padding: .65rem .55rem; border: 1px dashed #3b4d43; border-radius: 5px; text-align: left; background: #121b18; color: var(--muted); font-size: .8rem; }
.slot.filled { border-style: solid; color: var(--text); background: #26392f; }
.slot strong { color: var(--accent); font: 600 .72rem ui-monospace, monospace; white-space: nowrap; }
.row { padding: .8rem 0; border-bottom: 1px solid var(--line); }
.row:first-child { padding-top: 0; }
.row:last-child { border-bottom: 0; padding-bottom: 0; }
.row p { margin-top: .22rem; }
.activity { margin-top: 1rem; }
.activity ul { list-style: none; padding: 0 1rem; margin: .4rem 0; }
.activity li { display: flex; align-items: baseline; gap: .9rem; padding: .65rem 0; font-size: .9rem; }
time { color: var(--accent); white-space: nowrap; }
dialog { width: min(510px, calc(100% - 2rem)); padding: 0; color: var(--text); }
dialog::backdrop { background: #050b09d4; }
form { display: grid; gap: .8rem; }
form label { display: grid; gap: .35rem; }
input, select { color: var(--text); background: #101915; border: 1px solid #486154; border-radius: 6px; padding: .45rem .55rem; min-width: 0; }
.dialog-footer, dialog p + .toolbar { margin-top: .9rem; }
.form-error:empty { display: none; }
#notice:not(:empty) { position: fixed; z-index: 2; right: 1rem; bottom: 1rem; max-width: min(90vw, 430px); background: #293b31; color: var(--text); border: 1px solid #719e80; padding: .8rem 1rem; border-radius: 8px; }
@media (max-width: 900px) {
  .layout { grid-template-columns: 175px minmax(0, 1fr); }
  .floor-layout { grid-template-columns: 1fr; }
}
@media (max-width: 650px) {
  .topbar { flex-wrap: wrap; }
  .layout { display: block; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); padding: .75rem 1rem; }
  .sidebar h2, .site-label, .mission { display: none; }
  .save-status { margin-top: .45rem; }
  nav { display: flex; flex-wrap: wrap; }
  nav button { padding: .4rem; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scene canvas { height: 320px; }
}
