/* =====================================================================
   Deltalux World · stile dell'interfaccia sopra il mondo 3D
   ===================================================================== */
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal; font-weight: 200 800; font-display: swap;
  src: url('../fonts/plus-jakarta-sans-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal; font-weight: 200 800; font-display: swap;
  src: url('../fonts/plus-jakarta-sans-latin-ext-wght-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #05061a;
  --ink: #f4f2ff;
  --ink-2: #b9b6dc;
  --ink-3: #8683ad;
  --glass: rgba(16, 15, 44, .62);
  --glass-2: rgba(28, 26, 70, .72);
  --line: rgba(190, 180, 255, .18);
  --indigo: #5b4bff;
  --violet: #8a5cff;
  --cyan: #3ec8ff;
  --pink: #ff4fa3;
  --wa: #1fa55b;
  --accent: #8a5cff;
  --radius: 18px;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--font);
  overflow: hidden; overscroll-behavior: none;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  user-select: none; -webkit-user-select: none;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
a { color: inherit; }
:focus-visible { outline: 2px solid #fff; outline-offset: 3px; border-radius: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; cursor: grab; }
#scene.dragging { cursor: grabbing; }

/* ---------- pulsanti ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 48px; padding: 0 22px; border-radius: 999px;
  font-weight: 700; font-size: 15px; letter-spacing: .01em; text-decoration: none; white-space: nowrap;
  transition: transform .25s cubic-bezier(.2, .8, .2, 1), box-shadow .25s, background .25s, opacity .25s;
}
.btn:active { transform: scale(.96); }
.btn[disabled] { opacity: .45; cursor: progress; }
.btn-primary { background: linear-gradient(120deg, var(--indigo), var(--violet) 55%, var(--pink)); color: #fff; box-shadow: 0 10px 34px -10px rgba(138, 92, 255, .9), inset 0 1px 0 rgba(255, 255, 255, .35); }
.btn-primary:not([disabled]):hover { transform: translateY(-2px); box-shadow: 0 16px 44px -10px rgba(138, 92, 255, 1), inset 0 1px 0 rgba(255, 255, 255, .35); }
.btn-ghost { background: rgba(255, 255, 255, .07); border: 1px solid var(--line); color: var(--ink); }
.btn-ghost:hover { background: rgba(255, 255, 255, .14); }
.btn-wa { background: var(--wa); color: #fff; box-shadow: 0 10px 30px -12px rgba(31, 165, 91, .9); }
.btn-wa:hover { transform: translateY(-2px); }

/* ---------- schermata d'ingresso ---------- */
.gate {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(120% 90% at 50% 10%, #1a1250 0%, #0a0a26 45%, #04040f 100%);
  transition: opacity 1.1s ease, visibility 1.1s; overflow: auto;
}
.gate.is-ready { background: radial-gradient(120% 90% at 50% 10%, rgba(26, 18, 80, .86) 0%, rgba(10, 10, 38, .9) 45%, rgba(4, 4, 15, .95) 100%); }
.gate.is-leaving { opacity: 0; visibility: hidden; pointer-events: none; }
.gate-inner { width: min(560px, 100%); text-align: center; padding-bottom: var(--sab); }
.gate-logo { width: 92px; height: auto; margin: 0 auto 18px; display: block; filter: drop-shadow(0 0 22px rgba(138, 92, 255, .8)); }
.gate-tri { stroke-dasharray: 320; stroke-dashoffset: 320; animation: draw 2.2s cubic-bezier(.6, 0, .2, 1) forwards; }
.gate-tri-2 { stroke-dasharray: 150; stroke-dashoffset: 150; animation-delay: .7s; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.gate-kicker { margin: 0 0 10px; font-size: 12px; font-weight: 700; letter-spacing: .32em; text-transform: uppercase; color: #b9a8ff; }
.gate-title { margin: 0 0 14px; font-size: clamp(30px, 6.4vw, 50px); line-height: 1.06; font-weight: 800; letter-spacing: -.02em; text-wrap: balance;
  background: linear-gradient(100deg, #fff 30%, #c9bcff 60%, #7fdcff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.gate-sub { margin: 0 auto 26px; max-width: 46ch; color: var(--ink-2); font-size: 16px; line-height: 1.55; text-wrap: pretty; }
.gate-bar { height: 3px; width: min(260px, 70%); margin: 0 auto 26px; border-radius: 3px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.gate-bar i { display: block; height: 100%; width: 100%; transform: scaleX(0); transform-origin: left; background: linear-gradient(90deg, var(--violet), var(--cyan)); transition: transform .5s ease; }
.gate-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.gate-actions .btn-primary { min-width: 230px; min-height: 58px; font-size: 18px; }
.gate-tip { margin: 16px 0 0; font-size: 13px; color: var(--ink-3); }
.gate-lang { margin-top: 22px; display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(255, 255, 255, .06); border: 1px solid var(--line); }
.gate-lang button { padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.gate-lang button[aria-pressed="true"] { background: rgba(255, 255, 255, .16); color: #fff; }
.gate-foot { margin: 22px 0 0; font-size: 12px; color: var(--ink-3); }
.nogl-debug { text-align: left; font-size: 11px; color: var(--ink-3); white-space: pre-wrap; margin-top: 18px; }

/* ---------- barra in alto ---------- */
.hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
.hud > * { pointer-events: auto; }
.top { z-index: 6; position: absolute; top: calc(12px + var(--sat)); left: calc(14px + var(--sal)); right: calc(14px + var(--sar)); display: flex; align-items: center; justify-content: space-between; pointer-events: none; }
.top > * { pointer-events: auto; }
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; font-weight: 800; font-size: 18px; letter-spacing: -.01em; text-shadow: 0 2px 18px rgba(0, 0, 0, .6); }
.brand svg { width: 24px; height: 22px; color: #b9a8ff; filter: drop-shadow(0 0 8px rgba(138, 92, 255, .9)); }
.top-right { display: flex; align-items: center; gap: 8px; }
.pill, .icon-btn, .menu, .panel, .nav, .act, .emotes, .hint, .toast, .modal-card {
  background: var(--glass); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(16px) saturate(1.5); backdrop-filter: blur(16px) saturate(1.5);
}
.pill { display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 14px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.pill b { color: #fff; font-weight: 800; }
.pill i { width: 8px; height: 8px; border-radius: 50%; background: #3ddc84; box-shadow: 0 0 0 0 rgba(61, 220, 132, .7); animation: live 2.4s infinite; }
.pill.is-off i { background: #777; animation: none; }
@keyframes live { 70% { box-shadow: 0 0 0 9px rgba(61, 220, 132, 0); } 100% { box-shadow: 0 0 0 0 rgba(61, 220, 132, 0); } }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; transition: transform .2s, background .2s; }
.icon-btn:hover { background: var(--glass-2); transform: translateY(-1px); }
.icon-btn svg { width: 20px; height: 20px; }
#btn-sound .off, #btn-sound[aria-pressed="false"] .on { display: none; }
#btn-sound[aria-pressed="false"] .off { display: block; }
#btn-sound[aria-pressed="false"] { color: var(--ink-3); }
.menu { position: absolute; right: 0; top: 50px; width: 250px; padding: 8px; border-radius: var(--radius); display: grid; gap: 2px; box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .8); }
.menu button, .menu a { display: block; width: 100%; text-align: left; padding: 11px 12px; border-radius: 12px; font-size: 14px; font-weight: 600; text-decoration: none; color: var(--ink); }
.menu button:hover, .menu a:hover { background: rgba(255, 255, 255, .1); }
.menu b { color: #b9a8ff; }

/* ---------- tasti dei quartieri (come i tasti di un pianoforte) ---------- */
.nav { position: absolute; left: 0; right: 0; margin: 0 auto; width: max-content; bottom: calc(18px + var(--sab)); display: flex; gap: 4px; padding: 6px; border-radius: 999px; max-width: calc(100vw - 340px); overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav button { position: relative; flex: none; display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 999px; font-size: 13.5px; font-weight: 700; color: var(--ink-2); transition: color .3s, background .3s, transform .3s cubic-bezier(.2, .8, .2, 1); }
.nav button i { width: 9px; height: 9px; border-radius: 3px; background: var(--c); box-shadow: 0 0 10px var(--c); transform: rotate(45deg); transition: transform .4s; }
.nav button:hover { color: #fff; background: rgba(255, 255, 255, .08); transform: translateY(-2px); }
.nav button.is-here { color: #fff; background: color-mix(in srgb, var(--c) 34%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 70%, transparent); }
.nav button.is-here i { transform: rotate(225deg) scale(1.25); }
.nav button.is-going { color: #fff; animation: going 1s ease-in-out infinite; }
@keyframes going { 50% { background: color-mix(in srgb, var(--c) 26%, transparent); } }

/* ---------- scheda del quartiere ---------- */
.panel { position: absolute; right: calc(18px + var(--sar)); top: calc(50% - 24px); width: min(372px, calc(100vw - 36px)); max-height: calc(100vh - 196px); overflow: auto; scrollbar-width: thin; padding: 24px 24px 22px; border-radius: 24px; transform: translate(0, -50%);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .9), inset 0 1px 0 rgba(255, 255, 255, .12), inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent);
  animation: panel-in .7s cubic-bezier(.2, .9, .2, 1) both; }
.panel::before { content: ''; position: absolute; left: 24px; right: 24px; top: 0; height: 3px; border-radius: 3px; background: linear-gradient(90deg, transparent, var(--accent), transparent); }
.panel.is-out { animation: panel-out .35s ease forwards; }
@keyframes panel-in { from { opacity: 0; transform: translate(40px, -50%) scale(.96); } }
@keyframes panel-out { to { opacity: 0; transform: translate(30px, -50%) scale(.97); } }
/* Pulsante "chiudi": la zona che si può premere è un quadrato di 48px, più grande del cerchio che si vede.
   z-index: deve stare SOPRA i testi della scheda (la scritta piccola in alto ha un filtro che altrimenti la porta davanti e ruba i clic). */
.panel-close { position: absolute; z-index: 3; top: 4px; right: 6px; width: 48px; height: 48px; display: grid; place-items: center; color: var(--ink-2); touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.panel-close::before { content: ''; position: absolute; inset: 6px; border-radius: 50%; background: rgba(255, 255, 255, .08); transition: background .2s, transform .2s; }
.panel-close svg { position: relative; width: 16px; height: 16px; }
.panel-close:hover { color: #fff; }
.panel-close:hover::before { background: rgba(255, 255, 255, .18); }
.panel-close:active::before { transform: scale(.9); background: rgba(255, 255, 255, .24); }
.panel-kicker { margin: 0 0 6px; padding-right: 36px; font-size: 11.5px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; color: var(--accent); filter: brightness(1.35); }
.panel-title { margin: 0 0 10px; font-size: 27px; line-height: 1.1; font-weight: 800; letter-spacing: -.02em; padding-right: 40px; }
.panel-text { margin: 0 0 14px; color: var(--ink-2); font-size: 15px; line-height: 1.5; text-wrap: pretty; }
.panel-points { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 8px; }
.panel-points li { position: relative; padding-left: 24px; font-size: 14px; line-height: 1.4; color: var(--ink); }
.panel-points li::before { content: ''; position: absolute; left: 3px; top: .42em; width: 9px; height: 9px; background: var(--accent); clip-path: polygon(50% 0, 100% 100%, 0 100%); filter: drop-shadow(0 0 5px var(--accent)); }
.panel-points li.pkg { padding: 10px 14px; border-radius: 14px; background: rgba(255, 255, 255, .06); border: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: baseline; }
.panel-points li.pkg::before { display: none; }
.panel-points li.pkg b { font-size: 15px; }
.panel-points li.pkg span { grid-column: 1; font-size: 12.5px; color: var(--ink-2); }
.panel-points li.pkg em { grid-row: 1 / 3; grid-column: 2; font-style: normal; font-weight: 800; font-size: 20px; color: #fff; align-self: center; }
.panel-points li.pkg.is-top { border-color: color-mix(in srgb, var(--accent) 70%, transparent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.panel-foot { display: grid; gap: 14px; }
.panel-price { font-size: 24px; font-weight: 800; letter-spacing: -.01em; }
.panel-price small { font-size: 13px; font-weight: 600; color: var(--ink-3); margin-left: 6px; }
.panel-cta { display: flex; flex-wrap: wrap; gap: 8px; }
.panel-cta .btn { flex: 1 1 auto; min-height: 46px; padding: 0 18px; font-size: 14px; }

/* ---------- joystick ---------- */
.joy { position: absolute; left: calc(22px + var(--sal)); bottom: calc(22px + var(--sab)); width: 140px; height: 140px; border-radius: 50%; touch-action: none; cursor: grab;
  background: radial-gradient(circle at 50% 50%, rgba(138, 92, 255, .14), rgba(16, 15, 44, .5) 70%); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: 0 0 40px -8px rgba(138, 92, 255, .5), inset 0 0 24px rgba(138, 92, 255, .14); }
.joy-ring { position: absolute; inset: 21%; border-radius: 50%; border: 1px dashed rgba(190, 180, 255, .3); animation: spin 40s linear infinite; }
/* scritta ad arco "MUOVI E CAMMINA": fa capire a tutti a cosa serve il cerchio */
.joy-label { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; transition: opacity .25s; }
.joy-label text { font: 800 12.4px var(--font, 'Plus Jakarta Sans', system-ui, sans-serif); letter-spacing: 1.7px; fill: #fff; fill-opacity: .94; paint-order: stroke; stroke: rgba(14, 12, 44, .7); stroke-width: 3px; stroke-linejoin: round; }
.joy.is-active .joy-label { opacity: .3; }
.joy-hand { position: absolute; left: 50%; top: 50%; margin: 6px 0 0 -4px; font-size: 30px; line-height: 1; pointer-events: none; opacity: 0; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .5)); }
@keyframes spin { to { transform: rotate(360deg); } }
.joy-knob { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%; will-change: transform;
  background: radial-gradient(circle at 35% 30%, #fff, #c9bcff 35%, #7b5cff 75%); box-shadow: 0 6px 24px rgba(123, 92, 255, .8), inset 0 -4px 10px rgba(40, 20, 120, .5); transition: transform .22s cubic-bezier(.2, .9, .3, 1.3); }
.joy.is-active { cursor: grabbing; }
.joy.is-active .joy-knob { transition: none; }
/* guida passo passo, primo passo: il cerchio pulsa e la pallina mostra il gesto da fare */
.joy.is-coach { animation: joyPulse 1.8s ease-out infinite; border-color: rgba(255, 255, 255, .55); }
.joy.is-coach:not(.is-active) .joy-knob { animation: joyDemo 2.6s ease-in-out infinite; }
.joy.is-coach:not(.is-active) .joy-hand { opacity: 1; animation: joyDemo 2.6s ease-in-out infinite; }
@keyframes joyPulse { 0% { box-shadow: 0 0 0 0 rgba(180, 160, 255, .75), 0 0 40px -8px rgba(138, 92, 255, .5); } 100% { box-shadow: 0 0 0 26px rgba(180, 160, 255, 0), 0 0 40px -8px rgba(138, 92, 255, .5); } }
@keyframes joyDemo { 0%, 18%, 100% { transform: translate(0, 0); } 45%, 70% { transform: translate(0, -30px); } }

/* ---------- guida passo passo (prima visita) ---------- */
.coach { position: absolute; left: 50%; top: calc(72px + var(--sat)); width: min(430px, calc(100vw - 28px)); translate: -50% 0; padding: 14px 16px 12px; border-radius: 20px; z-index: 4;
  background: rgba(18, 16, 52, .82); border: 1px solid rgba(255, 255, 255, .22); -webkit-backdrop-filter: blur(14px) saturate(1.3); backdrop-filter: blur(14px) saturate(1.3);
  box-shadow: 0 24px 60px -24px rgba(0, 0, 0, .9), inset 0 1px 0 rgba(255, 255, 255, .14); animation: pop .5s both; }
.coach-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.coach-badge { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.coach-badge b { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; font-size: 15px; font-weight: 800; color: #fff; background: linear-gradient(140deg, #5b4bff, #b25cff); box-shadow: 0 6px 16px -4px rgba(123, 92, 255, .9); transition: background .3s, scale .3s cubic-bezier(.2, .9, .3, 1.6); }
.coach-dots { display: inline-flex; gap: 6px; }
.coach-dots i { width: 22px; height: 5px; border-radius: 5px; background: rgba(255, 255, 255, .18); transition: background .3s; }
.coach-dots i.is-on { background: #2fe0b5; }
.coach-dots i.is-now { background: #fff; }
.coach-text { margin: 0; font-size: 16.5px; line-height: 1.38; font-weight: 600; color: #fff; text-wrap: pretty; }
.coach-text b { font-weight: 800; color: #d9d0ff; }
.coach-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.coach-skip { min-height: 36px; padding: 0 4px; font-size: 13px; font-weight: 600; color: var(--ink-3, #9a9cc0); text-decoration: underline; text-underline-offset: 3px; }
.coach-next { min-height: 38px; padding: 0 18px; border-radius: 999px; font-size: 14px; font-weight: 700; color: #fff; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .22); }
.coach-next:hover { background: rgba(255, 255, 255, .2); }
.coach.is-ok .coach-badge b { background: linear-gradient(140deg, #14c9a6, #2fe0b5); scale: 1.18; }
.coach.is-ok { border-color: rgba(47, 224, 181, .7); }
.coach.is-done .coach-badge b { background: linear-gradient(140deg, #14c9a6, #2fe0b5); }
.coach.is-done .coach-foot { display: none; }
/* terzo passo: i nomi dei quartieri si illuminano */
.nav.is-coach { animation: navPulse 1.6s ease-out infinite; border-color: rgba(255, 255, 255, .6); }
@keyframes navPulse { 0% { box-shadow: 0 0 0 0 rgba(180, 160, 255, .7); } 100% { box-shadow: 0 0 0 16px rgba(180, 160, 255, 0); } }
.hud.has-coach .toast { top: calc(214px + var(--sat)); }

/* ---------- azioni (salto, reazioni) ---------- */
.actions { position: absolute; right: calc(22px + var(--sar)); bottom: calc(22px + var(--sab)); display: flex; align-items: flex-end; gap: 10px; }
.act { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; transition: transform .2s cubic-bezier(.2, .8, .2, 1.4), background .2s; }
.act svg { width: 24px; height: 24px; }
.act:hover { transform: translateY(-2px); background: var(--glass-2); }
.act:active { transform: scale(.9); }
.act-big { width: 66px; height: 66px; background: linear-gradient(140deg, rgba(91, 75, 255, .75), rgba(138, 92, 255, .6)); box-shadow: 0 10px 30px -8px rgba(123, 92, 255, .9); }
.emotes { position: absolute; right: 76px; bottom: 62px; display: flex; gap: 2px; padding: 6px; border-radius: 999px; animation: pop .35s cubic-bezier(.2, .9, .3, 1.3) both; }
.emotes button { width: 44px; height: 44px; border-radius: 50%; font-size: 22px; transition: transform .2s; }
.emotes button:hover { transform: scale(1.25) translateY(-3px); background: rgba(255, 255, 255, .1); }
@keyframes pop { from { opacity: 0; transform: scale(.7) translateY(12px); } }

/* ---------- mappa ---------- */
.map { position: absolute; left: calc(14px + var(--sal)); top: calc(64px + var(--sat)); width: 120px; height: 120px; border-radius: 50%; pointer-events: none; opacity: .92; }

/* ---------- suggerimenti e avvisi ---------- */
.hint { position: absolute; left: 50%; bottom: calc(86px + var(--sab)); transform: translateX(-50%); padding: 12px 18px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--ink); white-space: nowrap; max-width: calc(100vw - 28px); overflow: hidden; text-overflow: ellipsis; animation: pop .5s both; pointer-events: none; }
.hint kbd { display: inline-block; min-width: 24px; padding: 2px 6px; margin: 0 1px; border-radius: 6px; background: rgba(255, 255, 255, .14); border: 1px solid var(--line); font: inherit; font-size: 12px; text-align: center; }
.toast { position: absolute; left: 50%; top: calc(66px + var(--sat)); transform: translate(-50%, -20px); padding: 10px 16px; border-radius: 999px; font-size: 13.5px; font-weight: 600; opacity: 0; transition: opacity .4s, transform .5s cubic-bezier(.2, .9, .3, 1.2); pointer-events: none; white-space: nowrap; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- finestra ---------- */
.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 20px; background: rgba(3, 3, 14, .6); animation: fade .3s both; }
@keyframes fade { from { opacity: 0; } }
.modal-card { position: relative; width: min(520px, 100%); max-height: min(80vh, 640px); overflow: auto; padding: 28px 26px 24px; border-radius: 24px; user-select: text; -webkit-user-select: text; }
.modal-card h2 { margin: 0 0 14px; font-size: 22px; padding-right: 40px; }
.modal-card p, .modal-card li { color: var(--ink-2); font-size: 14.5px; line-height: 1.55; }
.modal-card ul { padding-left: 18px; margin: 0 0 12px; }
.modal-card kbd { display: inline-block; padding: 2px 7px; border-radius: 6px; background: rgba(255, 255, 255, .12); border: 1px solid var(--line); font: inherit; font-size: 12.5px; color: #fff; }

/* ---------- telefoni ---------- */
@media (max-width: 760px) {
  .brand span { display: none; }
  .map { display: none; }
  .nav { top: calc(60px + var(--sat)); bottom: auto; left: 14px; right: 14px; margin: 0; width: auto; max-width: none; border-radius: 16px; }
  .nav button { height: 36px; padding: 0 12px; font-size: 13px; }
  .panel { top: calc(116px + var(--sat)); right: 14px; left: 14px; width: auto; transform: none; padding: 16px 18px 16px; border-radius: 20px; max-height: calc(100vh - 300px - var(--sat) - var(--sab)); overflow: auto; }
  @keyframes panel-in { from { opacity: 0; transform: translateY(-16px) scale(.97); } }
  @keyframes panel-out { to { opacity: 0; transform: translateY(-12px) scale(.98); } }
  .panel-title { font-size: 21px; margin-bottom: 6px; }
  .panel-title::after { content: ''; display: inline-block; width: 8px; height: 8px; margin-left: 10px; border-right: 2px solid var(--ink-2); border-bottom: 2px solid var(--ink-2); transform: translateY(-4px) rotate(45deg); transition: transform .3s; }
  .panel.is-open .panel-title::after { transform: translateY(0) rotate(225deg); }
  .panel-text { font-size: 14px; margin-bottom: 10px; }
  .panel-points { gap: 6px; margin-bottom: 12px; }
  .panel-points li { font-size: 13px; }
  .panel-foot { grid-template-columns: auto 1fr; align-items: center; gap: 10px; }
  .panel-price { font-size: 19px; }
  .panel-cta .btn { min-height: 42px; padding: 0 14px; font-size: 13px; }
  .panel:not(.is-open) .panel-points, .panel:not(.is-open) .panel-text, .panel:not(.is-open) #panel-more { display: none; }
  /* i suggerimenti stanno in alto, sotto i nomi dei quartieri, così non coprono l'avatar;
     con la scheda di un quartiere aperta scendono sopra il joystick */
  .hint { top: calc(112px + var(--sat)); bottom: auto; font-size: 14px; white-space: normal; text-align: center; border-radius: 16px; width: max-content; max-width: calc(100vw - 28px); }
  .hud:has(#panel:not([hidden])) .hint { top: auto; bottom: calc(184px + var(--sab)); }
  .toast { top: calc(110px + var(--sat)); }
  .joy { width: 152px; height: 152px; left: calc(14px + var(--sal)); bottom: calc(16px + var(--sab)); }
  .joy-knob { width: 60px; height: 60px; margin: -30px 0 0 -30px; }
  .coach { top: calc(112px + var(--sat)); }
  .hud.has-coach .toast { top: calc(262px + var(--sat)); }
  .actions { right: calc(16px + var(--sar)); bottom: calc(18px + var(--sab)); }
  .pill span { display: none; }
}
@media (max-height: 480px) and (orientation: landscape) {
  .nav { top: calc(8px + var(--sat)); left: 120px; right: 150px; }
  .panel { top: calc(56px + var(--sat)); left: auto; width: 320px; max-height: calc(100vh - 70px); }
  .gate-logo { width: 54px; margin-bottom: 8px; }
  .gate-sub { margin-bottom: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .gate-tri { animation: none; stroke-dashoffset: 0; }
  .joy-ring, .pill i, .joy.is-coach, .joy.is-coach .joy-knob, .joy.is-coach .joy-hand, .nav.is-coach { animation: none !important; }
  .panel, .emotes, .hint, .modal { animation-duration: .01s; }
}
