:root {
  color-scheme: dark;
  --frame: #000000;
  --ground: #080808;
  --ink: #f4f5f6;
  --muted: #b8b8b8;
  --line: #353535;
  --cursor: #ff8566;
  font: 16px/1.4 Arial, sans-serif;
  color: var(--ink);
  background: var(--ground);
}
* { box-sizing: border-box; }
body { margin: 0; height: 100vh; height: 100dvh; min-height: 280px; display: grid; grid-template-rows: auto minmax(0,1fr) auto; }
header, footer, .transport { padding-inline: clamp(14px, 3vw, 52px); }
header, footer { background-color: var(--frame); }
header, nav, footer, .brand { display: flex; align-items: center; }
header { min-height: clamp(46px, 7.5vh, 76px); gap: 22px; border-bottom: 1px solid var(--line); }
a { color: inherit; text-decoration: none; } a:hover { text-decoration: underline; }
a:focus-visible, input:focus-visible { outline: 2px solid var(--cursor); outline-offset: 3px; }
.brand { gap: 6px; font-size: clamp(20px, 2vw, 29px); font-weight: 700; letter-spacing: -.065em; }
.brand img { width: 1.35em; filter: invert(1); }
.tagline { white-space: nowrap; }
.tagline, footer { color: var(--muted); font-size: .78rem; }
nav { margin-left: auto; gap: clamp(10px, 2vw, 32px); font-size: .86rem; }
nav > * { padding: 8px 2px; }
main { display: grid; grid-template-rows: minmax(0,1fr) auto; min-height: 0; }
.field {
  position: relative;
  min-height: 0;
  overflow: hidden;
  isolation: isolate;
  background: radial-gradient(ellipse at 68% 53%, #010101 2%, #050505 26%, #101010 56%, #090909 85%, #060606 100%);
}
canvas { display: block; width: 100%; height: 100%; }
.caption, .map-key { position: absolute; pointer-events: none; }
.caption { top: clamp(12px, 3.8vh, 44px); left: clamp(14px, 3vw, 52px); }
.caption p, .map-key, .clock, .marks, .splits b { font-family: ui-monospace, monospace; }
.caption p, .map-key { margin: 0; color: #c3cbd5; font-size: clamp(10px, .85vw, 13px); }
h1 { margin: 0; max-width: 95vw; text-wrap: balance; font-size: clamp(22px, 3.1vw, 49px); line-height: 1.05; letter-spacing: -.065em; }
.map-key { bottom: 14px; right: 3vw; display: flex; gap: 8px; align-items: center; }
.map-key i { width: 5px; height: 5px; background: var(--cursor); }
.transport { display: grid; grid-template-columns: max-content minmax(0, 1fr); align-items: center; gap: clamp(20px, 3vw, 54px); padding-block: clamp(10px, 2.1vh, 23px); border-block: 1px solid var(--line); }
.readout { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
#phase { font-size: .76rem; color: var(--muted); }
.clock {
  display: flex; align-items: flex-end; gap: 6px;
  color: #ffdcaa; font-size: clamp(32px, 3.2vw, 48px);
  line-height: 1; font-variant-numeric: tabular-nums;
}
.clock small { padding-bottom: .22em; color: #ffc08b; font-size: .42em; }
.flip-board {
  display: flex; gap: 3px; padding: 3px; border: 1px solid #504239;
  border-radius: 5px; background: #080605;
  box-shadow: inset 0 1px 3px #000, 0 1px 0 #ffffff12;
}
.flip-board:empty { display: none; }
.flap-digit {
  --face-height: 1.14em;
  position: relative; width: .77em; height: var(--face-height); perspective: 4em;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-weight: 400; text-shadow: 0 0 2px #ff913b, 0 0 6px #ff730bc9, 0 0 13px #ff6b125c;
}
.flap-digit::after {
  content: ""; position: absolute; z-index: 2; top: 50%; left: 0; right: 0;
  height: 1px; background: #180e09; box-shadow: 0 1px #ffb47018;
}
.flap-digit > span {
  position: absolute; left: 0; right: 0; height: 50%; overflow: hidden;
  backface-visibility: hidden;
}
.flap-digit > span::before {
  content: attr(data-glyph); position: absolute; left: 0; right: 0;
  text-align: center; line-height: var(--face-height);
}
.flap-upper {
  top: 0; transform-origin: center bottom; border-radius: 2px 2px 0 0;
  background: linear-gradient(#463125 0%, #2a1c15 14%, #211611 100%);
}
.flap-upper::before { top: 0; }
.flap-lower {
  bottom: 0; transform-origin: center top; border-radius: 0 0 2px 2px;
  background: linear-gradient(#15100c, #291b12 84%, #35251a);
}
.flap-lower::before { bottom: 0; }
.flap-upper.moving { transform: rotateX(-90deg); }
.ruler { min-width: 0; }
.rail { position: relative; --elapsed: 100%; }
.rail::before, .rail::after {
  content: ""; position: absolute; pointer-events: none; left: 7px; right: 7px;
}
.rail::before {
  top: calc(50% - 12px); height: 9px;
  background: repeating-linear-gradient(90deg, #9da1a6 0 1px, transparent 1px 25%) left bottom / 100% 100% no-repeat,
              repeating-linear-gradient(90deg, #65676b 0 1px, transparent 1px 5%) left bottom / 100% 4px no-repeat;
  border-right: 1px solid #9da1a6;
}
.rail::after {
  top: calc(50% - 2px); height: 4px;
  background: linear-gradient(90deg, #be5236, #ffb385 var(--elapsed), #58595c var(--elapsed));
}
#scrub {
  position: relative; z-index: 1; display: block; margin: 0; padding: 0;
  width: 100%; height: 44px; appearance: none; background: transparent; cursor: ew-resize;
  --thumb-glow: 0 0 4px #ff935c, 0 0 12px #ff844480;
}
#scrub::-webkit-slider-runnable-track { height: 4px; background: transparent; }
#scrub::-moz-range-track { height: 4px; background: transparent; }
#scrub::-webkit-slider-thumb {
  appearance: none; box-sizing: border-box; width: 14px; height: 22px; margin-top: -9px;
  background: #ffecd4; border: 2px solid #ff9e70; border-radius: 2px; box-shadow: var(--thumb-glow);
}
#scrub::-moz-range-thumb {
  box-sizing: border-box; width: 14px; height: 22px;
  background: #ffecd4; border: 2px solid #ff9e70; border-radius: 2px; box-shadow: var(--thumb-glow);
}
.marks {
  position: relative; height: 1.15em; margin: -3px 7px 0;
  font-size: clamp(14px, 1.25vw, 20px); font-weight: 600; line-height: 1.1;
  color: #e6e7e8; font-variant-numeric: tabular-nums;
}
.marks span { position: absolute; transform: translateX(-50%); }
.marks span:first-child { left: 0; transform: none; }
.marks span:nth-child(2) { left: 25%; }
.marks span:nth-child(3) { left: 50%; }
.marks span:nth-child(4) { left: 75%; }
.marks span:last-child { right: 0; transform: none; }
footer { justify-content: space-between; min-height: 30px; gap: 8px; font-size: .72rem; }
.sr { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
@media(max-width: 620px) {
  header { gap: 8px; }
  #scrub { height: 44px; }
  .tagline { font-size: clamp(.625rem, 2.9vw, .75rem); line-height: 1.2; }
  nav { flex-shrink: 0; }
  .explain {display:none;} .transport {grid-template-columns: 1fr; gap: 3px;}
  .readout { flex-direction: row-reverse; align-items: center; justify-content: space-between; }
}
@media(max-height: 480px) and (min-width: 500px) {
  header {min-height:36px;} .transport {grid-template-columns: max-content minmax(0,1fr); padding-block:4px;}
  .readout { flex-direction: column; align-items: flex-start; }
  footer {min-height:22px;} .caption {top:9px;}
  h1 {font-size:24px;} .map-key {bottom:5px;}
}

@media(max-width:620px) { .explain { display:inline; font-size:.63rem; } h1 {max-width:90vw;} }

.depth-plane, #map { position: absolute; inset: 0; }
.depth-plane { pointer-events: none; transition: transform 120ms ease-out; }
.map-key { bottom: 3px; min-height: 32px; gap: 12px; pointer-events: auto; }
@media (max-width: 620px) {
  .map-key { left: 12px; right: 12px; justify-content: space-between; }
}
@media (max-height: 480px) { .map-key { bottom: 0; } }
@media (prefers-reduced-motion: reduce) { .depth-plane { transition: none; transform: none !important; } }

@media (max-width: 360px) {
  header { padding-inline: 8px; gap: 4px; }
  .brand img { width: 1.1em; }
  .brand { gap: 4px; font-size: 18px; }
  nav { font-size: .78rem; }
}
