/* Climb Daily v2 — one screen, one gesture. Two themes for comparison: retro (default) and clean. */

:root,
[data-theme="retro"] {
  --bg: #1d1a2f;
  --panel: #2a2645;
  --ink: #fbf5e6;
  --muted: #a9a3c7;
  --accent: #ffb000;
  --accent-ink: #1d1a2f;
  --good: #3ccf6e;
  --bad: #ef4b4b;
  --wall: #34305a;
  --wall-line: #2a2649;
  --line: #000;
  --border: 3px solid #000;
  --shadow: 4px 4px 0 #000;
  --radius: 0;
  --font: 'Bricolage Grotesque', system-ui, sans-serif;
  --font-display: 'Press Start 2P', ui-monospace, monospace;
  --hold-1: #ef5b3a;
  --hold-2: #2fb5d9;
  --hold-3: #9b5de5;
  --hold-ink: #fff;
  --hold-shadow: 0 2px 0 #000, 2px 0 0 #000, -2px 0 0 #000, 0 -2px 0 #000;
  --skin: #f2c7a0;
  --shirt: #ffb000;
  --pants: #3a6ea5;
  --hair: #b4864e;
  --shoes: #ef4b4b;
  --helmet: #ef4b4b;
  --rope: #e8e3ff;
  --holes: rgba(0, 0, 0, .35);
  --chip-1: #f2c14e;
  --chip-2: #7ad3a6;
  --chip-3: #f28ab2;
  --route: #2ec4b6;
  --sling: #ffb000;
  --mat: #2f4f8a;
  --sky-top: #2b2350;
  --sky-bottom: #c86b5a;
  --trees: #1f2a3a;
  --ground: #3b3a2e;
  --rock-light: #9a8f86;
  --rock-dark: #5e5650;
  --pad-1: #ef4b4b;
  --pad-2: #2fb5d9;
  --ledge: #b9ada0;
}

[data-theme="clean"] {
  --bg: #f4efe3;
  --panel: #fffaf0;
  --ink: #1f2e27;
  --muted: #6b766f;
  --accent: #b84d2a;
  --accent-ink: #fff;
  --good: #3f8f5a;
  --bad: #c2412d;
  --wall: #e6dcc6;
  --wall-line: #d9cdb2;
  --line: #d6cbb3;
  --border: 1px solid #d6cbb3;
  --shadow: 0 6px 18px rgba(60, 40, 10, .12);
  --radius: 18px;
  --font: 'Bricolage Grotesque', system-ui, sans-serif;
  --font-display: 'Bricolage Grotesque', system-ui, sans-serif;
  --hold-1: #d9653b;
  --hold-2: #3d8fb0;
  --hold-3: #7e6bb5;
  --hold-ink: #fff;
  --hold-shadow: 0 1px 2px rgba(0, 0, 0, .35);
  --shirt: #b84d2a;
  --pants: #1f2e27;
  --shoes: #3d8fb0;
  --helmet: #3d8fb0;
  --hair: #a87b46;
  --rope: #6b766f;
  --holes: rgba(31, 46, 39, .22);
  --chip-1: #e3b448;
  --chip-2: #6fa88a;
  --chip-3: #c9849a;
  --route: #2a9d8f;
  --sling: #b84d2a;
  --mat: #34588c;
  --sky-top: #9fd0e8;
  --sky-bottom: #eef3e6;
  --trees: #7fa37a;
  --ground: #a99a72;
  --rock-light: #d9d2c4;
  --rock-dark: #a39887;
  --pad-1: #b84d2a;
  --pad-2: #3d8fb0;
  --ledge: #e6ddcd;
}

* { box-sizing: border-box; margin: 0; }
/* manipulation = no double-tap zoom (on iPhone it enlarged the page by mistake), but the pinch stays free:
   blocking it leaves the page enlarged with no way back, and it is an accessibility problem too. */
html, body { height: 100%; touch-action: manipulation; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }

