:root {
  color-scheme: dark;
  --bg: #11181c;
  --panel: #182227;
  --border: #2e3e44;
  --text: #edf2ef;
  --muted: #a4b3b7;
  --accent: #ffc475;
  --radius: 16px;
  font-family: system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, canvas:focus-visible, summary:focus-visible {
  outline: 2px solid #9de7ef;
  outline-offset: 3px;
}
a { color: #a6e2ec; }

.shell { width: min(1120px, calc(100% - 64px)); margin-inline: auto; }
.topbar { border-bottom: 1px solid #283339; }
.brand { display: flex; align-items: center; gap: 12px; min-height: 65px; font-size: .87rem; font-weight: 750; letter-spacing: .14em; }
.logo { display: grid; width: 31px; height: 31px; place-content: center; background: var(--accent); color: #24221b; border-radius: 8px; font-size: 1.2rem; letter-spacing: 0; }
.brand-note { letter-spacing: 0; font-weight: 500; color: var(--muted); }
main { padding-bottom: 52px; }
.intro { padding: clamp(32px, 5vw, 60px) 0 29px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2.6rem, 8vw, 5.35rem); font-weight: 790; line-height: 1; letter-spacing: -.075em; }
h1 span { color: var(--accent); }
.intro p { margin-top: 15px; max-width: 46rem; font-size: 1.05rem; line-height: 1.55; color: var(--muted); }

.controls { display: flex; gap: 18px 26px; align-items: center; flex-wrap: wrap; padding: 17px 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend, .temperature, .contact, .model-select, .timeline { font-size: .875rem; color: var(--muted); font-weight: 600; }
legend { padding: 0; }
.segmented { display: flex; gap: 3px; border: 1px solid var(--border); padding: 3px; border-radius: 8px; background: #10191d; margin-top: 6px; }
.segmented label { position: relative; }
.segmented input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; width: 100%; }
.segmented span { display: block; padding: 5px 12px; font-size: .875rem; border-radius: 5px; }
.segmented input:checked + span { background: #3a474a; color: var(--text); }
.segmented input:focus-visible + span { outline: 2px solid #9de7ef; }
.temperature { display: grid; gap: 6px; }
.number { display: flex; align-items: center; gap: 6px; color: var(--text); }
.number input, select { min-height: 37px; border-radius: 8px; border: 1px solid var(--border); color: var(--text); background: #10191d; padding: 6px 9px; }
.number input { width: 74px; }
.contact { display: grid; grid-template-columns: auto auto; column-gap: 12px; row-gap: 6px; }
.contact output, .timeline output { justify-self: end; color: var(--accent); font-variant-numeric: tabular-nums; }
input[type=range] { width: 100%; grid-column: 1 / -1; margin: 2px 0 0; accent-color: var(--accent); cursor: pointer; }
#compare { margin-left: auto; border: 1px solid #64523a; border-radius: 9px; color: var(--accent); background: #382e23; padding: 9px 14px; font-weight: 650; font-size: .875rem; }
#compare[aria-pressed=true], #compare:hover { background: #4a3825; }

.model-selectors { display: grid; gap: 14px; margin: 20px 0 12px; }
.model-selectors.split { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.model-select { display: grid; gap: 5px; min-width: 0; }
.model-select select { width: 100%; }
.reset { border: 1px solid var(--border); border-radius: 8px; background: transparent; padding: 8px 13px; color: var(--text); font-size: .875rem; white-space: nowrap; }
.reset:hover { background: #2b3a40; }
select { appearance: none; padding-right: 28px; background-image: linear-gradient(45deg, transparent 50%, #a4b3b7 50%), linear-gradient(135deg, #a4b3b7 50%, transparent 50%); background-position: calc(100% - 15px) center, calc(100% - 10px) center; background-size: 5px 5px; background-repeat: no-repeat; }

.scenes { display: grid; gap: 14px; }
.scenes.split { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; }
.scene { overflow: hidden; display: flex; flex-direction: column; }
.scene-head, .section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 21px; }
.scene-head { flex: 1; }
.scene-head p, .section-head p, .metrics p { color: var(--muted); margin-top: 5px; line-height: 1.45; }
h2 { font-size: 1.35rem; letter-spacing: -.025em; }
.stage { position: relative; background: radial-gradient(ellipse at 50% 45%, #273d47, #152027 72%); border-block: 1px solid var(--border); }
.stage canvas, #chart { display: block; width: 100%; }
.stage canvas { height: clamp(240px, 28vw, 345px); cursor: grab; touch-action: none; }
.stage canvas:active { cursor: grabbing; }
.stage canvas:focus-visible { outline-offset: -3px; }
.stage-label { position: absolute; bottom: 13px; right: 15px; padding: 4px 8px; border-radius: 5px; background: #142229; color: #b7c8ce; pointer-events: none; font-size: .78rem; }
.scene-footer { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 15px 21px; }
.scene-footer span { display: block; color: var(--muted); font-size: .875rem; }
.scene-footer strong { display: block; font-size: 1.65rem; font-variant-numeric: tabular-nums; margin-top: 3px; letter-spacing: -.04em; }
.scene-footer .target { color: var(--accent); }

.simulation { margin-top: 20px; }
.legend, #legend { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.legend span { font-size: .875rem; white-space: nowrap; }
#legend span::before, .metrics h3::before, td i, th i { display: inline-block; content: ''; vertical-align: .09em; width: 9px; height: 9px; margin-right: 7px; border-radius: 3px; background: var(--swatch); }
.goal-key::before { content: ""; display: inline-block; vertical-align: middle; width: 13px; margin-right: 7px; border-top: 1px dashed var(--muted); }
#chart { height: clamp(220px, 27vw, 310px); cursor: crosshair; }
.timeline { display: grid; grid-template-columns: 1fr auto; margin: 0 21px 17px; gap: 7px; }
.section-title { margin-top: 15px; padding-inline: 0; }
.metrics { padding: 18px 20px 10px; }
.metrics h3 { font-size: 1rem; }
.stacked { margin-top: 14px; display: flex; overflow: hidden; height: 10px; border-radius: 12px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; margin-top: 9px; text-align: right; font-size: .875rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
td, th { padding: 9px 0 9px 8px; }
th:first-child { padding-left: 0; text-align: left; }
thead { color: var(--muted); font-weight: 600; }
thead small { font-size: .7rem; font-weight: 500; }
tbody tr, tfoot tr { border-top: 1px solid var(--border); }
tbody th { font-weight: 560; }
tfoot { color: var(--accent); font-weight: 700; }
.method { margin-top: 20px; padding: 15px 20px; }
.method summary { cursor: pointer; font-weight: 650; }
.method p { margin-top: 12px; color: var(--muted); line-height: 1.55; max-width: 78ch; }

@media (max-width: 760px) {
  .shell { width: calc(100% - 32px); }
  .scenes.split { grid-template-columns: 1fr; }
  .section-head { flex-wrap: wrap; }
  #compare { margin-left: 0; }
}
@media (max-width: 440px) {
  .controls, .scene-head, .section-head, .scene-footer, .metrics { padding-inline: 13px; }
  .section-title { padding-inline: 0; }
  .scene-head { flex-wrap: wrap; }
  .model-select select { font-size: .875rem; }
  td, th { padding-left: 5px; }
}
