/* Joyride Island */
:root {
  --ink: #fffdf6;
  --muted: #d8e6f2;
  --panel: rgba(20, 40, 60, 0.84);
  --accent: #ffc93c;
  --accent-ink: #2a1c00;
  --good: #7bd389;
  --gutter: max(16px, env(safe-area-inset-left));
  --gutter-r: max(16px, env(safe-area-inset-right));
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  height: 100%;
  overflow: hidden;
  background: #2a9fd8;
  color: var(--ink);
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  overscroll-behavior: none;
}

#game { position: fixed; inset: 0; display: block; width: 100%; height: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; }

/* ------------------------------------------------------------ HUD ---- */
#hud {
  position: fixed; top: 0; left: 0; right: 0;
  display: none;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 8px;
  padding: max(10px, env(safe-area-inset-top)) var(--gutter-r) 0 var(--gutter);
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}
body[data-state="playing"] #hud, body[data-state="paused"] #hud { display: grid; }
.hud-left { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.chip {
  background: rgba(10, 30, 50, 0.45);
  border-radius: 14px;
  padding: 5px 12px;
  font-weight: 800;
  font-size: clamp(15px, 3.4vw, 20px);
  white-space: nowrap;
}
.chip.small { font-size: 14px; font-weight: 700; }
.hud-center { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; }
#objective {
  background: rgba(255, 255, 255, 0.92); color: #23415a; text-shadow: none;
  border-radius: 14px; padding: 6px 14px; font-weight: 800; font-size: clamp(13px, 3vw, 17px);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
  max-width: min(70vw, 520px);
}
#timer { font-weight: 900; font-size: clamp(18px, 4vw, 26px); font-variant-numeric: tabular-nums; }
#timer.low { color: #ff6b6b; animation: pulse 0.8s ease-in-out infinite; }
.hud-right { display: flex; gap: 8px; justify-content: flex-end; }
.icon-btn {
  pointer-events: auto;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(10, 30, 50, 0.45);
  font-size: 18px;
}
.icon-btn.off { opacity: 0.45; }

#minimap {
  position: fixed; display: none;
  left: var(--gutter); bottom: max(16px, env(safe-area-inset-bottom));
  width: 180px; height: 180px;
  border-radius: 50%;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}
#speedo {
  position: fixed; display: none;
  right: var(--gutter-r); bottom: max(16px, env(safe-area-inset-bottom));
  text-align: right; pointer-events: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}
#vname { font-weight: 800; font-size: 16px; }
#speed { font-weight: 900; font-size: clamp(18px, 4vw, 26px); font-variant-numeric: tabular-nums; }
body[data-state="playing"] #minimap, body[data-state="playing"] #speedo,
body[data-state="paused"] #minimap, body[data-state="paused"] #speedo { display: block; }

#prompt {
  position: fixed; left: 50%; bottom: max(26px, calc(env(safe-area-inset-bottom) + 12px));
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.92); color: #23415a;
  border-radius: 999px; padding: 8px 18px; font-weight: 800; font-size: 15px;
  pointer-events: none; white-space: nowrap;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
}
body[data-state="title"] #prompt { display: none; }
#banner {
  position: fixed; left: 50%; top: 22%;
  transform: translate(-50%, -10px) scale(0.9);
  background: var(--accent); color: var(--accent-ink);
  border-radius: 18px; padding: 10px 20px;
  font-weight: 900; font-size: clamp(15px, 3.6vw, 22px);
  text-align: center; max-width: min(88vw, 640px);
  opacity: 0; transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
#banner.show { opacity: 1; transform: translate(-50%, 0) scale(1); }

