@charset "UTF-8";
:root {
  color-scheme: light;
  --paper: #f5f2e9;
  --ink: #213e40;
  --muted: #7c8a80;
  --teal: #197e70;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; display: grid; place-items: center; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible, canvas:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }
.game { --maze-aspect: 1; --board-size: min(1000px, calc(100vw - 24px), calc((100dvh - 144px) * var(--maze-aspect))); width: var(--board-size); margin: 6px auto; }
.game-header { height: 50px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
h1 { margin: 0; font-size: 18px; font-weight: 850; line-height: 1; letter-spacing: .6px; white-space: nowrap; }
h1 span { color: var(--teal); }
#dateLabel { font-size: 10px; color: var(--muted); white-space: nowrap; line-height: 1; }
#raceTimer { font: 500 29px/1 ui-monospace, "Cascadia Code", Consolas, monospace; font-variant-numeric: tabular-nums; letter-spacing: -1px; }
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 3px; }
.reset-button { min-height: 30px; margin: 0; padding: 4px 10px; border: 1px solid #c8d6c8; border-radius: 6px; background: #edf1e7; color: var(--teal); font-size: 11px; line-height: 18px; font-weight: 650; white-space: nowrap; }
.reset-button:hover { background: #dfe9da; }
.reset-button:active { background: #d2e2cd; }
.reset-button kbd { margin-left: 4px; padding: 0 3px; border: 1px solid #c8d6c8; border-radius: 3px; font: inherit; font-size: 9px; }
.icon-button { display: grid; place-items: center; width: 38px; height: 38px; padding: 9px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); }
.icon-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.icon-button:hover { background: #e9ece2; color: var(--teal); }
.icon-button:active { background: #dce5d8; }
.help-button { font-size: 18px; font-weight: 650; }
.sound-muted, .sound-button[aria-pressed="true"] .sound-waves { display: none; }
.sound-button[aria-pressed="true"] .sound-muted { display: inline; }
#raceCanvas { width: 100%; aspect-ratio: var(--maze-aspect); display: block; border-radius: 10px; background: #263337; box-shadow: 0 1px 1px #17372b12, 0 8px 22px #17372b08; touch-action: none; }
.status-row { position: relative; display: flex; justify-content: center; align-items: center; gap: 10px; height: 30px; }
.resume-button { padding: 3px 9px; border: 1px solid #b7c9ba; border-radius: 5px; background: #fffdf6; font-size: 11px; color: var(--teal); }
.touch-controls { display: none; }
.touch-controls { position: fixed; z-index: 2; left: max(18px, env(safe-area-inset-left)); right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); align-items: flex-end; justify-content: space-between; gap: 24px; pointer-events: none; }
.touch-controls button { position: relative; flex-shrink: 0; padding: 0; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; pointer-events: auto; }
.drive-pad { width: 144px; height: 144px; border: 1px solid #69897d; border-radius: 32px; background: #263b3b; box-shadow: inset 0 1px 0 #cde5d11a, 0 4px 0 #142e2c, 0 9px 18px #1b3f3220; }
.pad-guides { position: absolute; inset: 0; width: 100%; height: 100%; fill: none; stroke: #8ab3a13b; stroke-width: 1; }
.pad-guides .pad-directions { stroke: #a3cbb898; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pad-thumb { position: absolute; left: 50%; top: 50%; display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid #97c8b0; border-radius: 50%; background: #d5e6cf; box-shadow: inset 0 2px 1px #f7fff180, 0 3px 7px #071c2259; transform: translate(calc(-50% + var(--thumb-x, 0px)), calc(-50% + var(--thumb-y, 0px))); pointer-events: none; }
.pad-thumb>span { width: 12px; height: 12px; border: 1px solid #80a990; border-radius: 50%; background: #a3c8ad; }
.drive-pad.held { border-color: #73baa0; }
.drive-pad.held .pad-thumb { background: #b7ebd0; border-color: #b5f1d7; box-shadow: 0 0 16px #84e7bf33, 0 3px 7px #071c2259; }
.touch-boost { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; width: 104px; height: 104px; margin: 0 6px 6px 0; border: 1px solid #326f60; border-radius: 50%; color: #e7f3db; background: #237d6b; box-shadow: inset 0 1px 0 #d3f5df33, 0 4px 0 #174f43, 0 9px 18px #1b3f3220; }
.boost-bolt { width: 26px; height: 30px; fill: currentColor; }
.touch-boost>span { font-size: 10px; font-weight: 750; letter-spacing: 1.3px; }
.boost-ring { position: absolute; inset: -7px; width: calc(100% + 14px); height: calc(100% + 14px); fill: none; pointer-events: none; transform: rotate(-90deg); opacity: 0; }
.touch-boost.has-charge .boost-ring { opacity: 1; }
.boost-ring circle { stroke: #e7b45d; stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: var(--charge, 0) 100; }
.touch-boost.held { background: #155e50; box-shadow: inset 0 2px 5px #0b3e4366, 0 2px 0 #174f43; }
.touch-boost.charged { color: #ffe0a1; border-color: #d9b76b; box-shadow: 0 0 18px #e7b45d38, 0 4px 0 #174f43; }
noscript { max-width: 360px; padding: 20px; font-size: 13px; }
.help-dialog { width: min(360px, calc(100vw - 28px)); max-height: calc(100dvh - 24px); overflow: auto; padding: 20px; border: 1px solid #cbd6c8; border-radius: 14px; background: var(--paper); color: var(--ink); box-shadow: 0 12px 45px #102b3038; }
.help-dialog::backdrop { background: #152b3066; }
.help-heading { display: flex; justify-content: space-between; font-size: 10px; line-height: 14px; letter-spacing: 1px; font-weight: 700; color: var(--teal); }
#helpStep { letter-spacing: 0; font-variant-numeric: tabular-nums; }
.help-dialog h2 { margin: 12px 0; font-size: 20px; line-height: 26px; font-weight: 750; letter-spacing: -.4px; }
#helpIllustration { display: block; width: 100%; height: auto; margin: 0 auto; border-radius: 8px; background: #243337; }
#helpText { min-height: 60px; margin: 12px 0 0; font-size: 13px; line-height: 20px; }
#helpNote { min-height: 32px; margin: 8px 0 0; font-size: 11px; line-height: 16px; color: #61776d; }
#helpNote.speed-tip { font-size: 14px; line-height: 20px; font-weight: 600; color: var(--ink); }
#helpNote small { display: block; margin-top: 5px; font-size: 11px; line-height: 16px; font-weight: 400; color: #61776d; }
.help-actions { display: flex; align-items: center; gap: 6px; margin-top: 14px; }
.help-actions button { min-height: 40px; padding: 8px 14px; border-radius: 7px; font-size: 12px; font-weight: 650; }
.help-skip { margin-right: auto; border: 0; background: transparent; color: #61776d; }
.help-back { border: 1px solid #c8d6c8; background: transparent; }
.help-back:disabled { visibility: hidden; }
.help-next { min-width: 80px; border: 1px solid var(--teal); background: var(--teal); color: #fffdf6; }
.leaderboard-dialog { width: min(460px, calc(100vw - 24px)); max-height: calc(100dvh - 28px); overflow: auto; overscroll-behavior: contain; padding: 24px; border: 1px solid #c5d4c7; border-radius: 18px; background: var(--paper); color: var(--ink); box-shadow: 0 24px 90px #132a3655; }
.leaderboard-dialog::backdrop { background: #152b3073; backdrop-filter: blur(3px); }
.lb-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.lb-header h2 { margin: 0; font-size: 29px; line-height: 1.1; letter-spacing: -1px; font-weight: 800; }
.lb-header h2 span { color: var(--teal); }
.lb-close { width: 36px; height: 36px; border: 1px solid #cbd6c9; border-radius: 50%; background: transparent; color: #64766c; font: 300 27px/1 system-ui; }
.lb-close:hover { background: #e3eade; }
.lb-course { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin: 15px 0 12px; font-size: 11px; color: #67796d; }
.lb-pace { padding: 16px 22px; border: 1px solid #32544d; border-radius: 12px; background: #223b39; color: #f6f3e7; text-align: center; }
.lb-pace p { margin: 0 0 5px; color: #a4c3ae; font-size: 10px; letter-spacing: 1.6px; font-weight: 700; }
.lb-pace strong { display: block; font: 500 52px/1.1 ui-monospace, "Cascadia Code", Consolas, monospace; letter-spacing: -1.8px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lb-pace span { display: block; margin-top: 8px; font-size: 11px; line-height: 16px; color: #bfd1c0; }
.lb-list-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 16px 0 12px; }
.lb-list-heading>span { font-size: 8px; letter-spacing: 1px; color: #829085; }
.lb-tabs { display: flex; gap: 4px; }
.lb-tabs button { min-height: 32px; padding: 6px 11px; border: 0; border-radius: 6px; color: #718074; background: transparent; font-size: 11px; font-weight: 650; }
.lb-tabs button[aria-selected="true"] { color: #126b60; background: #e1ecde; }
.lb-table-wrap { max-height: 220px; min-height: 96px; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #bacbbd transparent; }
.lb-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 12px; }
.lb-table th { position: sticky; top: 0; z-index: 1; background: var(--paper); padding: 3px 7px 10px; color: #7a8a7e; font-size: 9px; font-weight: 550; text-align: left; border-bottom: 1px solid #d7ded1; }
.lb-table th:first-child { width: 39px; }
.lb-table th:nth-child(3) { width: 88px; text-align: right; }
.lb-table th:last-child { width: 68px; text-align: right; }
.lb-table td { height: 49px; padding: 6px 7px; border-bottom: 1px solid #e1e5d9; }
.lb-table td:nth-child(3), .lb-table td:last-child { text-align: right; font-family: ui-monospace, Consolas, monospace; font-variant-numeric: tabular-nums; }
.lb-table td:nth-child(3) { font-size: 14px; font-weight: 650; }
.lb-table td:last-child { color: #809083; font-size: 10px; }
.lb-rank { display: grid; place-items: center; width: 24px; height: 24px; font-size: 11px; color: #839083; font-variant-numeric: tabular-nums; }
.lb-medal-1 { border-radius: 50%; color: #80662c; background: #ecdfb5; font-weight: 750; }
.lb-medal-2 { border-radius: 50%; color: #536b65; background: #dfe6df; font-weight: 750; }
.lb-medal-3 { border-radius: 50%; color: #916c46; background: #e9dccb; font-weight: 750; }
.lb-racer { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.lb-you, .lb-new { display: block; margin-top: 3px; font-size: 8px; font-weight: 750; letter-spacing: .8px; color: #6e907b; }
.lb-new { color: var(--teal); }
.lb-row-latest { background: #e2edde; }
.lb-row-latest td:first-child { box-shadow: inset 2px 0 var(--teal); }
.lb-empty { padding: 20px 12px 24px; text-align: center; }
.lb-empty>span { color: #8da998; font-size: 27px; }
.lb-empty h3 { margin: 8px 0 6px; font-size: 15px; font-weight: 650; }
.lb-empty p { max-width: 220px; margin: auto; font-size: 11px; line-height: 17px; color: #748579; }
.lb-identity { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 18px; padding: 16px; border: 1px solid #d1dece; border-radius: 10px; background: #e9efe3; }
.lb-identity>div { min-width: 0; }
.lb-identity span { display: block; margin-bottom: 4px; color: #657b6e; font-size: 12px; }
.lb-identity strong { display: block; overflow-wrap: anywhere; color: #294f44; font-size: 22px; line-height: 1.2; font-weight: 750; }
.lb-identity button { flex-shrink: 0; min-height: 44px; padding: 10px 13px; color: var(--teal); background: #f7f9f1; border: 1px solid #b6cdbb; border-radius: 7px; font-size: 13px; font-weight: 650; white-space: nowrap; }
.lb-identity button:hover { background: #dbe8d6; border-color: #8db09b; }
.lb-name-form { margin: 8px 0; padding: 12px; border-radius: 8px; background: #e9eee2; }
.lb-name-form label { display: block; margin-bottom: 6px; font-size: 10px; color: #5b7665; }
.lb-name-form>div { display: flex; gap: 6px; }
.lb-name-form input { min-width: 0; width: 100%; padding: 7px 9px; border: 1px solid #adbfaf; border-radius: 5px; background: #fffdf6; color: var(--ink); font: inherit; font-size: 13px; line-height: 20px; }
.lb-name-form button { padding: 7px 10px; border: 0; border-radius: 5px; background: var(--teal); color: white; font-size: 11px; }
#leaderboardNameCancel { background: transparent; color: #657d6b; }
@media (pointer: coarse), (max-width: 600px) {
  body { padding-top: env(safe-area-inset-top); padding-bottom: calc(178px + env(safe-area-inset-bottom)); }
  .game { --board-size: min(1000px, calc(100vw - 24px - env(safe-area-inset-left) - env(safe-area-inset-right)), calc((100dvh - 270px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) * var(--maze-aspect))); }
  .touch-controls { display: flex; }
  .game-header { height: 58px; gap: 6px; }
  h1 { font-size: 15px; letter-spacing: .3px; }
  #raceTimer { font-size: 25px; }
  #dateLabel { font-size: 9px; }
  .icon-button { width: 34px; height: 30px; padding: 5px 7px; }
  .header-actions { display: grid; grid-template-columns: 34px 46px; gap: 0; }
  .header-actions .leaderboard-button { grid-column: 1; grid-row: 1; width: 34px; height: 28px; padding: 5px 7px; }
  .leaderboard-button svg { width: 18px; height: 18px; }
  .reset-button { grid-column: 2; grid-row: 2; min-height: 28px; padding: 0 5px; font-size: 10px; }
  .sound-button { grid-column: 1; grid-row: 2; }
  .help-button { grid-column: 2; grid-row: 1; justify-self: center; width: 30px; }
  .reset-button kbd { display: none; }
  .leaderboard-dialog { padding: 18px; }
  .lb-header h2 { font-size: 26px; }
  .lb-pace { padding: 16px; }
  .lb-pace strong { font-size: 40px; }
  .lb-list-heading>span { display: none; }
  .lb-table th:first-child { width: 33px; }
  .lb-table th:nth-child(3) { width: 79px; }
  .lb-table th:last-child { width: 62px; }
  .lb-table th, .lb-table td { padding-left: 4px; padding-right: 4px; }
  .lb-table-wrap { max-height: 208px; }
  .lb-identity { padding: 12px; gap: 10px; }
  .lb-identity strong { font-size: 20px; }
}
@media (max-width: 360px) {
  h1 { font-size: 13px; letter-spacing: .1px; }
  #raceTimer { font-size: 23px; }
  .touch-controls { left: max(14px, env(safe-area-inset-left)); right: max(14px, env(safe-area-inset-right)); }
  .drive-pad { width: 132px; height: 132px; border-radius: 28px; }
  .touch-boost { width: 96px; height: 96px; }
  .icon-button { width: 30px; }
  .header-actions { grid-template-columns: 34px 42px; }
  .help-button { width: 28px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .game { --board-size: min(1000px, calc((100dvh - 130px) * var(--maze-aspect)), calc(100vw - 24px)); }
  .game-header { height: 46px; gap: 5px; }
  .brand { gap: 3px; }
  h1 { font-size: 11px; letter-spacing: .1px; }
  #dateLabel { font-size: 8px; }
  #raceTimer { font-size: 21px; }
  .icon-button { width: 31px; height: 22px; padding: 2px 5px; }
  .icon-button svg { width: 18px; height: 18px; }
  .header-actions { display: grid; grid-template-columns: 31px 44px; gap: 0; }
  .header-actions .leaderboard-button { grid-column: 1; grid-row: 1; width: 31px; height: 22px; }
  .reset-button { grid-column: 2; grid-row: 2; min-height: 22px; padding: 0 5px; font-size: 10px; }
  .sound-button { grid-column: 1; grid-row: 2; }
  .help-button { grid-column: 2; grid-row: 1; justify-self: center; width: 28px; }
  .reset-button kbd { display: none; }
  #raceCanvas { border-radius: 7px; }
  .status-row { height: 26px; }
}
@media (max-height: 500px) and (orientation: landscape) and (pointer: coarse), (max-height: 500px) and (orientation: landscape) and (max-width: 600px) {
  body { padding-bottom: env(safe-area-inset-bottom); }
  .game { --board-size: min(1000px, calc((100dvh - 90px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) * var(--maze-aspect)), calc(100vw - 340px - env(safe-area-inset-left) - env(safe-area-inset-right))); }
  .touch-controls { left: max(16px, env(safe-area-inset-left)); right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); }
  .drive-pad { width: 128px; height: 128px; border-radius: 28px; }
  .touch-boost { width: 96px; height: 96px; }
}
@media (max-height: 350px) and (orientation: landscape) {
  .game-header { grid-template-columns: 1fr auto; }
  .brand { display: none; }
  #raceTimer { justify-self: start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}
@media (max-height: 440px) {
  .help-dialog { padding: 14px 18px; }
  .help-dialog h2 { margin: 7px 0; font-size: 18px; line-height: 23px; }
  #helpIllustration { width: min(100%, 228px); }
  #helpNote { min-height: 16px; }
  .help-actions { margin-top: 8px; }
}

.lb-retry { display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%; min-height: 44px; margin-top: 14px; padding: 10px 14px; border: 1px solid #11675d; border-radius: 8px; background: var(--teal); color: #fffdf4; font-size: 13px; font-weight: 650; }
.lb-retry:hover { background: #126b60; }
.lb-retry:active { background: #105e55; }
.lb-retry kbd { margin-left: auto; padding: 2px 5px; border: 1px solid #ffffff55; border-radius: 4px; color: #cbe3d6; font: inherit; font-size: 10px; line-height: 14px; }
.lb-error { margin: 8px 0 0; color: #915f36; font-size: 11px; }
@media (pointer: coarse), (max-width: 600px) { .lb-retry kbd { display: none; } }
/* Hosted daily: tries left, name prompt and share. Hidden offline. */
.tries-label { display: inline-block; margin-left: 8px; padding: 2px 7px; border-radius: 999px; background: #e3ede0; color: var(--teal); font-size: 10px; font-weight: 700; line-height: 14px; white-space: nowrap; }
.tries-label[data-practice] { background: #efe7d6; color: #8a6a2f; }
.lb-name-hint { margin: 10px 0 0; padding: 10px 12px; border-radius: 8px; background: #fff3cf; color: #6b5220; font-size: 13px; font-weight: 650; }
.lb-share-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.lb-share { min-height: 40px; padding: 8px 16px; border: 1px solid #b6cdbb; border-radius: 8px; background: #f7f9f1; color: var(--teal); font-size: 14px; font-weight: 700; }
.lb-share:hover { background: #dbe8d6; }
.lb-share-status { color: #5b7665; font-size: 12px; }
