:root {
  color-scheme: light;
  --paper: #eff2e8;
  --ink: #223b35;
  --pine: #284c43;
  --mint: #d6e3c9;
  --yellow: #ffce75;
  --note: #fff0c9;
  --border: #2f6353;
  --mono: "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  font: 16px/1.45 system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
button {
  min-width: 44px;
  min-height: 44px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: #fff5dc;
  color: var(--ink);
  font: 750 0.94rem/1.13 system-ui, sans-serif;
  padding: .5rem .76rem;
  cursor: pointer;
  box-shadow: 0 2px 0 var(--ink);
}
button:hover { background: white; }
button:active, button.held { transform: translateY(2px); box-shadow: none; }
button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 3px double #283b8a;
  outline-offset: 3px;
}
a { color: #295146; text-underline-offset: .22em; }
.primary { background: var(--yellow); }
.primary:hover { background: #ffdb97; }
.quiet { background: transparent; border-color: transparent; box-shadow: none; text-decoration: underline; text-underline-offset: .24em; }
.game {
  --cut: 22px;
  --bevel: polygon(var(--cut) 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, var(--cut) 100%, 0 calc(100% - var(--cut)), 0 var(--cut));
  position: relative;
  width: min(100% - 24px, 1660px);
  height: clamp(470px, 84dvh, 1050px);
  margin: 8px auto 0;
  clip-path: var(--bevel);
  background: var(--border);
  touch-action: none;
  user-select: none;
  -webkit-touch-callout: none;
  isolation: isolate;
}
.game-inner {
  --cut: 16px;
  position: absolute;
  inset: 7px;
  overflow: hidden;
  clip-path: var(--bevel);
  background: #d1dfae;
}
.game canvas { display: block; position: absolute; width: 100%; height: 100%; }
.game:fullscreen, .game.expanded {
  margin: 0;
  width: 100%;
  max-width: none;
  height: 100dvh;
  min-height: 0;
  max-height: none;
  clip-path: none;
}
.game.expanded { position: fixed; inset: 0; z-index: 20; }
body.is-expanded { overflow: hidden; }
.game:fullscreen .game-inner, .game.expanded .game-inner {
  inset: max(6px, env(safe-area-inset-top)) max(6px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
}
.top-tools { position: absolute; top: 13px; right: 15px; z-index: 5; display: flex; gap: 7px; }
.tool { display: grid; width: 46px; height: 46px; place-content: center; padding: 0; background: #fff2cc; }
.tool svg { width: 23px; height: 23px; }
svg path { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.panel { background: #fff0ca; border: 2px solid var(--ink); box-shadow: 6px 7px 0 #27463dc9; }
.panel h2 { font-family: var(--mono); line-height: .96; letter-spacing: -.075em; margin: 0; }
.menu {
  position: absolute;
  left: clamp(19px, 4.7vw, 78px);
  top: 13%;
  width: max-content;
  padding: 27px 28px 12px;
  transform: rotate(-1.5deg);
  border-radius: 6px 22px 10px 6px;
}
.menu::before { content: ""; height: 7px; background: #d4ae68; position: absolute; inset: 0 6px auto; border-radius: 0 10px 4px 4px; }
.menu-stamp {
  display: grid;
  width: 55px; height: 53px;
  place-items: center;
  background: #30594b; color: #ffdc8c;
  border: 2px solid var(--ink);
  border-radius: 9px 16px 9px 9px;
  transform: rotate(4deg);
  margin-bottom: 8px;
}
.menu-stamp svg { width: 43px; height: 43px; }
.menu h2 { font-size: clamp(3rem, 6.05vw, 6rem); font-weight: 900; }
.menu p { margin: .55rem 0 1.1rem; font-size: clamp(1rem, 1.55vw, 1.25rem); font-weight: 700; }
.menu-actions, .menu-bottom, .dialog-actions, .switches { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.menu-actions button { min-width: 126px; }
.menu-bottom { gap: 5px 16px; margin-top: 5px; }
.menu-bottom span { font: bold .88rem var(--mono); }
.menu-bottom button:first-child { margin-left: -.68rem; }
.hud { position: absolute; top: 13px; left: 15px; display: grid; grid-template-columns: minmax(0, 1fr); width: min(100% - 128px, 450px); gap: 8px; }
.scoreboard, .objective { display: flex; width: max-content; max-width: 100%; gap: 6px; align-items: stretch; }
.score, .clock {
  display: flex;
  align-items: center;
  gap: .45rem;
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 5px;
  padding: 5px 8px;
  height: 39px;
  font-size: 0.875rem;
  font-weight: 800;
}
.score-one { flex-shrink: 0; background: #e4dffe; }
.score-two { min-width: 0; background: #ffdac0; }
#name-two { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score strong, .clock { font: 800 .95rem var(--mono); font-variant-numeric: tabular-nums; }
.clock { flex-shrink: 0; min-width: 53px; justify-content: center; background: #fff0ca; }
.clock.urgent { background: #a1254e; color: #fff7db; }
.objective { background: #fff1ca; border: 2px solid var(--ink); border-radius: 5px; padding: 5px 8px; align-items: center; font-size: .875rem; line-height: 1.19; }
.objective > span:first-child { font-weight: 750; padding-right: 7px; border-right: 1px solid #9a8b64; white-space: nowrap; }
.objective strong { font-family: var(--mono); }
.objective span:last-child { font: 900 1.05rem var(--mono); }
#goal-arrow:empty { display: none; }
.pad { position: absolute; bottom: 12px; inset-inline: 16px; display: flex; justify-content: space-between; gap: 8px; pointer-events: none; }
.pad-group { pointer-events: auto; min-width: 0; color: #fff3d4; display: grid; gap: 4px; }
.pad-group:last-child:not(:first-child) { justify-items: end; margin-left: auto; }
.pad-info {
  display: flex; align-items: baseline; gap: 9px;
  width: max-content; max-width: 100%; padding: 2px 6px;
  border-radius: 4px; background: #294b40; color: #fff3d4;
  font-size: .875rem; line-height: 1.23;
}
.pad-info b { font-family: var(--mono); }
.pad-keys { display: flex; gap: 6px; }
.pad-keys button {
  width: 58px;
  height: 49px;
  min-height: 46px;
  padding: 2px 4px;
  background: #fff2cc;
  color: var(--ink);
  border-color: #1d3831;
  box-shadow: 0 3px 0 #1d3831;
  display: grid;
  place-content: center;
  gap: 1px;
}
.pad-keys button:hover, .pad-keys button.held { background: #ffd486; }
.pad-keys button[data-input="fire"] { color: #60253e; min-width: 64px; }
.pad-group.aim button[data-input="fire"] {
  background: #ffce75;
  outline: 2px solid #fff3cc;
  outline-offset: 2px;
}
.pad-mark { font: 900 1.23rem/1 var(--mono); }
.key-label { font: 800 .875rem/1.1 var(--mono); }
.game.large-pad .pad-keys button { width: 70px; height: 53px; }
.route {
  position: absolute;
  top: 68px;
  right: 15px;
  width: min(42%, 320px);
  background: #294c42;
  color: #fff3d4;
  border: 2px solid #203a33;
  border-radius: 6px;
  box-shadow: 0 2px 0 #203a33;
  pointer-events: none;
}
.trap-readout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 5px 8px;
  padding: 5px 8px 0;
  font: 800 .875rem/1.3 var(--mono);
}
#trap-direction { font-size: 1rem; text-align: center; }
#trap-status { min-width: 7em; text-align: right; white-space: nowrap; }
.trap-readout[data-phase="aim"] #trap-status { color: #ffda8b; }
.trap-readout[data-phase="wind"] #trap-status { color: #ffe192; }
.trap-readout[data-phase="active"] #trap-status { color: #ffc1ba; }
.trap-progress { grid-column: 1 / -1; height: 4px; background: #517264; border-radius: 2px; overflow: hidden; }
.trap-progress > span { display: block; height: 100%; background: #99ad8b; transform-origin: left center; }
.trap-readout[data-phase="wind"] .trap-progress > span,
.trap-readout[data-phase="aim"] .trap-progress > span { background: #ffcf75; }
.trap-readout[data-phase="active"] .trap-progress > span { background: #efa29b; }
.route-map { height: 32px; position: relative; }
.route-map > div { position: absolute; }
.route-rail, #route-traps { inset: 0 14px; }
.route-rail { top: 17px; bottom: auto; height: 5px; background: #84937a; display: flex; gap: 2px; }
.route-rail i { background: #b6bd93; flex: 1; }
.route-rail i:nth-child(2n) { background: #d2bd8c; }
#route-traps i {
  position: absolute; top: 14px; width: 5px; height: 11px; background: #7f4851;
  border: 1px solid #e6adab; transform: translateX(-50%); border-radius: 2px; font-size: 0;
}
#route-traps i.selected {
  z-index: 1; top: 2px; width: 18px; height: 18px;
  background: #fff2c6; border-color: #332e22; color: #332e22;
  text-align: center; font: 800 .875rem/16px var(--mono);
}
#route-traps i.wind, #route-traps i.active { background: #ff9f9e; border-color: #ffddad; }
#route-traps i.cool:not(.selected) { background: #536e65; border-color: #b7c298; }
#route-target, #route-runner { height: 0; inset: 0 14px auto; }
#route-target::before, #route-runner::before { content: ""; position: absolute; left: var(--position); }
#route-target::before { top: 14px; width: 12px; height: 12px; border: 2px solid #513c26; transform: translateX(-50%) rotate(45deg); background: #ffcc70; border-radius: 2px; }
#route-runner::before { top: 15px; width: 11px; height: 11px; border: 2px solid #fff3d4; transform: translateX(-50%); background: #6459a4; border-radius: 50%; }
#route-runner.second::before { background: #b74b38; }
.message {
  position: absolute; bottom: 16px; left: 50%; max-width: min(calc(100% - 28px), 37%);
  width: max-content; transform: translateX(-50%);
  border: 2px solid var(--ink); border-radius: 5px; background: #fff0c9; color: var(--ink);
  padding: 5px 10px; text-align: center; font-size: .9rem; font-weight: 760; box-shadow: 0 2px 0 #273e38;
  pointer-events: none;
}
.overlay { position: absolute; inset: 0; display: grid; align-items: center; justify-items: center; padding: 11px; background: #213e3355; z-index: 4; }
.dialog { width: min(100%, 480px); border-radius: 7px 17px 7px 7px; padding: clamp(13px, 4vw, 25px); max-height: 100%; overflow: auto; }
.dialog h2 { font-size: clamp(2.15rem, 6vw, 4.2rem); margin-bottom: .35em; }
.dialog p { margin: 0 0 11px; }
.dialog-actions, .switches { gap: 7px; }
.dialog-actions + .switches, .switches + .dialog-actions { margin-top: 13px; }
.switches button[aria-pressed]::before { content: ""; display: inline-block; width: .66rem; height: .66rem; border: 1.5px solid var(--ink); border-radius: 50%; margin-right: .38em; }
.switches button[aria-pressed="true"]::before { background: #4a795f; }
.switches button[aria-pressed="true"] { background: #e0ebca; }
.switches button[aria-pressed="false"] { background: #fff4d5; }
#bindings { display: flex; flex-wrap: wrap; gap: 7px; margin: 13px 0 8px; }
#bindings button { flex: 1 1 29%; }
#bindings button[aria-pressed="true"] { background: var(--yellow); }
#key-note { font-size: .875rem; }
.swap-panel { width: min(100%, 390px); }
.swap-track { height: 8px; border: 1px solid var(--ink); background: #eed6aa; border-radius: 5px; overflow: hidden; }
.swap-track span { display: block; width: 100%; height: 100%; background: #4c775b; transform-origin: left center; }
.result { text-align: center; background: #fff1c8; }
.result .dialog-actions { justify-content: center; }
.result-bell { width: 46px; height: 46px; display: block; margin: 0 auto 6px; color: #884c38; }
.result h2 { margin-bottom: .23em; }
.game[data-mode="won"] .result { border-color: #1f714b; background: #fff2bf; }
.result-scores { display: flex; justify-content: center; gap: 8px; margin: 0 0 14px; }
.result-scores span { border: 1.5px solid var(--ink); border-radius: 4px; background: #e3dcf9; padding: 4px 9px; font: bold .95rem/1.4 var(--mono); }
.result-scores span + span { background: #ffdbc1; }
.cup-result { color: #30583e; font-weight: 800; }
.cup-panel h2 { font-size: clamp(1.7rem, 5vw, 2.8rem); margin: .25em 0; }
.cup-tools, .cup-pages { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cup-pages { margin-top: 8px; font: 800 .875rem var(--mono); }
.cup-pages button { min-width: 44px; }
.cup-panel button:disabled { opacity: .48; cursor: default; }
.cup-entries { display: grid; gap: 4px; }
.cup-entry {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  border-top: 1px solid #bc9e6d; padding: 5px 0;
  font-size: .875rem; line-height: 1.18;
}
.cup-entry strong { display: block; margin-bottom: 2px; font-family: var(--mono); }
.cup-entry.earned strong, .cup-entry.earned .cup-status { color: #30583e; }
.cup-status { flex: 0 0 auto; font-weight: 800; }
#share-note { min-height: 0; font-size: .875rem; margin-top: .35em; }
.masthead {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: min(100% - 34px, 1630px);
  min-height: 53px;
  margin: 0 auto;
  padding: .3rem .1rem;
  border-bottom: 2px solid #aebfb0;
}
.masthead h1 { margin: 0; font: 800 clamp(1.05rem, 2.2vw, 1.62rem)/1.15 var(--mono); letter-spacing: -.045em; }
.masthead h1 span { color: #48665b; }
.masthead a { font-size: .875rem; white-space: nowrap; flex-shrink: 0; }
.guide, .legal { width: min(100% - 34px, 850px); margin: clamp(20px, 4vw, 52px) auto; }
.guide details { border: 1px solid #aebfb0; border-top: 3px solid #3e6c5a; border-radius: 3px 12px 4px 4px; background: #f9fbf3; margin-bottom: 11px; }
.guide summary { cursor: pointer; min-height: 48px; padding: 13px 16px; }
.guide summary h2 { display: inline; font: 800 clamp(1rem, 2.4vw, 1.24rem)/1.25 var(--mono); }
.guide .detail-body { padding: 0 18px 9px; }
.guide p, .legal p { margin: .4em 0 1.05em; max-width: 73ch; }
.guide li { margin-bottom: 9px; }
.guide dt { font-weight: 750; }
.guide dd { margin: 2px 0 12px; }
.footer { width: min(100% - 34px, 850px); margin: 0 auto 12px; border-top: 2px solid #aebfb0; }
.footer nav { display: flex; align-items: center; gap: clamp(10px, 4vw, 19px); min-height: 47px; font-size: .875rem; }
.languages {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  width: min(100% - 24px, 850px);
  margin: 8px auto 0;
  font-size: .875rem;
}
.languages a { display: inline-flex; align-items: center; padding: 3px 7px; min-height: 32px; }
.languages a[aria-current="page"] {
  border-radius: 99px;
  box-shadow: inset 0 0 0 1px #789685;
  font-weight: 750;
  text-decoration: none;
}
.footer nav { flex-wrap: wrap; row-gap: 3px; }
.footer small { color: #48665b; }
html:not([lang="en"]) .pad-keys button[data-input="fire"] { min-width: 76px; }
html:not([lang="en"]) .pad-keys button[data-input="fire"] .pad-mark {
  font-size: .82rem;
}
html:not([lang="en"]) .cup-entry > div { overflow-wrap: anywhere; }
.footer span { border: 1px solid #789685; border-radius: 99px; padding: 2px 9px; margin-left: auto; }
.legal h1, .legal h2 { font-family: var(--mono); line-height: 1.15; }
.legal h1 { font-size: clamp(1.85rem, 4.8vw, 3.4rem); }
.legal h2 { font-size: 1.25rem; }
.legal img { width: min(100%, 720px); height: auto; border: 3px solid var(--pine); border-radius: 7px; }

@media (hover: none) and (pointer: coarse) {
  .key-label { display: none; }
  .pad-keys button { width: 53px; }
  .pad-hint { display: none; }
}
@media (max-width: 650px) {
  .game { width: calc(100% - 8px); margin-top: 4px; height: 81dvh; min-height: 425px; --cut: 16px; }
  .game-inner { inset: 5px; --cut: 11px; }
  .top-tools { top: 8px; right: 8px; gap: 4px; }
  .tool { min-width: 44px; width: 44px; height: 44px; }
  .hud { width: calc(100% - 115px); top: 9px; left: 9px; gap: 5px; }
  .objective { max-width: calc(100% + 75px); }
  html:not([lang="en"]) #bindings button { flex-basis: calc(50% - 7px); }
  .scoreboard { gap: 4px; }
  .score, .clock { padding-inline: 5px; gap: 3px; height: 36px; }
  .clock { min-width: 44px; }
  .menu { top: clamp(65px, 14%, 99px); left: 17px; padding: 16px 17px 6px; max-width: calc(100% - 34px); }
  .menu h2 { font-size: clamp(2.7rem, 12.2vw, 4.7rem); }
  .menu p { margin: .5rem 0 .75rem; }
  .menu-stamp { width: 39px; height: 37px; margin-bottom: 5px; }
  .menu-stamp svg { width: 33px; height: 33px; }
  .menu-actions { gap: 6px; }
  .menu-actions button { min-width: 103px; padding-inline: .5rem; }
  .pad { inset-inline: 10px; bottom: 10px; }
  .pad-group { gap: 3px; }
  .pad-hint { display: none; }
  .pad-keys { gap: 5px; }
  .pad-keys button { width: 53px; }
  .game.large-pad .pad-keys button { width: 61px; }
  .game[data-duel="true"] .pad { flex-wrap: wrap; row-gap: 5px; }
  .game[data-duel="true"] .pad-group { flex: 1 1 100%; }
  .route { top: 85px; right: 9px; left: 9px; width: auto; }
  .message { top: 164px; bottom: auto; max-width: calc(100% - 24px); }
  .route:has(#trap-readout[hidden]) ~ .message { top: 129px; }
  .masthead { width: calc(100% - 24px); }
}
@media (max-height: 480px) and (min-aspect-ratio: 4/3) {
  .game { height: calc(100dvh - 60px); min-height: 240px; }
  .menu { top: 12%; padding: 14px 19px 4px; }
  .menu h2 { font-size: clamp(2.5rem, 6.5vw, 4.45rem); }
  .menu p { margin: .35em 0 .6em; }
  .menu-stamp { width: 37px; height: 34px; margin-bottom: 3px; }
  .menu-stamp svg { width: 29px; height: 29px; }
  .menu-bottom { margin-top: 1px; }
  .result-bell { width: 35px; height: 35px; }
  .cup-panel { padding: 9px 16px; }
  .cup-panel h2 { font-size: 1.65rem; }
  .cup-panel p { margin-bottom: 4px; }
  .cup-entry { padding-block: 3px; }
  .cup-pages { margin-top: 3px; }
  .mission-entries { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 13px; }
  .mission-entries .cup-entry { align-items: start; gap: 5px; }
}
@media (max-height: 480px) and (min-aspect-ratio: 4/3) and (min-width: 651px) {
  .route { top: 13px; right: 121px; }
}
@media (max-height: 480px) and (min-aspect-ratio: 4/3) and (min-width: 500px) {
  .cup-panel { display: grid; width: min(100%, 560px); grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; }
  .cup-tools { grid-area: 1 / 1; justify-content: flex-start; }
  .cup-pages { grid-area: 1 / 2; margin-top: 0; }
  .cup-panel h2, .cup-panel p, .cup-entries { grid-column: 1 / -1; }
}
@media (max-width: 650px) and (max-height: 700px) and (orientation: portrait) {
  .menu { top: 55px; padding-top: 12px; }
  .menu-stamp { display: none; }
}
@media (min-width: 358px) and (max-width: 650px) {
  .game[data-duel="true"]:not(.large-pad) .pad { flex-wrap: nowrap; align-items: end; inset-inline: 5px; gap: 4px; }
  .game[data-duel="true"]:not(.large-pad) .pad-group { flex: 0 1 auto; }
  .game[data-duel="true"]:not(.large-pad) .pad-keys { gap: 4px; }
  .game[data-duel="true"]:not(.large-pad) .pad-keys button { width: 44px; min-width: 44px; }
  .game[data-duel="true"]:not(.large-pad) .pad-keys button[data-input="fire"] .pad-mark { font-size: .9rem; }
}
@media (max-width: 320px) {
  .game .pad-keys { gap: 3px; }
  .game .pad-keys button, .game.large-pad .pad-keys button { width: 46px; }
  .scoreboard { flex-wrap: wrap; }
  .objective { width: 100%; }
  .route { top: 126px; }
  .message { top: 205px; }
  .route:has(#trap-readout[hidden]) ~ .message { top: 170px; }
}
@media (min-width: 651px) and (max-width: 1010px) {
  .message { left: 15px; top: 92px; bottom: auto; transform: none; max-width: 46%; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; } }