#bubbles { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.bubble {
  position: absolute; left: 0; top: 0;
  background: #fff; color: #2a2a3a;
  border-radius: 14px; padding: 5px 11px;
  font-weight: 800; font-size: 14px; white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transform-origin: 50% 100%;
}
.bubble::after {
  content: ""; position: absolute; left: 50%; bottom: -7px; margin-left: -7px;
  border: 7px solid transparent; border-top-color: #fff; border-bottom: 0;
}
.bubble.pop { animation: bubblepop 0.25s ease-out; }
@keyframes bubblepop { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

/* --------------------------------------------------------- touch ---- */
#touch { position: fixed; inset: 0; display: none; }
body.touch[data-state="playing"] #touch { display: block; }
#stick {
  position: absolute; left: 40px; bottom: 60px; width: 120px; height: 120px;
  border-radius: 50%; background: rgba(255, 255, 255, 0.16); border: 2px solid rgba(255, 255, 255, 0.35);
  opacity: 0.55; pointer-events: none;
}
#stick.on { opacity: 1; }
#stick-knob {
  position: absolute; left: 35px; top: 35px; width: 50px; height: 50px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.75);
}
.tbtns {
  position: absolute; right: var(--gutter-r); bottom: max(14px, env(safe-area-inset-bottom));
  display: grid; grid-template-columns: 64px 76px; gap: 10px; align-items: end;
}
.tbtn {
  width: 64px; height: 64px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.28); border: 2px solid rgba(255, 255, 255, 0.5);
  font-weight: 900; font-size: 14px; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
.tbtn.big { width: 76px; height: 76px; font-size: 15px; background: rgba(255, 201, 60, 0.55); }
.tbtn.down { transform: scale(0.92); background: rgba(255, 255, 255, 0.5); }
body.touch #speedo { bottom: auto; top: max(110px, calc(env(safe-area-inset-top) + 100px)); }
body.touch #minimap { width: 104px; height: 104px; left: auto; right: var(--gutter-r); top: max(58px, calc(env(safe-area-inset-top) + 52px)); bottom: auto; }
body.touch #speedo { right: auto; left: var(--gutter); top: auto; bottom: 200px; text-align: left; }
body.touch #prompt { bottom: auto; top: 30%; }
@media (max-height: 450px) {
  .chip { padding: 3px 9px; }
  body.touch #speedo { bottom: auto; top: 96px; }
}

/* --------------------------------------------------------- menus ---- */
#overlay {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  background: radial-gradient(circle at 50% 30%, rgba(255, 220, 120, 0.25), rgba(10, 30, 60, 0.55));
  overflow-y: auto;
}
.panel {
  background: var(--panel);
  border-radius: 24px;
  padding: 24px 26px;
  max-width: 560px; width: 100%;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  display: flex; flex-direction: column; gap: 12px; align-items: center;
}
h1 { font-size: clamp(34px, 8vw, 52px); font-weight: 900; letter-spacing: 0.5px; line-height: 1; }
h1 span { color: var(--accent); }
h2 { font-size: 28px; font-weight: 900; }
.tagline { color: var(--muted); font-size: 16px; }
.map-line { font-size: 16px; }
.muted { color: var(--muted); font-weight: 600; font-size: 14px; }
.panel button {
  min-height: 44px; padding: 0 20px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.14); font-weight: 800; font-size: 16px;
}
.panel button:hover { background: rgba(255, 255, 255, 0.24); }
.panel button.primary { background: var(--accent); color: var(--accent-ink); min-width: 200px; font-size: 20px; min-height: 52px; }
.panel button.off { opacity: 0.5; }
.row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.help { font-size: 13px; color: var(--muted); line-height: 1.6; }
.touch-only { display: none; }
body.touch .touch-only { display: block; }
body.touch .kbd-only { display: none; }
.noscript { position: fixed; inset: 0; display: grid; place-items: center; font-size: 20px; }
@media (max-height: 450px) {
  .panel { padding: 14px 18px; gap: 8px; }
  h1 { font-size: 32px; }
  .tagline, .help { font-size: 12px; }
}

