:root {
  --u: var(--ui, 1);
  --c-accent: #59f3ff;
  --c-on-accent: #02101c;
  --c-page-bg: radial-gradient(ellipse at 50% 60%, rgba(8, 24, 60, 0.3), rgba(2, 3, 10, 0.88) 75%);
  --cyan: #59f3ff;
  --amber: #ffb347;
  --red: #ff5a36;
  --ink: #dff6ff;
  --glass: rgba(5, 14, 30, 0.58);
  --line: rgba(89, 243, 255, 0.4);
  --face: Bahnschrift, "DIN Alternate", "Roboto Condensed", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: Consolas, "SF Mono", "Roboto Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; background: #02030a; color: var(--ink); font-family: var(--face); -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#vig, #warn, #flash { position: fixed; inset: 0; pointer-events: none; }
#vig { background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 52%, rgba(0, 0, 6, 0.62) 100%); }
#warn { opacity: 0; background: radial-gradient(ellipse at center, rgba(255, 40, 20, 0) 38%, var(--warn, rgba(255, 40, 20, 0.42)) 100%); }
#flash { opacity: 0; background: #fff; }
#scan { position: fixed; inset: 0; pointer-events: none; background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.028) 0 1px, transparent 1px 3px); mix-blend-mode: overlay; }
#hud { position: fixed; inset: 0; pointer-events: none; font-size: calc(12px * var(--u)); letter-spacing: 0.08em; }
#top { position: absolute; top: calc(var(--band-h, 52px) + 6px); left: 50%; transform: translateX(-50%); }
#pause, .step { --b: max(34px, calc(30px * var(--u))); position: absolute; left: calc(100% + 8px); top: 0; width: var(--b); height: var(--b); display: grid; place-items: center; padding: 0; pointer-events: auto; cursor: pointer; background: var(--glass); border: 1px solid var(--line); color: var(--cyan); clip-path: polygon(0 0, 100% 0, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%); backdrop-filter: blur(4px); -webkit-tap-highlight-color: transparent; }
#pause svg, .step svg { width: 52%; height: 52%; fill: currentColor; filter: drop-shadow(0 0 6px rgba(89, 243, 255, 0.8)); }
#prev { left: auto; right: calc(100% + 8px); }
#pause { left: auto; right: calc(100% + 8px); top: calc(var(--b) + 5px); }
.step:active { color: #fff; }
#dots { display: flex; gap: calc(4px * var(--u)); margin-top: calc(3px * var(--u)); }
#dots i { width: calc(5px * var(--u)); height: calc(5px * var(--u)); background: rgba(223, 246, 255, 0.25); }
#dots i.done { background: rgba(223, 246, 255, 0.6); }
#dots i.now { background: var(--cyan); box-shadow: 0 0 6px var(--cyan); }
#pause .i-play, #pause.on .i-pause { display: none; }
#pause.on .i-play { display: block; }
#pause.on { color: var(--amber); border-color: var(--amber); }
#pause.on svg { filter: drop-shadow(0 0 6px rgba(255, 179, 71, 0.8)); }
#pause:focus-visible, .step:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
#cruise, #dock { position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: calc(7px * var(--u)); padding: calc(5px * var(--u)) calc(14px * var(--u)); background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(4px); white-space: nowrap; }
#cruise output, #dock output { font-family: var(--mono); font-size: calc(18px * var(--u)); font-weight: 700; color: #fff; text-shadow: 0 0 10px rgba(89, 243, 255, 0.8); }
#cruise small, #dock small { color: rgba(223, 246, 255, 0.6); font-size: calc(12px * var(--u)); margin-right: calc(10px * var(--u)); }
#cruise .i-sun { width: calc(18px * var(--u)); height: calc(18px * var(--u)); fill: var(--amber); color: var(--amber); }
#cruise .i-mars { width: calc(12px * var(--u)); height: calc(12px * var(--u)); border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffa074, #d9532c 60%, #7a2d17); box-shadow: 0 0 8px rgba(255, 106, 61, 0.8); }
#pip { position: absolute; left: 10px; top: 80px; width: 180px; height: 112px; background: transparent; border: 1px solid var(--line); box-shadow: 0 0 14px rgba(89, 243, 255, 0.25); }
#hud.paused *, #hud.paused { animation-play-state: paused !important; }
#clock { display: grid; justify-items: center; gap: 1px; padding: calc(5px * var(--u)) calc(22px * var(--u)) calc(7px * var(--u)); background: var(--glass); border: 1px solid var(--line); clip-path: polygon(0 0, 100% 0, calc(100% - 14px) 100%, 14px 100%); backdrop-filter: blur(4px); white-space: nowrap; }
#clock output { font-family: var(--mono); font-size: calc(24px * var(--u)); font-weight: 700; color: #fff; text-shadow: 0 0 12px rgba(89, 243, 255, 0.8); letter-spacing: 0.04em; line-height: 1.05; }
#clock.hold { border-color: var(--red); }
#clock.hold output { color: var(--red); text-shadow: 0 0 12px rgba(255, 90, 54, 0.9); animation: lit 0.9s steps(2, jump-none) infinite; }
#clock.hold #phase, #clock.hold #rate { color: var(--red); }
#phase { color: var(--cyan); font-size: calc(12px * var(--u)); font-weight: 600; }
#mission { color: rgba(223, 246, 255, 0.6); font-size: calc(12px * var(--u)); }
#rate { color: var(--amber); font-weight: 600; }
.meter.real .bar i { background: repeating-linear-gradient(90deg, var(--amber) 0 5px, rgba(255, 179, 71, 0.45) 5px 7px); box-shadow: 0 0 8px var(--amber); }
.meter.real output { color: var(--amber); }
.panel { position: absolute; top: 50%; transform: translateY(-50%); width: calc(190px * var(--u)); padding: calc(10px * var(--u)) calc(11px * var(--u)) calc(11px * var(--u)); background: linear-gradient(160deg, rgba(8, 22, 44, 0.7), rgba(4, 10, 24, 0.5)); border: 1px solid var(--line); backdrop-filter: blur(5px); clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px); }
#hud .panel, #caption { transition: opacity 1.6s; }
#hud.ended .panel, #hud.ended #caption { opacity: 0; }
.panel::before { content: ""; position: absolute; left: 0; top: 0; width: 34px; height: 3px; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
.panel::after { content: ""; position: absolute; right: 16px; bottom: 0; width: 46px; height: 2px; background: var(--amber); }
#left { left: max(10px, env(safe-area-inset-left)); }
#right { right: max(10px, env(safe-area-inset-right)); }
.panel h2 { font-size: calc(12px * var(--u)); font-weight: 600; color: var(--cyan); letter-spacing: 0.2em; margin-bottom: calc(8px * var(--u)); display: flex; align-items: center; gap: 8px; }
.panel h2::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line), transparent); }
#left.swap { animation: swap 0.5s ease-out; }
@keyframes swap { from { opacity: 0; filter: brightness(3); } to { opacity: 1; filter: none; } }
#switches { list-style: none; display: grid; gap: calc(7px * var(--u)); }
#switches li { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: calc(9px * var(--u)); align-items: center; color: rgba(223, 246, 255, 0.55); transition: color 0.3s; }
.sw { grid-row: 1 / 3; position: relative; width: calc(30px * var(--u)); height: calc(16px * var(--u)); border: 1px solid rgba(160, 190, 220, 0.5); background: rgba(0, 0, 0, 0.45); clip-path: polygon(4px 0, 100% 0, calc(100% - 4px) 100%, 0 100%); }
.sw b { position: absolute; top: 2px; bottom: 2px; left: 2px; width: 42%; background: #6d7a8f; transition: left 0.22s cubic-bezier(0.3, 1.6, 0.5, 1), background 0.22s, box-shadow 0.22s; clip-path: polygon(3px 0, 100% 0, calc(100% - 3px) 100%, 0 100%); }
.name { font-size: calc(12px * var(--u)); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st { font-style: normal; font-family: var(--mono); font-size: calc(12px * var(--u)); letter-spacing: 0.06em; color: rgba(160, 190, 220, 0.5); }
#switches li.on { color: #fff; }
#switches li.on .sw { border-color: var(--cyan); box-shadow: inset 0 0 8px rgba(89, 243, 255, 0.5); }
#switches li.on .sw b { left: 54%; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
#switches li.on .st { color: var(--cyan); text-shadow: 0 0 8px rgba(89, 243, 255, 0.8); animation: lit 0.6s steps(2) 2; }
#switches li.amber .sw { border-color: var(--amber); box-shadow: inset 0 0 8px rgba(255, 179, 71, 0.5); }
#switches li.amber .sw b { background: var(--amber); box-shadow: 0 0 10px var(--amber); }
#switches li.amber .st { color: var(--amber); text-shadow: 0 0 8px rgba(255, 179, 71, 0.8); }
#switches li.red .sw { border-color: var(--red); box-shadow: inset 0 0 8px rgba(255, 90, 54, 0.5); }
#switches li.red .sw b { background: var(--red); box-shadow: 0 0 10px var(--red); }
#switches li.red .st { color: var(--red); text-shadow: 0 0 8px rgba(255, 90, 54, 0.8); }
@keyframes lit { 50% { opacity: 0.25; } }
.nums { display: grid; gap: calc(5px * var(--u)); margin-bottom: calc(9px * var(--u)); }
.num { display: grid; grid-template-columns: calc(42px * var(--u)) 1fr auto; align-items: baseline; gap: 6px; }
.num label, .meter label { color: rgba(223, 246, 255, 0.6); font-size: calc(12px * var(--u)); }
.num output { font-family: var(--mono); font-size: calc(19px * var(--u)); font-weight: 700; color: #fff; text-align: right; text-shadow: 0 0 10px rgba(89, 243, 255, 0.6); }
.num small { font-size: calc(12px * var(--u)); color: var(--cyan); min-width: calc(34px * var(--u)); }
.meters { display: grid; gap: calc(6px * var(--u)); }
.meter { display: grid; grid-template-columns: 1fr auto; row-gap: 2px; }
.meter output { font-family: var(--mono); font-size: calc(12px * var(--u)); color: var(--cyan); }
.bar { grid-column: 1 / 3; height: calc(5px * var(--u)); background: rgba(160, 190, 220, 0.16); overflow: hidden; clip-path: polygon(3px 0, 100% 0, calc(100% - 3px) 100%, 0 100%); }
.bar i { display: block; height: 100%; transform-origin: left; transform: scaleX(0); background: repeating-linear-gradient(90deg, var(--cyan) 0 5px, rgba(89, 243, 255, 0.45) 5px 7px); box-shadow: 0 0 8px var(--cyan); }
#ticker { margin-top: calc(9px * var(--u)); padding-top: calc(6px * var(--u)); border-top: 1px solid rgba(89, 243, 255, 0.2); font-family: var(--mono); font-size: calc(12px * var(--u)); color: var(--amber); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#ticker::before { content: "\25B8  "; }
#count { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); font-family: var(--mono); font-weight: 700; font-size: min(46vmin, 300px); line-height: 1; color: rgba(255, 255, 255, 0.92); text-shadow: 0 0 40px rgba(89, 243, 255, 0.9), 0 0 120px rgba(89, 243, 255, 0.5); }
#count.word { font-family: var(--face); font-size: min(15vw, 150px); letter-spacing: 0.12em; color: #fff; text-shadow: 0 0 40px rgba(255, 179, 71, 0.9), 0 0 120px rgba(255, 90, 54, 0.6); white-space: nowrap; }
#count.beat { animation: beat 0.95s ease-out both; }
#count.word.beat { animation: word 1.6s ease-out both; }
@keyframes beat { from { opacity: 1; transform: translate(-50%, -50%) scale(1.25); } to { opacity: 0.12; transform: translate(-50%, -50%) scale(0.9); } }
@keyframes word { from { opacity: 1; transform: translate(-50%, -50%) scale(0.7); } to { opacity: 0; transform: translate(-50%, -50%) scale(1.25); } }
#caption { position: absolute; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: min(92vw, 720px); padding: calc(7px * var(--u)) calc(16px * var(--u)); background: var(--glass); border-left: 3px solid var(--cyan); backdrop-filter: blur(4px); font-size: calc(15px * var(--u)); letter-spacing: 0.03em; line-height: 1.3; text-align: left; animation: said 0.25s ease-out; }
#caption b { display: block; font-size: calc(12px * var(--u)); letter-spacing: 0.2em; color: var(--cyan); }
#caption.ground { border-left-color: var(--amber); }
#caption.ground b { color: var(--amber); }
#caption.talk { border-left-color: rgba(223, 246, 255, 0.45); font-style: italic; color: rgba(223, 246, 255, 0.85); }
#caption.talk b { color: rgba(223, 246, 255, 0.6); font-style: normal; }
#caption.commander { border-left-color: #fff; }
#caption.commander b { color: #fff; }
@keyframes said { from { opacity: 0; transform: translateX(-50%) translateY(6px); } to { opacity: 1; transform: translateX(-50%); } }
#end { position: fixed; inset: 0; display: grid; align-content: center; justify-items: center; gap: calc(6px * var(--u)); text-align: center; padding: 20px; z-index: 4; }
#end { align-content: end; padding-bottom: max(12vh, 70px); pointer-events: none; animation: fadein 2.5s ease-out; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.over { color: var(--amber); letter-spacing: 0.5em; font-size: calc(13px * var(--u)); padding-left: 0.5em; }
#end h1 { font-weight: 700; color: #fff; line-height: 1.1; font-size: min(9.5vw, calc(50px * var(--u))); letter-spacing: 0.16em; padding-left: 0.16em; text-shadow: 0 0 30px rgba(255, 120, 70, 0.9), 0 0 90px rgba(255, 90, 54, 0.5); }
.under { color: var(--cyan); letter-spacing: 0.42em; padding-left: 0.42em; font-size: calc(14px * var(--u)); margin-bottom: calc(22px * var(--u)); }
#again { pointer-events: auto; margin-top: 4px; }
@media (max-aspect-ratio: 4/5) {
  #top { left: max(8px, env(safe-area-inset-left)); transform: none; }
  #pause, .step { --b: 38px; }
  #pause { right: auto; left: calc(100% + 8px); top: 0; }
  #prev { right: auto; left: calc(100% + 52px); }
  #next { left: calc(100% + 96px); }
  #cruise, #dock { left: 0; transform: none; }
  #clock { justify-items: start; padding-left: 12px; clip-path: polygon(0 0, 100% 0, calc(100% - 14px) 100%, 0 100%); }
  #mission { font-size: 12px; }
  .panel { top: auto; bottom: calc(max(14px, env(safe-area-inset-bottom)) + 74px); transform: none; width: 47vw; padding: 8px 8px 9px; }
  #left { left: 6px; }
  #right { right: 6px; }
  #switches { gap: 6px; }
  #switches li { grid-template-rows: auto; }
  .sw { grid-row: 1; }
  .st { display: none; }
  .panel h2 { margin-bottom: 6px; }
  .meters, #ticker { display: none; }
  .nums { margin-bottom: 0; }
  #count { top: 30%; }
}
@media (max-height: 460px) and (min-aspect-ratio: 4/5) {
  .panel { width: 178px; padding: 7px 9px 8px; }
  #switches { gap: 4px; }
  .meters, #ticker { display: none; }
  .nums { margin-bottom: 0; }
  #clock output { font-size: 20px; }
  #caption { font-size: 13px; padding: 5px 12px; }
}
