:root {
  --orange: #ff7b1c; --red: #d8402f; --ink: #2a1a2e; --cream: #fff8e8; --yellow: #ffd23a; --blue: #2a7fff;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #8fd6ff; font-family: Nunito, system-ui, sans-serif; color: var(--ink); }
#game, #game canvas { position: fixed; inset: 0; display: block; }
.hidden { display: none !important; }
button { font: 800 15px Nunito, sans-serif; border: 3px solid var(--ink); background: #fff; color: var(--ink); border-radius: 14px; padding: 8px 14px; cursor: pointer; box-shadow: 0 4px 0 var(--ink); transition: transform .08s; }
button:hover { transform: translateY(-1px); }
button:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
button.big { background: var(--orange); color: #fff; font-size: 19px; padding: 11px 22px; font-family: 'Lilita One', sans-serif; letter-spacing: .5px; }
/* "continue where you left off": green, above the normal start, with the checkpoint underneath */
button.big.continue { background: #3f9a4a; display: block; width: 100%; margin-bottom: 8px; line-height: 1.15; }
button.big.continue.hidden { display: none; }
button.big.continue small { display: block; font-family: system-ui, sans-serif; font-size: 13px; font-weight: 600; opacity: .9; letter-spacing: 0; margin-top: 3px; }

.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(40, 20, 50, .25); z-index: 10; overflow-y: auto; }
#menu { background: linear-gradient(180deg, rgba(143,214,255,.15), rgba(40,20,50,.35)); }
.card { background: var(--cream); border: 4px solid var(--ink); border-radius: 26px; padding: 22px 26px; max-width: 640px; width: 100%; box-shadow: 0 10px 0 var(--ink), 0 20px 50px rgba(0,0,0,.3); margin: auto; }
.card.small { max-width: 440px; text-align: center; }
h1 { font-family: 'Lilita One', sans-serif; font-size: 54px; margin: 0; line-height: .95; color: #fff; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 0 5px 0 var(--ink); }
h1 span { color: var(--orange); display: block; font-size: 44px; }
h2 { font-family: 'Lilita One', sans-serif; font-size: 36px; margin: 0 0 8px; color: var(--orange); -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; }
.story { margin: 12px 0; font-size: 15px; }
.herd { background: #e8f6d8; border: 2px dashed #6cb24a; border-radius: 12px; padding: 8px 12px; margin-bottom: 12px; font-size: 14px; }
.herd .cows { font-size: 20px; margin-right: 6px; }
.muted { opacity: .7; }
.pick { display: flex; gap: 12px; align-items: stretch; }
.drop { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px; border: 3px dashed var(--ink); border-radius: 16px; padding: 18px; cursor: pointer; background: #fff; text-align: center; transition: background .15s; }
.drop.hover, .drop:hover { background: #fff1d6; }
.drop input { display: none; }
.drop span { font-size: 13px; opacity: .7; }
#menuMap { display: none; background: #e8f6d8; border: 3px solid var(--ink); border-radius: 16px; }
#menuMap.show { display: block; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; }
.row.center { justify-content: center; }
.row label { display: flex; align-items: center; gap: 8px; font-weight: 800; flex: 1; }
.demos span { font-size: 14px; font-weight: 800; }
.demos button { padding: 6px 10px; font-size: 14px; }
select { font: 700 14px Nunito, sans-serif; border: 3px solid var(--ink); border-radius: 12px; padding: 7px; background: #fff; flex: 1; min-width: 0; }
#routeInfo { margin-top: 12px; padding: 10px 12px; background: #fff; border-radius: 12px; border: 2px solid #ddd; font-size: 14px; }
#routeInfo .land { margin-top: 6px; font-size: 13px; line-height: 1.45; }
#routeInfo .land.busy { animation: pulse 1s infinite alternate; }
@keyframes pulse { from { opacity: .45; } to { opacity: 1; } }
.attrib { font-size: 11.5px; opacity: .7; margin: 10px 0 0; }
.attrib a { color: inherit; }
#osmCredit { position: absolute; right: 10px; bottom: 6px; font-size: 10px; color: rgba(255,255,255,.85); text-shadow: 0 1px 2px rgba(0,0,0,.6); }
#routeInfo.err { border-color: var(--red); color: var(--red); font-weight: 800; }
.controls { margin-top: 14px; font-size: 13px; }
.controls summary { cursor: pointer; font-weight: 800; }
.controls table { border-collapse: collapse; margin-top: 8px; width: 100%; }
.controls td { padding: 3px 6px; vertical-align: top; }
kbd { display: inline-block; min-width: 22px; text-align: center; background: #fff; border: 2px solid var(--ink); border-bottom-width: 4px; border-radius: 6px; padding: 0 4px; font: 800 12px Nunito, sans-serif; }
.stats { text-align: left; margin: 12px 0; }
.stats div { display: flex; justify-content: space-between; padding: 6px 4px; border-bottom: 2px dotted #e0d3b8; }
.stats .total { font-size: 18px; border: 0; color: var(--orange); }

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
.hud-left, .hud-right { position: absolute; top: 14px; display: flex; gap: 8px; }
.hud-left { left: 14px; } .hud-right { right: 122px; }
.pill { display: flex; align-items: center; gap: 6px; background: #fff; border: 3px solid var(--ink); border-radius: 999px; padding: 4px 14px 4px 8px; box-shadow: 0 4px 0 var(--ink); font-family: 'Lilita One', sans-serif; font-size: 22px; }
.pill small { font-size: 13px; opacity: .6; }
.pill .ico { font-size: 22px; }
.bell .meter { width: 54px; height: 12px; border: 2px solid var(--ink); border-radius: 8px; overflow: hidden; background: #eee; }
.bell .meter i { display: block; height: 100%; width: 0; background: #ffc531; }
.bell.ready { animation: wiggle 1.2s infinite; }
@keyframes wiggle { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-6deg); } 92% { transform: rotate(6deg); } }
#progress { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); width: min(420px, 60vw); height: 16px; background: rgba(255,255,255,.8); border: 3px solid var(--ink); border-radius: 10px; }
#progFill { height: 100%; width: 0; background: linear-gradient(90deg, #6cc24a, var(--orange)); border-radius: 6px; }
#progCow { position: absolute; top: -26px; transform: translateX(-50%) scaleX(-1); font-size: 24px; }
#progress .goal { position: absolute; right: -14px; top: -28px; font-size: 26px; }
#minimap { position: absolute; left: 14px; bottom: 14px; width: 150px; height: 150px; background: rgba(40, 90, 40, .35); border: 3px solid var(--ink); border-radius: 18px; }
#message { position: absolute; top: 22%; left: 50%; transform: translate(-50%, -50%) scale(.6); font-family: 'Lilita One', sans-serif; font-size: 46px; text-align: center; color: #fff; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 0 5px 0 var(--ink); opacity: 0; white-space: nowrap; line-height: 1.05; }
#message small { font-size: 22px; -webkit-text-stroke: 2px var(--ink); }
#message.show { animation: pop 1.8s ease-out forwards; }
@keyframes pop { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.4); } 12% { opacity: 1; transform: translate(-50%, -50%) scale(1.12); } 22% { transform: translate(-50%, -50%) scale(1); } 85% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -60%) scale(1); } }

#muteBtn, #musicBtn { position: fixed; top: 12px; right: 14px; z-index: 20; padding: 4px 8px; font-size: 20px; border-radius: 50%; width: 46px; height: 46px; }
#musicBtn { right: 66px; }
#musicBtn.off { opacity: .55; text-decoration: line-through; }

/* ---- touch controls: hold anywhere = pedal, drag = steer, round buttons for the rest ---- */
#touch { display: none; }
body.touch.ingame #touch { display: block; }
#touch, #touch * { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
#touchZone { position: fixed; inset: 0; z-index: 4; }
#steerHint { position: fixed; z-index: 4; width: 120px; height: 46px; margin: -23px 0 0 -60px; border-radius: 999px; pointer-events: none;
  background: rgba(255,255,255,.18); border: 2px solid rgba(255,255,255,.55); opacity: 0; transition: opacity .15s; }
#steerHint.on { opacity: 1; }
#steerHint i { position: absolute; left: 50%; top: 50%; width: 38px; height: 38px; margin: -19px 0 0 -19px; border-radius: 50%;
  background: rgba(255,255,255,.85); box-shadow: 0 2px 8px rgba(0,0,0,.25); }
#touch .tpad { position: fixed; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 6; display: flex; align-items: flex-end; gap: 12px; }
#touch .tleft { left: calc(16px + env(safe-area-inset-left)); }
#touch .tright { right: calc(16px + env(safe-area-inset-right)); }
.tbtn { position: relative; width: 64px; height: 64px; padding: 0; border-radius: 50%; border: 0; display: grid; place-items: center; align-content: center; gap: 0;
  color: #fff; background: rgba(42,26,46,.42); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  box-shadow: inset 0 0 0 2.5px rgba(255,255,255,.7), 0 4px 14px rgba(0,0,0,.25); transition: transform .08s, background .08s; }
.tbtn:hover { transform: none; }
.tbtn b { font-size: 26px; line-height: 1; font-weight: 400; }
.tbtn small { font: 800 10px Nunito, sans-serif; letter-spacing: .8px; opacity: .9; margin-top: 2px; }
.tbtn.on, .tbtn:active { transform: scale(.9); box-shadow: inset 0 0 0 2.5px #fff, 0 2px 6px rgba(0,0,0,.25); }
.tbtn.hop { width: 88px; height: 88px; background: rgba(255,123,28,.88); }
.tbtn.hop b { font-size: 36px; font-weight: 800; }
.tbtn.brake { width: 76px; height: 76px; background: rgba(216,64,47,.78); }
.tbtn.bell .on, .tbtn.bell.on { background: rgba(255,210,58,.85); }
.tbtn.small { position: fixed; top: 12px; right: 118px; width: 46px; height: 46px; z-index: 20; }
.tbtn.small b, .tbtn.small { font-size: 18px; }
#touchTip { position: fixed; left: 50%; bottom: calc(118px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 5; pointer-events: none;
  background: rgba(42,26,46,.6); color: #fff; font-weight: 800; font-size: 14px; padding: 7px 14px; border-radius: 999px; white-space: nowrap; transition: opacity .6s; }
#touchTip.gone { opacity: 0; }
body.touch .hud-right { right: 174px; }
/* make room for the buttons along the bottom edge */
body.touch #progress { bottom: calc(104px + env(safe-area-inset-bottom)); width: min(300px, 40vw); height: 12px; }
body.touch #where { bottom: calc(128px + env(safe-area-inset-bottom)); max-width: 40vw; font-size: 12px; padding: 3px 10px; }
body.touch #minimap { bottom: calc(108px + env(safe-area-inset-bottom)); width: 96px; height: 96px; }
body.touch #touchTip { bottom: calc(160px + env(safe-area-inset-bottom)); }

/* ---------- playful start screen ---------- */
#menu { justify-content: flex-start; padding: 12px 4vw; overflow: hidden; background: radial-gradient(ellipse at 75% 60%, rgba(255,255,255,0) 30%, rgba(40,20,50,.28) 100%); }
.menu-card {
  max-width: 520px; width: calc(100vw - 24px); padding: 16px 22px 14px;
  position: absolute; left: 4vw; top: 50%; margin: 0; z-index: 2;
  transform: translateY(-50%) rotate(-1.2deg) scale(var(--fit, 1)); transform-origin: left center;
  background:
    radial-gradient(circle at 94% 6%, #2a1a2e 0 22px, transparent 23px),
    radial-gradient(circle at 99% 16%, #2a1a2e 0 12px, transparent 13px),
    radial-gradient(circle at 3% 97%, #2a1a2e 0 18px, transparent 19px),
    var(--cream);
  animation: cardIn .7s cubic-bezier(.2, 1.6, .4, 1) both;
}
.menu-card > * { transform: rotate(1.2deg); }
@keyframes cardIn { from { transform: translateY(calc(-50% + 40px)) rotate(-6deg) scale(calc(var(--fit, 1) * .9)); opacity: 0; } }
@keyframes cardInPhone { from { transform: translateY(40px) rotate(-5deg) scale(.92); opacity: 0; } }
.logo { font-size: 50px; margin: 0; }
.logo .w1, .logo .w2 { display: inline-block; }
.logo .w2 { color: var(--orange); font-size: 42px; margin-left: 10px; }
.menu-card .story { margin: 6px 0 8px; font-size: 16px; line-height: 1.35; }
.menu-card .step { margin: 10px 0 6px; font-size: 19px; }
.menu-card .drop { padding: 10px; }
.menu-card .drop b { font-size: 17px; }
.menu-card #menuMap { width: 130px; height: 94px; }
.menu-card .demos { margin-top: 8px; }
.menu-card .demo { padding: 5px 6px 6px; }
.menu-card .demo i { font-size: 24px; }
.menu-card .demo b { font-size: 16px; }
.menu-card #routeInfo { margin-top: 8px; padding: 6px 10px; font-size: 15px; }
.menu-card #routeInfo .land { margin-top: 3px; font-size: 14px; }
.menu-card .diffs { margin-top: 8px; }
.menu-card .attrib { margin-top: 6px; font-size: 12px; }
.menu-card .controls { margin-top: 6px; font-size: 14px; }
.menu-card .herd { padding: 4px 10px; font-size: 15px; }
/* wide but short windows: two columns so the card can stay big */
@media (min-aspect-ratio: 3/2) and (max-height: 820px) and (min-width: 900px) {
  .menu-card { max-width: 880px; }
  .menu-card .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; align-items: start; }
  .menu-card .col > .step:first-child { margin-top: 10px; }
  .menu-card .diffs { grid-template-columns: 1fr 1fr; }
  .menu-card .row.go { flex-direction: column; align-items: stretch; }
  .bubble { left: auto; right: 3vw; top: 12vh; }
}
.logo .ch { display: inline-block; animation: hop 2.6s ease-in-out infinite; animation-delay: calc(var(--i) * 70ms); }
@keyframes hop { 0%, 60%, 100% { transform: translateY(0) rotate(0); } 70% { transform: translateY(-10px) rotate(-6deg); } 80% { transform: translateY(0) rotate(3deg); } }
.story { font-size: 15.5px; }
.step { font-family: 'Lilita One', sans-serif; font-weight: 400; font-size: 21px; margin: 16px 0 8px; display: flex; align-items: center; gap: 8px; }
.step span { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--orange); color: #fff; border: 3px solid var(--ink); font-size: 17px; transform: rotate(-8deg); }
.herd { background: linear-gradient(#bfe7ff, #bfe7ff 55%, #7cc652 55%); border: 3px solid var(--ink); border-radius: 14px; padding: 6px 12px; font-size: 14px; font-weight: 800; }
.herd .cows span { display: inline-block; animation: graze 1.6s ease-in-out infinite; animation-delay: calc(var(--i) * -0.23s); }
@keyframes graze { 50% { transform: translateY(-3px) rotate(-6deg); } }
.drop { border: 3px dashed var(--ink); background: #fff; position: relative; overflow: hidden; transition: transform .15s, background .15s; }
.drop::before { content: ''; position: absolute; inset: 0; opacity: .1; pointer-events: none;
  background: radial-gradient(circle at 20% 30%, #000 0 18px, transparent 19px), radial-gradient(circle at 70% 70%, #000 0 26px, transparent 27px), radial-gradient(circle at 85% 20%, #000 0 12px, transparent 13px), radial-gradient(circle at 35% 85%, #000 0 10px, transparent 11px); }
.drop:hover, .drop.hover { transform: rotate(-1deg) scale(1.02); background: #fff3dd; }
.drop b { font-family: 'Lilita One', sans-serif; font-weight: 400; font-size: 19px; line-height: 1.1; }
#menuMap { transform: rotate(2deg); }
.demos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.demo { display: flex; flex-direction: column; align-items: center; gap: 0; padding: 8px 6px 9px; border-radius: 16px; transition: transform .15s; }
.demo i { font-style: normal; font-size: 30px; line-height: 1.1; transition: transform .2s; }
.demo b { font-family: 'Lilita One', sans-serif; font-weight: 400; font-size: 18px; }
.demo small { font-size: 13px; opacity: .75; }
.demo.polder { background: #c9efb0; transform: rotate(-2deg); }
.demo.grachten { background: #ffd2c2; transform: rotate(1.5deg); }
.demo.duinen { background: #ffeeb0; transform: rotate(-1deg); }
.demo:hover { transform: rotate(0) translateY(-3px) scale(1.04); }
.demo:hover i { transform: scale(1.25) rotate(-10deg); }
#loadBox { margin-top: 10px; background: #fff; border: 3px solid var(--ink); border-radius: 16px; padding: 10px 14px 12px; text-align: center; }
.lane { position: relative; height: 34px; border-bottom: 4px dashed #c4533f; margin: 0 6px 6px; overflow: hidden; }
.lane .rider { position: absolute; bottom: 2px; left: 0; font-size: 26px; transform: scaleX(-1); transition: left .4s ease-out; animation: bob .35s ease-in-out infinite alternate; }
@keyframes bob { to { margin-bottom: 3px; } }
.pbar { position: relative; height: 22px; margin: 4px 6px 2px; background: #f1ead9; border: 3px solid var(--ink); border-radius: 12px; overflow: hidden; }
.pbar i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: repeating-linear-gradient(-45deg, #7cc652 0 12px, #6ab541 12px 24px); transition: width .4s ease-out; animation: stripes 1s linear infinite; background-size: 34px 34px; }
@keyframes stripes { to { background-position: 34px 0; } }
.pbar span { position: relative; display: block; text-align: center; font: 400 14px/16px 'Lilita One', sans-serif; color: var(--ink); }
#loadMsg { margin: 2px 0 4px; font-size: 14px; opacity: .75; min-height: 15px; }
#loadPill .mini { display: inline-block; vertical-align: middle; width: 90px; height: 10px; margin: 0 6px; border: 2px solid var(--ink); border-radius: 6px; overflow: hidden; background: #f1ead9; }
#loadPill .mini i { display: block; height: 100%; background: #7cc652; }
.lane .flag { position: absolute; right: 0; bottom: 2px; font-size: 24px; }
@keyframes ride { from { left: -30px; } to { left: calc(100% - 40px); } }
.lane .rider { transform-origin: bottom center; }
.factHead { margin: 2px 0 0; font-family: 'Lilita One', sans-serif; font-size: 16px; color: var(--orange); }
#fact { margin: 2px 0 10px; min-height: 40px; font-size: 16px; font-weight: 700; }
#fact.in { animation: factIn .5s cubic-bezier(.2, 1.5, .4, 1); }
@keyframes factIn { from { opacity: 0; transform: translateY(8px) scale(.96); } }
button.practice { background: #7cc652; color: #fff; font-family: 'Lilita One', sans-serif; font-weight: 400; font-size: 17px; animation: nudge 2s ease-in-out infinite; }
@keyframes nudge { 0%, 85%, 100% { transform: rotate(0); } 90% { transform: rotate(-3deg) scale(1.04); } 95% { transform: rotate(3deg) scale(1.04); } }
.row.go { margin-top: 4px; }
.row.small { margin-top: 10px; font-size: 15px; }
.row.small select { font-size: 15px; padding: 6px; }
#startBtn:not(:disabled) { animation: pulseBtn 1.4s ease-in-out infinite; }
@keyframes pulseBtn { 50% { transform: scale(1.06) rotate(-1deg); } }
button.ghost { background: transparent; border: 0; box-shadow: none; text-decoration: underline; font-size: 16px; padding: 6px; }
.floaties { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 1; }
.floaties span { position: absolute; bottom: -60px; font-size: 34px; opacity: .85; animation: float var(--d) linear infinite; animation-delay: var(--w); filter: drop-shadow(0 4px 0 rgba(42,26,46,.35)); }
@keyframes float { from { transform: translateY(0) rotate(0); } to { transform: translateY(-120vh) rotate(360deg); } }
.bubble { position: fixed; z-index: 2; left: 70vw; top: 16vh; max-width: 260px; background: #fff; border: 4px solid var(--ink); border-radius: 22px; padding: 12px 16px; font-family: 'Lilita One', sans-serif; font-size: 21px; line-height: 1.15; box-shadow: 0 6px 0 var(--ink); transform-origin: 20% 100%; animation: bubbleIn .5s cubic-bezier(.2, 1.7, .4, 1); }
.bubble::after { content: ''; position: absolute; left: 34px; bottom: -22px; border: 12px solid transparent; border-top: 14px solid var(--ink); }
.bubble.pop { animation: bubbleIn .5s cubic-bezier(.2, 1.7, .4, 1); }
@keyframes bubbleIn { from { transform: scale(.3) rotate(-10deg); opacity: 0; } }
@media (max-width: 980px) {
  .bubble { display: none; }
  .menu-card { left: 50%; transform: translate(-50%, -50%) rotate(-1.2deg) scale(var(--fit, 1)); transform-origin: center center; }
  @keyframes cardIn { from { transform: translate(-50%, calc(-50% + 40px)) rotate(-6deg) scale(calc(var(--fit, 1) * .9)); opacity: 0; } }
}

.diffs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 12px; }
.diffs button { display: flex; flex-direction: column; align-items: center; padding: 5px 4px 6px; font-size: 14px; border-radius: 12px; background: #fff; box-shadow: 0 3px 0 var(--ink); }
.diffs button i { font-style: normal; font-size: 20px; }
.diffs button.on { background: var(--yellow); transform: translateY(-2px) rotate(-2deg); box-shadow: 0 5px 0 var(--ink); }

#where { position: absolute; left: 50%; bottom: 52px; transform: translateX(-50%); background: rgba(28, 77, 155, .92); color: #fff; border: 3px solid var(--ink); border-radius: 12px; padding: 4px 14px; font-weight: 800; font-size: 15px; white-space: nowrap; box-shadow: 0 3px 0 var(--ink); max-width: 80vw; overflow: hidden; text-overflow: ellipsis; }
#where .knoop { display: inline-block; background: #1f8a3e; border: 2px solid #fff; border-radius: 50%; min-width: 26px; height: 26px; line-height: 22px; text-align: center; margin-right: 6px; animation: pulseBtn .6s 3; }
#where small { opacity: .8; font-weight: 700; }

#wchip { position: absolute; top: 70px; right: 14px; background: #fff; border: 3px solid var(--ink); border-radius: 999px; padding: 4px 12px; box-shadow: 0 3px 0 var(--ink); font-weight: 800; font-size: 15px; white-space: nowrap; }
#wchip .warrow { display: inline-block; color: #2a7fff; font-size: 17px; transition: transform .3s; }
#wchip small { opacity: .7; }

/* practice banner */
#loadPill { position: absolute; top: 70px; left: 50%; transform: translateX(-50%); background: #fff; border: 3px solid var(--ink); border-radius: 999px; padding: 6px 16px; box-shadow: 0 4px 0 var(--ink); font-weight: 800; font-size: 15px; white-space: nowrap; pointer-events: auto; max-width: 92vw; overflow: hidden; text-overflow: ellipsis; }
#loadPill small { opacity: .65; }
#loadPill .spin { display: inline-block; animation: spin 2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#loadPill button { border: 0; box-shadow: none; padding: 0; background: none; font: inherit; color: #2a8a3a; animation: pulseBtn 1s infinite; }
#loadPill kbd { margin-left: 6px; }

@media (max-width: 640px) {
  .logo { font-size: 44px; } .logo .w2 { font-size: 36px; }
  .demos { grid-template-columns: 1fr 1fr 1fr; gap: 6px; } .demo small { display: none; }
  h1 { font-size: 40px; } h1 span { font-size: 32px; }
  .pick { flex-direction: column; } #menuMap { align-self: center; }
  .pill { font-size: 17px; padding: 2px 10px 2px 6px; } .pill .ico { font-size: 17px; }
  .hud-right { right: 66px; top: 60px; } .hud-right .pill.bell .meter { width: 34px; }
  #minimap { width: 100px; height: 100px; }
  /* phone: the start screen scrolls instead of shrinking, so the text stays readable */
  #menu { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 66px 10px 24px; display: block; }
  .menu-card { position: relative; left: auto; top: auto; width: auto; max-width: none; margin: 0 auto; transform: rotate(-.8deg); animation-name: cardInPhone; background: var(--cream); }
  .menu-card > * { transform: rotate(.8deg); }
  .menu-card .story { font-size: 17px; }
  .menu-card #routeInfo { font-size: 16px; } .menu-card #routeInfo .land { font-size: 15px; }
  .menu-card .attrib { font-size: 13px; }
  .row.small, .row.small select { font-size: 16px; }
  .row.small label { display: flex; flex-direction: column; gap: 3px; flex: 1; }
  .row.small select { width: 100%; }
  .diffs { grid-template-columns: 1fr 1fr; } .diffs button { font-size: 16px; padding: 8px 4px; }
  .demo b { font-size: 18px; }
  #startBtn { width: 100%; font-size: 22px; padding: 14px; }
  body.touch .hud-right { right: 14px; }
  #loadPill { top: 108px; } #wchip { top: 156px; }
  body.touch #touchTip { bottom: calc(230px + env(safe-area-inset-bottom)); }
  #touchTip { font-size: 12px; white-space: normal; width: max-content; max-width: 70vw; text-align: center; }
  #message { font-size: 30px; }
}

/* Inside the Android app (?app=1): the app draws the menu, buttons and result screens natively */
body.app #menu, body.app #pause, body.app #complete, body.app #gameover,
body.app #touch, body.app #touchTip, body.app #muteBtn, body.app #musicBtn, body.app #loadPill { display: none !important; }
body.app .hud-right { right: 14px; }
body.app #wchip { top: 64px; }

/* Language picker (top left of the menu) */
.step em { font-style: normal; }
.langPick { position: absolute; z-index: 3; top: 12px; left: 12px; display: flex; align-items: center; gap: 4px; background: #fff; border: 3px solid var(--ink); border-radius: 14px; padding: 3px 6px 3px 10px; box-shadow: 0 4px 0 var(--ink); font-size: 18px; cursor: pointer; }
.langPick select { font: 800 14px 'Nunito', sans-serif; border: 0; background: transparent; color: var(--ink); cursor: pointer; padding: 4px 2px; }
body.app .langPick { display: none; }