/* ------------------------------------- toast, radio, progress, settings ---- */
#toast {
  background: rgba(10, 30, 50, 0.72); color: var(--ink);
  border-radius: 999px; padding: 5px 14px; font-weight: 800; font-size: 15px;
  white-space: nowrap; max-width: min(80vw, 520px); overflow: hidden; text-overflow: ellipsis;
  opacity: 0; transform: translateY(-6px); transition: opacity 0.25s, transform 0.25s;
}
#toast.show { opacity: 1; transform: none; }
#toast small { font-weight: 600; color: var(--muted); margin-left: 4px; }
.radio-btn { display: none; }
body.in-vehicle .radio-btn { display: inline-block; }
.progress { width: 100%; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.progress .stats { font-weight: 800; font-size: 16px; }
.progress .missions { font-size: 14px; color: var(--muted); }
.progress .missions .ok { color: var(--ink); }
.progress .jumps {
  list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 2px 12px;
  width: 100%; font-size: 13px; color: var(--muted); text-align: left;
}
.progress .jumps .ok { color: var(--ink); }
.progress .jumps span { color: var(--accent); font-weight: 800; }
.settings { display: flex; flex-direction: column; gap: 6px; width: 100%; max-width: 380px; }
.set-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; font-size: 14px; font-weight: 700; }
.set-row > span:first-child { flex: 1; text-align: left; }
.set-row b { min-width: 44px; text-align: center; font-variant-numeric: tabular-nums; }
.panel button.mini { min-height: 36px; width: 40px; padding: 0; font-size: 20px; }
.seg { display: inline-flex; gap: 4px; }
.panel .seg button { min-height: 36px; padding: 0 12px; font-size: 14px; }
.panel .seg button.on { background: var(--accent); color: var(--accent-ink); }
.panel button.subtle { min-height: 36px; font-size: 14px; background: transparent; color: var(--muted); }
.panel button.danger { background: #ff6b6b; color: #2a0000; }
.confirm { background: rgba(255, 255, 255, 0.1); border-radius: 16px; padding: 10px 14px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; font-weight: 700; }
@media (max-height: 450px) {
  #toast { font-size: 13px; padding: 3px 10px; }
  .progress .jumps { font-size: 12px; }
}
/* tall menus on short (phone landscape) screens: scrollable, never clipped at the top */
#overlay { touch-action: pan-y; }
#overlay > .panel { margin: auto; }
@media (max-height: 450px) {
  .progress .jumps { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .set-row { font-size: 13px; }
  .panel button.mini, .panel .seg button { min-height: 32px; }
}

/* ------------------------------- step 2: garage, photo mode, map, travel ---- */
/* HUD buttons and the minimap sit above the touch zone so they can be tapped */
#hud { z-index: 2; }
#minimap { pointer-events: auto; cursor: pointer; z-index: 2; }
body.pad .kbd-only { display: none; }
.pad-only { display: none; }
body.pad .pad-only { display: inline; }
.navfocus { outline: 3px solid var(--accent) !important; outline-offset: 2px; }

/* garage shop: a side panel, the car stays visible in the showroom */
body[data-state="garage"] #overlay { background: linear-gradient(90deg, rgba(10, 30, 60, 0) 40%, rgba(10, 30, 60, 0.45)); justify-content: flex-end; }
#overlay > .panel.side { margin: auto 0 auto auto; max-width: 400px; gap: 10px; }
.gar-head { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 8px; }
.gar-head h2 { font-size: 24px; }
.panel .tabs { width: 100%; display: flex; }
.panel .tabs button { flex: 1; padding: 0 6px; }
.panel .tabs button.on { background: var(--accent); color: var(--accent-ink); }
#gar-body { width: 100%; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; width: 100%; }
.panel button.sw { min-height: 40px; padding: 0; border-radius: 50%; aspect-ratio: 1; background: var(--c); border: 3px solid rgba(255, 255, 255, 0.35); }
.panel button.sw:hover { background: var(--c); }
.panel button.sw.on { border-color: #fff; transform: scale(1.1); box-shadow: 0 0 0 3px var(--accent); }
.finishes, .horns { width: 100%; }
.panel .finishes button, .panel .horns button { min-height: 36px; padding: 0 10px; font-size: 14px; }
.panel .finishes button.on, .panel .horns button.on { background: var(--accent); color: var(--accent-ink); }
.panel button small { font-weight: 700; opacity: 0.8; }
.ups { width: 100%; display: flex; flex-direction: column; gap: 6px; }
.up, .slot { display: flex; align-items: center; gap: 10px; background: rgba(255, 255, 255, 0.08); border-radius: 14px; padding: 6px 8px; text-align: left; width: 100%; }
.up .ic { font-size: 24px; }
.up .nm, .slot .nm { flex: 1; display: flex; flex-direction: column; font-size: 14px; }
.up .nm small, .slot .nm small { color: var(--muted); font-weight: 600; }
.up .ok, .slot .ok { color: var(--good); font-weight: 800; font-size: 14px; }
.panel .up button, .panel .slot button { min-height: 36px; padding: 0 12px; font-size: 14px; }
.panel .slot button.subtle { padding: 0 6px; }
.cars { width: 100%; display: flex; flex-direction: column; gap: 6px; }
.slot.empty { color: var(--muted); font-weight: 700; justify-content: center; min-height: 48px; }
.slot .dot { width: 26px; height: 26px; border-radius: 50%; background: var(--c); border: 2px solid #fff; flex: none; }
.sub { font-weight: 800; font-size: 14px; align-self: flex-start; }
.gar-msg, .map-msg { background: rgba(255, 255, 255, 0.92); color: #23415a; border-radius: 12px; padding: 6px 12px; font-weight: 800; font-size: 14px; }
.warn { color: #ffd0a0; }

/* map screen */
#overlay > .panel.wide { max-width: 980px; padding: 16px; }
.map-wrap { display: flex; gap: 16px; width: 100%; align-items: stretch; }
#bigmap { width: min(62vh, 560px); height: min(62vh, 560px); border-radius: 18px; flex: none; cursor: pointer; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35); touch-action: none; }
.map-side { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; max-height: min(62vh, 560px); }
#map-list { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; flex: 1; touch-action: pan-y; padding: 3px; }
.panel #map-list button { min-height: 38px; font-size: 15px; text-align: left; }
.panel #map-list button.locked { opacity: 0.45; cursor: default; }
@media (max-width: 700px), (max-height: 450px) {
  .map-wrap { gap: 10px; }
  #bigmap { width: min(calc(100vh - 56px), 52vw); height: min(calc(100vh - 56px), 52vw); }
  .map-side { max-height: calc(100vh - 56px); }
  .map-side h2 { font-size: 20px; }
  #overlay > .panel.wide { padding: 10px; }
}

/* photo mode */
#photo-ui { position: fixed; inset: 0; display: none; pointer-events: none; z-index: 3; }
body[data-state="photo"] #photo-ui { display: block; }
body[data-state="photo"] #bubbles, body[data-state="photo"] #banner, body[data-state="photo"] #prompt { display: none; }
#ph-vig { position: absolute; inset: 0; opacity: 0; background: radial-gradient(ellipse at center, rgba(40, 20, 0, 0) 45%, rgba(40, 20, 0, 1) 100%); }
#ph-tilt .band { position: absolute; left: 0; right: 0; height: 36%; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
#ph-tilt .top { top: 0; -webkit-mask-image: linear-gradient(#000, transparent); mask-image: linear-gradient(#000, transparent); }
#ph-tilt .bottom { bottom: 0; -webkit-mask-image: linear-gradient(transparent, #000); mask-image: linear-gradient(transparent, #000); }
.ph-frame { position: absolute; inset: 0; }
.ph-frame .st, .ph-frame .cap { display: none; }
.ph-frame.postcard { border: solid #fffaf0; border-width: 3.5vmin 3.5vmin 13vmin; }
.ph-frame.postcard .cap { display: block; position: absolute; left: 0; right: 0; bottom: -13vmin; height: 13vmin; line-height: 13vmin; text-align: center; color: #e8524a; font-weight: 900; font-style: italic; font-size: 5.4vmin; }
.ph-frame.stickers .st { display: block; position: absolute; font-size: 10vmin; transform: translate(-50%, -50%); }
.st.s1 { left: 7%; top: 11%; }
.st.s2 { left: 93%; top: 11%; }
.st.s3 { left: 7%; top: 89%; }
.st.s4 { left: 93%; top: 89%; }
#ph-flash { position: absolute; inset: 0; background: #fff; opacity: 0; }
#ph-flash.go { animation: flash 0.45s ease-out; }
@keyframes flash { from { opacity: 0.85; } to { opacity: 0; } }
.ph-top { position: absolute; top: max(10px, env(safe-area-inset-top)); left: var(--gutter); right: var(--gutter-r); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
.ph-help { font-size: 13px; font-weight: 700; color: var(--ink); }
#ph-spot { background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 4px 12px; font-weight: 900; font-size: 14px; text-shadow: none; }
.ph-zoom { position: absolute; right: var(--gutter-r); top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 10px; pointer-events: auto; }
.ph-zoom .icon-btn { width: 46px; height: 46px; font-size: 22px; font-weight: 900; color: #fff; }
.ph-bar { position: absolute; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; align-items: center; gap: 8px; pointer-events: auto; background: rgba(10, 30, 50, 0.6); border-radius: 999px; padding: 6px 8px; white-space: nowrap; }
.ph-bar button, #photo-result button, #photo-result .btn { min-height: 42px; padding: 0 14px; border-radius: 999px; background: rgba(255, 255, 255, 0.16); font-weight: 800; font-size: 15px; color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; }
.ph-bar .snap { background: var(--accent); color: var(--accent-ink); font-size: 17px; }
#ph-filter-name { font-weight: 800; min-width: 128px; text-align: center; }
#photo-result { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 12px; align-items: center; justify-content: center; background: rgba(10, 30, 60, 0.7); pointer-events: auto; padding: 16px; }
#photo-result[hidden] { display: none; }
#ph-img { max-width: min(80vw, 760px); max-height: 62vh; border-radius: 10px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4); transform: rotate(-1.5deg); background: #fff; }
@media (max-height: 450px) {
  .ph-help { display: none !important; }
  .ph-bar { gap: 4px; padding: 4px 6px; }
  .ph-bar button { min-height: 38px; padding: 0 10px; font-size: 14px; }
  #ph-filter-name { min-width: 104px; font-size: 14px; }
  #overlay > .panel.side { max-width: 380px; padding: 12px 14px; }
  .swatches { gap: 6px; }
  .panel button.sw { min-height: 32px; }
}

/* fast travel iris wipe */
#iris { position: fixed; inset: 0; z-index: 5; pointer-events: none; overflow: hidden; }
#iris-hole { position: absolute; left: 50%; top: 50%; width: 160vmax; height: 160vmax; border-radius: 50%; box-shadow: 0 0 0 200vmax #1b2b44; transform: translate(-50%, -50%) scale(1); }
#iris-label { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); text-align: center; font-weight: 900; font-size: clamp(22px, 5vw, 36px); opacity: 0; transition: opacity 0.2s; }

/* ------------------------------------------- back to the road (rescue.js) ---- */
#btn-unstuck {
  position: fixed; left: 50%; bottom: max(78px, calc(env(safe-area-inset-bottom) + 64px));
  transform: translateX(-50%);
  z-index: 3; pointer-events: auto;
  background: #ff7a59; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  border: 3px solid rgba(255, 255, 255, 0.85); border-radius: 999px;
  padding: 10px 20px; font-weight: 900; font-size: 16px; white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  animation: unstuckpop 0.35s ease-out, unstuckbob 1.6s ease-in-out 0.35s infinite;
}
#btn-unstuck[hidden], body:not([data-state="playing"]) #btn-unstuck { display: none; }
#btn-unstuck:active { transform: translateX(-50%) scale(0.94); }
/* touch: bottom centre, between the stick and the action buttons */
body.touch #btn-unstuck { bottom: max(18px, calc(env(safe-area-inset-bottom) + 8px)); padding: 12px 18px; font-size: 15px; }
@keyframes unstuckpop { from { opacity: 0; transform: translateX(-50%) scale(0.6); } to { opacity: 1; transform: translateX(-50%) scale(1); } }
@keyframes unstuckbob { 0%, 100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(-4px); } }

/* ------------------------------------------------ intro flyover (intro.js) ---- */
#intro { position: fixed; inset: 0; z-index: 6; pointer-events: none; overflow: hidden; }
#intro .lb { position: absolute; left: 0; right: 0; height: 11vh; background: #10203a; transition: transform 0.9s ease-in-out; }
#intro .lb.top { top: 0; }
#intro .lb.bottom { bottom: 0; }
#intro.out .lb.top, #intro.k-still .lb { transform: translateY(-100%); }
#intro.out .lb.bottom { transform: translateY(100%); }
#intro.k-still .lb.bottom { transform: translateY(100%); }
#intro-card {
  position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%) scale(0.85);
  text-align: center; opacity: 0; transition: opacity 0.8s, transform 0.8s cubic-bezier(0.3, 1.5, 0.5, 1);
  text-shadow: 0 3px 0 rgba(20, 50, 80, 0.55), 0 6px 22px rgba(0, 0, 0, 0.35);
  width: calc(100% - 32px);
}
#intro-card.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
#intro .in-name { font-size: clamp(38px, 9vw, 92px); font-weight: 900; color: #fffdf6; letter-spacing: 1px; line-height: 1.05; -webkit-text-stroke: 2px rgba(20, 50, 80, 0.35); }
#intro .in-sub { margin-top: 6px; font-size: clamp(17px, 3.2vw, 28px); font-weight: 800; color: var(--accent); }
#intro .in-skip { position: absolute; right: var(--gutter-r); bottom: calc(11vh + 10px); font-size: 14px; font-weight: 800; color: rgba(255, 255, 255, 0.85); background: rgba(10, 30, 50, 0.45); border-radius: 999px; padding: 4px 12px; }
#intro.k-still { background: radial-gradient(circle at 50% 40%, rgba(255, 220, 120, 0.25), rgba(10, 30, 60, 0.5)); }
#intro.k-still .in-skip { bottom: max(16px, env(safe-area-inset-bottom)); }
body[data-state="intro"] #banner, body[data-state="intro"] #bubbles, body[data-state="intro"] #prompt { display: none; }
@media (prefers-reduced-motion: reduce) {
  #intro .lb, #intro-card { transition: opacity 0.4s; }
}

/* ------------------------------------------- achievements (achievements.js) ---- */
#ach-toast {
  position: fixed; left: 50%; top: max(64px, calc(env(safe-area-inset-top) + 56px)); z-index: 7;
  display: flex; align-items: center; gap: 12px; text-align: left;
  background: linear-gradient(135deg, #fff6d6, #ffe08a); color: #4a3200;
  border: 3px solid #fff; border-radius: 20px; padding: 8px 18px 8px 10px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.3); max-width: min(92vw, 460px);
  opacity: 0; transform: translate(-50%, -24px) scale(0.9); transition: opacity 0.3s, transform 0.45s cubic-bezier(0.3, 1.6, 0.5, 1);
  pointer-events: none;
}
#ach-toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
#ach-toast .badge { font-size: 38px; width: 54px; height: 54px; display: grid; place-items: center; background: #fff; border-radius: 50%; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.08); flex: none; }
#ach-toast.show .badge { animation: achspin 0.7s ease-out; }
#ach-toast .txt { display: flex; flex-direction: column; min-width: 0; }
#ach-toast small { font-size: 12px; font-weight: 800; color: #9a6a00; text-transform: uppercase; letter-spacing: 0.5px; }
#ach-toast b { font-size: 18px; font-weight: 900; }
#ach-toast .txt > span { font-size: 13px; font-weight: 700; opacity: 0.85; }
@keyframes achspin { from { transform: scale(0.3) rotate(-30deg); } 60% { transform: scale(1.2) rotate(8deg); } to { transform: none; } }
body:not([data-state="playing"]) #ach-toast { display: none; }   /* waits for play (queued) */
.ach-grid { width: 100%; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; text-align: left; }
.ach { display: flex; gap: 10px; align-items: center; background: rgba(255, 255, 255, 0.08); border-radius: 14px; padding: 8px 10px; opacity: 0.75; }
.ach.ok { background: rgba(255, 201, 60, 0.22); opacity: 1; box-shadow: inset 0 0 0 2px rgba(255, 201, 60, 0.6); }
.ach .badge { font-size: 28px; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, 0.14); flex: none; filter: grayscale(1); }
.ach.ok .badge { filter: none; background: #fff6d6; }
.ach .txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; font-size: 12px; color: var(--muted); font-weight: 600; }
.ach .txt b { font-size: 15px; color: var(--ink); font-weight: 900; }
.ach .txt small { font-size: 11px; font-weight: 800; }
.ach .when { color: var(--accent); }
.ach .bar { display: block; height: 6px; background: rgba(255, 255, 255, 0.15); border-radius: 3px; overflow: hidden; margin-top: 3px; }
.ach .bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.ach.secret .txt span { font-style: italic; }
@media (max-height: 450px) {
  .ach-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; }
  .ach { padding: 5px 8px; }
  .ach .badge { width: 36px; height: 36px; font-size: 22px; }
  #ach-toast { top: 50px; padding: 5px 14px 5px 6px; }
  #ach-toast .badge { width: 42px; height: 42px; font-size: 28px; }
  #ach-toast b { font-size: 15px; }
}
