* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #111; color: #fff; font-family: "Arial Black", "Helvetica Neue", Arial, sans-serif; user-select: none; -webkit-user-select: none; touch-action: none; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; image-rendering: auto; }
.hidden { display: none !important; }

#hud { position: fixed; inset: 0; pointer-events: none; text-shadow: 2px 2px 0 #000, -1px -1px 0 #000; }
@keyframes flash { 50% { opacity: 0.3; } }

#menu { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at center, rgba(40,20,10,.78), rgba(0,0,0,.95)); z-index: 10; padding: 16px; text-align: center; overflow-y: auto; }
#menu.ingame { background: rgba(0,0,0,.72); }
.menu-box { max-width: 960px; width: 100%; margin: auto; }
#menu h1 { white-space: nowrap; }
#menu.controls h1 { font-size: 40px; text-shadow: 2px 2px 0 #b03010, 4px 4px 0 #000; }
#menu.controls .sub, #menu.controls .credits { display: none; }
#menu h1 { font-size: clamp(36px, 8vw, 96px); margin: 0; color: #ffcf3a; text-shadow: 4px 4px 0 #b03010, 8px 8px 0 #000; font-style: italic; }
#menu h1 span { color: #fff; }
#menu .sub { font-family: Arial, sans-serif; letter-spacing: 4px; color: #ddd; margin: 8px 0 24px; }
#menu h2 { font-size: 30px; margin: 0 0 6px; color: #ffcf3a; text-shadow: 3px 3px 0 #000; }
#loading { font-family: Arial, sans-serif; color: #ccc; margin-bottom: 16px; }
#menu-items { display: flex; flex-direction: column; align-items: center; gap: 10px; }
#menu-items button { font: inherit; font-size: 22px; width: min(360px, 90vw); padding: 10px 20px; background: #ffcf3a; color: #000; border: 4px solid #000; box-shadow: 4px 4px 0 #b03010; cursor: pointer; }
#menu-items button:hover, #menu-items button:focus { background: #fff; outline: none; transform: translate(-1px, -1px); box-shadow: 5px 5px 0 #b03010; }
#menu-items button.secondary { background: #2b2b2b; color: #eee; box-shadow: 4px 4px 0 #000; border-color: #000; }
#menu-items button.secondary:hover, #menu-items button.secondary:focus { background: #444; color: #fff; }
#menu-items button.danger { background: #e8574a; color: #fff; }
#menu-items button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
#menu-status { font-family: Arial, sans-serif; font-size: 14px; color: #bbb; margin-top: 16px; min-height: 20px; }
#menu-controls .hint { font-family: Arial, sans-serif; font-size: 13px; color: #aaa; margin: 0 0 12px; }
#controls-table { margin: 0 auto; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 15px; }
#controls-table td { padding: 3px 6px; text-align: left; color: #ddd; }
#controls-table td:first-child { padding-right: 18px; }
#controls-table button { font: bold 14px Arial, sans-serif; min-width: 92px; padding: 5px 8px; background: #2b2b2b; color: #fff; border: 2px solid #666; cursor: pointer; }
#controls-table button:hover, #controls-table button:focus { border-color: #ffcf3a; outline: none; }
#controls-table button.waiting { background: #ffcf3a; color: #000; border-color: #000; animation: flash 0.6s steps(2) infinite; }
#controls-table .fixed { color: #888; font-size: 13px; }
#controls-note { font-family: Arial, sans-serif; font-size: 13px; color: #ffcf3a; min-height: 18px; }
#menu .row { display: flex; gap: 12px; justify-content: center; margin-top: 8px; }
#menu button.small { font: bold 15px Arial, sans-serif; padding: 8px 16px; background: #ffcf3a; color: #000; border: 3px solid #000; cursor: pointer; }
#menu button.small:hover, #menu button.small:focus { background: #fff; outline: none; }
.credits { font-family: Arial, sans-serif; font-size: 12px; color: #888; margin-top: 24px; }
.credits a { color: #aaa; }

#pause, #wasted { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 5; pointer-events: none; text-shadow: 3px 3px 0 #000; }
#pause { background: rgba(0,0,0,.5); }
#pause h2 { font-size: 64px; margin: 0; }
#wasted { font-size: clamp(48px, 10vw, 110px); color: #e02020; font-style: italic; }
#wasted.busted { color: #3a7aff; }

#bigmap { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 6; }
#bigmap-canvas { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#bigmap .hint { position: absolute; bottom: 10px; left: 0; right: 0; text-align: center; font-family: var(--hud-small); font-weight: 700; font-size: 15px; color: #eee; text-shadow: 1px 1px 0 #000; pointer-events: none; padding: 0 60px; }
#bigmap .hint-touch { display: none; }
@media (pointer: coarse) { #bigmap .hint-pc { display: none; } #bigmap .hint-touch { display: block; } }
#bigmap-box { position: absolute; inset: 2vh 2vw; border: 3px solid #000; border-radius: 12px; overflow: hidden; box-shadow: 0 0 0 2px rgba(255,255,255,.25), 6px 6px 0 #b03010; background: #2f6aa0; }
#bigmap-title { position: absolute; top: 10px; left: 14px; font-family: var(--hud-font); font-size: 22px; color: #ffcf3a; text-shadow: 2px 2px 0 #000; pointer-events: none; }
#bigmap-title small { font-family: var(--hud-small); font-size: 15px; color: #fff; }
#bigmap-btns { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 8px; }
#bigmap-btns button, #bigmap-close { width: 46px; height: 46px; border-radius: 10px; border: 2px solid #000; background: rgba(20,18,15,.85); color: #fff; font-size: 24px; line-height: 1; cursor: pointer; box-shadow: 2px 2px 0 rgba(0,0,0,.5); }
#bigmap-btns button:active, #bigmap-close:active { background: #ffcf3a; color: #000; }
#bigmap-btns button.hidden { display: none; }
#bigmap-close { position: absolute; top: 8px; right: 12px; background: #b03010; }

#touch { position: fixed; inset: 0; pointer-events: none; z-index: 4; }
#stick { position: absolute; left: 30px; bottom: 30px; width: 140px; height: 140px; border-radius: 50%; background: rgba(255,255,255,.12); border: 2px solid rgba(255,255,255,.3); pointer-events: auto; }
#knob { position: absolute; left: 45px; top: 45px; width: 50px; height: 50px; border-radius: 50%; background: rgba(255,255,255,.45); }
#tbuttons { position: absolute; right: 20px; bottom: 30px; display: grid; grid-template-columns: 80px 80px; gap: 12px; pointer-events: auto; }
#tbuttons button { height: 64px; border-radius: 50%; border: 2px solid rgba(255,255,255,.4); background: rgba(0,0,0,.35); color: #fff; font: inherit; font-size: 12px; }
@media (pointer: coarse) { #radar { width: 110px; height: 110px; top: 70px; bottom: auto; } }

/* copertina accanto al menu sugli schermi larghi; il titolo è già nella copertina */
#menu .menu-box { display: flex; align-items: center; justify-content: center; gap: 48px; max-width: 1200px; }
#menu .menu-col { flex: 0 1 560px; }
#cover { height: min(86vh, 900px); aspect-ratio: 2 / 3; object-fit: cover; border: 4px solid #000; box-shadow: 8px 8px 0 #b03010, 0 0 60px rgba(0,0,0,.8); transform: rotate(-1.5deg); }
@media (max-width: 899px), (max-height: 519px) { #cover { display: none; } }
#menu.controls #cover, #menu.ingame #cover { display: none; }

/* navigatore (missioni, taxi) */
#nav { position: absolute; left: 50%; top: 62px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; background: rgba(0,0,0,.55); border: 2px solid #000; padding: 6px 14px 6px 8px; max-width: 70vw; }
#nav-arrow { width: 44px; height: 44px; flex: none; }
#nav-arrow path { fill: #ffd800; stroke: #000; stroke-width: 2; }
#nav-label { font-size: 16px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#nav-dist { font-size: 14px; color: #ffd800; }
/* scelta sì/no */
#choice { position: absolute; left: 50%; bottom: 22%; transform: translateX(-50%); background: rgba(0,0,0,.78); border: 3px solid #000; box-shadow: 4px 4px 0 #b03010; padding: 14px 20px; text-align: center; pointer-events: auto; max-width: 90vw; }
#choice-text { font-size: 20px; color: #fff; margin-bottom: 10px; }
#choice-text small { font-size: 16px; color: #ffcf3a; }
.choice-btns { display: flex; gap: 12px; justify-content: center; }
.choice-btns button { font: inherit; font-size: 16px; padding: 6px 16px; border: 3px solid #000; cursor: pointer; }
#choice-yes { background: #9fe870; } #choice-no { background: #e8574a; color: #fff; }

/* ================= HUD: ispirato al vecchio GTA, ma moderno ================= */
:root { --hud-font: 'Anton', Impact, 'Arial Black', sans-serif; --hud-small: 'Barlow Condensed', 'Arial Narrow', Arial, sans-serif;
  --money: #7ee35a; --gold: #ffcf3a; --red: #e8413a; --panel: rgba(10, 12, 16, .55); }
#hud { font-family: var(--hud-font); }
#hud-panel { position: absolute; right: 18px; top: 14px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.hud-row { display: flex; align-items: stretch; gap: 10px; }
#weapon-box { min-width: 150px; height: 52px; border-radius: 12px; background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.16), rgba(0,0,0,.1) 60%), var(--panel);
  border: 2px solid rgba(255,255,255,.25); box-shadow: 0 0 0 2px #000, 0 6px 18px rgba(0,0,0,.45); display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 14px 4px 10px; }
#weapon-icon { width: 70px; height: 44px; filter: drop-shadow(2px 2px 0 #000); }
#weapon-icon path, #weapon-icon rect, #weapon-icon circle { fill: #f2f2f2; }
#weapon-img { width: 70px; height: 44px; object-fit: contain; filter: drop-shadow(2px 2px 0 #000); image-rendering: auto; }
#ammo { font-size: 24px; color: #fff; letter-spacing: 1px; line-height: 1; }
.hud-stack { display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: 4px; }
#money { position: absolute; left: 18px; top: 12px; font-size: 42px; line-height: 1; color: var(--money); letter-spacing: 1px; font-style: italic;
  text-shadow: 2px 0 0 #000, -2px 0 0 #000, 0 2px 0 #000, 0 -2px 0 #000, 3px 4px 0 rgba(0,0,0,.6); }
.bar-row { display: flex; align-items: center; gap: 6px; }
.ico { width: 20px; height: 20px; filter: drop-shadow(1px 1px 0 #000) drop-shadow(-1px -1px 0 #000); }
.ico.heart path { fill: var(--red); } .ico.bolt path { fill: var(--gold); }
.bar { position: relative; width: 150px; height: 13px; border-radius: 3px; background: rgba(0,0,0,.6); box-shadow: 0 0 0 2px #000, inset 0 1px 0 rgba(255,255,255,.15); overflow: hidden; transform: skewX(-12deg); }
.bar > div { height: 100%; transition: width .25s ease; }
.bar::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 13px, rgba(0,0,0,.55) 13px 15px); } /* segmenti */
#healthbar { width: 100%; background: linear-gradient(180deg, #ff7a6e, #e8413a 55%, #a3201b); }
#health.low #healthbar { animation: flash 0.6s steps(2) infinite; }
#battery-level { background: linear-gradient(180deg, #a6f37a, #4cc22f 55%, #2c8a19); }
#battery.low #battery-level { background: linear-gradient(180deg, #ff9b6e, #e8573a); } #battery.low .ico { animation: flash 0.6s steps(2) infinite; }
#battery-pct { font-family: var(--hud-small); font-weight: 700; font-size: 16px; color: #fff; min-width: 38px; text-align: right; }
/* stelle del ricercato: vuote ma visibili, piene dorate con bagliore */
#wanted { display: flex; gap: 3px; height: 30px; opacity: 0; transition: opacity .4s; }
#wanted.on { opacity: 1; }
#wanted i { width: 28px; height: 28px; background: rgba(0,0,0,.45); clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
#wanted i.on { background: linear-gradient(180deg, #fff2a8, var(--gold) 45%, #d68a00); filter: drop-shadow(0 0 6px rgba(255,200,40,.8)); }
#wanted.flash i.on { animation: flash 0.5s steps(2) infinite; }
#suspicion { display: flex; align-items: center; gap: 6px; font-family: var(--hud-small); font-weight: 700; font-size: 13px; letter-spacing: 2px; color: #ffd84a; }
#suspicion .track { width: 110px; height: 7px; border-radius: 4px; background: rgba(0,0,0,.6); box-shadow: 0 0 0 2px #000; overflow: hidden; }
#suspicion-bar { height: 100%; width: 0; background: linear-gradient(90deg, #ffd84a, #ff7a2a, #e8413a); transition: width .4s; }
#mission-timer { font-size: 30px; color: #fff; letter-spacing: 1px; }
#menu-btn { position: absolute; left: 16px; top: 66px; pointer-events: auto; width: 42px; height: 38px; font-size: 20px; border-radius: 10px; background: var(--panel); color: #fff; border: 2px solid rgba(255,255,255,.3); box-shadow: 0 0 0 2px #000; cursor: pointer; }
#menu-btn:hover { background: rgba(0,0,0,.75); }
@media (pointer: fine) { #menu-btn { display: none; } } /* con la tastiera c'è Esc */
/* radar */
#radar { position: absolute; left: 16px; bottom: 16px; width: 180px; height: 180px; border-radius: 50%; background: #000;
  border: 3px solid #111; box-shadow: 0 0 0 3px rgba(255,255,255,.35), 0 0 0 6px #000, 0 8px 22px rgba(0,0,0,.5); }
/* dove ti trovi: città piccola con filetti, quartiere grande in corsivo */
#location { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); text-align: center; max-width: 80vw; padding: 6px 40px 4px;
  background: radial-gradient(ellipse at center, rgba(0,0,0,.55), rgba(0,0,0,0) 70%); }
#loc-city { display: flex; align-items: center; justify-content: center; gap: 10px; font-family: var(--hud-small); font-weight: 700; font-size: 13px; letter-spacing: 6px; color: var(--gold); text-shadow: 1px 1px 0 #000; }
#loc-city::before, #loc-city::after { content: ''; height: 2px; width: 34px; background: linear-gradient(90deg, transparent, var(--gold)); box-shadow: 0 1px 0 #000; }
#loc-city::after { background: linear-gradient(90deg, var(--gold), transparent); }
#district { font-size: 30px; line-height: 1.15; color: #fff; font-style: italic; letter-spacing: .5px; white-space: nowrap; padding: 0 .35em 2px .1em; /* il corsivo sborda: niente taglio */
  text-shadow: 2px 0 0 #000, -2px 0 0 #000, 0 2px 0 #000, 0 -2px 0 #000, 3px 3px 0 rgba(0,0,0,.5); }
/* titolo grande quando entri in una zona */
#area-title { position: absolute; left: 50%; top: 17%; transform: translateX(-50%); text-align: center; white-space: nowrap; opacity: 0; transition: opacity 2.5s ease; }
#area-title.show { opacity: 1; transition: opacity 0.6s ease; }
#area-city { font-size: clamp(40px, 7vw, 78px); line-height: 1; color: var(--gold); font-style: italic; letter-spacing: 2px; text-shadow: 3px 3px 0 #b03010, 6px 6px 0 #000; }
#area-district { font-family: var(--hud-small); font-weight: 700; font-size: clamp(18px, 2.6vw, 28px); color: #fff; letter-spacing: 4px; text-transform: uppercase; margin-top: 4px; }
#vehicle-name { position: absolute; right: 18px; bottom: 18px; font-size: 26px; color: #9fd8ff; font-style: italic; letter-spacing: 1px; }
#message { position: absolute; left: 50%; top: 34%; transform: translateX(-50%); font-size: 30px; color: #fff; text-align: center; letter-spacing: .5px; }
#message small { font-family: var(--hud-small); font-weight: 600; font-size: 20px; }
#nav, #choice, #nav-label, #choice-text { font-family: var(--hud-small); font-weight: 700; }
#nav { border-radius: 12px; border-color: rgba(255,255,255,.25); box-shadow: 0 0 0 2px #000; }
#nav-dist { font-family: var(--hud-font); font-size: 16px; }
#choice { border-radius: 12px; }
#choice-text { font-size: 22px; } #choice-text b { font-family: var(--hud-font); font-weight: 400; letter-spacing: .5px; }
#wasted { font-family: var(--hud-font); letter-spacing: 2px; text-shadow: 4px 4px 0 #000; }
@media (max-width: 700px) { #money { font-size: 30px; } .bar { width: 110px; } #weapon-box { min-width: 120px; height: 44px; } #weapon-icon, #weapon-img { width: 56px; height: 36px; } #district { font-size: 22px; } }

/* ora del giorno, in alto al centro */
#clock { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 4px 16px 4px 12px;
  border-radius: 12px; background: var(--panel); box-shadow: 0 0 0 2px #000; border: 2px solid rgba(255,255,255,.2); font-size: 28px; letter-spacing: 1px; color: #fff; }
#clock-icon { font-size: 22px; color: var(--gold); text-shadow: 0 0 8px rgba(255,200,60,.7); }
#clock.night #clock-icon { color: #cfd8ff; text-shadow: 0 0 8px rgba(160,180,255,.7); }

/* radar: su telefono e tablet si tocca per aprire la mappa della città */
@media (pointer: coarse) { #radar { pointer-events: auto; } }

/* ================= MENU: logo e voci in stile GTA ================= */
#menu { background: radial-gradient(ellipse at 70% 40%, rgba(120,50,10,.55), rgba(0,0,0,.92) 70%), linear-gradient(180deg, rgba(0,0,0,.2), rgba(0,0,0,.6)); }
#menu.ingame { background: radial-gradient(ellipse at center, rgba(40,20,10,.78), rgba(0,0,0,.93)); }
/* con il menu aperto spariscono le scritte del gioco che si sovrapporrebbero */
body.menu-open #area-title, body.menu-open #message, body.menu-open #choice { visibility: hidden; }
#menu .menu-col { display: flex; flex-direction: column; align-items: center; }
#menu h1.logo { display: flex; flex-direction: column; align-items: center; line-height: .86; margin: 0 0 6px; font-family: var(--hud-font); font-style: normal; text-shadow: none; transform: rotate(-3deg); animation: logo-sway 6s ease-in-out infinite; }
@keyframes logo-sway { 50% { transform: rotate(-1.5deg) scale(1.02); } }
#menu h1.logo .gta { font-size: clamp(64px, 10vw, 128px); color: #fff; letter-spacing: 2px;
  -webkit-text-stroke: 3px #000; paint-order: stroke fill; text-shadow: 5px 5px 0 #b03010, 9px 9px 0 #000; }
#menu h1.logo .sd { font-size: clamp(38px, 6vw, 74px); letter-spacing: 3px; text-transform: uppercase;
  background: linear-gradient(180deg, #fff6b0 0%, #ffd23a 45%, #e88a0c 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  -webkit-text-stroke: 2px #000; filter: drop-shadow(4px 4px 0 #000); }
#menu .sub { display: flex; align-items: center; gap: 12px; margin: 10px 0 26px; font-family: var(--hud-small); font-weight: 700; letter-spacing: 8px; color: var(--gold); font-size: 16px; }
#menu .sub::before, #menu .sub::after { content: ''; width: 46px; height: 2px; background: linear-gradient(90deg, transparent, var(--gold)); }
#menu .sub::after { background: linear-gradient(90deg, var(--gold), transparent); }
/* voci del menu: testo grande con contorno, la selezionata diventa dorata con la freccia */
#menu-items { gap: 4px; }
#menu-items button, #menu-items button.secondary { position: relative; width: auto; min-width: 0; padding: 4px 26px; background: none; border: none; box-shadow: none;
  font-family: var(--hud-font); font-size: clamp(26px, 3.2vw, 36px); letter-spacing: 1.5px; text-transform: uppercase; color: #f4f4f4;
  -webkit-text-stroke: 1.5px #000; paint-order: stroke fill; text-shadow: 3px 3px 0 #000; transition: transform .12s, color .12s; cursor: pointer; }
#menu-items button.secondary { font-size: clamp(20px, 2.4vw, 26px); color: #cfcfcf; }
#menu-items button:focus, #menu-items button.secondary:focus {
  background: none; color: var(--gold); transform: scale(1.08); box-shadow: none; outline: none; }
#menu-items button:focus::before { content: '▶'; position: absolute; left: 0; top: 50%; transform: translateY(-50%); font-size: .6em; color: var(--gold); -webkit-text-stroke: 1px #000; }
#menu-items button.danger { color: #ff6b5e; }
#menu-items button:disabled { color: #777; transform: none; }
#menu-items button:disabled::before { content: none; }
#menu-status { font-family: var(--hud-small); font-weight: 600; font-size: 15px; letter-spacing: .5px; color: #c9c9c9; text-shadow: 1px 1px 0 #000; }
#loading { font-family: var(--hud-small); font-weight: 700; letter-spacing: 3px; text-transform: uppercase; color: var(--gold); }
/* con la copertina accanto il logo resta, un po' più piccolo */
@media (min-width: 900px) and (min-height: 520px) { #menu:not(.controls):not(.ingame) h1.logo .gta { font-size: clamp(72px, 8.5vw, 130px); } #menu:not(.controls):not(.ingame) h1.logo .sd { font-size: clamp(40px, 4.6vw, 70px); } }
#menu.controls h1.logo { transform: none; animation: none; margin-bottom: 0; }
#menu.controls h1.logo .gta { font-size: 44px; text-shadow: 3px 3px 0 #b03010, 5px 5px 0 #000; } #menu.controls h1.logo .sd { font-size: 26px; }

/* schermata Comandi compatta: entra tutta nello schermo */
#menu h2 { font-family: var(--hud-font); font-weight: 400; letter-spacing: 2px; text-transform: uppercase; -webkit-text-stroke: 1px #000; paint-order: stroke fill; }
#menu.controls .menu-box { padding-top: 4px; }
#menu.controls .sub { display: none; }
#controls-table { font-size: 14px; }
#controls-table td { padding: 1px 6px; }
#controls-table button { font-size: 13px; padding: 3px 8px; min-width: 86px; }
@media (min-width: 1100px) { #controls-table { columns: 2; } }

/* proposta con il ritratto del capo che parla */
#choice { display: flex; align-items: center; gap: 16px; text-align: left; }
#choice.hidden { display: none; }
#choice-face { width: 104px; height: 104px; border-radius: 12px; border: 3px solid #000; box-shadow: 0 0 0 2px rgba(255,255,255,.35); flex: none; object-fit: cover; }
#choice-who { font-family: var(--hud-font); font-size: 22px; letter-spacing: 1px; color: var(--gold); line-height: 1; margin-bottom: 4px; }
#choice-who small { font-family: var(--hud-small); font-weight: 700; font-size: 14px; color: #ddd; letter-spacing: 2px; text-transform: uppercase; margin-left: 8px; }
#choice .choice-btns { justify-content: flex-start; }
#choice.talk .choice-btns { display: none; } #choice.talk { pointer-events: none; }
/* negozi: hotel e armeria */
#shop { position: fixed; inset: 0; z-index: 6; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.45); font-family: var(--hud-small); }
#shop.hidden { display: none; }
#shop .shop-box { background: rgba(14,12,10,.94); border: 3px solid #000; box-shadow: 5px 5px 0 #b03010; border-radius: 12px; padding: 16px 20px; width: min(460px, calc(100vw - 32px)); color: #fff; }
#shop .shop-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
#shop .shop-head img { width: 48px; height: 48px; }
#shop .shop-head b { display: block; font-family: var(--hud-font); font-weight: 400; font-size: 26px; letter-spacing: .5px; }
#shop .shop-head small { color: #ffcf3a; font-size: 16px; font-weight: 700; }
#shop .shop-money { margin-left: auto; font-family: var(--hud-font); font-size: 24px; color: #9fe870; }
#shop ul { list-style: none; margin: 0; padding: 0; }
#shop li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; font-size: 20px; font-weight: 700; cursor: pointer; }
#shop li small { display: block; font-size: 14px; color: #bbb; font-weight: 600; }
#shop li em { font-style: normal; color: #9fe870; font-family: var(--hud-font); font-weight: 400; }
#shop li.sel { background: #ffcf3a; color: #000; } #shop li.sel small { color: #333; } #shop li.sel em { color: #0a5a00; }
#shop li.off { opacity: .45; cursor: default; }
#shop .shop-esito { min-height: 24px; margin-top: 8px; font-size: 18px; font-weight: 700; color: #9fe870; } #shop .shop-esito .no { color: #ff6a5a; }
#shop .shop-keys { font-size: 14px; color: #aaa; margin-top: 4px; }
#sleep { position: fixed; inset: 0; z-index: 7; background: #000; opacity: 0; pointer-events: none; transition: opacity .8s; display: flex; align-items: center; justify-content: center; font-family: var(--hud-font); font-size: 56px; color: #fff; }
#sleep.on { opacity: 1; }
/* indicazioni delle missioni: piccole, sotto il navigatore (non coprono la strada) */
#note { position: absolute; left: 50%; top: 122px; transform: translateX(-50%); max-width: min(560px, calc(100vw - 32px)); font-family: var(--hud-small); font-weight: 700; font-size: 17px; color: #fff; text-align: center; background: rgba(0,0,0,.5); border-radius: 8px; padding: 4px 12px; text-shadow: 1px 1px 0 #000; transition: opacity .4s; opacity: 0; pointer-events: none; }
#note.on { opacity: 1; }
#note small { font-size: 15px; }
#choice .choice-enter { display: none; margin-top: 8px; font-size: 16px; color: #ffcf3a; }
#choice.read .choice-btns { display: none; } #choice.read .choice-enter { display: block; }
body.menu-open #note { visibility: hidden; }
/* codice della partita (salvataggi online) */
.save-code { font-family: var(--hud-font); font-weight: 400; letter-spacing: 3px; color: #ffcf3a; }
.save-code.big { font-size: 30px; }
.code-form { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 10px; }
.code-form label { font-family: var(--hud-small); font-weight: 700; font-size: 18px; }
#code-input { font-family: var(--hud-font); font-size: 34px; letter-spacing: 8px; text-align: center; width: 260px; max-width: 80vw; padding: 6px 10px; box-sizing: border-box; border: 3px solid #000; border-radius: 8px; background: #fff; color: #111; text-transform: uppercase; }
/* schermo troppo piccolo o telefono in verticale */
#screen-error { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; background: #111; color: #fff; text-align: center; font-family: var(--hud-small); font-size: 20px; font-weight: 600; line-height: 1.4; }
#screen-error.hidden { display: none; }
#screen-error b { display: block; font-family: var(--hud-font); font-weight: 400; font-size: 34px; color: #ffcf3a; margin-bottom: 6px; }
#screen-error small { color: #bbb; font-size: 16px; }
/* navigatore in alto nascosto: per l'obiettivo bastano la freccia sul bordo dello schermo e il percorso sul radar */
#nav { display: none !important; }
#note { top: 62px; }
/* testo delle missioni alla cabina */
#choice-text .mis-testo { display: block; font-style: italic; margin-bottom: 6px; }
#choice-text .mis-passi { margin: 6px 0 4px; padding-left: 22px; font-size: 18px; text-align: left; }
#choice-text .mis-passi li { margin: 3px 0; }
#choice-text .mis-avviso { font-size: 16px; color: #ff9a6a; margin: 4px 0; }
#choice-text .mis-info { font-size: 16px; color: #ffcf3a; margin-top: 6px; }
/* missione in corso: titolo e destinazione sotto l'ora */
#mission-info { position: absolute; left: 50%; top: 56px; transform: translateX(-50%); max-width: min(620px, calc(100vw - 32px)); text-align: center; pointer-events: none; text-shadow: 2px 2px 0 #000; }
#mission-info.hidden { display: none; }
#mission-info b { display: block; font-family: var(--hud-font); font-weight: 400; font-size: 20px; letter-spacing: .5px; color: #ffcf3a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#mission-info small { display: block; font-family: var(--hud-small); font-weight: 700; font-size: 15px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#note { top: 108px !important; }
body.menu-open #mission-info { visibility: hidden; }
#screen-error #fs-btn { display: block; margin: 16px auto 4px; font-family: var(--hud-font); font-size: 24px; padding: 10px 22px; border: 3px solid #000; border-radius: 10px; background: #ffcf3a; color: #000; box-shadow: 4px 4px 0 #b03010; }
/* pulsante CORRI (interruttore): largo, acceso quando corri */
#tbuttons button.wide { grid-column: span 2; height: 46px; border-radius: 23px; }
#tbuttons button.on { background: rgba(255,207,58,.85); color: #000; border-color: #000; }
/* comandi touch diversi a piedi e in auto */
body.in-vehicle #tbuttons .foot-only, body:not(.in-vehicle) #tbuttons .car-only, #tbuttons .off { display: none; }
#tbuttons button { line-height: 1.05; }
/* mappa su telefono: zoom con le dita, niente + e − (e la ✕ resta lontana dagli altri pulsanti) */
@media (pointer: coarse) { #bigmap-btns [data-map="in"], #bigmap-btns [data-map="out"] { display: none; } #bigmap-btns { top: auto; bottom: 46px; transform: none; } }
/* mentre si legge la missione le altre scritte spariscono (niente sovrapposizioni) */
body.reading #message, body.reading #note, body.reading #area-title, body.reading #mission-info, body.reading #nav { visibility: hidden; }
#choice-text .mis-passo { font-size: 20px; }
/* su telefono il riquadro della missione è centrato, largo e con il testo più grande */
@media (pointer: coarse) {
  body.reading #choice { top: 50%; bottom: auto; transform: translate(-50%, -50%); width: min(92vw, 640px); max-height: 86vh; overflow-y: auto; }
  body.reading #choice-text { font-size: 20px; }
  body.reading #choice .choice-enter { font-size: 17px; }
}

/* ---- impaginazione delle scritte: niente sovrapposizioni ---- */
#top-center { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 4px;
  max-width: calc(100vw - 420px); min-width: 180px; pointer-events: none; }
#top-center #clock, #top-center #mission-info, #top-center #note { position: static; transform: none; left: auto; top: auto !important; max-width: 100%; }
#top-center #note { margin-top: 2px; }
#center-stack { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 7vh; width: 100%; pointer-events: none; }
#center-stack:empty, #center-stack:has(> #area-title:not(.show)):has(> #message:empty) { margin-top: 0; }
#message { white-space: normal; }
#center-stack #area-title, #center-stack #message { position: static; transform: none; left: auto; top: auto; }
#center-stack #area-title:not(.show) { display: none; } /* quando è spento non occupa spazio */
#location { max-width: calc(100vw - 440px); }
@media (max-width: 900px) { #top-center { max-width: calc(100vw - 420px); } }
/* schermi bassi (telefono in orizzontale): tutto un po' più compatto */
@media (max-height: 500px) {
  #center-stack { margin-top: 2vh; }
  #area-city { font-size: 34px !important; } #area-district { font-size: 15px !important; }
  #message { font-size: 22px; } #message small { font-size: 15px; }
  #mission-info b { font-size: 16px; } #mission-info small { font-size: 13px; }
  #note { font-size: 14px; }
}
/* telefono: il nome del veicolo sopra il quartiere (a destra ci sono i pulsanti) */
@media (pointer: coarse) { #vehicle-name { right: auto; left: 50%; transform: translateX(-50%); bottom: 58px; font-size: 18px; } }
/* popup con domanda aperto: via le scritte che gli finirebbero sotto e, su telefono, i pulsanti touch */
body.choosing #center-stack, body.choosing #note { visibility: hidden; }
@media (pointer: coarse) { body.choosing #touch { display: none; } body.choosing #choice { top: 50%; bottom: auto; transform: translate(-50%, -50%); width: min(92vw, 640px); } }
/* logo del menu: SANDONATO in grande (con SASSARI sotto) */
#menu h1.logo .sd-big { font-size: clamp(54px, 8.4vw, 118px); letter-spacing: 2px; -webkit-text-stroke: 3px #000; filter: drop-shadow(5px 5px 0 #b03010) drop-shadow(4px 4px 0 #000); }
#menu.controls h1.logo .sd-big, #menu.ingame h1.logo .sd-big { font-size: clamp(36px, 5vw, 64px); }
/* menu segreto del gestore */
#menu.admin #cover { display: none; }
#menu.admin .menu-col { width: min(1100px, 94vw); }
.admin-box { width: 100%; font-family: var(--hud-small); color: #fff; text-align: left; margin-bottom: 12px; }
.admin-box h3 { font-family: var(--hud-font); font-weight: 400; color: #ffcf3a; font-size: 24px; margin: 4px 0 10px; letter-spacing: 1px; }
.admin-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.admin-card { background: rgba(0,0,0,.55); border: 2px solid #000; border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; }
.admin-card small { color: #ffcf3a; font-weight: 700; font-size: 14px; } .admin-card b { font-family: var(--hud-font); font-weight: 400; font-size: 40px; line-height: 1.1; }
.admin-card span { font-size: 14px; color: #ddd; } .admin-card em { font-style: normal; font-size: 15px; color: #9fe870; font-weight: 700; }
.admin-lists { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px; margin-top: 10px; }
.admin-list { background: rgba(0,0,0,.45); border-radius: 10px; padding: 8px 12px; font-size: 15px; }
.admin-list small { display: block; color: #ffcf3a; font-weight: 700; margin-bottom: 4px; }
.admin-list div { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px solid rgba(255,255,255,.08); padding: 2px 0; }
.admin-log { max-height: 52vh; overflow: auto; background: rgba(0,0,0,.55); border-radius: 10px; }
.admin-log table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-log th { position: sticky; top: 0; background: #1b1712; color: #ffcf3a; text-align: left; padding: 6px 8px; }
.admin-log td { padding: 4px 8px; border-bottom: 1px solid rgba(255,255,255,.07); white-space: nowrap; }
@media (max-width: 800px) { .admin-cards { grid-template-columns: repeat(2, 1fr); } .admin-lists { grid-template-columns: 1fr; } }
#menu.admin .menu-col { width: min(1100px, 94vw) !important; max-width: none !important; }
#menu.admin #menu-items, #menu.admin #menu-main { width: 100% !important; max-width: none !important; }
#menu.admin .menu-col { flex: 0 1 min(1100px, 94vw) !important; }
#menu.admin #menu-items { align-items: stretch; }
#menu.admin #menu-items > button { align-self: center; }
/* frecce verso gli obiettivi: sopra HUD e comandi touch, sotto mappa, negozi e menu */
#arrows { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; }
/* tasto ✕ per abbandonare la missione (solo su telefono) */
#abort-btn { display: none; position: absolute; left: 68px; top: 64px; width: 42px; height: 42px; border-radius: 50%; border: 2px solid #000; background: rgba(176,48,16,.85); color: #fff; font-size: 22px; font-weight: 700; pointer-events: auto; box-shadow: 2px 2px 0 rgba(0,0,0,.5); }
#abort-btn.conferma { width: auto; padding: 0 14px; border-radius: 23px; font-family: var(--hud-small); font-size: 16px; background: #e8413a; }
@media (pointer: coarse) { body.in-missione #abort-btn { display: block; } }
