﻿:root {
  color-scheme: dark;
  --night: #111a30;
  --panel: #1d2b45;
  --white: #fff3da;
  --muted: #becbe3;
  --sand: #ffce84;
  --red: #fb634b;
  --line: #415477;
  --display: "Arial Narrow", "Franklin Gothic Demi Cond", Impact, sans-serif;
  --body: "Segoe UI", system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--night); color: var(--white); font: 16px/1.5 var(--body); }
body { margin: 0; padding-inline: env(safe-area-inset-left) env(safe-area-inset-right); }
a { color: inherit; text-underline-offset: .24em; }
a:hover { color: var(--sand); }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid #fff4b7; outline-offset: 4px; }
.wrap { width: min(94%, 1720px); margin-inline: auto; }
.masthead {
  min-height: 78px;
  padding-top: env(safe-area-inset-top);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.brand-mark { flex: 0 0 auto; }
h1, h2, h3 { margin: 0; }
h1, .plate h2, .legal h1 {
  font: normal clamp(2.2rem, 4vw, 3.65rem)/.98 var(--display);
  text-transform: uppercase;
  letter-spacing: .023em;
}
h1 span { color: var(--sand); }
.masthead-links { display: grid; justify-items: end; flex: none; }
.guide-link, .language-link {
  display: grid;
  min-height: 28px;
  align-items: center;
  color: var(--muted);
  font: 650 .875rem var(--body);
}
.language-link { font-weight: 400; }
.field {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  height: 79vh;
  height: min(max(79dvh, 500px), calc(100dvh - 82px - env(safe-area-inset-top)));
  background: #7295db;
  border: 1px solid #6c81ac;
  border-radius: 12px;
}
canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.hud {
  position: absolute;
  inset: clamp(9px, 1.4vw, 21px) clamp(9px, 1.4vw, 21px) auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  gap: 8px;
}
.meters, .race-buttons { display: flex; gap: 6px; align-items: stretch; }
.meter {
  min-width: 76px;
  padding: 6px 12px 8px;
  color: var(--white);
  background: #17233c;
  border-bottom: 3px solid #445883;
  border-radius: 7px;
  line-height: 1;
}
.meter span { display: block; color: #d3def3; font-size: .79rem; }
.meter strong { display: block; font: normal 1.62rem/1.05 var(--display); margin-top: 3px; font-variant-numeric: tabular-nums; }
.icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid #4d6084;
  border-radius: 7px;
  background: #17233c;
  pointer-events: auto;
}
.icon:hover { background: #263d61; }
.icon[data-act=ghost][aria-pressed=true] { color: #b6f6ff; border-color: #70b9ca; }
.practice-pace strong { font-size: 1.18rem; }
.icon .mute, .icon[aria-pressed=false] .waves { display: none; }
.icon[aria-pressed=false] .mute { display: block; }
.input-cue {
  position: absolute;
  bottom: 17px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  width: max-content;
  max-width: calc(100% - 24px);
  padding: 6px 13px 6px 7px;
  border-radius: 7px;
  color: #fff5e0;
  background: #182743;
  font-size: clamp(.78rem, 2.8vw, .94rem);
  font-weight: 650;
  pointer-events: none;
}
.cue-icon { display: grid; place-items: center; flex: none; width: 31px; height: 31px; border-radius: 4px; color: var(--sand); background: #33486d; }
.input-cue[data-ready=true] { box-shadow: inset 0 0 0 2px var(--sand); }
.input-cue[data-ready=true] .cue-icon { color: #121b2f; background: var(--sand); }
.input-cue[data-drift=true] .cue-icon svg { transform: scaleX(-1); }
.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  pointer-events: none;
  z-index: 1;
}
.entry, .result { align-items: end; justify-items: center; padding: 14px 14px clamp(15px, 3.2dvh, 35px); }
.launch, .plate {
  width: min(100%, 370px);
  background: #192641;
  border: 1px solid #576d95;
  border-top: 3px solid var(--sand);
  border-radius: 9px;
  box-shadow: 0 12px 34px #10172b69;
  padding: 13px;
  pointer-events: auto;
}
.launch { width: min(100%, 394px); }
.drive-line { margin: 0 0 10px; font-size: .91rem; font-weight: 650; }
.launch-actions, .settings, .panel-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.launch-actions [data-act=corner]:has(+ [hidden]) { grid-column: 1 / -1; }
.button, .plain {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 7px 10px;
  line-height: 1.1;
  font-weight: 750;
  overflow-wrap: anywhere;
  transition: background-color 100ms, box-shadow 100ms;
}
.button:active { box-shadow: inset 0 2px 6px #10172b91; }
.primary { background: var(--red); color: #1c1824; box-shadow: inset 0 -3px #8f352e65; }
.primary:hover { background: #ff8a66; }
.secondary { background: #253957; border-color: #506786; }
.secondary:hover { background: #304a70; }
.secondary[aria-pressed=true] { border-color: #c39362; }
.plain { background: transparent; color: #d5e0f6; text-decoration: underline; text-underline-offset: .2em; }
.plain:hover { color: var(--sand); }
.wide { width: 100%; }
.centered { place-items: center; padding: 11px; background: #11192f70; pointer-events: auto; }
.plate { width: min(100%, 360px); }
.plate h2 { font-size: clamp(1.95rem, 5vw, 2.95rem); }
.centered .plate h2 { margin-bottom: 12px; }
.settings { margin-top: 8px; font-size: .875rem; }
.panel-links { margin-top: 3px; font-size: .875rem; }
.result .plate { animation: settle 180ms ease-out both; }
.result #result-kind { margin: 0 0 3px; color: var(--sand); font-size: .82rem; font-weight: bold; }
.result #result-detail { margin: 5px 0 12px; color: var(--muted); font-size: .92rem; }
.turn-legend { display: flex; flex-wrap: wrap; gap: 1px 12px; margin: -4px 0 10px; color: var(--muted); font-size: .79rem; }
.turn-legend span { display: inline-flex; gap: 4px; align-items: center; }
.turn-legend span::before { content: ''; width: 9px; height: 9px; flex: none; background: #a4efff; border-radius: 50%; }
.turn-legend .legend-input::before { background: #ffe192; border-radius: 1px; transform: rotate(45deg) scale(.8); }
.turn-legend .legend-edge::before { background: #ff7b71; border-radius: 1px; }
.result[data-won=true] .plate { border-color: #e5b772; background: #27334b; }
.game-won .meter:first-child { border-color: var(--sand); }
.no-script { position: absolute; top: 0; margin: 16px; padding: 9px; background: #192641; }
@keyframes settle { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: translateY(0); } }

.guide {
  max-width: 1110px;
  padding-block: clamp(48px, 8vw, 115px);
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.25fr);
  gap: clamp(30px, 8vw, 115px);
  scroll-margin-top: 20px;
}
.guide-title p { margin: 0 0 16px; }
.guide-title p:first-child { font-size: 1.15rem; }
.guide p, .guide li, .legal p { color: #d9e2f5; }
.guide-body section { margin: 0 0 27px; padding-top: 17px; border-top: 1px solid #3c4d71; }
.guide h2, .legal h2 { font-size: 1.29rem; }
.guide-body p { margin: 8px 0 0; }
.guide-body ul { padding-left: 1.35rem; margin-bottom: 0; }
.guide-body li + li { margin-top: .5rem; }
kbd { border: 1px solid #607299; border-radius: 3px; padding: .02em .28em; color: #fdf2d5; font: .9em var(--body); white-space: nowrap; }
details { border-bottom: 1px solid #3c4d71; }
summary { min-height: 44px; cursor: pointer; padding: 9px 0; font-weight: 650; }
details p { padding-bottom: 14px; }
.footer {
  min-height: 64px;
  padding-block: 12px max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid #3c4d71;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px 18px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: .9rem;
}
.footer nav { display: flex; gap: 16px; flex-wrap: wrap; }
.footer a { display: inline-flex; align-items: center; min-height: 44px; }
.footer .language-nav { flex-basis: 100%; gap: 0 16px; }
.language-nav [aria-current=page] { color: var(--sand); font-weight: 700; }
.legal { width: min(91%, 705px); margin: 0 auto; padding: 44px 0 70px; }
.legal h1 { margin: 0 0 22px; color: var(--sand); }
.legal h2 { margin-top: 26px; }
.legal p { margin: 12px 0; }
.legal .button { display: inline-flex; align-items: center; text-decoration: none; margin-top: 18px; }

@media (max-width: 700px) {
  .masthead { width: min(94%, 540px); min-height: 64px; }
  .brand { gap: .48rem; }
  .brand-mark { width: 27px; height: 27px; }
  h1 { font-size: clamp(1.65rem, 6.7vw, 2.5rem); }
  .guide-link, .language-link { font-size: .78rem; white-space: nowrap; }
  html:not([lang=en]) .masthead h1 { font-size: clamp(1.3rem, 5.85vw, 2.5rem); }
  .field { width: 96%; height: min(82dvh, calc(100dvh - 68px - env(safe-area-inset-top))); border-radius: 8px; }
  .meter { min-width: 65px; padding-inline: 8px; }
  .guide { width: min(89%, 500px); grid-template-columns: 1fr; }
  .footer { width: 89%; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .masthead { min-height: 52px; }
  .masthead-links { display: flex; align-items: center; gap: 12px; }
  .brand-mark { width: 30px; height: 30px; }
  h1 { font-size: 2rem; }
  .field { height: min(81dvh, calc(100dvh - 56px - env(safe-area-inset-top))); }
  .input-cue { bottom: 8px; }
  .entry, .result { padding-bottom: 9px; }
  .launch { padding: 8px 10px; }
  .drive-line { margin-bottom: 6px; }
}
@media (min-width: 720px) and (max-height: 560px) and (orientation: landscape) {
  .entry, .result { justify-items: end; padding-right: 14px; }
  .result .plate { width: min(41%, 345px); }
  .result .plate h2 { font-size: clamp(1.6rem, 3.8vw, 2.4rem); }
}
@media (max-height: 340px) and (orientation: landscape) {
  .centered .plate { padding: 8px; }
  .centered .plate h2 { margin-bottom: 5px; font-size: 1.6rem; }
  .centered .settings { gap: 4px; margin-top: 4px; }
}
@media (min-width: 1080px) {
  .result { justify-items: end; padding-right: clamp(18px, 2.5vw, 45px); }
}
@media (max-width: 350px) {
  .guide-link { display: none; }
  .meter { min-width: 56px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; }
}
[data-reduced=true] *, [data-reduced=true] *::before, [data-reduced=true] *::after { animation-duration: .001ms !important; }