#app {
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  padding: max(10px, env(safe-area-inset-top)) 14px max(12px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 22px;
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .02em;
  transition: transform .08s;
}
.btn:active { transform: translate(2px, 2px); box-shadow: none; }
[data-theme="clean"] .btn:active { transform: scale(.98); box-shadow: var(--shadow); }
.btn.ghost { background: var(--panel); color: var(--ink); font-size: 16px; min-height: 44px; }
.btn.small { min-height: 38px; font-size: 14px; padding: 0 12px; }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 34px; padding: 0 10px;
  border: var(--border); border-radius: var(--radius);
  background: var(--panel); font-size: 14px; font-weight: 600;
}
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

/* ---------- Home ---------- */
.home { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: space-between; text-align: center; gap: 10px; }
.toolbar { width: 100%; display: flex; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.toolbar .group { display: flex; gap: 6px; }
/* ? on the left, ⚙️ on the right: the only two things above the logo */
.topbar { width: 100%; display: flex; justify-content: space-between; }
.icon-btn {
  width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center;
  border: var(--border); border-radius: var(--radius);
  background: var(--panel); color: var(--ink); font-size: 18px; font-weight: 700;
}
.logo { font-family: var(--font-display); font-size: clamp(32px, 9.5vw, 44px); line-height: .95; font-weight: 500; letter-spacing: -.01em; }
.logo span { color: var(--accent); display: block; }
[data-theme="retro"] .logo { text-shadow: 4px 4px 0 #000; letter-spacing: .02em; }
.tagline { color: var(--muted); font-size: 16px; margin-top: 6px; }
.hero { position: relative; width: min(260px, 70vw); aspect-ratio: 1; border: var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.hero .wall { position: absolute; inset: 0; }
/* Each world shows its own scene. Outdoor is a crop of the limestone crag: the game already bakes that
   picture (assets/crag-flat), so the home stays cheap and the file is warm by the time you tap "Gioca". */
.hero.outdoor .wall { background: #b9a384 url(assets/crag-flat.webp) 42% 60% no-repeat; }
.hero.outdoor.bloc .wall { background: #3f5a3a; } /* boulder outdoor: the block canvas covers the box, no crag picture to download */
.hero.indoor .wall { background-color: #46305e; }
.hero .deco { position: absolute; width: 26%; height: 12%; }
.dateline { font-size: 15px; color: var(--muted); }
.dateline b { color: var(--ink); }
.streak { font-size: 15px; font-weight: 700; }
.disc-today { font-size: 15px; font-weight: 700; margin-top: 2px; }
.disc-today span { font-weight: 500; color: var(--muted); }
.cta { width: 100%; display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.cta .btn { min-height: 62px; font-size: 26px; }
/* API mode: no connection, no via: the home says why instead of Play, with a retry */
.cta .offline { margin: 0; text-align: center; font-weight: 700; color: var(--ink); }
.cta .btn[disabled] { opacity: .6; }
.meta { color: var(--muted); font-size: 14px; }
.fine { color: var(--muted); font-size: 11px; opacity: .8; }

/* ---------- Play ---------- */
.bar { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.bar .exit { width: 40px; height: 40px; border: var(--border); border-radius: var(--radius); background: var(--panel); font-size: 18px; line-height: 1; }
.pips { flex: 1; display: flex; gap: 6px; justify-content: center; }
.pip { width: 26px; height: 18px; border: var(--border); border-radius: 999px; background: var(--panel); position: relative; }
[data-theme="retro"] .pip { border-radius: 0; }
.pip.crux { width: 34px; }
.pip.crux::after { content: '★'; position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; line-height: 1; color: var(--muted); }
.pip.now { background: var(--accent); animation: pulse 1s infinite alternate; }
.pip.ok { background: var(--good); }
.pip.bad { background: var(--bad); }
.pip.part { background: var(--accent); }
.pip.now::after, .pip.ok::after, .pip.bad::after, .pip.part::after { color: var(--accent-ink); }
@keyframes pulse { to { opacity: .55; } }
.score { min-width: 64px; text-align: right; font-family: var(--font-display); font-weight: 700; font-size: 22px; }
.score small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); margin-top: -2px; }

.ask { min-height: 92px; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.ask .tag { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.ask h2 { font-family: var(--font); font-size: clamp(19px, 5.4vw, 24px); line-height: 1.15; font-weight: 700; }
.ask .hint { font-size: 14px; color: var(--muted); }

.wall {
  position: relative;
  flex: 1;
  min-height: 0;
  border: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background-color: var(--wall);
  transition: background-position .6s ease-out;
}
[data-theme="retro"] .wall { background-image: linear-gradient(175deg, rgba(255, 255, 255, .05), transparent 60%); }
[data-theme="clean"] .wall { background-image: linear-gradient(175deg, rgba(255, 255, 255, .45), transparent 60%); }

.hold {
  position: absolute;
  width: 60%;
  min-height: 70px;
  padding: 12px 18px;
  border: 0;
  background: none;
  display: grid;
  place-items: center;
  text-align: center;
  z-index: 2;
  animation: holdIn .42s cubic-bezier(.2, 1.4, .5, 1) both;
}
.hold:nth-of-type(1) { left: 3%; top: 3%; }
.hold:nth-of-type(2) { right: 3%; top: 26%; animation-delay: .07s; }
.hold:nth-of-type(3) { left: 6%; top: 49%; animation-delay: .14s; }
.hold svg.shape { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; z-index: -1; filter: drop-shadow(var(--hold-drop, 0 4px 0 rgba(0, 0, 0, .35))); }
[data-theme="clean"] .hold svg.shape { --hold-drop: 0 5px 8px rgba(60, 40, 10, .25); }
.hold .label { padding: 0 18px 0 4px; color: var(--hold-ink); font-weight: 700; font-size: clamp(16px, 4.6vw, 19px); line-height: 1.1; text-shadow: var(--hold-shadow); }
.hold:active { transform: scale(.96); }
.hold.c1 { --c: var(--hold-1); }
.hold.c2 { --c: var(--hold-2); }
.hold.c3 { --c: var(--hold-3); }
.hold .fill { fill: var(--c); }
.hold .edge { fill: none; stroke: #000; stroke-width: 3; vector-effect: non-scaling-stroke; }
[data-theme="clean"] .hold .edge { stroke: rgba(0, 0, 0, .18); stroke-width: 1.5; }
.hold.right .fill { fill: var(--good); }
.hold.dim { opacity: .35; }
.hold.break { animation: crumble .7s ease-in forwards; }
.hold.right { animation: pop .4s ease-out; }
@keyframes holdIn { from { opacity: 0; transform: translateY(-40px) scale(.8); } }
@keyframes pop { 50% { transform: scale(1.08); } }
@keyframes crumble {
  0%, 30% { transform: translateX(0); }
  10% { transform: translateX(-6px) rotate(-3deg); }
  20% { transform: translateX(6px) rotate(3deg); }
  100% { transform: translateY(260px) rotate(28deg); opacity: 0; }
}


.banner {
  position: absolute; left: 50%; top: 42%; z-index: 6;
  transform: translate(-50%, -50%) rotate(-4deg);
  padding: 10px 18px; white-space: nowrap;
  border: var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  background: var(--accent); color: var(--accent-ink);
  font-family: var(--font-display); font-weight: 800; font-size: 26px;
  animation: banner 1.3s ease-in-out forwards; pointer-events: none;
}
@keyframes banner {
  0% { transform: translate(-50%, -50%) scale(.2) rotate(-4deg); opacity: 0; }
  20%, 75% { transform: translate(-50%, -50%) scale(1) rotate(-4deg); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.3) rotate(-4deg); opacity: 0; }
}

/* Crux: year slider */
.yearbox { position: absolute; inset: 6% 6% auto; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.year {
  font-family: var(--font-display); font-weight: 800; font-size: clamp(56px, 18vw, 80px); line-height: 1;
  padding: 8px 18px; background: var(--panel); border: var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  font-variant-numeric: tabular-nums;
}
.year.truth { color: var(--good); }
.slider-row { width: 100%; display: flex; align-items: center; gap: 8px; }
.slider-row .step { width: 48px; height: 48px; flex: none; border: var(--border); border-radius: var(--radius); background: var(--panel); font-size: 24px; font-weight: 700; }
input[type="range"] { flex: 1; appearance: none; height: 48px; background: transparent; touch-action: pan-x; }
input[type="range"]::-webkit-slider-runnable-track { height: 12px; background: var(--panel); border: var(--border); border-radius: var(--radius); }
input[type="range"]::-moz-range-track { height: 12px; background: var(--panel); border: var(--border); border-radius: var(--radius); }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 30px; height: 36px; margin-top: -15px; background: var(--accent); border: var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
input[type="range"]::-moz-range-thumb { width: 30px; height: 36px; background: var(--accent); border: var(--border); border-radius: var(--radius); }
[data-theme="clean"] input[type="range"]::-webkit-slider-thumb { border-radius: 50%; width: 32px; height: 32px; margin-top: -12px; }
.range-ends { width: 100%; display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); padding: 0 56px; margin-top: -8px; }
.yearbox .btn { width: 70%; }

/* Feedback sheet */
.sheet {
  position: absolute; left: 8px; right: 8px; bottom: 8px; z-index: 5; max-height: calc(100% - 16px); overflow-y: auto;
  padding: 14px; display: flex; flex-direction: column; gap: 8px;
  background: var(--panel); border: var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  animation: sheetIn .3s cubic-bezier(.2, 1.2, .5, 1) both;
}
@keyframes sheetIn { from { transform: translateY(110%); } }
.sheet .head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.sheet .verdict { font-family: var(--font-display); font-size: 26px; font-weight: 800; }
.sheet .verdict.ok { color: var(--good); }
.sheet .verdict.bad { color: var(--bad); }
.sheet .pts { font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--accent); }
.sheet .answer { font-size: 15px; font-weight: 700; }
.sheet .note { font-size: 13px; color: var(--muted); margin-top: -4px; }
.sheet p { font-size: 15px; line-height: 1.35; color: var(--muted); }
.sheet .btn { width: 100%; }

.pump { display: flex; align-items: center; gap: 10px; min-height: 30px; }
.pump span { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); min-width: 52px; }
.meter { flex: 1; height: 16px; border: var(--border); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--good), var(--accent) 55%, var(--bad)); background-size: 300px 100%; }
[data-theme="retro"] .meter i { background: repeating-linear-gradient(90deg, var(--accent) 0 10px, transparent 10px 12px); }
.meter.high i { background: repeating-linear-gradient(90deg, var(--bad) 0 10px, transparent 10px 12px); }
[data-theme="clean"] .meter.high i { background: var(--bad); }

/* ---------- Result ---------- */
.result { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px; }
.grade-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.grade-label { font-size: 14px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.recap { list-style: none; padding: 8px 12px; width: 100%; background: var(--panel); border: var(--border); border-radius: var(--radius); display: flex; flex-direction: column; gap: 4px; text-align: left; }
.recap li { display: grid; grid-template-columns: 22px 92px 1fr auto; gap: 6px; align-items: center; font-size: 14px; }
.recap .what { color: var(--muted); }
.recap .ans { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.linkish { background: none; border: 0; color: var(--muted); font-size: 13px; text-decoration: underline; padding: 4px; }
.result .kicker { font-size: 15px; color: var(--muted); }
.badge {
  display: grid; place-items: center; width: min(150px, 40vw); aspect-ratio: 1;
  background: var(--accent); color: var(--accent-ink);
  border: var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  font-family: var(--font-display); font-weight: 800; font-size: clamp(48px, 14vw, 66px); line-height: 1;
  animation: pop .6s ease-out;
}
[data-theme="clean"] .badge { border-radius: 50%; }
.tier { font-family: var(--font-display); font-size: 30px; font-weight: 800; letter-spacing: .04em; }
.tier-line { color: var(--muted); font-size: 16px; }
.big-score { font-size: 18px; font-weight: 700; }
.result .pips { flex: none; }
.result .actions { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.result .actions .btn:first-child { min-height: 58px; font-size: 22px; }
.result .row { display: flex; gap: 8px; }
.result .row .btn { flex: 1; }
.countdown { font-size: 14px; color: var(--muted); }
.countdown b { color: var(--ink); font-variant-numeric: tabular-nums; }

.overlay { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, .55); display: flex; align-items: flex-end; justify-content: center; }
.overlay .panel {
  width: min(480px, 100%); max-height: 82dvh; overflow: auto; overscroll-behavior: contain;
  background: var(--bg); border: var(--border); border-radius: var(--radius) var(--radius) 0 0;
  padding: 16px 16px max(16px, env(safe-area-inset-bottom)); text-align: left;
}
.overlay h3 { font-family: var(--font); font-size: 22px; margin-bottom: 10px; }
.overlay ol { padding-left: 20px; display: flex; flex-direction: column; gap: 12px; }
.overlay li p { font-size: 15px; line-height: 1.35; }
.overlay li .q { font-weight: 700; }
.overlay li a { font-size: 13px; color: var(--muted); }
.overlay .btn { width: 100%; margin-top: 14px; }

/* "How to play" and settings: one sheet each, same shape as the facts panel */
.how-intro { font-size: 15px; line-height: 1.35; color: var(--muted); }
.how-list { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.how-list li { display: grid; grid-template-columns: 26px auto; column-gap: 8px; font-size: 14px; line-height: 1.3; }
.how-list .how-ico { grid-row: span 2; font-size: 20px; text-align: center; }
.how-list b { font-size: 15px; }
.how-list li span:last-child { color: var(--muted); }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--wall-line); font-size: 15px; font-weight: 600; }
.set-row .group { display: flex; gap: 6px; }
/* API mode only (the platform serves /privacy): one quiet line under the settings */
.privacy-link { margin-top: 10px; font-size: 13px; text-align: center; }
.privacy-link a { color: inherit; }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 30; width: max-content; max-width: calc(100vw - 48px); text-align: center; padding: 10px 16px; background: var(--ink); color: var(--bg); border-radius: var(--radius); font-weight: 700; }

@media (max-height: 740px) {
  .result { gap: 8px; }
  .badge { width: 104px; font-size: 44px; }
  .tier { font-size: 24px; }
  .tier-line, .big-score { font-size: 14px; }
  .recap { padding: 6px 10px; gap: 2px; }
  .recap li { font-size: 13px; }
  .result .actions { gap: 6px; }
  .result .actions .btn:first-child { min-height: 50px; font-size: 20px; }
  .result .actions .btn.ghost { min-height: 40px; font-size: 14px; }
}

@media (max-height: 640px) {
  .ask { min-height: 76px; }
  .ask h2 { font-size: 18px; }
  .hold { min-height: 58px; padding: 8px 14px; }
  .hero { width: min(200px, 60vw); }
  .badge { width: 110px; font-size: 48px; }
  .result { gap: 8px; }
  .tier { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Retro display font: Press Start 2P keeps lowercase (8c vs 8C matters for grades) and stays crisp.
   It has one weight and is wide, so sizes are tuned down here; never synthesize bold. */
[data-theme="retro"] .logo { font-size: clamp(24px, 7.5vw, 32px); line-height: 1.2; font-weight: 400; letter-spacing: 0; }
[data-theme="retro"] .badge { font-size: clamp(30px, 10vw, 40px); font-weight: 400; }
[data-theme="retro"] .tier { font-size: 18px; font-weight: 400; letter-spacing: 0; line-height: 1.4; }
[data-theme="retro"] .sheet .verdict { font-size: 18px; font-weight: 400; }
[data-theme="retro"] .banner { font-size: 15px; font-weight: 400; padding: 12px 16px; }
@media (max-height: 740px) {
  [data-theme="retro"] .badge { font-size: 30px; }
  [data-theme="retro"] .tier { font-size: 16px; }
}

/* Numbers that must be read precisely use the readable font, even in Retro. */
.year, .score, .sheet .pts { font-family: var(--font); font-weight: 800 !important; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

/* Climber canvas layer (climber.js) */
.climber-canvas, .wall-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
.wall-canvas { z-index: 0; }
.hero .climber-canvas { z-index: 2; }
.hero .hold.deco { z-index: 1; }
/* Answer volumes */
.hold .facet { fill: rgba(255, 255, 255, .22); }
.hold .grip { fill: rgba(0, 0, 0, .38); }
.hold .screw { fill: rgba(255, 255, 255, .5); }

/* Crux slider: wrapper for the right-year marker, guess shown after locking */
.track-wrap { position: relative; flex: 1; display: flex; align-items: center; }
.track-wrap input[type="range"] { width: 100%; }
.truth-mark { position: absolute; top: 2px; bottom: 2px; width: 4px; margin-left: -2px; background: var(--good); border-radius: 2px; pointer-events: none;
  /* the native thumb is ~30px wide, so the usable track is inset by half a thumb on each side */
  left: 0; transform: translateX(calc(15px - 30px * var(--p, 0))); }
#guessLine { font-weight: 700; color: var(--ink); }
.slider-row .step { touch-action: none; user-select: none; -webkit-user-select: none; }

/* Scenes can lower the whole wall (e.g. topping out a boulder): answers follow the canvas camera. */
.wall .hold, .wall .yearbox { translate: 0 var(--cam, 0px); }

/* Answers pinned to the perspective wall: hidden until placed, then fade in at their anchor. */
.wall .hold.persp { opacity: 0; transition: opacity .25s; animation: none; width: 42% !important; min-height: 56px !important; padding-top: 12px !important; }
.wall .hold.persp .label { font-size: 15px; }
.wall .hold.persp.placed { opacity: 1; }
.wall .hold.persp.break { animation: crumble .7s ease-in forwards; }

/* Phones with browser bars: home and result may scroll instead of hiding buttons below the fold. */
#app { overflow-y: auto; -webkit-overflow-scrolling: touch; }
@media (max-height: 700px) {
  .home { gap: 8px; }
  .hero { width: min(170px, 46vw); }
  [data-theme="retro"] .logo { font-size: clamp(22px, 7vw, 28px); }
  .cta .btn { min-height: 52px; font-size: 22px; }
  .cta .btn.ghost { min-height: 40px; font-size: 16px; }
}

.lab-links { display: flex; gap: 8px; justify-content: center; width: 100%; }
.lab-links .btn { flex: 1; text-decoration: none; font-size: 13px; min-height: 38px; padding-inline: 6px; }

/* ---------- v3: estimate panels ---------- */
.est { position: absolute; left: 8px; right: 8px; top: 8px; z-index: 4; display: flex; flex-direction: column; gap: 10px; align-items: center;
  padding: 12px; background: var(--panel); border: var(--border); border-radius: var(--radius); box-shadow: var(--shadow); transition: opacity .35s, transform .35s; }
.est.gone { opacity: 0; transform: translateY(-16px); pointer-events: none; }
/* The map takes the whole wall, and the question above it shrinks, so the map gets most of the phone screen. */
.ask-where { min-height: 0; }
.est-map { inset: 3px; padding: 4px; gap: 6px; }
.est-map #map { position: relative; width: 100%; flex: 1; min-height: 220px; border-radius: max(0px, calc(var(--radius) - 6px)); overflow: hidden;
  background: radial-gradient(circle at 50% 45%, #2e2858 0%, #1d1a2f 75%); }
.globe-cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.globe-zoom { position: absolute; right: 8px; top: 8px; display: flex; flex-direction: column; gap: 6px; }
.globe-zoom button { width: 38px; height: 38px; border-radius: 8px; border: 2px solid #4a4175; background: #272248; color: #f3f0ff; font: 700 20px/1 var(--font); }
.est-map .btn, .est-order .btn, .est-chi .btn { width: 100%; }
.est-slider .btn { width: 70%; }
.est-slider .year { font-size: clamp(34px, 11vw, 56px); }
.est .btn:disabled { opacity: .45; }
.ord-card { width: 100%; display: grid; grid-template-columns: 36px 1fr auto; grid-template-rows: auto auto; align-items: center; column-gap: 8px; text-align: left;
  padding: 8px 10px; min-height: 54px; border: var(--border); border-radius: var(--radius); background: var(--bg); color: var(--ink); }
.ord-n { grid-row: span 2; width: 30px; height: 30px; border-radius: 50%; border: 2px dashed var(--muted); display: grid; place-items: center; font-weight: 800; }
.ord-card.picked .ord-n { background: var(--accent); color: var(--accent-ink); border-style: solid; border-color: var(--accent); }
.ord-name { font-weight: 800; font-size: 16px; }
.ord-who { grid-column: 2; font-size: 12px; color: var(--muted); }
.ord-year { grid-column: 3; grid-row: 1 / span 2; font-weight: 800; font-size: 18px; font-variant-numeric: tabular-nums; }
.ord-card.right { border-color: var(--good); box-shadow: 0 0 0 2px var(--good) inset; }
.ord-card.wrong { border-color: var(--bad); box-shadow: 0 0 0 2px var(--bad) inset; }
/* "Chi": four names, one tap. Same card as the order round without the number, so four of them plus the
   question and the Blocca button still fit a 390×664 screen. */
.chi-card { width: 100%; padding: 10px 12px; min-height: 48px; text-align: left; font-weight: 800; font-size: 16px;
  border: var(--border); border-radius: var(--radius); background: var(--bg); color: var(--ink); }
/* "Cosa significa…?" (O7): four short sentences instead of four names, up to two lines each */
.chi-card.chi-term { font-size: 14px; font-weight: 700; line-height: 1.25; padding: 8px 12px; }
.chi-card.picked { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.chi-card.right { border-color: var(--good); box-shadow: 0 0 0 2px var(--good) inset; }
.chi-card.wrong { border-color: var(--bad); box-shadow: 0 0 0 2px var(--bad) inset; }
.pip.pip-est { width: 34px; height: 24px; display: grid; place-items: center; font-size: 13px; line-height: 1; }
.pip.pip-est::after { content: none; }
.sheet .guess { color: var(--muted); font-weight: 500; }
.leaflet-container { font: 12px var(--font); }

/* v4: indoor podium round */
.est-podium .ord-year { font-size: 20px; }

/* Map labels: country names and crags, shown by zoom level (classes z1..z7 on the map container) */
.map-country, .map-crag { pointer-events: none; display: none; }
.map-country span { display: block; transform: translate(-50%, -50%); white-space: nowrap; font: 700 11px/1 var(--font, sans-serif);
  letter-spacing: .04em; text-transform: uppercase; color: #6b5f48; text-shadow: 0 0 3px #efe6cf, 0 0 3px #efe6cf; }
/* countries from the start (big ones), the others as you zoom in */
.z1 .map-country.t1, .z3 .map-country.t2, .z4 .map-country.t3 { display: block; }
.z1:not(.z3) .map-country span { font-size: 9px; letter-spacing: .02em; }
.z5 .map-country span { font-size: 12px; }
.map-crag i { position: absolute; left: -4px; top: -4px; width: 8px; height: 8px; border-radius: 50%; background: #c0392b; border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.3); }
.map-crag span { position: absolute; left: 7px; top: -7px; white-space: nowrap; font: 700 12px/1 var(--font, sans-serif); color: #2b2318;
  text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 2px #fff; }
/* crags only after the answer is locked (they would give it away), names from zoom 4 */
.reveal .map-crag { display: block; }
.reveal:not(.z4) .map-crag span { display: none; }

/* Pump ("ghisa", D15): a slim bar next to the round tag. Empty for the first 10 s, then it fills in 20 s;
   the bar is moved by a 4 Hz tick (transform only) and the transition smooths the steps in between.
   The label stays in the body font, numbers too: Press Start 2P is for titles and badges only. */
.tagrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.tagrow .tag { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gh { flex: 0 1 150px; min-width: 112px; display: flex; align-items: center; gap: 6px; font: 700 11px/1 var(--font); letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted); opacity: .7; transition: opacity .3s; }
.gh.on { opacity: 1; color: var(--ink); }
.gh-bar { flex: 1; height: 10px; border: 2px solid var(--muted); border-radius: 3px; background: var(--panel); overflow: hidden; }
[data-theme="clean"] .gh-bar { border-width: 1px; }
.gh-bar i { display: block; height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: 0 50%; transition: transform .25s linear; }
.gh.high .gh-bar { border-color: var(--bad); }
.gh.high .gh-bar i { background: var(--bad); }
.gh em { min-width: 30px; text-align: right; font-style: normal; font-variant-numeric: tabular-nums; letter-spacing: 0; color: var(--bad); }
.gh.stopped .gh-bar i { transition: none; }
.sheet .pts-box { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.sheet .pump-cost { font: 700 13px/1.1 var(--font); color: var(--bad); white-space: nowrap; }
.how-pump { font-size: 14px; line-height: 1.35; }
