/* Audioguida visitatore — tema scuro ad alto contrasto (grotte, musei, sole sul display all'aperto) */
:root {
  --bg: #0e1316;
  --bg2: #161d22;
  --bg3: #1f2930;
  --line: #2b3740;
  --fg: #eef2f4;
  --fg2: #a9b6be;
  --fg3: #6d7c86;
  --accent: #f5b942; /* luce calda */
  --accent-ink: #1b1405;
  --sea: #4cc3c9;
  --danger: #ff6b5e;
  --ok: #5fd38d;
  --radius: 18px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); }
body {
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; touch-action: manipulation; }
button:disabled { opacity: .4; cursor: default; }
.hidden { display: none !important; }

#app { display: flex; flex-direction: column; height: 100%; max-width: 560px; margin: 0 auto; }

/* ---------- barra superiore ---------- */
header.top {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  border-bottom: 1px solid var(--line); background: var(--bg);
}
header.top h1 { font-size: 17px; font-weight: 650; margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px;
  background: var(--bg3); font-size: 14px; font-weight: 600; white-space: nowrap;
}
.chip.ok { color: var(--ok); }
.chip.warn { color: var(--accent); }
.chip.gps-on { background: var(--sea); color: #04191a; }

main { flex: 1; overflow: auto; position: relative; }
.pad { padding: 18px 16px calc(18px + var(--safe-b)); }

/* ---------- scelta lingua ---------- */
.lang-pick h2 { font-size: 26px; line-height: 1.2; margin: 6px 0 6px; }
.lang-pick p { color: var(--fg2); margin: 0 0 18px; }
.langs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lang {
  padding: 18px 14px; border-radius: var(--radius); background: var(--bg2); border: 1px solid var(--line);
  text-align: left; font-size: 19px; font-weight: 600; min-height: 64px;
}
.lang small { display: block; font-size: 13px; color: var(--fg3); font-weight: 500; margin-top: 2px; }
.lang.suggested { border-color: var(--accent); }
.other { margin-top: 18px; display: flex; gap: 8px; }
select {
  flex: 1; font: inherit; color: var(--fg); background: var(--bg2); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px 12px; min-width: 0;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 18px; border-radius: 14px; background: var(--bg3); font-weight: 650; min-height: 52px;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.block { width: 100%; }
.progress { height: 8px; border-radius: 99px; background: var(--bg3); overflow: hidden; margin: 12px 0 6px; }
.progress > i { display: block; height: 100%; width: 0; background: var(--sea); transition: width .3s; }
.muted { color: var(--fg2); font-size: 15px; }
.note { color: var(--fg3); font-size: 13px; }

/* ---------- tastierino ---------- */
.keypad-view { display: flex; flex-direction: column; height: 100%; padding: 14px 16px calc(14px + var(--safe-b)); }
.display {
  height: 112px; border-radius: var(--radius); background: var(--bg2); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  font-size: 50px; line-height: 1.1; font-weight: 700; letter-spacing: 6px; gap: 4px; overflow: hidden; font-variant-numeric: tabular-nums;
}
.display .num-row { height: 56px; display: flex; align-items: center; }
.display .caret { width: 3px; height: 40px; border-radius: 2px; background: var(--accent); animation: blink 1s steps(1) infinite; }
.display .found { height: 22px; line-height: 22px; }
.display .found.err { color: var(--danger); }
@keyframes blink { 50% { opacity: 0; } }
.display .found { font-size: 15px; letter-spacing: 0; font-weight: 600; color: var(--accent); max-width: 92%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.display.shake { animation: shake .35s; border-color: var(--danger); }
@keyframes shake { 25% { transform: translateX(-8px); } 50% { transform: translateX(8px); } 75% { transform: translateX(-4px); } }
.keys { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; gap: 10px; margin-top: 12px; min-height: 300px; }
.key {
  border-radius: var(--radius); background: var(--bg2); border: 1px solid var(--line);
  font-size: 34px; font-weight: 650; font-variant-numeric: tabular-nums;
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.key:active { background: var(--bg3); transform: scale(.97); }
.key.go { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-size: 30px; }
.key.del { font-size: 26px; color: var(--fg2); }
.keypad-foot { display: flex; gap: 10px; margin-top: 12px; }
.keypad-foot .btn { flex: 1; }

/* ---------- player ---------- */
.player { display: flex; flex-direction: column; height: 100%; }
.player-head { padding: 14px 16px 8px; display: flex; gap: 12px; align-items: flex-start; }
.num {
  flex: none; min-width: 52px; height: 52px; padding: 0 8px; border-radius: 14px; background: var(--accent); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 800;
}
.player-head h2 { margin: 2px 0 0; font-size: 21px; line-height: 1.25; }
.player-head .meta { color: var(--fg3); font-size: 13px; margin-top: 3px; }
.transcript {
  flex: 1; overflow: auto; padding: 8px 18px 6px; font-size: 21px; line-height: 1.6;
  scroll-behavior: smooth;
}
.transcript.big { font-size: 25px; }
.seg { border-radius: 8px; padding: 2px 3px; margin: 0 -3px; cursor: pointer; transition: background .2s; }
.seg.cur { background: rgba(245, 185, 66, .10); }
/* le parole non ancora lette sono invisibili: il testo si "scrive" mentre la voce lo legge */
.w { visibility: hidden; color: var(--fg); }
.w.read { visibility: visible; color: var(--fg); }
.w.on { visibility: visible; color: var(--accent); }
.endcard { display: flex; flex-direction: column; gap: 10px; margin: 28px 0 12px; }
.endcard .end-title { text-align: center; color: var(--fg2); font-size: 15px; }
.end-pop .endcard .end-title { color: var(--fg); font-size: 26px; font-weight: 700; }
.end-pop .end-sub { text-align: center; color: var(--fg2); margin: 0 0 6px; }
.endcard .btn { min-height: 54px; font-size: 17px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.endcard .btn.primary { background: var(--accent); color: var(--accent-ink); }
.endcard .btn.primary span { font-size: 14px; font-weight: 500; opacity: .85; }
.machine { color: var(--fg3); font-size: 12px; padding: 0 18px 4px; }

.controls { border-top: 1px solid var(--line); background: var(--bg); padding: 10px 14px calc(12px + var(--safe-b)); }
.seek { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--fg2); font-variant-numeric: tabular-nums; }
.seek input { flex: 1; accent-color: var(--accent); height: 28px; }
.ctl { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.ctl button { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.ctl button:active { background: var(--bg3); }
.ctl .play { width: 74px; height: 74px; background: var(--accent); color: var(--accent-ink); }
.ctl svg { width: 28px; height: 28px; }
.ctl .play svg { width: 34px; height: 34px; }
.ctl .txt { font-size: 15px; font-weight: 700; }
.player-foot { display: flex; gap: 8px; margin-top: 8px; }
.player-foot .btn { flex: 1; min-height: 46px; padding: 10px; font-size: 15px; }

/* ---------- elenco ---------- */
.list { list-style: none; margin: 0; padding: 8px 0 calc(16px + var(--safe-b)); }
.list li button {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 16px; text-align: left;
  border-bottom: 1px solid var(--line);
}
.list .n { flex: none; width: 44px; height: 44px; border-radius: 12px; background: var(--bg3); display: flex; align-items: center; justify-content: center; font-weight: 750; }
.list .t { flex: 1; min-width: 0; }
.list .t b { display: block; font-weight: 600; }
.list .t small { color: var(--fg3); }
.list .s { flex: none; color: var(--fg3); font-size: 20px; }
.list .played .n { background: var(--ok); color: #062012; }

/* ---------- foglio pagamento / avvisi ---------- */
.sheet-wrap { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; justify-content: center; z-index: 20; }
.sheet {
  width: 100%; max-width: 560px; background: var(--bg2); border-radius: 22px 22px 0 0; padding: 22px 18px calc(22px + var(--safe-b));
  border-top: 1px solid var(--line); animation: up .2s ease-out;
}
@keyframes up { from { transform: translateY(40px); } }
.sheet h3 { margin: 0 0 6px; font-size: 22px; }
.sheet .price { font-size: 40px; font-weight: 800; margin: 10px 0; }
.sheet .btn + .btn { margin-top: 10px; }

.toast {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: max-content; max-width: min(88vw, 420px); text-align: center;
  background: rgba(14, 19, 22, .94); color: #fff; border: 1px solid var(--line); padding: 14px 20px; border-radius: 16px;
  font-weight: 600; line-height: 1.4; z-index: 70; box-shadow: 0 10px 40px rgba(0,0,0,.55);
}
.near {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(92vw, 440px);
  background: var(--sea); color: #04191a; border-radius: 22px; padding: 22px 20px; display: flex; flex-direction: column; align-items: stretch; gap: 16px; text-align: center;
  z-index: 65; /* sopra la mappa (35) e sopra il velo del blocco schermo (60) */
  font-weight: 700; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35), 0 20px 70px rgba(0,0,0,.55);
}
.near span { font-size: 24px; line-height: 1.3; }
.near-btns { display: flex; gap: 10px; }
.near .btn { min-height: 58px; padding: 10px 16px; background: #04191a; color: var(--sea); font-size: 21px; }
.near .btn.go { flex: 1; }
.near .btn svg { width: 24px; height: 24px; }

/* popup di ingresso tappa */
.stop-intro { position: fixed; inset: 0; z-index: 30; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 24px; text-align: center; }
.stop-intro.out { opacity: 0; transition: opacity .25s; }
.stop-intro .num { min-width: 96px; height: 96px; padding: 0 16px; border-radius: 26px; background: var(--accent); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; font-size: 52px; font-weight: 800; }
.stop-intro h2 { margin: 0; font-size: 26px; line-height: 1.25; }
.stop-intro .intro-why { margin: 0; max-width: 320px; color: var(--fg2); font-size: 16px; line-height: 1.45; }
.stop-intro .intro-go { min-width: 220px; min-height: 60px; font-size: 20px; }

/* tasto ⌫ evidenziato quando il codice non esiste */
.key.del.hl { background: var(--danger); color: #fff; border-color: var(--danger); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.06); } }

.key.go:disabled { opacity: .3; pointer-events: none; }

/* icone nei pulsanti */
.btn svg { width: 22px; height: 22px; flex: none; }
.home-actions { display: flex; flex-direction: column; gap: 10px; padding-top: 8px; }

/* lettore QR */
.scan { position: fixed; inset: 0; z-index: 40; background: #000; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.scan video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: relative; width: min(68vw, 300px); aspect-ratio: 1; border: 3px solid var(--accent); border-radius: 22px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.55); }
.scan-hint { position: absolute; left: 16px; right: 16px; bottom: calc(110px + var(--safe-b)); text-align: center; color: #fff; font-weight: 600; text-shadow: 0 1px 6px #000; }
.scan-close { position: absolute; left: 16px; right: 16px; bottom: calc(24px + var(--safe-b)); }

/* Home: in alto a sinistra, a fianco del titolo */
.home-btn { flex: none; width: 48px; height: 48px; margin-left: -10px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--fg2); }
.home-btn:active { background: var(--bg3); }
.home-btn svg { width: 32px; height: 32px; }

/* debug GPS (?gpsdebug=1) */
#gps-debug { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; pointer-events: none; background: rgba(0,0,0,.82); color: #7dff9b; font: 11px/1.4 ui-monospace, Menlo, monospace; padding: 4px 8px calc(4px + var(--safe-b)); }

/* lingue da preparare: pulsante largo per quella del telefono, elenco a scomparsa per le altre */
.lang.wide { width: 100%; margin-top: 14px; }
.other-langs { margin-top: 14px; text-align: left; }
.other-langs summary { cursor: pointer; color: var(--fg2); padding: 10px 4px; font-weight: 600; text-align: center; }
.other-langs .langs { margin-top: 8px; }

/* foto di sfondo della tappa: velo scuro più forte in basso, dove si legge; il testo già letto si dissolve in alto */
.player { position: relative; isolation: isolate; }
.player-bg { position: absolute; inset: 0; z-index: -1; background-size: cover; background-position: center; animation: bg-in .6s ease-out; }
.player-bg::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(14,19,22,.30) 0%, rgba(14,19,22,.78) 50%, rgba(14,19,22,.92) 100%); }
.has-photo .player-head, .has-photo .transcript { text-shadow: 0 1px 6px rgba(0,0,0,.75); }
.has-photo .transcript { -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 16%); mask-image: linear-gradient(to bottom, transparent 0, #000 16%); }
@keyframes bg-in { from { opacity: 0; } to { opacity: 1; } }

/* icone SVG (al posto delle emoji) */
.key svg { width: 30px; height: 30px; display: block; flex: none; }
.key.go svg { width: 60px; height: 60px; }
.list .n svg, .list .s svg { width: 20px; height: 20px; }
.chip svg { width: 14px; height: 14px; margin-right: 4px; vertical-align: -2px; }
.end-title svg { width: 18px; height: 18px; vertical-align: -3px; color: var(--ok); }
.btn.primary b svg { width: 16px; height: 16px; vertical-align: -2px; }
.near .btn svg { width: 20px; height: 20px; }
.btn svg { margin-right: 2px; }
.btn:empty svg, .key svg, .near .btn svg { margin-right: 0; }
.display .found svg { width: 14px; height: 14px; vertical-align: -2px; }

/* scelta lingua: bandiere SVG, ricerca */
.lang { display: flex; align-items: center; gap: 12px; }
.lang[hidden], .other-langs[hidden], .lang-none[hidden] { display: none; }
.flag { width: 30px; height: 22px; border-radius: 4px; object-fit: cover; flex: none; box-shadow: 0 0 0 1px rgba(255,255,255,.14); }
.lang-search { width: 100%; padding: 14px 16px; margin: 0 0 14px; border-radius: var(--radius); background: var(--bg2); border: 1px solid var(--line); color: var(--fg); font: inherit; font-size: 17px; }
.lang-search:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.lang-none { text-align: center; margin-top: 18px; }

/* preparazione di una lingua: indicatore ruotante + barra che si muove */
.prep { text-align: center; padding-top: 48px; }
.prep h2 { display: flex; align-items: center; justify-content: center; gap: 10px; }
.spinner { width: 54px; height: 54px; margin: 0 auto 18px; border-radius: 50%; border: 5px solid var(--bg3); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress.busy { height: 12px; margin: 18px 0 8px; position: relative; }
.progress.busy > i { position: relative; min-width: 4%; transition: width .5s ease-out; overflow: hidden; }
.progress.busy > i::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.45), transparent); animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.prep-count { margin: 0 0 14px; color: var(--fg2); font-size: 17px; }

/* indicazioni a piedi */
.nav-ov { position: fixed; inset: 0; z-index: 35; background: var(--bg); display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; padding: 14px 16px calc(14px + var(--safe-b)); gap: 12px; }
.nav-head { display: flex; align-items: center; gap: 12px; }
.nav-head .num { flex: none; min-width: 44px; height: 44px; padding: 0 8px; border-radius: 12px; background: var(--accent); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 800; }
.nav-head h2 { flex: 1; margin: 0; font-size: 19px; line-height: 1.25; }
.nav-x { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--fg2); }
.nav-x:active { background: var(--bg3); }
.nav-x svg { width: 24px; height: 24px; }
.nav-card { display: flex; align-items: center; gap: 18px; padding: 18px; border-radius: var(--radius); background: var(--bg2); border: 1px solid var(--line); }
.nav-arrow { flex: none; width: 84px; height: 84px; border-radius: 22px; background: var(--accent); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; }
.nav-arrow svg { width: 52px; height: 52px; transition: transform .3s; }
.nav-do { font-size: 24px; font-weight: 750; line-height: 1.2; }
.nav-street { font-size: 18px; color: var(--accent); font-weight: 600; margin-top: 2px; }
.nav-in { font-size: 17px; color: var(--fg2); margin-top: 4px; }
.nav-status { margin: 0; color: var(--fg2); font-size: 15px; min-height: 20px; }
.nav-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
.nav-total { color: var(--fg2); font-variant-numeric: tabular-nums; }
.nav-listen[hidden] { display: none; }

/* mappa nelle indicazioni */
.nav-mapwrap { position: relative; flex: 1; min-height: 160px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--bg2); }
.nav-map { display: block; width: 100%; height: 100%; }
.nav-attr { position: absolute; right: 8px; bottom: 6px; font-size: 10px; color: var(--fg2); background: rgba(14,19,22,.7); padding: 1px 6px; border-radius: 6px; }
.nav-card { padding: 14px; gap: 14px; }
.nav-arrow { width: 68px; height: 68px; border-radius: 18px; }
.nav-arrow svg { width: 42px; height: 42px; }
.nav-do { font-size: 22px; }

.nav-fit { position: absolute; top: 100px; right: 8px; width: 42px; height: 42px; border-radius: 50%; background: rgba(14,19,22,.78); color: #fff; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; }
.nav-fit[hidden] { display: none; }
.nav-fit svg { width: 22px; height: 22px; }
.nav-compass { position: absolute; top: 8px; right: 8px; width: 58px; height: 58px; border-radius: 50%; background: rgba(14,19,22,.78); color: #fff; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; }
.nav-compass svg { width: 52px; height: 52px; }
.nav-hdg { position: absolute; top: 68px; right: 8px; min-width: 58px; text-align: center; font-size: 12px; font-weight: 700; color: #fff; background: rgba(14,19,22,.78); border-radius: 8px; padding: 2px 6px; font-variant-numeric: tabular-nums; }
.nav-hdg[hidden] { display: none; }

.list-top { position: sticky; top: 0; z-index: 2; display: flex; justify-content: flex-end; padding: 8px 12px; background: var(--bg); }
.list-top .btn { min-height: 44px; padding: 8px 14px; }
.list-top .btn svg { width: 20px; height: 20px; }

.sponsor { margin-top: 28px; text-align: center; }
.sponsor small { display: block; color: var(--fg2); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; margin-bottom: 8px; }
.sponsor img { max-width: 70%; max-height: 72px; object-fit: contain; background: #fff; border-radius: 12px; padding: 10px 14px; }
.sponsor a { display: inline-block; }

.end-pop { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.62); display: flex; align-items: center; justify-content: center; padding: 16px; animation: fadein .2s ease; }
.end-pop .endcard { width: min(100%, 420px); background: var(--bg2); border: 1px solid var(--line); border-radius: 22px; padding: 22px 18px 18px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.end-pop .end-icon { align-self: center; width: 64px; height: 64px; border-radius: 50%; background: var(--ok); color: #04190d; display: flex; align-items: center; justify-content: center; }
.end-pop .end-icon svg { width: 36px; height: 36px; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

/* tablet: la barra superiore è più grande, il resto della colonna resta com'è */
@media (min-width: 700px) {
  header.top { padding: 14px 20px; gap: 14px; }
  header.top h1 { font-size: 22px; }
  .home-btn { width: 56px; height: 56px; }
  .home-btn svg { width: 38px; height: 38px; }
  .chip { font-size: 17px; padding: 9px 16px; }
}

/* blocco schermo (come in BabelTalkie): velo scuro, sblocco con pressione lunga */
.screen-lock { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.5); touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.screen-lock.on-map { background: rgba(0,0,0,.28); } /* sulla mappa resta ben visibile */
.screen-lock.on-map .sl-banner { top: auto; bottom: calc(46px + var(--safe-b, 0px)); left: 16px; transform: none; }
.screen-lock .sl-banner { position: absolute; top: calc(14px + var(--safe-t, 0px)); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; background: rgba(30,40,46,.95); color: var(--fg2); padding: 8px 16px; border-radius: 20px; font-size: 14px; border: 1px solid var(--line); white-space: nowrap; }
.screen-lock .sl-banner svg { width: 16px; height: 16px; }
.screen-lock .sl-near { position: absolute; left: 16px; right: 16px; top: 38%; background: var(--sea); color: #04191a; border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 12px; font-weight: 650; font-size: 18px; text-align: center; max-width: 520px; margin: 0 auto; }
.screen-lock .sl-near[hidden] { display: none; }
.screen-lock .sl-near .btn { min-height: 56px; background: #04191a; color: var(--sea); font-size: 18px; }
.screen-lock .sl-hint { position: absolute; right: 18px; bottom: calc(126px + var(--safe-b)); width: 150px; text-align: center; color: var(--fg2); font-size: 12px; background: rgba(30,40,46,.9); padding: 5px 10px; border-radius: 10px; pointer-events: none; }
.screen-lock .sl-unlock { position: absolute; right: 18px; bottom: calc(26px + var(--safe-b)); width: 88px; height: 88px; border-radius: 50%; background: rgba(30,40,46,.95); border: 2px solid var(--line); color: var(--fg); display: flex; align-items: center; justify-content: center; touch-action: none; }
.screen-lock .sl-unlock > svg:last-child { width: 36px; height: 36px; pointer-events: none; }
.screen-lock .sl-ring { position: absolute; inset: -2px; width: 88px; height: 88px; transform: rotate(-90deg); pointer-events: none; }
.screen-lock .sl-ring circle { fill: none; stroke: var(--ok); stroke-width: 3; stroke-dasharray: 257.6; stroke-dashoffset: 257.6; }
#lock-chip svg, #map-chip svg { width: 16px; height: 16px; margin: 0; }

/* popup di fine tappa/percorso: centrato sulla pagina e, su telefoni piccoli, con scorrimento e spazi ridotti */
.end-pop { align-items: flex-start; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); }
.end-pop .endcard { margin: auto; max-height: none; }
@media (max-height: 640px) {
  .end-pop .endcard { padding: 14px 14px 12px; gap: 8px; }
  .end-pop .end-icon { width: 44px; height: 44px; }
  .end-pop .end-icon svg { width: 26px; height: 26px; }
  .end-pop .endcard .end-title { font-size: 21px; }
  .end-pop .endcard .btn { min-height: 46px; font-size: 15px; }
  .end-pop .end-sub { font-size: 14px; margin: 0 0 2px; }
}

.sheet .pay-after { margin: 0 0 10px; color: var(--accent); font-weight: 650; }

/* scelta della tappa da raggiungere, nella mappa */
.nav-stops { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0; flex: none; scrollbar-width: none; }
.nav-stops::-webkit-scrollbar { display: none; }
.nav-stops:empty { display: none; }
.nav-stops button { flex: none; min-width: 40px; height: 40px; padding: 0 10px; border-radius: 12px; background: var(--bg2); color: var(--fg); border: 1px solid var(--line); font-weight: 700; font-size: 16px; }
.nav-stops button.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

/* tasto mappa in alto a destra, sopra la foto della tappa */
.player-map { position: absolute; top: 12px; right: 12px; z-index: 3; width: 46px; height: 46px; border-radius: 50%; background: rgba(14,19,22,.72); color: #fff; border: 1px solid rgba(255,255,255,.25); display: flex; align-items: center; justify-content: center; backdrop-filter: blur(6px); }
.player-map svg { width: 24px; height: 24px; }
.player-head.with-map { padding-right: 70px; }

.end-note { color: var(--fg2); font-size: 14px; text-align: center; margin: -4px 0 2px; }
