* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
:root {
  --ink: #19363b;
  --deep: #054d52;
  --paper: #f6f6ed;
  --line: #d8ded0;
  --gold: #ffd255;
  --muted: #546964;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font:
    16px/1.5 "Segoe UI",
    "Microsoft YaHei",
    sans-serif;
}
button,
select,
textarea {
  font: inherit;
  color: inherit;
}
button,
select {
  cursor: pointer;
}
button {
  border: 1px solid var(--line);
  background: #fffef8;
  border-radius: 10px;
  padding: 8px 14px;
  font-weight: 650;
}
button:focus-visible,
select:focus-visible,
input:focus-visible + span,
textarea:focus-visible {
  outline: 3px solid #db8135;
  outline-offset: 2px;
}
button:disabled {
  opacity: 0.53;
  cursor: default;
}
header {
  background: #fffef7;
  border-bottom: 1px solid var(--line);
}
.navInner,
main {
  max-width: 1280px;
  margin: auto;
  padding-inline: clamp(14px, 4vw, 50px);
}
.navInner {
  height: 62px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.brand,
nav,
.modes,
.dlgHead,
.raceHead,
.panelTop,
#soloPreview,
.pickers,
.hud {
  display: flex;
  align-items: center;
}
.brand {
  gap: 10px;
  font-size: 22px;
  letter-spacing: -0.04em;
}
.brand i {
  font: normal 24px Georgia;
  color: #ffefb8;
  background: #18565b;
  transform: rotate(-7deg);
  border-radius: 8px;
  text-align: center;
  width: 36px;
}
.brand small {
  font: 800 12px/1 monospace;
  letter-spacing: 0.11em;
  color: #527069;
}
nav {
  gap: 8px;
}
nav button {
  font-size: 14px;
}
main {
  padding-block: 18px 24px;
}
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: 22px;
  background: #096578 url(cloudport.webp) center 46% / cover no-repeat;
  min-height: clamp(226px, 25vw, 330px);
  box-shadow: 0 4px 13px #113d4520;
  display: flex;
  align-items: center;
}
.hero:before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    90deg,
    #043f4cd9 0%,
    #07506160 32%,
    transparent 55%
  );
}
.heroCopy {
  color: #fffdf3;
  padding: 20px clamp(16px, 4vw, 56px);
  text-shadow: 0 2px 8px #12465280;
}
.heroCopy p {
  font-weight: 750;
  margin: 0 0 8px;
  letter-spacing: 0.12em;
  font-size: 14px;
}
.heroCopy h1 {
  font-size: clamp(44px, 6.3vw, 88px);
  font-weight: 950;
  line-height: 0.99;
  letter-spacing: -0.07em;
  margin: 0 0 14px;
}
.heroCopy em {
  font-style: normal;
  color: #ffdc71;
}
.heroCopy span {
  font-size: 15px;
  font-weight: 600;
}
.lobbyGrid {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 16px;
  margin-top: 16px;
}
.box,
.panel {
  padding: clamp(15px, 2vw, 26px);
  background: #fffef8;
  border: 1px solid var(--line);
  border-radius: 17px;
}
.box h2,
.dlgHead h2 {
  font-size: 23px;
  letter-spacing: -0.045em;
  margin: 0 0 12px;
}
.filters {
  display: grid;
  grid-template-columns: 0.85fr 0.8fr 1.9fr;
  gap: 10px;
}
.filters label,
.pickers label,
dialog label {
  display: grid;
  gap: 5px;
  font-size: 14px;
  font-weight: 650;
}
.filters label,
.pickers label {
  min-width: 0;
}
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid #c6d1c6;
  border-radius: 9px;
  background: #fffefa;
  padding: 7px 8px;
}
.levels {
  border: 0;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  gap: 8px;
}
.levels legend {
  font-weight: 650;
  font-size: 14px;
  padding: 0 0 5px;
}
.levels label {
  flex: 1;
  position: relative;
}
.levels input {
  position: absolute;
  opacity: 0;
}
.levels span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid #c7d3c8;
  padding: 10px 2px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 650;
}
.levels i {
  font: 700 15px Georgia;
}
.levels :checked + span {
  background: #dff2df;
  border-color: #37705c;
  color: #194e3a;
  box-shadow: inset 0 0 0 1px #37705c;
}
#poolCount,
#pickHint,
dialog p {
  color: var(--muted);
  font-size: 14px;
}
#poolCount {
  margin: 10px 0 0;
}
.modes {
  background: #eaf0e5;
  padding: 4px;
  border-radius: 11px;
}
.distanceChoice {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 650;
}
.distanceChoice select {
  flex: 1;
  width: auto;
  min-width: 0;
}
.modes button {
  flex: 1;
  background: transparent;
  border: 0;
}
.modes [aria-pressed="true"] {
  color: #fff;
  background: #21635a;
}
.primary {
  display: block;
  width: 100%;
  border: 1px solid #cd9c2c;
  border-bottom: 3px solid #af8021;
  background: var(--gold);
  min-height: 44px;
  font-size: 17px;
}
.primary:hover:enabled {
  background: #ffde76;
}
#soloPreview {
  gap: 7px;
  justify-content: center;
  margin: 8px 0;
  height: 60px;
}
#soloPreview i,
.pickers > span {
  font: italic 800 13px Georgia;
  color: #667971;
}
.runner {
  width: 43px;
  height: 50px;
  font-size: 0;
  background: center/contain no-repeat;
}
.orange {
  background-image: url(fox.webp);
}
.teal {
  background-image: url(otter.webp);
}
.pickers {
  gap: 7px;
  margin-top: 9px;
}
.pickers label {
  flex: 1;
}
.link {
  background: transparent;
  border: 0;
  text-decoration: underline;
  padding: 6px 0;
  color: #25665a;
}
.pickers > span {
  align-self: end;
  padding-bottom: 10px;
}
#pickHint {
  margin-left: 8px;
}
.raceHead,
.dlgHead,
.panelTop {
  justify-content: space-between;
  gap: 10px;
}
.raceHead {
  margin-bottom: 10px;
}
.raceHead h1 {
  margin: 0;
  font-size: clamp(22px, 3vw, 32px);
}
.raceHead p {
  font-size: 14px;
  margin: 0;
  color: var(--muted);
}
#raceMode {
  background: #e1ebde;
  border-radius: 8px;
  padding: 5px 10px;
  font-weight: 700;
}
.arena {
  position: relative;
  background: #a3d9df;
  border-radius: 16px;
  overflow: hidden;
}
.arena canvas {
  display: block;
  width: 100%;
  height: clamp(200px, 34vh, 375px);
}
.hud {
  position: absolute;
  inset: 8px 10px auto;
  justify-content: space-between;
  pointer-events: none;
}
.hud b {
  background: #133f43dc;
  color: white;
  border: 1px solid #ffffff65;
  border-radius: 18px;
  padding: 3px 10px;
  font:
    700 14px/1.6 "Segoe UI",
    sans-serif;
  max-width: 47%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#banner {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%) rotate(-3deg);
  background: var(--gold);
  color: #184740;
  font-weight: 900;
  border-radius: 12px;
  font-size: clamp(20px, 4vw, 48px);
  padding: 2px 20px;
  max-width: 92%;
  text-align: center;
}
#banner:empty {
  display: none;
}
#panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: 10px;
  margin-top: 12px;
}
.panel {
  padding: 14px 18px;
  border-top: 4px solid #e79b56;
}
.panel:nth-child(2) {
  border-top-color: #45a69e;
}
.panel h2 {
  margin: 8px 0 12px;
  line-height: 1.32;
  font-size: clamp(19px, 2.1vw, 29px);
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.panelTop b {
  overflow-wrap: anywhere;
}
.panelTop button {
  padding: 4px 10px;
  font-size: 14px;
}
.answers {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.answers button {
  min-height: 42px;
  flex: 1 1 85px;
  background: #f3f6ed;
  overflow-wrap: anywhere;
}
.answers button:hover:enabled {
  border-color: #387d67;
}
.answers button:disabled {
  opacity: 0.7;
}
.feedback {
  font-size: 14px;
  margin: 8px 0 0;
}
.feedback:empty {
  display: none;
}
#results,
#again {
  margin-top: 10px;
}
#results p {
  margin: 4px 0;
}
dialog {
  width: min(600px, 92vw);
  max-height: 82vh;
  padding: 22px;
  border: 1px solid #c4d3c7;
  border-radius: 18px;
  background: #fffef7;
  color: var(--ink);
}
dialog::backdrop {
  background: #123d42a8;
}
dialog .dlgHead {
  margin-bottom: 14px;
}
dialog h2 {
  margin: 0 !important;
}
dialog textarea {
  resize: vertical;
  width: 100%;
  margin: 8px 0 0;
  border: 1px solid #bbcabc;
  border-radius: 9px;
  padding: 10px;
}
details {
  border-top: 1px solid var(--line);
  padding: 8px 0;
}
summary {
  cursor: pointer;
}
@media (max-width: 760px) {
  .lobbyGrid {
    grid-template-columns: 1fr;
  }
  .hero {
    min-height: 230px;
    background-position: 57% center;
  }
  .heroCopy span {
    display: block;
    max-width: 145px;
  }
  .brand small {
    display: none;
  }
  .navInner {
    height: 53px;
  }
  .brand {
    font-size: 19px;
  }
  .navInner button {
    padding: 6px 9px;
  }
  .heroCopy h1 {
    font-size: 46px;
  }
  .lobbyGrid {
    gap: 10px;
    margin-top: 10px;
  }
  main {
    padding-top: 10px;
  }
  .filters {
    grid-template-columns: 1fr 1fr;
  }
  .filters label:last-child {
    grid-column: 1/-1;
  }
  .levels span {
    padding: 8px;
  }
  .raceHead p {
    font-size: 12px;
  }
  .arena canvas {
    height: clamp(155px, 25svh, 220px);
  }
  .panel {
    padding: 9px 10px;
  }
  .answers button {
    font-size: 14px;
    padding: 6px;
  }
  .panel h2 {
    margin: 5px 0 8px;
  }
  .hud b {
    font-size: 12px;
  }
  .panelTop button {
    min-height: 37px;
  }
  #panels {
    gap: 7px;
    margin-top: 8px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}
.courseHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.box .courseHead h2 {
  margin: 0;
}
.courseHead label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 650;
}
.courseHead select {
  width: auto;
  min-height: 36px;
  padding: 4px 6px;
}
#edition {
  color: #48635c;
  font-size: 14px;
  margin: 9px 0 0;
}

#rotateHint {
  display: none;
}
.correction {
  padding: 10px 14px;
  border-radius: 12px;
  background: #fff4d8;
  border: 1px solid #eacf8b;
}
.correction strong {
  color: #694616;
}
.correction p {
  margin: 4px 0 9px;
  line-height: 1.4;
}
.correction button,
.panelTop button,
.answers button {
  min-height: 46px;
  touch-action: manipulation;
}
.correction .continue {
  background: #256b5f;
  color: white;
}
.recallTag {
  margin-right: auto;
  border-radius: 15px;
  color: #76531d;
  background: #fff1ce;
  padding: 3px 9px;
  font-size: 14px;
}
@media (min-width: 600px) and (orientation: portrait) {
  #rotateHint {
    display: block;
    text-align: center;
    color: var(--muted);
    font-size: 14px;
  }
  .inRace #rotateHint {
    margin: 3px 0 6px;
  }
}
@media (min-width: 800px) and (orientation: landscape) {
  .navInner,
  main {
    max-width: 1500px;
    padding-inline: clamp(16px, 2.8vw, 46px);
  }
  #lobby {
    display: grid;
    grid-template-columns: minmax(235px, 0.84fr) minmax(450px, 1.4fr);
    gap: 18px;
    align-items: stretch;
  }
  #lobby .hero {
    height: 100%;
    min-height: 340px;
    background-position: 68% center;
    align-items: flex-end;
  }
  .hero::before {
    background: linear-gradient(0deg, #033d4aeb, transparent 68%);
  }
  .heroCopy {
    padding: 25px;
  }
  .heroCopy h1 {
    font-size: clamp(52px, 5.8vw, 80px);
  }
  .lobbyGrid {
    margin-top: 0;
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .lobbyGrid .box {
    padding: 14px 18px;
  }
  #soloPreview {
    height: 42px;
    margin: 4px 0;
  }
  #duoSetup {
    margin: 6px 0;
  }
  .inRace .navInner {
    height: 48px;
  }
  .inRace main {
    padding-top: 8px;
  }
  .raceHead {
    margin: 0 0 7px;
  }
  .raceHead h1 {
    font-size: 24px;
  }
  .arena canvas {
    height: clamp(180px, 38svh, 385px);
  }
  #panels {
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 14px;
    margin-top: 10px;
  }
  .panel {
    min-width: 0;
    padding: 10px 15px;
  }
  .panel h2 {
    font-size: clamp(19px, 2.2vw, 29px);
    margin: 6px 0 10px;
  }
  .answers button {
    padding: 8px;
    font-size: clamp(15px, 1.6vw, 20px);
    min-height: 52px;
  }
  .panelTop button {
    min-width: 96px;
  }
}
@media (pointer: coarse) {
  button,
  select {
    touch-action: manipulation;
  }
  .modes button,
  nav button,
  select,
  .link {
    min-height: 44px;
  }
}
#soloPreview {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) auto;
  height: auto;
  gap: 4px 10px;
  margin: 10px 0;
}
#soloPreview .distanceChoice {
  margin: 0;
}
.notebookActions {
  display: flex;
  gap: 6px;
}
.notebookActions button {
  min-height: 44px;
}
#notebookHint {
  grid-column: 1/-1;
  color: var(--muted);
  font-size: 14px;
}
#notebookPlay {
  margin-top: 14px;
}
#notebookList details p {
  margin: 6px 0;
}
#saveWarning {
  background: #fff4d8;
  padding: 8px 12px;
  border-radius: 8px;
}
@media (max-width: 960px) {
  #soloPreview {
    grid-template-columns: 1fr;
  }
  .notebookActions button {
    flex: 1;
  }
}
