* { box-sizing: border-box; }
:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #172f40;
  background: #edf2ef;
  --ink: #172f40;
  --pale: #f5f2e7;
  --red: #a82d22;
  --line: #c4cfcc;
}
body { margin: 0; }
[hidden] { display: none !important; }
button { font: inherit; font-weight: 720; cursor: pointer; min-width: 44px; min-height: 44px; }
a { color: inherit; text-underline-offset: .24em; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #12395b; outline-offset: 3px; }
#game:focus-visible { outline-offset: -5px; }
.masthead {
  width: min(100%, 1632px);
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 70px;
  padding: 8px max(24px, env(safe-area-inset-right)) 8px max(24px, env(safe-area-inset-left));
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand svg { display: block; flex: none; background: var(--red); color: #fff3e0; border-radius: 7px; }
h1 { margin: 0; font-size: clamp(1.42rem, 3.5vw, 2.45rem); letter-spacing: -.062em; line-height: 1.02; }
.header-link { font-weight: 710; font-size: .94rem; min-height: 44px; display: inline-flex; align-items: center; }
.stage {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: auto;
  max-width: 1592px;
  height: calc(100dvh - 89px);
  min-height: 325px;
  margin: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  background: #bed6da;
  border-radius: 12px;
  box-shadow: 0 1px 0 #62828b;
}
@media (min-width: 1630px) { .stage { margin-inline: auto; } }
#game {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.tools [data-act=pause] { touch-action: manipulation; }
.hud {
  position: absolute;
  top: clamp(10px, 2vw, 21px);
  left: clamp(10px, 2vw, 23px);
  right: clamp(10px, 2vw, 23px);
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: start;
  pointer-events: none;
}
.course {
  display: grid;
  min-width: 0;
  overflow-wrap: anywhere;
  justify-items: start;
  gap: 1px;
  padding: 7px 12px 9px;
  background: #f7f1e4;
  border-radius: 5px;
  border-left: 4px solid var(--red);
  box-shadow: 0 2px 0 #43657243;
}
.course span { font-size: .79rem; font-weight: 680; font-variant-numeric: tabular-nums; }
.course strong { font-size: clamp(.87rem,2vw,1.08rem); line-height: 1.15; }
.tools, .actions, .options { display: flex; flex-wrap: wrap; gap: 7px; }
.tools { pointer-events: auto; flex-wrap: nowrap; }
.icon { display: grid; place-items: center; width: 46px; height: 46px; background: #f7f1e4; color: var(--ink); }
.icon svg { width: 23px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon[aria-pressed=false] svg { opacity: .46; }
.icon[aria-pressed=false]::after {
  content: "";
  width: 24px;
  height: 2px;
  background: var(--red);
  position: absolute;
  transform: rotate(-43deg);
  pointer-events: none;
}
.dock {
  position: absolute;
  left: clamp(14px, 3.4vw, 54px);
  bottom: clamp(19px, 4vw, 63px);
  width: min(410px, calc(100% - 28px));
  padding: clamp(17px, 3vw, 30px);
  color: var(--pale);
  background: #182f3f;
  border-radius: 9px;
  border-top: 4px solid #f57552;
  box-shadow: 0 8px 0 #142e4052;
}
.dock[data-view=menu] { width: min(460px, calc(100% - 28px)); }
.dock[data-view=won] { border-color: #f6c171; }
.stage[data-motion=full] .dock[data-view=won] { animation: settle-in .24s .13s both ease-out; }
@keyframes settle-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .stage[data-motion=full] .dock[data-view=won] { animation: none; }
}
.dock[data-view=over] { border-color: #f78466; }
@media (min-width: 930px) {
  .dock[data-view=paused] { left: auto; right: clamp(16px,3.4vw,47px); }
}
.dock-label {
  display: inline-block;
  color: #ffd2ad;
  font-weight: 730;
  font-size: .94rem;
  margin-bottom: 6px;
}
.dock h2 {
  margin: 0;
  font-size: clamp(2.15rem, 5.2vw, 4.65rem);
  letter-spacing: -.078em;
  line-height: .96;
}
.dock:not([data-view=menu]) h2 { font-size: clamp(2rem,4vw,3.8rem); }
.dock p { margin: 12px 0 17px; color: #ecf1ee; }
.dock p:empty { display: none; }
.dock .result-comparison { margin: -8px 0 14px; color: #ffdfad; font-size: .94rem; }
button { border: 0; border-radius: 5px; padding: 0 13px; }
.dock, .picker-heading { overflow-wrap: anywhere; }
.dock button { max-width: 100%; }
.primary { color: #fff9ee; background: var(--red); }
.dock .primary { color: #221619; background: #ff8a64; box-shadow: inset 0 -3px 0 #bf503b; }
.dock .primary[data-act=play] { min-width: 112px; }
.secondary { color: var(--ink); background: #e5eeea; }
.dock .secondary { color: var(--pale); background: #2e4858; }
.dock button:focus-visible { outline-color: #ffdfa3; }
button:hover { filter: brightness(.92); }
button:active { transform: translateY(1px); }
.options { margin-top: 13px; }
.options button { background: #e5eeea; color: var(--ink); font-size: .9rem; }
.options button[aria-pressed=false] { background: #2e4858; color: #f4ede3; }
.prompt, .timing {
  position: absolute;
  bottom: 17px;
  pointer-events: none;
  background: var(--ink);
  color: #fff8e9;
  padding: 9px 13px;
  border-radius: 5px;
  font-size: .95rem;
  font-weight: 670;
  box-shadow: 0 2px 0 #192d3854;
}
.prompt { left: 50%; translate: -50% 0; width: max-content; max-width: calc(100% - 210px); text-align: center; }
.prompt[data-cue=retry] { border-bottom: 3px solid #ff9a76; }
.prompt[data-cue=release] { background: #fff0c7; color: #172f40; border-bottom: 3px solid #a93123; }
.timing { right: 15px; display: flex; align-items: center; gap: 10px; font-variant-numeric: tabular-nums; }
#time { min-width: 4ch; }
#progress { display: block; width: clamp(45px, 8vw, 100px); height: 5px; border-radius: 3px; background: #66818d; }
#progress i { display: block; height: 100%; width: 0; border-radius: 3px; background: #ff9a76; }
.course-picker {
  position: absolute;
  inset: auto auto max(11px, env(safe-area-inset-bottom)) 12px;
  width: min(800px, calc(100% - 24px));
  max-height: calc(100% - 81px);
  overflow: auto;
  background: #f7f1e5;
  border-radius: 8px;
  border-top: 4px solid var(--red);
  padding: 15px;
  box-shadow: 0 6px 0 #223c4866;
}
.picker-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.picker-heading h2 { margin: 0; font-size: clamp(1.7rem, 5vw, 2.75rem); letter-spacing: -.07em; }
.chapter-list { display: grid; gap: 8px 19px; grid-template-columns: repeat(auto-fit,minmax(min(100%,305px),1fr)); }
.chapter-list h3 { margin: 8px 0 6px; font-size: .96rem; }
.chapter-courses { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 4px; }
.chapter-courses button { padding: 0; min-width: 0; background: var(--ink); color: white; }
.chapter-courses button.cleared { background: var(--red); }
.chapter-courses button[aria-current] { outline: 2px solid #99452e; outline-offset: 1px; }
.chapter-courses button:disabled { background: #e2e4df; color: #4a616c; cursor: default; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.languages {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 16px;
  width: min(calc(100% - 36px), 810px);
  margin: 6px auto 0;
  font-size: .94rem;
}
.languages a { display: inline-flex; align-items: center; min-height: 44px; }
.languages a[aria-current=page] { font-weight: 720; }
.reading, .legal {
  width: min(calc(100% - 36px), 810px);
  margin: clamp(46px,8vw,110px) auto;
  font-size: 1.0625rem;
  line-height: 1.68;
}
.reading h2, .legal h2 { font-size: clamp(1.45rem,4vw,2.1rem); line-height: 1.13; letter-spacing: -.038em; margin: 34px 0 10px; }
.reading h3 { font-size: 1.1rem; margin-bottom: 0; }
.reading h3 + p { margin-top: 4px; }
.reading li + li { margin-top: 6px; }
.reading kbd { font: inherit; font-size: .9em; font-weight: 660; padding: 1px 5px; border: 1px solid #aebcb7; border-radius: 4px; }
.legal h1 { font-size: clamp(2.4rem,7vw,5rem); }
footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 22px max(18px,7vw) max(22px,env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  font-size: .96rem;
}
footer nav { display: flex; flex-wrap: wrap; gap: 16px; }
footer a { display: inline-flex; align-items: center; min-height: 44px; }
@media (max-width: 575px) {
  .masthead { min-height: 60px; padding-inline: max(9px, env(safe-area-inset-left)) max(9px, env(safe-area-inset-right)); }
  .brand { gap: 7px; }
  .brand svg { width: 35px; height: 35px; border-radius: 5px; }
  .header-link { font-size: .79rem; }
  .masthead .header-link { flex-shrink: 0; max-width: 29%; }
  .stage { height: calc(100dvh - 69px); margin-inline: max(5px, env(safe-area-inset-left)) max(5px, env(safe-area-inset-right)); border-radius: 8px; }
  .dock { bottom: max(16px, env(safe-area-inset-bottom)); }
  .dock[data-view=menu] h2 { font-size: clamp(3rem,15vw,4.6rem); }
  .dock p { margin: 9px 0 12px; }
  .prompt { bottom: 62px; max-width: calc(100% - 24px); }
  .timing { right: 9px; }
}
@media (max-height: 495px) and (orientation: landscape) {
  .masthead { min-height: 49px; padding-block: 2px; }
  .brand svg { width: 34px; height: 34px; }
  h1 { font-size: 1.7rem; }
  .stage { min-height: 240px; height: calc(100dvh - 55px); }
  .hud { inset: 9px 10px auto; }
  .dock { bottom: 12px; padding: 11px 15px; }
  .dock[data-view=menu] { width: min(295px, calc(100% - 28px)); }
  .dock h2 { font-size: 2.3rem; }
  .dock p { margin: 5px 0 8px; }
  .dock-label { margin-bottom: 3px; }
  .options { margin-top: 5px; }
}
