/* Meter Down UI: cartoon ink outlines, hard drop shadows and glossy candy buttons,
   in kaali-peeli yellow and auto green. */
:root {
 --ink: #10261d;
 --cream: #fffbea;
 --yellow: #ffd23f;
 --saffron: #ff9933;
 --green: #3fbf6f;
 --auto: #247867;
 --pink: #ff5ca8;
 --sky: #7cc8ff;
 --red: #ff6b50;
 --muted: #5a4a35;
 --display: 'Lilita One', 'Arial Rounded MT Bold', 'Trebuchet MS', sans-serif;
 --gloss: rgba(255, 255, 255, .5);
 --safe-top: env(safe-area-inset-top, 0px);
 --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; overflow: hidden; background: #f3b06b; color: var(--ink); font-family: Nunito, 'Segoe UI', Arial, sans-serif; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; }
button:focus-visible { outline: 4px solid var(--yellow); outline-offset: 3px; }
[hidden] { display: none !important; }

#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 62% 55%, transparent 45%, #4a1f0a55); transition: opacity .6s; }
body.playing #vignette { opacity: .45; }

kbd { display: inline-block; font: 800 11px Nunito, sans-serif; padding: 2px 6px 3px; background: #fff; border: 2px solid var(--ink); border-radius: 7px; box-shadow: 0 2px 0 var(--ink); line-height: 1.2; }

/* ---------- Shared chunky pieces ---------- */
.pill, .icon, .btn, .mbtn, .card, .trip, .speed, .map, #toast { border: 4px solid var(--ink); }
.pill {
 display: flex; align-items: center; gap: 8px; height: 50px; padding: 0 16px 0 8px;
 background: #fff; border-radius: 18px; box-shadow: 0 5px 0 var(--ink);
 font: 400 21px var(--display); letter-spacing: .5px;
}
.coin {
 display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; flex: none;
 background: radial-gradient(circle at 35% 30%, #fff8b0, var(--yellow) 55%, #e8a312);
 border: 3px solid var(--ink); font: 400 15px var(--display); animation: coinSpin 2.4s ease-in-out infinite;
}
@keyframes coinSpin { 0%, 70%, 100% { transform: scaleX(1); } 80% { transform: scaleX(.1); } 90% { transform: scaleX(1); } }
#wallet { display: inline-block; font-weight: 400; }

.icon {
 position: relative; isolation: isolate; overflow: hidden; display: grid; place-items: center; padding: 0;
 width: 56px; height: 56px; border-radius: 50%; background: #fff;
 box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .1), 0 5px 0 var(--ink);
 transition: transform .15s cubic-bezier(.3, 1.8, .5, 1);
}
.icon:hover { transform: scale(1.1) rotate(-8deg); }
.icon:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.icon svg { width: 26px; height: 26px; fill: none; stroke: var(--ink); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.icon svg .speaker, #garage-tab svg path { fill: var(--ink); }
.icon svg .bars { stroke-width: 4; }
#sound .slash { display: none; }
#sound.off .slash { display: inline; }
#sound.off .wave { display: none; }
#garage-tab.active { background: var(--yellow); }

/* Glossy highlight across the top of every candy button. */
.icon::before, .btn::before, .mbtn::before {
 content: ''; position: absolute; left: 14%; right: 14%; top: 4px; height: 5px;
 border-radius: 999px; background: var(--gloss); pointer-events: none; z-index: -1;
}
.btn, .mbtn {
 position: relative; isolation: isolate; overflow: hidden;
 display: flex; align-items: center; justify-content: center; gap: 10px;
 width: 100%; padding: 15px 18px; border-radius: 20px;
 font: 400 24px/1 var(--display); letter-spacing: .5px; color: var(--ink);
 background: linear-gradient(#ffe27a, var(--yellow));
 box-shadow: inset 0 -7px 0 rgba(0, 0, 0, .16), 0 6px 0 var(--ink), 0 10px 16px rgba(0, 0, 0, .18);
 transition: transform .12s cubic-bezier(.3, 1.8, .5, 1), box-shadow .1s, background .15s;
}
.btn:hover:not(:disabled), .mbtn:hover:not(:disabled) { transform: translateY(-2px) scale(1.03) rotate(-1deg); }
.btn:active:not(:disabled), .mbtn:active:not(:disabled) { transform: translateY(5px) scale(1.02, .94); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .16), 0 1px 0 var(--ink); }
.btn.yellow { background: linear-gradient(#ffe27a, var(--yellow)); }
.btn.green { background: linear-gradient(#8ff09a, #48c556); }
.btn.blue { background: linear-gradient(#bfe8ff, var(--sky)); }
.btn.red { background: linear-gradient(#ffa48f, var(--red)); }
.btn.small { width: auto; font-size: 17px; padding: 11px 16px; border-radius: 15px; box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .14), 0 4px 0 var(--ink); }
.btn:disabled, .mbtn:disabled { background: #efe6d4; color: #9a9284; box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .06), 0 4px 0 var(--ink); }

.card {
 position: relative; border-radius: 30px;
 background: radial-gradient(circle at 10px 10px, rgba(255, 153, 51, .09) 3px, transparent 3.5px) 0 0 / 22px 22px, var(--cream);
 box-shadow: 0 9px 0 var(--ink), 0 18px 30px rgba(0, 0, 0, .25);
}
.card::after { content: ''; position: absolute; inset: 7px; border: 2.5px dashed rgba(16, 38, 29, .16); border-radius: 23px; pointer-events: none; }

/* ---------- Corner controls ---------- */
.topbar { position: fixed; top: calc(18px + var(--safe-top)); right: 18px; z-index: 12; display: flex; gap: 10px; align-items: center; }
#pause { display: none; }
body.playing #pause { display: grid; }

/* ---------- Start menu ---------- */
.menu { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
.menu-col { position: absolute; left: 6%; top: 50%; transform: translateY(-50%); width: 400px; pointer-events: auto; }
.logo-wrap { position: relative; width: max-content; }
/* Set by fitMenu() only when the menu cannot shrink any further. */
.menu-col.scroll { overflow-y: auto; overflow-x: hidden; }
.sunburst {
 position: absolute; left: 50%; top: 50%; width: 470px; height: 470px; translate: -50% -50%; z-index: -1; pointer-events: none;
 background: repeating-conic-gradient(rgba(255, 233, 46, .55) 0 10deg, rgba(255, 153, 51, 0) 10deg 20deg);
 -webkit-mask: radial-gradient(circle, #000 18%, transparent 62%); mask: radial-gradient(circle, #000 18%, transparent 62%);
 animation: spin 30s linear infinite;
}
@keyframes spin { to { rotate: 360deg; } }
.logo {
 margin: 0; font: 400 88px/.9 var(--display); letter-spacing: 1px; transform: rotate(-4deg);
 -webkit-text-stroke: 10px var(--ink); paint-order: stroke fill; text-shadow: 0 8px 0 var(--ink), 0 14px 18px rgba(0, 0, 0, .25);
}
.logo span { display: block; }
.logo .w1 { color: var(--yellow); }
.logo .w2 { color: var(--green); margin-left: 70px; }
.logo-hindi {
 position: absolute; right: -34px; top: -8px; padding: 3px 10px; transform: rotate(8deg);
 background: var(--saffron); color: #fff; border: 3px solid var(--ink); border-radius: 10px; box-shadow: 0 3px 0 var(--ink);
 font: 800 15px Nunito, sans-serif; white-space: nowrap; animation: putt .6s ease-in-out infinite alternate;
}
@keyframes putt { to { transform: rotate(5deg) translateY(-3px); } }
.tagline {
 display: inline-block; margin: 8px 0 26px 64px; padding: 5px 14px; transform: rotate(-3deg);
 background: var(--pink); color: #fff; border: 3px solid var(--ink); border-radius: 10px; box-shadow: 0 3px 0 var(--ink);
 font-weight: 900; font-size: 15px; animation: jiggle 3s ease-in-out infinite;
}
@keyframes jiggle { 0%, 90%, 100% { rotate: 0deg; } 94% { rotate: 4deg; } 97% { rotate: -2deg; } }
.menu .card { padding: 28px 20px 20px; }
.card-tab {
 position: absolute; top: -18px; right: 22px; z-index: 2; padding: 5px 14px; transform: rotate(4deg);
 background: var(--yellow); border: 3px solid var(--ink); border-radius: 12px; box-shadow: 0 4px 0 var(--ink);
 font: 400 15px var(--display); letter-spacing: .5px;
}
.field-label { font: 400 17px var(--display); letter-spacing: .5px; margin-bottom: 10px; }
.auto-row { display: flex; gap: 12px; }
.auto-choice {
 position: relative; flex: 1; height: 64px; padding: 0; border: 4px solid var(--ink); border-radius: 18px;
 background: radial-gradient(circle at 35% 28%, #ffffff77 0 12%, transparent 40%), var(--paint);
 box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .18), 0 4px 0 var(--ink);
 transition: transform .2s cubic-bezier(.3, 1.8, .5, 1);
}
.auto-choice::after { content: ''; position: absolute; left: 10px; right: 10px; top: 8px; height: 10px; border-radius: 6px 6px 3px 3px; background: var(--roof); border: 2.5px solid var(--ink); }
.auto-choice:hover { transform: translateY(-4px) scale(1.05); }
.auto-choice[aria-pressed="true"] { transform: translateY(-3px) scale(1.06); outline: 4px solid var(--saffron); outline-offset: 3px; }
.auto-choice[aria-pressed="true"]::before {
 content: '✓'; position: absolute; right: -10px; top: -10px; width: 22px; height: 22px; border-radius: 50%; z-index: 1;
 display: grid; place-items: center; background: var(--green); border: 3px solid var(--ink); color: #fff; font: 900 12px Nunito, sans-serif;
}
.auto-choice.locked { filter: saturate(.35) brightness(.9); }
.auto-choice .price {
 position: absolute; left: 50%; bottom: -12px; translate: -50% 0; padding: 1px 8px; white-space: nowrap;
 background: #fff; border: 2.5px solid var(--ink); border-radius: 9px; font: 400 12px var(--display);
}
.auto-name { margin: 18px 0 0; font-weight: 800; font-size: 14px; color: var(--muted); min-height: 19px; }
.auto-name b { color: var(--ink); }
.menu-stats { display: flex; gap: 8px; margin-top: 14px; }
.menu-stats div { flex: 1; padding: 8px 6px 7px; text-align: center; background: #fff; border: 3px solid var(--ink); border-radius: 14px; }
.menu-stats b { display: block; font: 400 20px var(--display); }
.menu-stats small { font-weight: 800; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.menu .mbtn { margin-top: 18px; font-size: 26px; padding: 17px 18px; background: linear-gradient(#ffc061, var(--saffron)); }
.menu .mbtn:not(:disabled) { animation: breathe 1.6s ease-in-out infinite; }
.menu .mbtn:hover:not(:disabled) { animation: none; }
@keyframes breathe { 50% { transform: scale(1.035); } }
.go-arrow { font-style: normal; display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: var(--yellow); font-size: 18px; }
.mbtn:not(:disabled) .go-arrow { animation: nudge .8s ease-in-out infinite; }
.menu .mbtn:disabled { background: #efe6d4; }
.mbtn:disabled .go-arrow { background: #c9bfae; color: #efe6d4; }
@keyframes nudge { 50% { transform: translateX(5px); } }
.how { font-size: 13px; font-weight: 700; line-height: 1.9; color: var(--muted); margin: 14px 0 0; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 6; }
#hud button { pointer-events: auto; }
.trip {
 position: absolute; top: calc(18px + var(--safe-top)); left: 18px; width: 290px; padding: 16px 18px 14px;
 border-radius: 24px; background: linear-gradient(#fffef6, #fff2c4);
 box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .06), 0 6px 0 var(--ink), 0 12px 20px rgba(0, 0, 0, .18);
 transition: box-shadow .2s;
}
.chip {
 display: inline-block; padding: 3px 11px 4px; border: 3px solid var(--ink); border-radius: 10px; box-shadow: 0 3px 0 var(--ink);
 background: var(--saffron); color: #fff; font: 400 14px var(--display); letter-spacing: .6px; transform: rotate(-2deg);
}
.trip[data-phase="drop"] .chip { background: var(--green); }
.trip h2 { margin: 10px 0 4px; font: 400 25px/1.05 var(--display); letter-spacing: .3px; }
.trip p { margin: 0; font-size: 13px; font-weight: 700; color: var(--muted); line-height: 1.4; }
.fare-line { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
#fare { font: 400 26px var(--display); white-space: nowrap; }
.trip[data-phase="pickup"] #fare { font-size: 19px; }
#timer { white-space: nowrap; }
#timer { padding: 3px 10px; background: var(--ink); color: var(--yellow); border-radius: 10px; font: 400 18px var(--display); min-width: 64px; text-align: center; }
.timer-track { height: 14px; margin: 10px 0 8px; background: #fff; border: 3px solid var(--ink); border-radius: 99px; overflow: hidden; }
.timer-track i { display: block; height: 100%; width: 100%; background: var(--yellow); border-radius: 99px; box-shadow: inset 0 3px 0 rgba(255, 255, 255, .45); transition: width .1s linear, background .4s; }
#deduction { font-weight: 900; font-size: 11px; letter-spacing: .8px; color: var(--muted); text-transform: uppercase; }
#streak { display: block; margin-top: 4px; font-weight: 900; font-size: 11px; letter-spacing: .6px; color: #e8783a; }
#streak:empty { display: none; }

.map {
 position: absolute; right: 18px; bottom: 22px; width: 210px; overflow: hidden; border-radius: 26px;
 background: var(--ink); box-shadow: 0 6px 0 var(--ink), 0 12px 20px rgba(0, 0, 0, .2);
}
.map canvas { width: 100%; display: block; }
.map-foot { display: flex; justify-content: space-between; padding: 7px 14px 9px; background: var(--cream); border-top: 4px solid var(--ink); font: 400 15px var(--display); letter-spacing: .5px; }
.map-foot span { color: var(--auto); }

.speed {
 position: absolute; left: 18px; bottom: 60px; width: 112px; height: 112px; border-radius: 50%;
 display: flex; flex-direction: column; align-items: center; justify-content: center;
 background: radial-gradient(circle at 50% 35%, #fffef6, #ffe9a8); box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .08), 0 6px 0 var(--ink);
}
.speed b { font: 400 44px/1 var(--display); }
.speed small { font-weight: 900; font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.speed.fast { background: radial-gradient(circle at 50% 35%, #fff4c0, var(--saffron)); }
.speed.fast b { animation: shiver .12s linear infinite; }
@keyframes shiver { 50% { transform: translateX(1px) rotate(-1deg); } }

.game-help { position: absolute; left: 50%; bottom: 16px; translate: -50% 0; display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; max-width: calc(100% - 520px); font-size: 12px; font-weight: 800; color: #fff; text-shadow: 0 1px 0 var(--ink), 0 0 6px var(--ink); }
.game-help kbd { color: var(--ink); text-shadow: none; }

#interact { position: absolute; left: 50%; bottom: 70px; width: auto; min-width: 270px; translate: -50% 0; font-size: 22px; background: linear-gradient(#8ff09a, #48c556); animation: pop .35s cubic-bezier(.3, 1.8, .5, 1); }
#interact::after { content: ''; position: absolute; left: 0; bottom: 0; height: 7px; width: calc(var(--progress, 0) * 100%); background: var(--ink); transition: width .1s linear; }
@keyframes pop { from { transform: scale(.4); } }

#touch { display: none; }

/* ---------- Toast, flashes and popups ---------- */
#toast {
 position: fixed; top: calc(20px + var(--safe-top)); left: 50%; z-index: 20; max-width: min(460px, calc(100% - 420px));
 padding: 11px 20px; border-radius: 18px; background: #fff; box-shadow: 0 5px 0 var(--ink);
 font-weight: 800; font-size: 15px; text-align: center; pointer-events: none;
 opacity: 0; transform: translateX(-50%) translateY(-20px) scale(.8); transition: opacity .2s, transform .3s cubic-bezier(.3, 1.8, .5, 1);
}
#toast.show { opacity: 1; transform: translateX(-50%); }
#flash { position: fixed; inset: 0; pointer-events: none; z-index: 15; opacity: 0; }
#flash.hit { animation: flash .45s ease-out; box-shadow: inset 0 0 160px 40px #ff3b2fb0; }
#flash.cash { animation: flash .9s ease-out; box-shadow: inset 0 0 180px 50px #ffcf5ea8; }
#flash.go { animation: flash .7s ease-out; box-shadow: inset 0 0 160px 40px #6dff9a80; }
@keyframes flash { 0% { opacity: 1; } 100% { opacity: 0; } }
/* Popups stack under the toast, in the sky, so they never sit on the road ahead. */
#popups { position: fixed; left: 50%; top: calc(84px + var(--safe-top)); transform: translateX(-50%); pointer-events: none; z-index: 16; display: flex; flex-direction: column; align-items: center; }
.popup {
 font: 400 40px var(--display); letter-spacing: 1px; color: #fff; white-space: nowrap;
 -webkit-text-stroke: 8px var(--ink); paint-order: stroke fill; text-shadow: 0 5px 0 var(--ink);
 animation: popup 2.6s cubic-bezier(.2, .9, .3, 1) forwards;
}
.popup.good { color: var(--yellow); }
.popup.bad { color: var(--red); font-size: 30px; }
@keyframes popup { 0% { opacity: 0; transform: translateY(20px) scale(.5) rotate(-8deg); } 15% { opacity: 1; transform: translateY(0) scale(1.15) rotate(3deg); } 25% { transform: scale(1) rotate(-2deg); } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-20px) rotate(-2deg); } }
.pill.bump { animation: bump .6s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes bump { 30% { transform: scale(1.2) rotate(-4deg); background: var(--yellow); } }
.trip.urgent { animation: urgent .8s ease-in-out infinite; }
.trip.urgent #timer { background: var(--red); color: #fff; }
@keyframes urgent { 50% { box-shadow: 0 6px 0 var(--ink), 0 0 0 5px var(--red), 0 0 30px #ff6b5099; } }
#fare.drop { animation: drop .5s ease-out; }
@keyframes drop { 0% { color: var(--red); transform: translateY(4px) scale(1.1); } }
#fare { display: inline-block; }

/* ---------- Modal ---------- */
.overlay { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 40px 18px 24px; background: rgba(16, 38, 29, .55); backdrop-filter: blur(3px); }
.modal { width: 560px; max-width: 100%; max-height: calc(100vh - 70px); overflow-x: hidden; overflow-y: auto; padding: 46px 30px 28px; animation: cardIn .45s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes cardIn { from { transform: translateY(40px) scale(.85); opacity: 0; } }
.overlay:has(.modal) { overflow: visible; }
.ribbon {
 position: absolute; left: 50%; top: 14px; translate: -50% 0; z-index: 2; white-space: nowrap;
 padding: 5px 22px 7px; background: var(--saffron); color: #fff; border: 4px solid var(--ink); border-radius: 14px; box-shadow: 0 4px 0 var(--ink);
 font: 400 16px var(--display); letter-spacing: 1px; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill;
 animation: ribbonIn .55s cubic-bezier(.3, 1.8, .5, 1) backwards .1s;
}
@keyframes ribbonIn { from { transform: scale(0) rotate(-20deg); } }
.modal .close { position: absolute; right: 16px; top: 14px; width: 44px; height: 44px; font: 900 18px Nunito, sans-serif; z-index: 3; }
.modal h2 { margin: 18px 0 14px; text-align: center; font: 400 38px/1.05 var(--display); color: #fff; -webkit-text-stroke: 8px var(--ink); paint-order: stroke fill; text-shadow: 0 5px 0 var(--ink); }
.modal p { color: var(--muted); font-weight: 700; line-height: 1.6; font-size: 15px; margin: 8px 0; }
.modal p b { color: var(--ink); }
#modal-action { margin-top: 22px; }
.receipt { display: flex; justify-content: space-between; gap: 12px; padding: 10px 2px; border-bottom: 3px dashed rgba(16, 38, 29, .18); font-weight: 800; font-size: 15px; }
.receipt b { font: 400 19px var(--display); }
.receipt.tip { color: #23864a; }
.receipt.total { margin-top: 10px; padding: 12px 16px; border: 4px solid var(--ink); border-radius: 18px; background: var(--yellow); box-shadow: 0 4px 0 var(--ink); font-size: 18px; }
.receipt.total b { font-size: 28px; }
.stars { display: flex; justify-content: center; gap: 6px; margin: 0 0 4px; }
.stars i { display: inline-block; font-style: normal; font-size: 46px; line-height: 1; color: #e6dcc4; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; text-shadow: 0 4px 0 var(--ink); animation: star .45s cubic-bezier(.2, 1.6, .4, 1) both; }
.stars i.on { color: var(--yellow); }
.stars i:nth-child(odd) { rotate: -6deg; }
.stars i:nth-child(even) { rotate: 6deg; translate: 0 -6px; }
@keyframes star { 0% { transform: scale(0) rotate(-60deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
.quote { text-align: center; font-style: italic; color: var(--ink) !important; }

.pause-art { font-size: 56px; text-align: center; margin: 4px 0; animation: putt 1s ease-in-out infinite alternate; }
.help-grid { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; align-items: center; margin: 14px 0 6px; font-weight: 800; font-size: 14px; }
.help-grid kbd { justify-self: start; }
.btn-row { display: flex; gap: 10px; margin-top: 16px; }
.btn-row .btn { flex: 1; }

.garage-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 12px; padding: 12px 14px; background: #fff; border: 3px solid var(--ink); border-radius: 18px; box-shadow: 0 4px 0 var(--ink); }
.garage-row h3 { margin: 0 0 3px; font: 400 19px var(--display); letter-spacing: .3px; display: flex; align-items: center; gap: 8px; }
.garage-row p { margin: 0; font-size: 13px; }
.garage-row button { flex: none; min-width: 112px; }
.level { display: inline-flex; gap: 3px; }
.level i { width: 12px; height: 12px; border: 2.5px solid var(--ink); border-radius: 4px; background: #fff; }
.level i.on { background: var(--green); }
.swatch { display: inline-block; width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--ink); }
.section-label { margin: 22px 0 2px; font: 400 17px var(--display); letter-spacing: .5px; }
.wallet-line { text-align: center; }

/* ---------- Touch and small screens ---------- */
@media (hover: none), (max-width: 900px) {
 #touch { display: flex; position: absolute; left: 14px; right: 14px; bottom: calc(16px + var(--safe-bottom)); gap: 12px; }
 #touch button {
  width: 64px; height: 64px; border: 4px solid var(--ink); border-radius: 50%; background: rgba(255, 251, 234, .9);
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .1), 0 5px 0 var(--ink); font-size: 26px; touch-action: none; user-select: none; -webkit-user-select: none;
 }
 #touch button:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); background: var(--yellow); }
 #touch button:nth-child(2) { margin-right: auto; }
 #touch button[data-key="w"] { background: linear-gradient(#8ff09a, #48c556); }
 #touch button[data-key="s"] { background: linear-gradient(#ffa48f, var(--red)); }
 .game-help { display: none; }
 .speed { left: 50%; translate: -50% 0; bottom: calc(18px + var(--safe-bottom)); width: 66px; height: 66px; border-width: 3px; }
 .speed b { font-size: 25px; }
 .speed small { font-size: 8px; }
 #interact { bottom: calc(100px + var(--safe-bottom)); }
 .map { top: calc(84px + var(--safe-top)); bottom: auto; width: 150px; border-radius: 20px; }
 .map-foot { font-size: 12px; padding: 4px 10px 6px; }
 /* The top bar and map leave no room for tips up top, so they go behind the auto. */
 #toast { top: auto; bottom: calc(110px + var(--safe-bottom)); max-width: calc(100% - 40px); }
 body:has(#interact:not([hidden])) #toast { bottom: calc(180px + var(--safe-bottom)); }
}
@media (max-width: 760px) {
 .topbar { top: calc(12px + var(--safe-top)); right: 12px; gap: 8px; }
 .icon { width: 46px; height: 46px; }
 .icon svg { width: 22px; height: 22px; }
 .pill { height: 44px; font-size: 18px; padding: 0 12px 0 6px; }
 .coin { width: 26px; height: 26px; font-size: 13px; }
 .menu-col { left: 14px; right: 14px; width: auto; top: auto; bottom: calc(16px + var(--safe-bottom)); transform: none; padding: 4px 4px 12px; }
 .logo { font-size: 60px; -webkit-text-stroke: 8px var(--ink); }
 .logo .w2 { margin-left: 48px; }
 .sunburst { width: 340px; height: 340px; }
 .tagline { margin: 4px 0 22px 30px; font-size: 13px; }
 .menu .card { padding: 24px 14px 14px; }
 .how { display: none; }
 .trip { top: calc(70px + var(--safe-top)); left: 12px; width: 220px; padding: 11px 13px 10px; border-radius: 20px; }
 .trip h2 { font-size: 19px; }
 .trip p { font-size: 11px; }
 #fare { font-size: 20px; }
 #timer { font-size: 15px; min-width: 52px; }
 .trip[data-phase="pickup"] #fare { font-size: 15px; }
 .trip[data-phase="pickup"] #timer { font-size: 12px; min-width: 0; }
 .logo-hindi { right: -6px; top: -16px; font-size: 12px; }
 .timer-track { height: 11px; margin: 7px 0 6px; }
 .map { top: calc(70px + var(--safe-top)); right: 12px; width: 118px; }
 /* Phones: tips and popups go under the trip card, the speech bubble down by the controls. */
 #toast, body:has(#interact:not([hidden])) #toast { top: calc(var(--trip-bottom, 280px) + 10px); bottom: auto; max-width: calc(100% - 24px); font-size: 13px; padding: 9px 16px; }
 #popups { top: calc(var(--trip-bottom, 280px) + 12px); }
 body:has(#toast.show) #popups { top: calc(var(--trip-bottom, 280px) + 84px); }
 .popup { font-size: 30px; -webkit-text-stroke: 7px var(--ink); }
 .popup.bad { font-size: 24px; }
 .modal { padding: 42px 18px 20px; }
 .modal h2 { font-size: 30px; }
 .garage-row { flex-wrap: wrap; }
 .garage-row button { width: 100%; }
}
@media (max-height: 640px) and (min-width: 761px) {
 .menu-col { padding: 4px; }
 .logo { font-size: 60px; }
 .tagline { margin-bottom: 18px; }
 .how { display: none; }
}
@media (prefers-reduced-motion: reduce) {
 *, *::before, *::after { animation-duration: .01s !important; animation-iteration-count: 1 !important; transition-duration: .01s !important; }
}

/* Speech bubble under the trip card: passengers complaining, people shouting. Kept off the
   middle of the screen so it never hides the auto or the road ahead. */
#speech { position: fixed; left: 18px; top: calc(var(--trip-bottom, 280px) + 22px); z-index: 17; width: 290px; box-sizing: border-box; padding: 10px 16px 12px; background: #fff; border: 4px solid var(--ink); border-radius: 20px; box-shadow: 0 5px 0 var(--ink); pointer-events: none; opacity: 0; transform: translateY(-8px) scale(.85); transform-origin: 30px 0; transition: opacity .15s, transform .25s cubic-bezier(.3, 1.6, .5, 1); }
#speech::after { content: ''; position: absolute; left: 30px; top: -16px; width: 22px; height: 22px; background: inherit; border: 4px solid var(--ink); border-bottom: 0; border-right: 0; transform: rotate(45deg); }
#speech.show { opacity: 1; transform: none; }
#speech b { display: block; font: 400 13px var(--display); letter-spacing: .8px; text-transform: uppercase; color: #6c7a72; }
#speech span { font-weight: 900; font-size: 16px; line-height: 1.25; }
#speech.angry { background: #ffe1d8; animation: rant .5s ease-in-out 2; }
#speech.angry b { color: var(--red); }
@keyframes rant { 0%, 100% { margin-left: 0; } 25% { margin-left: -6px; } 75% { margin-left: 6px; } }
@media (max-width: 760px) {
 #speech { left: 12px; right: 12px; top: auto; bottom: calc(100px + var(--safe-bottom)); width: auto; text-align: center; transform-origin: 50% 100%; }
 #speech::after { left: 50%; translate: -50% 0; }
 #speech span { font-size: 15px; }
 #hud:has(#interact:not([hidden])) ~ #speech { bottom: calc(178px + var(--safe-bottom)); }
}
/* Landscape phones: no room under the trip card, so the bubble covers its top half for a
   moment and tips and popups go in the gap between the trip card and the map. */
@media (max-height: 500px) and (min-width: 761px) {
 #speech { top: calc(14px + var(--safe-top)); left: 14px; width: 298px; transform-origin: 50% 0; }
 #speech::after { display: none; }
 #toast, body:has(#interact:not([hidden])) #toast { top: calc(84px + var(--safe-top)); bottom: auto; left: calc(50% + 70px); max-width: calc(100% - 500px); font-size: 13px; padding: 8px 14px; }
 #popups { top: calc(84px + var(--safe-top)); left: calc(50% + 70px); }
 body:has(#toast.show) #popups { top: calc(134px + var(--safe-top)); }
 .popup { font-size: 28px; -webkit-text-stroke: 7px var(--ink); }
 .popup.bad { font-size: 22px; }
}
/* Landscape phones: card on the left, logo beside it under the top bar, so the menu fits
   the height without scrolling. */
@media (max-height: 500px) and (min-width: 600px) {
 .menu-col { display: grid; grid-template-columns: 380px auto; grid-template-rows: 1fr auto auto; column-gap: 30px; width: max-content; left: 4%; right: auto; top: 50%; bottom: auto; transform: translateY(-50%); }
 .menu .card { grid-column: 1; grid-row: 1 / 4; align-self: center; }
 .logo-wrap { grid-column: 2; grid-row: 2; }
 .tagline { grid-column: 2; grid-row: 3; justify-self: start; margin-bottom: 0; }
}
