:root {
  color-scheme: light;
  --ink: #112b37;
  --muted: #47626c;
  --paper: #fff;
  --edge: #d5e7e8;
  --teal: #00736f;
  --lemon: #ffe473;
  --shadow: 0 18px 55px #1439410c, 0 2px 5px #14394106;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at top, #d9f5ee 0%, #eff8f6 42%, #f3f9f7 100%);
  color: var(--ink);
  font-family: ui-rounded, "Avenir Next", system-ui, sans-serif;
  line-height: 1.45;
}
h1, h2, p { margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .52; }
:focus-visible { outline: 3px solid #007d75; outline-offset: 4px; }
.shell { width: min(1120px, 100%); padding: 0 26px; margin: 0 auto; }
main { padding-bottom: 32px; }
.top { height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 1.075rem; font-weight: 850; letter-spacing: -.025em; }
.mark { display: grid; place-items: center; width: 39px; aspect-ratio: 1; border-radius: 12px; background: #ffe477; box-shadow: inset 0 -3px #966b171f; }
.mark .duck { font-size: 27px; }
.online { display: inline-flex; gap: 7px; align-items: center; padding: 7px 11px; border-radius: 30px; border: 1px solid #bfe4d9; background: #ffffff89; color: #126450; font-size: .875rem; font-weight: 720; white-space: nowrap; }
.online span { width: 7px; aspect-ratio: 1; border-radius: 100%; background: #159a70; }

.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  min-height: 326px;
  overflow: hidden;
  border-radius: 25px;
  background: #0b3c40;
  color: #fff;
  box-shadow: 0 11px 32px #0a3d4935;
}
.hero-art, .hero-art::after { position: absolute; inset: 0; }
.hero-art img { width: 100%; height: 100%; display: block; object-fit: cover; object-position: 50% 45%; }
.hero-art::after { content: ""; background: linear-gradient(90deg, #062a30 0%, #082e31f2 17%, #0b3338c7 33%, #0d394148 54%, transparent 74%); }
.hero-copy { position: relative; z-index: 1; width: min(56%, 580px); padding: 37px 0 43px clamp(26px, 5vw, 57px); }
.hero h1 { font-size: clamp(3rem, 7vw, 5.3rem); line-height: .98; font-weight: 950; letter-spacing: -.075em; text-wrap: balance; }
.hero em { color: var(--lemon); font-style: normal; }
.hero p { max-width: 285px; margin-top: 19px; color: #f2fcf9; font-size: 1.04rem; line-height: 1.55; }

.panel { margin-top: 22px; padding: 26px 30px 24px; border: 1px solid var(--edge); border-radius: 22px; background: var(--paper); box-shadow: var(--shadow); }
.setup-head, .bottom { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
h2 { font-size: clamp(1.4rem, 3vw, 1.78rem); font-weight: 850; letter-spacing: -.055em; }
.switch { display: flex; padding: 4px; gap: 3px; border: 1px solid #dfedeb; background: #eef7f4; border-radius: 12px; }
.switch button { border: 0; border-radius: 8px; background: transparent; color: var(--muted); padding: 8px 14px; font-size: .9rem; font-weight: 770; }
.switch button[aria-pressed="true"] { color: #075f59; background: #fff; box-shadow: 0 1px 5px #214a4822; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 14px; margin: 19px 0 20px; }
.fields label, legend { color: var(--ink); font-size: .94rem; font-weight: 780; }
.fields input { display: block; width: 100%; margin-top: 7px; padding: 11px 13px; border: 1px solid #c9dedf; border-radius: 10px; background: #f7fbfa; color: var(--ink); font-size: 1rem; }
.field-hint { display: block; margin-top: 3px; font-size: .875rem; font-weight: 550; color: var(--muted); }
.fields input::placeholder { color: #557178; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 9px; }
.ducks { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.choice { position: relative; display: grid; gap: 7px; cursor: pointer; text-align: center; font-size: .875rem; font-weight: 760; }
.choice input { position: absolute; z-index: 2; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.tile { position: relative; isolation: isolate; display: grid; place-items: center; min-height: 78px; overflow: hidden; border: 2px solid transparent; border-radius: 13px; box-shadow: inset 0 1px #fff8; transition: border-color 140ms; }
.tile::before { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(ellipse at 50% 38%, #ffffffe0, transparent 71%), repeating-linear-gradient(-32deg, transparent 0 13px, #ffffff3c 14px 15px); }
.tile .hull { font-size: clamp(42px, 6vw, 63px); transition: transform 160ms; }
.choice:hover .tile .hull { transform: translateY(-3px) rotate(-5deg); }
.choice:hover .tile { border-color: #6db3a6; }
.choice input:checked + .tile { border-color: var(--teal); box-shadow: inset 0 0 0 2px #fff; }
.choice input:checked ~ span:last-child { color: #006660; }
.choice input:focus-visible + .tile { outline: 3px solid #007d75; outline-offset: 3px; }
.tick { display: none; position: absolute; top: 5px; right: 5px; width: 21px; aspect-ratio: 1; border-radius: 50%; background: var(--teal); color: #fff; line-height: 21px; }
.choice input:checked + .tile .tick { display: block; }

.bottom { margin-top: 20px; padding-top: 17px; border-top: 1px solid #e3eeeb; color: var(--muted); font-size: .9rem; }
.primary, .secondary { min-height: 44px; padding: 10px 17px; border-radius: 10px; font-weight: 830; transition: background 140ms, transform 140ms; }
.primary { background: var(--lemon); color: #273126; border: 1px solid #f0cd4b; box-shadow: inset 0 -2px #9a690c21; }
.primary:hover:not(:disabled) { background: #ffda4e; }
.primary:active:not(:disabled), .secondary:active:not(:disabled) { transform: translateY(1px); }
.secondary { background: #f1f8f6; color: #075f59; border: 1px solid #cfe4df; }
.secondary:hover:not(:disabled) { background: #e5f4ef; }
.error, .room .error { margin-top: 12px; color: #a62342; }

.duck { position: relative; display: inline-block; width: 1em; height: .86em; vertical-align: middle; flex: none; }
.duck i { position: absolute; display: block; }
.duck-body { left: 5%; top: 44%; width: 79%; height: 48%; border-radius: 35% 50% 48% 53%; background: linear-gradient(155deg, #ffffff90, transparent 45%), var(--duck); transform: rotate(7deg); box-shadow: inset 0 -.07em var(--shade); }
.duck-wing { left: 18%; top: 57%; width: 38%; height: 24%; background: var(--shade); border-radius: 30% 55% 55% 60%; transform: rotate(12deg); }
.duck-head { left: 52%; top: 9%; width: 38%; height: 50%; background: linear-gradient(145deg,#fff9,transparent 49%), var(--duck); border-radius: 50%; transform: rotate(-12deg); }
.duck-beak { left: 82%; top: 39%; width: 17%; height: 15%; background: #fa863c; border-radius: 45% 65% 55% 45%; transform: rotate(5deg); }
.duck-eye { left: 73%; top: 26%; width: 7%; aspect-ratio: 1; background: #172630; border-radius: 50%; box-shadow: inset .012em .012em #ffffffad; }
.hull { position: relative; display: inline-block; vertical-align: middle; width: 1.3em; height: 1em; filter: drop-shadow(0 .07em .05em #10333a40); }
.hull .duck, .hull i { position: absolute; }
.hull .duck { top: 4%; left: 10%; font-size: .71em; }
.hull-body { inset: 57% 0 10%; background: linear-gradient(174deg, var(--deck) 0 15%, var(--hull) 16% 27%, #d59451 28% 53%, #a16038 54% 65%, #d59451 66% 77%, #8e502f 78% 100%); border-radius: 17% 14% 49% 49% / 20% 38% 90% 87%; transform: rotate(-5deg); }
.hull-trim { inset: 66% 12% 28% 9%; border-radius: 85% 44%; background: #ffe5aa94; transform: rotate(-5deg); }
.canoe-seat { inset: 54% 26% 31% 15%; border-radius: 62% 40% 52% 66%; background: #8a502e; transform: rotate(-4deg); }
.canoe-paddle { z-index: 1; top: 54%; left: 41%; height: .058em; width: .58em; border-radius: 50rem; background: #6d431f; transform: rotate(32deg); box-shadow: 0 -.02em #ffdc8c91; }
.canoe-paddle::after { content: ""; position: absolute; right: -.08em; top: -.046em; height: .15em; width: .22em; border-radius: 35% 42% 50% 38%; background: #dfa763; box-shadow: inset 0 -.025em #8a532c; }
.hero-canoe { position: absolute; z-index: 1; right: 10%; top: 38%; font-size: clamp(110px, 19vw, 265px); transform: rotate(-8deg); pointer-events: none; }
@media (max-width: 670px) {
  .hero-canoe { right: 6%; top: 6%; font-size: clamp(95px, 31vw, 175px); }
  .hero-copy { z-index: 2; }
}
.room { margin-top: 6px; }
.room-code { font-size: .88rem; font-weight: 850; letter-spacing: .10em; color: var(--teal); }
.room h1 { margin-top: 4px; font-size: clamp(2.1rem, 5vw, 3.4rem); font-weight: 900; line-height: 1.08; letter-spacing: -.063em; }
.room p { margin-top: 9px; color: var(--muted); }
#status { font-weight: 690; }
#notice { color: #075f59; overflow-wrap: anywhere; }
.share-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.track { margin-top: 8px; overflow: hidden; border: 1px solid #429a9c; border-radius: 15px; background: #87d6de; }
.track canvas { display: block; width: 100%; height: clamp(240px, 42vw, 490px); }
.course-key .marker { display: inline-grid; place-items: center; aspect-ratio: 1; }
.course-key .buoy { border: 2px solid #fff2d4; border-radius: 50%; background: #f56d42; box-shadow: inset 0 -2px #ae332a; }
.course-key .boost { border: 1px solid #256e60; border-radius: 4px; background: #cdff90; color: #0e6254; font-weight: 900; line-height: 1; }
.course-key { display: flex; gap: 12px 18px; flex-wrap: wrap; margin-top: 9px; color: var(--muted); font-size: .875rem; }
.course-key span { display: inline-flex; align-items: center; gap: 6px; }
.course-key .marker { position: static; transform: none; width: 15px; font-size: .75rem; }
.standings { display: flex; flex-wrap: wrap; gap: 7px; list-style: none; padding: 0; margin: 12px 0 0; }
.standings li { display: flex; align-items: center; gap: 6px; border: 1px solid var(--edge); background: #f2faf8; border-radius: 8px; padding: 5px 8px; color: #254952; font-size: .875rem; overflow-wrap: anywhere; }
.standing-color { width: 10px; height: 10px; border: 1px solid #17382a50; border-radius: 50%; flex: none; }
.results { display: grid; gap: 8px; margin: 18px 0 0; padding: 0; counter-reset: rank; }
.results li { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--edge); border-radius: 11px; background: #f2faf8; counter-increment: rank; }
.results li::before { content: counter(rank); font-weight: 850; }
.results li:first-child { background: #fff3c7; border-color: #f2dc93; }
.results .hull { font-size: 39px; flex: none; }
.results strong { overflow-wrap: anywhere; }
.results li > span:last-child { margin-left: auto; white-space: nowrap; font-variant-numeric: tabular-nums; }

.drive-controls { display: flex; align-items: center; gap: 10px 15px; flex-wrap: wrap; margin-top: 15px; padding: 11px; border: 1px solid #dcecea; border-radius: 12px; background: #f1f8f6; }
.drive-controls p { margin: 0; font-size: .9rem; }
.drive-buttons { display: flex; gap: 7px; }
.drive-buttons button { min-width: 50px; min-height: 49px; touch-action: manipulation; }
.drive-buttons .throttle { min-width: 106px; touch-action: none; user-select: none; }
.throttle.held { background: #ffc846; box-shadow: inset 0 3px 0 #0003; }

@media (max-width: 670px) {
  .shell { padding: 0 13px; }
  .top { height: 61px; }
  .hero { min-height: 332px; align-items: end; border-radius: 18px; }
  .hero-art img { object-position: 59% 46%; }
  .hero-art::after { background: linear-gradient(0deg, #07292eee 1%, #07292ebb 27%, #07292e36 53%, transparent 78%); }
  .hero-copy { width: 100%; padding: 110px 18px 19px; }
  .hero h1 { font-size: clamp(2.45rem, 8vw, 4.05rem); text-wrap: initial; }
  .hero p { margin-top: 8px; }
  .panel { margin-top: 14px; padding: 17px 14px; border-radius: 16px; }
  .setup-head { gap: 10px; }
  .switch button { padding-inline: 10px; }
  .ducks { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px 8px; }
  .tile { min-height: 63px; }

}
@media (max-width: 350px) {
  .brand { font-size: .925rem; }
  .online { padding-inline: 8px; }
  .mark { width: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.watch-page {
  color-scheme: dark;
  color: #effcfb;
  background: radial-gradient(ellipse at top right, #184d4d 0, #0c272e 42%, #081d25 85%);
}
.watch-shell { width: min(1380px, 100%); }
.watch-hero {
  display: grid;
  align-items: end;
  min-height: 196px;
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid #37706e;
  background: linear-gradient(90deg, #0b2833 4%, #0b2b34e8 25%, #0b30385c 65%, #0b303822),
    url("/chase-coast.webp") 58% 71% / cover;
  box-shadow: 0 12px 35px #020f15a0;
}
.watch-heading { padding: 23px clamp(17px, 4vw, 41px); }
.watch-heading h1 { font-size: clamp(2.35rem, 5vw, 4.5rem); font-weight: 920; line-height: 1; letter-spacing: -.07em; }
#watch-status {
  display: inline-block;
  margin-top: 12px;
  padding: 6px 11px;
  border: 1px solid #a4e5d34f;
  border-radius: 8px;
  background: #0b3036ed;
  color: #d4f4ea;
  font-size: .9rem;
  font-weight: 680;
}
#watch-retry { margin-left: 8px; min-height: 35px; padding: 5px 12px; }
.watch-layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(252px, 1fr); gap: 15px; margin-top: 16px; align-items: start; }
.watch-panel {
  min-width: 0;
  padding: 15px;
  border: 1px solid #30605e;
  border-radius: 16px;
  background: linear-gradient(155deg, #163e43, #0f2b34 70%);
  box-shadow: 0 12px 33px #020f1555;
}
.watch-panel-head { display: flex; min-height: 32px; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.watch-panel h2 { font-size: clamp(1.15rem, 2vw, 1.44rem); letter-spacing: -.035em; }
#watch-distance { color: #fbe794; font-size: .875rem; font-weight: 770; font-variant-numeric: tabular-nums; }
.watch-panel .track { margin-top: 0; border-color: #458582; border-radius: 11px; background: #1e6871; }
.watch-panel canvas { height: clamp(248px, 32vw, 415px); }
.watch-panel .course-key { color: #b7dede; }
.watch-panel .results { gap: 6px; margin: 0; }
.watch-panel .results li {
  display: grid;
  grid-template-columns: 22px 10px minmax(0, 1fr);
  align-items: center;
  gap: 2px 7px;
  padding: 9px 8px;
  color: #e9f8f4;
  background: #173e47;
  border: 1px solid #2a5460;
  border-radius: 9px;
  font-size: .9rem;
}
.watch-panel .results li::before { grid-row: span 2; color: #91bbc1; text-align: center; font-variant-numeric: tabular-nums; }
.watch-panel .results li:first-child { background: #3f4229; border-color: #a28d47; }
.watch-panel .results li:first-child::before { color: #ffdf76; }
.watch-panel .results li > span:last-child:not(.standing-color) { grid-column: 3; margin: 0; font-size: .875rem; color: #cde0de; }
.watch-panel .standing-color { border-color: #fff5; }
.watch-page :focus-visible { outline-color: #ffe682; }
@media (max-width: 850px) {
  .watch-layout { grid-template-columns: 1fr; }
}
@media (max-width: 490px) {
  .watch-hero { min-height: 166px; background-position: 67% 47%; }
  .watch-panel { padding: 10px; }
  .watch-panel canvas { height: 268px; }
}

.driver-stage {
  position: relative;
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid #224e59;
  border-radius: 16px;
  background: #142e3b;
  box-shadow: 0 10px 25px #103d481e;
}
.driver-stage .track { margin: 0; border: 0; border-radius: 0; }
.driver-stage canvas { height: clamp(275px, 43vw, 465px); }
.driver-hud {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  background: linear-gradient(112deg, #132d3b, #18464b 48%, #132d3b);
  color: #ecfffa;
  border-bottom: 1px solid #519998;
  font-variant-numeric: tabular-nums;
}
.hud-stat { min-width: 0; padding: 7px 14px; text-align: center; }
.hud-stat + .hud-stat { border-left: 1px solid #7ab8ae38; }
.hud-stat span { display: block; font-size: .875rem; color: #bce4dd; font-weight: 720; }
.hud-stat strong { color: #ffe580; font-size: clamp(1.15rem, 3vw, 1.75rem); font-weight: 900; letter-spacing: -.04em; }
.hud-stat small { margin-left: 4px; color: #d3efe7; font-size: .875rem; }
.hud-distance strong { font-size: clamp(.88rem, 2.7vw, 1.14rem); }
.hud-distance progress { display: block; height: 5px; margin: 3px auto 1px; width: min(100%, 220px); accent-color: #ffe580; }
.driver-countdown {
  position: absolute;
  top: 47%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  width: clamp(74px, 14vw, 115px);
  aspect-ratio: 1;
  color: #fff0a4;
  background: #0f3446e7;
  border: 2px solid #ffe580;
  border-radius: 50%;
  box-shadow: 0 0 0 8px #fff4a536;
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  font-weight: 950;
  line-height: 1;
  pointer-events: none;
}
.driver-stage::after { content: ""; position: absolute; inset: 0; pointer-events: none; transition: box-shadow .18s ease; }
.driver-boost::after { box-shadow: inset 0 0 28px 5px #caff7773; }
.driver-impact::after { box-shadow: inset 0 0 25px 4px #ff693680; }
.driver-room .drive-controls { background: #14343e; border-color: #255765; gap: 12px; }
.driver-room .drive-controls p { color: #e0f2ee; }
.driver-room .drive-controls .secondary { color: #effffa; background: #275561; border-color: #407882; font-weight: 900; font-size: 1.1rem; }
.driver-room .drive-controls .throttle { min-width: 112px; }
@media (max-width: 490px) {
  .hud-stat { padding: 6px 4px; }
  .driver-stage { border-radius: 12px; }
  .driver-stage canvas { height: clamp(255px, 70vw, 335px); }
  .driver-room .drive-buttons { width: 100%; }
  .driver-room .drive-buttons .throttle { flex: 1; }
}

.watch-telemetry { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
#watch-clock {
  display: inline-block;
  padding: 3px 8px;
  border: 1px solid #63b8cb;
  border-radius: 7px;
  background: #0b2638;
  color: #d9fbff;
  font: 800 clamp(.93rem, 2.5vw, 1.2rem)/1.15 ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}

.tile .duck-head { box-shadow: inset 0 -.055em var(--shade), 0 0 0 .025em #28425180; }
.tile .duck-body { box-shadow: inset 0 -.07em var(--shade), 0 .027em #28425165; }
.tile .duck-beak { box-shadow: inset 0 -.035em #b84e2985; }

.watch-crowd canvas { height: clamp(340px, 39vw, 510px); }
