:root {
  color-scheme: light;
  font-family: "DM Sans", system-ui, sans-serif;
  color: #142737;
  background: #f3efe6;
  --ink: #142737;
  --muted: #596771;
  --navy: #142735;
  --paper: #fffdf8;
  --yellow: #ffc741;
  --line: #dedbd1;
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible { outline: 3px solid #277cc5; outline-offset: 3px; }
.topbar { background: #122331; color: #fffdf8; border-bottom: 4px solid var(--yellow); }
.topbar-inner { width: min(100%, 624px); min-height: 51px; margin: auto; padding: env(safe-area-inset-top) max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left)); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.brand { min-width: 0; color: inherit; display: flex; align-items: center; gap: 8px; font: 800 clamp(18px, 5.5vw, 24px)/1 var(--display); letter-spacing: .04em; white-space: nowrap; }
.brand > span { overflow: hidden; text-overflow: ellipsis; }
.brand img { flex: none; width: 30px; height: 30px; border-radius: 7px; border: 1px solid #d5dfeb; }
.brand strong { color: var(--yellow); }
.top-button { background: transparent; color: #f9fafb; border: 1px solid #526472; border-radius: 7px; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 5px 9px; font-size: 13px; font-weight: 700; }
.top-button:hover { background: #2a3d4d; }
.header-actions { flex: none; display: flex; gap: 5px; }
.fullscreen-button { width: 44px; justify-content: center; font-size: 22px; }
.fullscreen-button[hidden] { display: none; }
.menu-icon { font-size: 15px; }
.page { padding: 10px max(6px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left)); }
.play-area { width: min(100%, 600px, max(350px, calc(100svh - 187px))); margin-inline: auto; }
.goal-strip { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: clamp(6px, 2vw, 14px); padding: 7px 9px 10px; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 6px; }
.goal-strip img { width: clamp(34px, 10vw, 44px); height: auto; border-radius: 5px; border: 1px solid var(--line); }
.destination h1 { margin: 0; font: 800 clamp(19px, 5.5vw, 30px)/1 var(--display); overflow-wrap: anywhere; }
.level-badge { font-size: 10px; font-weight: 800; color: var(--muted); letter-spacing: .045em; }
.goal-stat { border-left: 1px solid var(--line); padding-left: clamp(6px, 2vw, 14px); text-align: center; min-width: 0; }
.goal-stat strong { display: block; font: 800 clamp(22px, 7vw, 32px)/1 var(--display); }
.goal-stat span { font-size: 10px; color: var(--muted); font-weight: 700; white-space: nowrap; }
progress { appearance: none; border: 0; position: absolute; inset: auto 0 0; display: block; width: 100%; height: 4px; background: #ede8dc; }
progress::-webkit-progress-bar { background: #ede8dc; }
progress::-webkit-progress-value { background: #e9a71d; }
progress::-moz-progress-bar { background: #e9a71d; }
.board-frame { background: var(--navy); border: 1px solid #253e51; border-radius: 12px; padding: clamp(3px, .85vw, 8px); box-shadow: 0 3px 0 #dcd7cb; }
.play-controls { display: flex; justify-content: space-between; align-items: center; margin-top: 7px; gap: 8px; }
.score-strip { display: flex; flex-wrap: wrap; gap: 3px 14px; font-size: 12px; color: var(--muted); }
.score-strip strong { color: var(--ink); }
.eyebrow { margin: 0; font-size: 11px; letter-spacing: .16em; line-height: 1.3; font-weight: 800; }
h2 { margin: 0; font: 800 23px/1 var(--display); letter-spacing: .045em; }
.board-button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; color: #f0f5f8; background: #273e50; border: 1px solid #435868; padding: 6px 12px; min-height: 44px; min-width: 66px; border-radius: 6px; font-size: 13px; font-weight: 700; }
.board-button:not(:disabled):hover { background: #3c5870; }
.board-button:disabled { opacity: .5; }
.board-button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.board { display: grid; grid-template-columns: repeat(var(--columns, 8), minmax(0, 1fr)); grid-template-rows: repeat(var(--columns, 8), minmax(0, 1fr)); gap: clamp(2px, .6vw, 6px); aspect-ratio: 1; background: #101f2b; padding: clamp(4px, .7vw, 8px); border-radius: 10px; border: 1px solid #385064; }
.tile { min-width: 0; min-height: 0; padding: 0; display: grid; place-items: center; position: relative; background: linear-gradient(150deg, #344b5d, #283d4f); border: 1px solid #456073; border-radius: clamp(3px, .65vw, 8px); overflow: hidden; user-select: none; touch-action: pinch-zoom; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.tile img { width: 94%; height: 83%; object-fit: contain; pointer-events: none; user-select: none; }
.tile.taxi img { filter: drop-shadow(0 3px 2px #06131d9c); }
.tile.route img { width: 83%; height: 83%; border-radius: 6%; filter: drop-shadow(0 2px 3px #07131aab); }
.tile.selected { border-color: #ffde79; box-shadow: inset 0 0 0 2px var(--yellow); background: #59614f; z-index: 1; }
.tile:focus-visible { outline-color: white; outline-offset: -3px; z-index: 2; }
@media (hover: hover) { .tile:hover:not(.selected) { background: #415b70; } }
.tile.hinted { border-color: #ffdf74; box-shadow: inset 0 0 0 2px #ffdf74; background: #645e49; }
.tile.route.clearing { border-color: #fff2ac; box-shadow: inset 0 0 0 3px #ffe172; background: #645e49; }
.tile.clearing img { animation: vanish .22s ease-in both; }
.tile.falling img { animation: arrive .27s ease-out both; }
.tile.rejected { animation: reject .28s ease both; }
@keyframes vanish { to { opacity: 0; transform: scale(.3); } }
@keyframes arrive { from { transform: translateY(-60%); opacity: .2; } }
@keyframes reject { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.board-status { margin: 4px 0 0; min-height: 2.6em; color: var(--muted); font-size: 12px; font-weight: 600; }
.route-celebration { margin: 0 0 12px; padding: 6px 12px; border-radius: 8px; background: repeating-linear-gradient(115deg, #ffd055 0 24px, #ffc33c 24px 41px); text-align: center; }
.route-celebration img { display: block; width: min(100%, 230px); height: auto; margin: auto; }
#map-count { font-size: 11px; color: var(--muted); font-weight: 700; }
.route-map { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; }
.map-stop { width: 100%; min-height: 40px; display: grid; grid-template-columns: 21px minmax(0,1fr) 13px; gap: 5px; align-items: center; text-align: left; padding: 5px 6px; background: #f7f4ed; border: 1px solid #e2ded3; border-radius: 6px; color: var(--ink); font-size: 12px; font-weight: 800; }
.map-stop:disabled { color: #68727a; }
.map-stop.current { background: #ffebaf; border-color: #eac36a; color: var(--ink); }
.map-stop:not(:disabled):hover { border-color: #b88920; }
.stop-index { width: 19px; height: 19px; display: grid; place-items: center; background: #e6e2d8; border-radius: 50%; font-size: 10px; }
.current .stop-index { background: #ffc94b; }
.stop-icon { font-weight: 800; color: #68727a; text-align: center; }
.cleared .stop-icon { color: #1a7149; }
.dialog { width: min(460px,calc(100% - 24px)); padding: 0; border: 1px solid #b9c1c8; border-radius: 15px; color: var(--ink); background: var(--paper); box-shadow: 0 15px 45px #06131e65; }
.dialog::backdrop { background: #08151dd0; }
.dialog-copy { border-top: 6px solid var(--yellow); padding: 24px; }
.dialog h2 { margin: 6px 0 12px; font-size: 40px; }
.dialog p, .dialog li { line-height: 1.5; }
.dialog ul { padding-left: 19px; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.dialog-button { border: 1px solid #cfaa4c; border-radius: 7px; padding: 8px 13px; font-weight: 800; color: var(--ink); background: var(--yellow); }
.dialog-button.secondary { background: #fff; border-color: #c2c9ce; }
@media (max-width: 650px) {
  .page { padding: 4px env(safe-area-inset-right) max(10px, env(safe-area-inset-bottom)) env(safe-area-inset-left); }
  .play-area { width: min(100%, 600px); }
  .goal-strip { margin-inline: 4px; margin-bottom: 4px; padding-block: 5px 8px; }
  .board-frame { padding: 0; border: 0; border-radius: 0; }
  .board { gap: 2px; padding: 2px; border-radius: 0; border: 0; }
  .play-controls, .board-status { margin-inline: 6px; }
  .tile { border-radius: 4px; }
  .tile.taxi img { width: 99%; height: 90%; filter: drop-shadow(0 1px 1px #06131d9c); }
  .tile.route img { width: 93%; height: 93%; }
  .map-stop, .dialog-button { min-height: 44px; }
}
@media (max-width: 360px) {
  .brand { font-size: 15px; gap: 5px; }
  .brand img { width: 26px; height: 26px; }
  .menu-icon { display: none; }
}
.dialog {
  max-height: calc(100dvh - max(16px, env(safe-area-inset-top)) - max(16px, env(safe-area-inset-bottom)));
  overscroll-behavior: contain;
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; scroll-behavior: auto !important; }
}
