:root {
  color-scheme: dark;
  --ink: #f4eadd;
  --muted: #bcb0c7;
  --gold: #ffcf87;
  --violet: #d6b8ff;
  --line: #4a3e55;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  background: #12101c;
  color: var(--ink);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: radial-gradient(ellipse at 50% 0%, #2e2039 0%, #12101c 65%); min-height: 100dvh; }
main { width: min(100% - 40px, 980px); margin: auto; padding: 22px 0 28px; }
header, footer { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
header { margin-bottom: 16px; align-items: flex-end; }
.station, #eyebrow, .readout span, .rail, #flip span, .forecast { font: 700 .69rem ui-monospace, monospace; letter-spacing: .13em; }
.station { margin: 0 0 3px; color: var(--gold); }
h1, h2 { font-family: Georgia, serif; font-weight: normal; margin: 0; letter-spacing: -.045em; }
h1 { font-size: clamp(2.45rem, 6vw, 4.1rem); line-height: 1.05; }
h1 em { color: var(--gold); }
button { font-family: inherit; font-weight: 700; font-size: .88rem; color: var(--ink); cursor: pointer; padding: 9px 13px; border: 1px solid #6b5678; border-radius: 7px; background: #2d2339; min-height: 42px; touch-action: manipulation; }
button:hover:not(:disabled) { background: #493452; }
button:focus-visible, summary:focus-visible { outline: 2px solid white; outline-offset: 3px; }
button:disabled { opacity: .56; cursor: default; }
#sound { white-space: nowrap; margin-bottom: 3px; }
.console { border-radius: 13px; border: 1px solid var(--line); background: #1d1728; overflow: hidden; box-shadow: 0 16px 45px #0a0711aa; }
.readout { display: grid; grid-template-columns: repeat(4,1fr); background: #272035; }
.readout > div { padding: 9px 12px; display: flex; gap: 8px; justify-content: center; align-items: center; border-right: 1px solid var(--line); }
.readout > div:last-child { border: 0; }
.readout span { text-transform: uppercase; color: var(--muted); }
.readout strong { font-size: 1rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chamber { height: clamp(300px, 48vh, 490px); position: relative; isolation: isolate; background: #120f22; }
#rain { position: absolute; inset: 0; width: 100%; height: 100%; background: #161125 url("./chamber.webp") center / 100% 100% no-repeat; }
.rail { position: absolute; left: 50%; transform: translate(-50%, -50%); pointer-events: none; padding: 4px 9px; white-space: nowrap; filter: drop-shadow(0 2px 5px #000); }
.rail small { font-size: .93rem; }
.gold { top: 7%; color: var(--gold); }
.lilac { top: 93%; color: var(--violet); }
.forecast { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 5px 11px; border: 1px solid #9b8aa0; border-radius: 30px; background: #191223; letter-spacing: .07em; pointer-events: none; white-space: nowrap; }
#panel { position: absolute; z-index: 1; top: 50%; left: 50%; translate: -50% -50%; width: min(88%, 435px); padding: 19px 20px; text-align: center; border: 1px solid #82657c; border-radius: 12px; background: #1c1427f2; box-shadow: 0 12px 55px #090710b3; }
#eyebrow { margin: 0 0 6px; color: var(--gold); }
h2 { font-size: clamp(1.8rem, 5.5vw, 2.8rem); line-height: 1; }
#panel-info { font-size: .93rem; line-height: 1.45; margin: 10px auto 14px; color: #eee0f3; max-width: 340px; }
#start { background: var(--gold); color: #2b1820; border-color: var(--gold); }
#start:hover { background: #ffe1b6; }
.controls { display: grid; grid-template-columns: minmax(130px,1fr) auto auto; align-items: stretch; gap: 8px; padding: 9px 12px 0; }
#flip { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding-inline: 13px; border-color: #9c79b4; background: #3b2a51; color: var(--violet); }
#flip.up { border-color: #c39152; background: #513a32; color: var(--gold); }
#direction { white-space: nowrap; }
.hint { margin: 8px 12px 11px; font-size: .8rem; color: var(--muted); }
kbd { padding: 1px 4px; border: 1px solid #6b5678; border-radius: 4px; }
footer { margin-top: 12px; color: var(--muted); font-size: .75rem; align-items: flex-start; }
details { max-width: min(68%, 390px); text-align: right; }
summary { cursor: pointer; }
.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 520px) {
  main { width: calc(100% - 20px); padding-top: 16px; }
  header { margin-bottom: 12px; gap: 6px; }
  h1 { font-size: clamp(1.94rem, 8.2vw, 2.75rem); }
  .station { font-size: .58rem; }
  #sound { font-size: .75rem; padding: 5px 8px; min-height: 37px; }
  .readout > div { flex-direction: column; gap: 3px; padding: 7px 3px; }
  .readout span { font-size: .61rem; }
  .chamber { height: clamp(315px, 49dvh, 420px); }
  #rain { background-size: auto 100%; }
  .controls { padding: 8px 8px 0; grid-template-columns: minmax(116px,1fr) auto auto; gap: 5px; }
  .controls button { padding: 6px 8px; font-size: .72rem; }
  #flip { padding: 6px 8px; }
  #flip span { font-size: .58rem; letter-spacing: .04em; }
}
