/* Interfaccia del gioco (il nome è in GAME, js/config.js) */
:root { --blu: #6fa8ff; --glass: rgba(16, 20, 28, 0.66); --line: rgba(255, 255, 255, 0.12); --txt: #eef0f3; }
html, body { margin: 0; padding: 0; overflow: hidden; background: #0b1026; height: 100%; touch-action: none; font-family: 'Segoe UI', system-ui, sans-serif; color: var(--txt); }
canvas#game { display: block; }
.glass { background: var(--glass); border: 1px solid var(--line); border-radius: 12px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }

/* ---- caricamento e menu */
#loading { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 12px; background: radial-gradient(ellipse at 50% 30%, #1c2b55 0%, #0b1026 70%); transition: opacity .6s ease; overflow-y: auto; padding: 16px; box-sizing: border-box; touch-action: pan-y; }
#loading.done { opacity: 0; pointer-events: none; }
/* sfondo del menu: video (assets/video/menu-sfondo.mp4, elenco VIDEO in config.js), un po' scurito perché il menu si legga */
#menuVideo { position: fixed; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -1; opacity: 0; transition: opacity 1.2s ease; pointer-events: none; }
#menuVideo.on { opacity: .5; }
/* centratura "sicura": se il contenuto è più alto dello schermo si scorre e il titolo resta raggiungibile */
#title { margin-top: auto; } #loadingBox, #menu { margin-bottom: auto; }
#title { font-size: clamp(26px, 6vw, 44px); font-weight: 900; letter-spacing: 2px; text-shadow: 0 3px 0 #000; } #title span { color: var(--blu); }
#subtitle { opacity: .7; font-style: italic; margin-top: -8px; }
#loadingBox { display: flex; flex-direction: column; align-items: center; gap: 10px; width: min(360px, 90vw); }
#loadingText { font-size: 15px; opacity: .85; text-align: center; }
.bar { width: 100%; height: 6px; border-radius: 3px; background: rgba(255,255,255,.12); overflow: hidden; }
#loadingBar { width: 0; height: 100%; background: linear-gradient(90deg, #4f8cff, #9fd88a); transition: width .3s; }
#menu { display: none; flex-direction: column; gap: 14px; width: min(560px, 100%); }
.mcols { display: grid; gap: 14px; } .mcol { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
@media (min-width: 900px) { #menu { width: min(1000px, 100%); } .mcols { grid-template-columns: 1fr 1fr; align-items: start; } }
@media (max-height: 760px) { #title { font-size: clamp(22px, 4.5vw, 34px); } #loading { gap: 8px; } .msec { padding: 10px; } .opt { padding: 8px 10px; } #playBtn { padding: 12px; } }
.msec { background: rgba(255,255,255,.05); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.mlab { font-size: 12px; text-transform: uppercase; letter-spacing: 1.5px; opacity: .65; margin-bottom: 8px; }
.opts { display: flex; flex-direction: column; gap: 8px; } .opts.row { flex-direction: row; }
.opt { flex: 1; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(30,40,70,.6); color: #fff; font-size: 15px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.opt small { opacity: .7; font-size: 12px; } .opt.sel { border-color: var(--blu); background: rgba(50,90,170,.65); box-shadow: 0 0 0 1px var(--blu) inset; }
#photoKeys { display: none; margin-top: 10px; font-size: 13px; }
#photoKeys label { display: block; margin: 8px 0; } #photoKeys a { color: var(--blu); }
#photoKeys input { width: 100%; box-sizing: border-box; margin-top: 4px; padding: 9px; border-radius: 8px; border: 1px solid var(--line); background: rgba(0,0,0,.35); color: #fff; font-size: 14px; }
.note { opacity: .6; font-size: 12px; } #keyWarn { color: #ff9a8a; margin-top: 4px; }
.opt.chiusa { opacity: .5; }
.s3d, .s3dNota { display: none; } body.sceltaFoto .s3d { display: block; color: #ffd38a; } body.sceltaFoto .s3dNota { display: block; margin-top: 6px; } #cityNote { margin-top: 6px; } #cityNote.lampo { animation: lampo 1.2s; }
@keyframes lampo { 0%, 40% { opacity: 1; color: #ffd34d; } 100% { opacity: .6; } }
.devOpt { display: block; margin-top: 10px; font-size: 13px; cursor: pointer; } .devOpt input { vertical-align: middle; }
#btnDev, #btnShot { display: none; } body.dev #btnDev, body.dev #btnShot { display: flex; }
body:not(.locale) .soloLocale { display: none !important; }   /* modalità sviluppo e segnalazioni: solo con avvia.bat */
body.locale .soloOnline { display: none !important; }   /* 3D condiviso e codice di recupero: solo online */
body:not(.conToken) .soloToken { display: none !important; }   /* token personale: in locale (online solo con ONLINE.tokenPersonale) */
#fotoCondivisa { opacity: .85; color: #bfe0ff; margin: 2px 0 6px; }
.townSel { width: 100%; margin-top: 8px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(30,40,70,.6); color: #fff; font-size: 15px; }
.townSel.sel { border-color: var(--blu); background: rgba(50,90,170,.65); }
#gpuSoft { display: none; margin-top: 8px; opacity: .95; color: #ff9a8a; }
/* segnalazione rapida (non blocca il gioco: niente finestre del browser) */
#repBox { display: none; position: fixed; z-index: 47; left: 50%; top: max(8px, env(safe-area-inset-top)); transform: translateX(-50%); width: min(560px, calc(100vw - 24px)); padding: 10px 12px; box-sizing: border-box; font-size: 14px; touch-action: manipulation; }
#repBox.visible { display: block; }
.repHead { display: flex; gap: 10px; align-items: baseline; margin-bottom: 8px; flex-wrap: wrap; }
.repRow { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
#repThumb { width: 96px; height: 54px; object-fit: cover; border-radius: 6px; background: #000; flex: 0 0 96px; }
#repNote { flex: 1; min-width: 0; padding: 10px; border-radius: 8px; border: 1px solid var(--line); background: rgba(0,0,0,.4); color: #fff; font-size: 15px; }
#repChips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { padding: 5px 10px; border-radius: 14px; border: 1px solid var(--line); background: rgba(50,70,120,.7); color: #fff; font-size: 13px; cursor: pointer; }
#repSend, #repCancel { flex: 1; padding: 10px; border-radius: 8px; border: 0; font-size: 15px; font-weight: 700; cursor: pointer; color: #fff; }
#repSend { background: #2f6fe0; } #repCancel { background: rgba(255,255,255,.15); }
/* strumenti di volo */
#flightBox { display: none; position: fixed; z-index: 4; left: 50%; top: max(8px, env(safe-area-inset-top)); transform: translateX(-50%); padding: 5px 12px; gap: 14px; align-items: center; pointer-events: none; }
#flightBox.visible { display: flex; }
.fCol { display: flex; flex-direction: column; align-items: center; line-height: 1.1; } .fCol b { font-size: 19px; font-variant-numeric: tabular-nums; } .fCol small { font-size: 10px; opacity: .7; }
.fThrBox { width: 10px; height: 26px; border-radius: 3px; background: rgba(255,255,255,.15); position: relative; overflow: hidden; } #fThr { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: linear-gradient(0deg, #4f8cff, #9fd88a); }
#flightWarn { position: fixed; z-index: 4; left: 50%; top: 28%; transform: translateX(-50%); font-size: 16px; font-weight: 800; color: #ffe08a; text-shadow: 0 2px 4px #000; pointer-events: none; text-align: center; max-width: 90vw; }
#flightWarn.alarm { font-size: 24px; color: #ff6a5a; animation: blink .6s steps(2) infinite; }
body.flying #hint, body.skydive #hint { top: max(64px, calc(env(safe-area-inset-top) + 56px)); }
#devPanel { display: none; position: fixed; z-index: 45; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(440px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow-y: auto; padding: 14px; box-sizing: border-box; font-size: 14px; touch-action: pan-y; }
#devPanel.visible { display: block; }
.devHead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.devGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin-bottom: 12px; } .devGrid label { cursor: pointer; }
.devGrid input { width: 18px; height: 18px; vertical-align: middle; margin-right: 6px; }
.devRow { display: flex; gap: 8px; margin-bottom: 10px; } .devRow select { flex: 1; min-width: 0; }
.devRow select, .devRow button { padding: 9px 10px; border-radius: 8px; border: 1px solid var(--line); background: rgba(30,40,70,.85); color: #fff; font-size: 14px; cursor: pointer; }
.devRow button { flex: 1; }
#devInfo { display: none; position: fixed; z-index: 30; left: 50%; transform: translateX(-50%); top: max(8px, env(safe-area-inset-top)); background: rgba(0,0,0,.6); color: #9fef9f; font: 12px/1.35 ui-monospace, Menlo, monospace; padding: 4px 10px; border-radius: 6px; pointer-events: none; white-space: pre; }
#gpuTip { display: none; margin-top: 8px; opacity: .8; color: #ffd38a; }
#phoneBox { display: none; } .phoneRow { display: flex; gap: 12px; align-items: center; font-size: 14px; }
#phoneQr { flex: 0 0 96px; width: 96px; height: 96px; background: #fff; border-radius: 8px; } #phoneQr svg { width: 100%; height: 100%; display: block; }
#menuLoc { display: grid; grid-template-columns: 1fr 1fr; }
#playBtn { padding: 15px; font-size: 18px; font-weight: 800; letter-spacing: 1px; border: 0; border-radius: 12px; background: linear-gradient(90deg, #2f6fe0, #4f8cff); color: #fff; cursor: pointer; box-shadow: 0 6px 20px rgba(47,111,224,.4); }
#errBox { display: none; position: fixed; left: 8px; right: 8px; top: 8px; z-index: 60; max-height: 40vh; overflow: auto; background: rgba(120,20,20,.92); color: #fff; font: 12px/1.4 ui-monospace, Menlo, monospace; padding: 8px 10px; border-radius: 8px; white-space: pre-wrap; }

/* ---- HUD */
#hud { position: fixed; top: max(12px, env(safe-area-inset-top)); left: 12px; padding: 10px 14px; font-size: 13px; line-height: 1.5; box-sizing: border-box; width: min(250px, calc(100vw - 164px)); pointer-events: none; z-index: 4; }
#hud .mode { font-weight: 700; letter-spacing: .4px; color: #9fd88a; } #hud .mode.driving { color: #8ab6ff; }
#hud .stat { opacity: .94; margin-top: 2px; }
#hud .mission { color: #ffd77a; margin-top: 7px; padding-top: 7px; border-top: 1px solid var(--line); line-height: 1.4; }
#hudToggle { pointer-events: auto; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
#hudToggle .chev { opacity: .7; font-size: 12px; }
#hud.collapsed .hudBody { display: none; } #hud.collapsed .chev { transform: rotate(180deg); }
#wantedLine { font-size: 15px; letter-spacing: 2px; color: rgba(255,255,255,.35); }
#wantedLine.hot { color: #ffd34d; text-shadow: 0 0 8px rgba(255,200,40,.7); animation: blink 0.8s steps(2) infinite; }
@keyframes blink { 50% { opacity: .55; } }
#nav { display: none; align-items: center; gap: 8px; margin-top: 6px; color: #ffe9a8; }
#navArrow { display: inline-block; font-size: 18px; transition: transform .1s linear; }
#hint { position: fixed; top: max(14px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); padding: 8px 16px; z-index: 5; font-size: 14px; max-width: 46vw; text-align: center; opacity: 0; transition: opacity .25s ease; pointer-events: none; }
#hint.visible { opacity: 1; }
#streetName { position: fixed; right: 20px; bottom: max(150px, calc(env(safe-area-inset-bottom) + 130px)); text-align: right; opacity: 0; transition: opacity .6s; pointer-events: none; z-index: 3; text-shadow: 0 2px 4px #000, 0 0 12px rgba(0,0,0,.6); }
#streetName.visible { opacity: 1; }
#streetMain { font-size: clamp(18px, 3vw, 28px); font-weight: 800; font-style: italic; letter-spacing: .5px; }
#streetSub { font-size: 14px; opacity: .8; color: #ffd77a; }
body.desktop #streetName { bottom: 40px; }
#radioBox { position: fixed; left: 50%; transform: translateX(-50%); bottom: max(14px, env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 10px; padding: 7px 14px; font-size: 13px; z-index: 3; pointer-events: none; transition: opacity .3s; opacity: .55; }
#radioBox.on { opacity: 1; } #radioBox.hidden { opacity: 0; }
#radioBox .rIcon { font-size: 20px; } #radioName { font-weight: 700; } #radioSub { opacity: .75; font-size: 12px; }
#radioBox.flash { animation: rflash .6s; } @keyframes rflash { 0% { box-shadow: 0 0 0 0 rgba(111,168,255,.9); } 100% { box-shadow: 0 0 0 14px rgba(111,168,255,0); } }
#ctxPrompt { position: fixed; left: 50%; transform: translateX(-50%); bottom: max(70px, calc(env(safe-area-inset-bottom) + 64px)); display: none; align-items: center; gap: 10px; padding: 8px 16px 8px 8px; font-size: 15px; z-index: 6; cursor: pointer; pointer-events: auto; }
#lifeBox { position: fixed; left: 50%; top: 28%; transform: translateX(-50%); display: none; padding: 12px 18px; font-size: 16px; z-index: 7; pointer-events: none; max-width: min(560px, calc(100vw - 32px)); text-align: center; }
/* menu a schermo (D74): locali, negozi, casa */
#menuBox { position: fixed; right: 16px; top: 50%; transform: translateY(-50%); width: min(410px, calc(100vw - 32px)); max-height: calc(100vh - 32px); display: none; flex-direction: column; z-index: 30; padding: 12px; color: var(--txt); background: rgba(16, 20, 28, 0.86); }
#menuBox.visible { display: flex; }
.mbHead { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; } .mbHead i { font-style: normal; font-size: 28px; } .mbHead div { flex: 1; display: flex; flex-direction: column; min-width: 0; } .mbHead b { font-size: 17px; } .mbHead small { opacity: .7; }
.mbX { flex: none; width: 40px; height: 40px; border: none; border-radius: 10px; background: rgba(255,255,255,.1); color: #fff; font-size: 18px; cursor: pointer; }
.mbList { overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding-right: 2px; }
.mbRow { display: flex; align-items: center; gap: 10px; padding: 10px; border: none; border-radius: 12px; background: rgba(255,255,255,.07); color: #fff; text-align: left; cursor: pointer; font: inherit; }
.mbRow:hover { background: rgba(50,90,170,.45); } .mbRow.no { opacity: .45; } .mbRow.sel { outline: 2px solid var(--blu); }
.mbRow i { font-style: normal; font-size: 22px; width: 28px; text-align: center; flex: none; } .mbRow div { flex: 1; display: flex; flex-direction: column; min-width: 0; } .mbRow small { opacity: .7; font-size: 13px; }
.mbRow span { font-weight: 700; white-space: nowrap; } .mbRow kbd { font: 11px system-ui; opacity: .45; border: 1px solid rgba(255,255,255,.3); border-radius: 4px; padding: 0 4px; }
body:not(.desktop) .mbRow kbd { display: none; }
.mbNota { margin-top: 8px; opacity: .85; font-size: 14px; text-align: center; }
body.menu #touchControls, body.menu #ctxPrompt, body.menu #keyHints { display: none !important; }
/* ebbrezza (D74): bordi scuri che pulsano */
#ebbro { position: fixed; inset: 0; pointer-events: none; z-index: 4; opacity: 0; background: radial-gradient(ellipse at center, rgba(0,0,0,0) 35%, rgba(40,10,30,.9) 100%); }
#lifeBox.visible { display: block; } #lifeBox.eat { box-shadow: 0 0 0 100vmax rgba(0,0,0,.55); font-size: 18px; }
#moneyLine { font-size: 13px; color: #d9f2c9; margin-top: 2px; letter-spacing: .02em; }
/* notiziario della radio (news.js): sottotitoli sopra il riquadro della radio */
#newsBox { position: fixed; left: 50%; transform: translateX(-50%); bottom: max(120px, calc(env(safe-area-inset-bottom) + 114px)); display: none; flex-direction: column; gap: 3px; padding: 8px 14px; width: min(560px, calc(100vw - 32px)); box-sizing: border-box; z-index: 5; pointer-events: none; font-size: 15px; line-height: 1.35; text-align: center; }
#newsBox.visible { display: flex; animation: pop .25s ease-out; } #newsTitle { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #ffd77a; } #newsText { color: #fff; }
/* telefono (phone.js) */
#phone { position: fixed; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); width: 300px; height: min(580px, calc(100vh - 32px)); display: none; flex-direction: column; z-index: 26; border-radius: 30px; background: #0d1118; border: 3px solid #2a2f3a; box-shadow: 0 12px 40px rgba(0,0,0,.6); overflow: hidden; color: #fff; font: 14px system-ui, sans-serif; }
#phone.visible { display: flex; animation: phUp .25s ease-out; } @keyframes phUp { from { transform: translateY(40px); opacity: 0; } }
.phTop { padding: 12px 16px 8px; text-align: center; font-weight: 700; border-bottom: 1px solid rgba(255,255,255,.08); }
#phScreen { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.phBottom { display: flex; justify-content: space-around; padding: 6px 0 10px; border-top: 1px solid rgba(255,255,255,.08); }
.phBottom button { width: 44px; height: 36px; border: none; border-radius: 18px; background: rgba(255,255,255,.08); color: #fff; font-size: 18px; cursor: pointer; }
.phGrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 6px; }
.phApp { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border: none; border-radius: 16px; background: rgba(255,255,255,.06); color: #fff; font-size: 12px; cursor: pointer; }
.phApp i { font-style: normal; font-size: 26px; } .phApp.locked { opacity: .45; }
.phDot, .badge { position: absolute; top: 2px; right: 6px; min-width: 18px; height: 18px; border-radius: 9px; background: #ff3b30; color: #fff; font: 700 11px system-ui; display: flex; align-items: center; justify-content: center; padding: 0 4px; box-sizing: border-box; }
#btnPhone { position: relative; } #btnPhone .badge { top: -4px; right: -4px; display: none; }
/* telefono con messaggi non letti: pulsa finché non lo apri (D94); primi passi: il pulsante del consiglio pulsa e il consiglio gli sta accanto */
#btnPhone.squilla { animation: squilla 1.8s ease-in-out infinite; }
@keyframes squilla { 0%, 100% { box-shadow: 0 0 0 0 rgba(90,180,255,.0); } 50% { box-shadow: 0 0 0 7px rgba(90,180,255,.45); } }
.evidenzia { animation: evidenzia 1.1s ease-in-out infinite; z-index: 30; }
@keyframes evidenzia { 0%, 100% { box-shadow: 0 0 0 0 rgba(255,211,77,0); } 50% { box-shadow: 0 0 0 8px rgba(255,211,77,.65); } }
canvas.evidenzia { border-radius: 50%; }
#consiglio { position: fixed; z-index: 31; max-width: min(300px, 62vw); padding: 10px 14px; font-size: 14px; line-height: 1.35; cursor: pointer; animation: pop .25s ease-out; }
#consiglio small { display: block; margin-top: 6px; opacity: .65; font-size: 11px; } #consiglio .salta { text-decoration: underline; }
.phRow { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: none; border-radius: 12px; background: rgba(255,255,255,.05); color: #fff; text-align: left; cursor: pointer; }
.phRow i { font-style: normal; font-size: 22px; } .phRow div { display: flex; flex-direction: column; min-width: 0; } .phRow small { opacity: .65; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.phRow.unread b::after { content: ' ●'; color: #ff3b30; } .phRow.sel { background: rgba(50,90,170,.55); }
.phMsg { align-self: flex-start; max-width: 85%; padding: 8px 11px; border-radius: 14px 14px 14px 4px; background: #262c38; line-height: 1.35; }
.phMsg.mio { align-self: flex-end; background: #1b5fd0; border-radius: 14px 14px 4px 14px; }
.phMsg.entrata b { color: #7be38f; } .rep { color: #ffd23f; font-weight: 400; } .rep.no { color: rgba(255,255,255,.22); }   /* reputazione in Jober */ .phMsg small { opacity: .6; margin-left: 4px; }   /* app Banca */
.phAct { display: block; margin-top: 7px; width: 100%; padding: 8px; border: none; border-radius: 10px; background: #ffd77a; color: #14161b; font-weight: 800; cursor: pointer; }
.phEmpty, .phCenter { text-align: center; opacity: .8; line-height: 1.4; } .phSmall { font-size: 12px; opacity: .65; }
.phBig { text-align: center; font-size: 42px; font-weight: 800; margin-top: 10px; } .phSub { font-weight: 700; opacity: .85; margin-top: 6px; }
.phBtn { padding: 10px; border: none; border-radius: 12px; background: rgba(50,90,170,.75); color: #fff; font-weight: 700; cursor: pointer; } .phBtn.danger { background: rgba(200,50,50,.55); }
.phCode { width: 100%; box-sizing: border-box; height: 54px; border-radius: 8px; background: #161b24; color: #cfe; border: 1px solid #333; font-size: 10px; } .phQr svg { display: block; margin: 0 auto; background: #fff; }
.phInput { width: 100%; box-sizing: border-box; margin: 6px 0; padding: 10px 12px; border-radius: 8px; border: 1px solid #2c3546; background: #161b24; color: #e8eef8; font: 15px system-ui, sans-serif; resize: none; }
.phCodiceRec { text-align: center; font: 600 14px/1.3 ui-monospace, Consolas, monospace; white-space: nowrap; color: #cfe; background: #161b24; border: 1px solid #333; border-radius: 8px; padding: 8px 4px; margin: 8px 0 0; user-select: all; }
.phQr { display: flex; justify-content: center; margin: 8px 0; } .phQr svg { width: 180px; height: 180px; background: #fff; border-radius: 6px; }
.phCall { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 20px; } .phCallIco { font-size: 64px; } .phCall small { opacity: .7; }
.phVideo { width: 100%; border-radius: 12px; background: #000; }
.phAnswer { margin-top: 18px; padding: 12px 22px; border: none; border-radius: 26px; background: #34c759; color: #fff; font-weight: 800; font-size: 16px; cursor: pointer; animation: blink 1s steps(2) infinite; }
#phToast { position: fixed; top: max(64px, calc(env(safe-area-inset-top) + 56px)); left: 50%; transform: translateX(-50%); display: none; gap: 10px; align-items: center; padding: 9px 14px; max-width: min(460px, calc(100vw - 32px)); z-index: 27; cursor: pointer; }
#phToast.visible { display: flex; animation: pop .25s ease-out; } #phToast i { font-style: normal; font-size: 24px; } #phToast div { display: flex; flex-direction: column; } #phToast span { font-size: 13px; opacity: .85; }
body.phoneOpen .abtn { display: none !important; }
/* dialoghi, titoli e video della storia (story.js) */
#dialogBox { position: fixed; left: 50%; transform: translateX(-50%); bottom: max(166px, calc(env(safe-area-inset-bottom) + 160px)); display: none; flex-direction: column; gap: 2px; padding: 8px 16px; width: min(620px, calc(100vw - 32px)); box-sizing: border-box; z-index: 28; pointer-events: none; text-align: center; font-size: 17px; line-height: 1.35; }
#dialogBox.visible { display: flex; }
/* telefono aperto (chiamate): i sottotitoli nello spazio libero a sinistra del telefono */
body.phoneOpen #dialogBox { left: calc((100vw - 332px) / 2); width: min(620px, calc(100vw - 364px)); } #dlgWho { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: #8ec5ff; }
#titleCard { position: fixed; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; z-index: 29; pointer-events: none; text-align: center; background: radial-gradient(ellipse at center, rgba(0,0,0,.55), rgba(0,0,0,.15) 70%); }
#titleCard.visible { display: flex; animation: tcIn 1.2s ease-out; } @keyframes tcIn { from { opacity: 0; } }
#titleCard .tc1 { font: 900 clamp(34px, 7vw, 76px) Georgia, serif; color: #fff; text-shadow: 0 4px 18px #000; } #titleCard .tc2 { font: italic 600 clamp(18px, 3vw, 30px) Georgia, serif; color: #ffd77a; text-shadow: 0 2px 10px #000; margin-top: 6px; }
/* apertura a flashback (Capitolo 1): fermo immagine sbiadito e "nastro che si riavvolge" */
body.fermo canvas { filter: saturate(.25) contrast(1.15) sepia(.2) brightness(.95); transition: filter .25s; }
#rewindFx { position: fixed; inset: 0; z-index: 28; pointer-events: none; display: none; overflow: hidden;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.07) 0 2px, transparent 2px 5px); }
#rewindFx b { position: absolute; top: 8%; right: 6%; font: 900 clamp(26px, 5vw, 52px) system-ui, sans-serif; color: #fff; text-shadow: 0 0 12px #000; animation: rwBlink .5s steps(2) infinite; }
#rewindFx::before { content: ''; position: absolute; left: 0; right: 0; height: 18%; background: linear-gradient(transparent, rgba(255,255,255,.18), transparent); animation: rwRoll .35s linear infinite; }
body.nero canvas { filter: brightness(0); transition: filter .4s; }
body.riavvolgi #rewindFx { display: block; } body.riavvolgi canvas { filter: saturate(.1) contrast(1.4) blur(1.2px) hue-rotate(180deg); }
@keyframes rwBlink { 50% { opacity: 0; } } @keyframes rwRoll { from { top: 110%; } to { top: -20%; } }
/* in spazzatrice il pulsante FUOCO diventa il sapone */
body.sapone #btnFire { display: flex; background: rgba(120,190,255,.3); border-color: rgba(170,215,255,.8); font-size: 26px; }
#titleCard.small { align-items: flex-start; justify-content: flex-end; padding: 0 0 22vh 6vw; background: none; } #titleCard.small .tc1 { font-size: clamp(22px, 3.4vw, 36px); } #titleCard.small .tc2 { font-size: clamp(14px, 2vw, 20px); }
#videoBox { position: fixed; inset: 0; display: none; z-index: 24; background: #000; pointer-events: none; } #videoBox.visible { display: block; } #videoBox.salta { pointer-events: auto; cursor: pointer; } #videoBox video { width: 100%; height: 100%; object-fit: cover; } #videoBox.verticale video { object-fit: contain; }
/* cartolina (postcard.js) */
#pcView { display: none; position: fixed; inset: 0; z-index: 30; touch-action: none; cursor: grab; }
#pcBox { display: none; position: fixed; left: 50%; transform: translateX(-50%); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 31; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; padding: 8px 10px; max-width: calc(100vw - 24px); box-sizing: border-box; }
body.postcard #pcView { display: block; } body.postcard #pcBox { display: flex; }
body.postcard #hud, body.postcard #minimap, body.postcard #sideBtns, body.postcard #touchControls, body.postcard #ctxPrompt, body.postcard #radioBox, body.postcard #newsBox, body.postcard #flightBox, body.postcard #flightWarn, body.postcard #keyHints, body.postcard #streetName, body.postcard #lifeBox, body.postcard #jumpCharge, body.postcard #crosshair { display: none !important; }
#pcFilters { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; } #pcFilters .opt { flex: none; padding: 8px 12px; font-size: 14px; }
#pcShoot { height: 42px; padding: 0 20px; border: none; border-radius: 21px; background: #ffd77a; color: #14161b; font: 800 15px system-ui, sans-serif; cursor: pointer; }
#pcClose { width: 42px; height: 42px; border-radius: 21px; border: 1px solid rgba(255,255,255,.3); background: rgba(30,40,70,.85); color: #fff; font-size: 18px; cursor: pointer; }
#pcFlash { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 35; } #pcFlash.go { animation: pcflash .45s ease-out; } @keyframes pcflash { from { opacity: .85; } to { opacity: 0; } }
#pcPreview { display: none; position: fixed; inset: 0; z-index: 36; background: rgba(0,0,0,.72); align-items: center; justify-content: center; padding: 12px; box-sizing: border-box; }
#pcPreview.visible { display: flex; }
.pcCard { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 12px; max-width: min(1100px, 100%); box-sizing: border-box; }
#pcImg { max-width: 100%; max-height: 72vh; border-radius: 6px; box-shadow: 0 8px 28px rgba(0,0,0,.55); }
.pcRow { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.pcRow button { height: 40px; padding: 0 16px; border-radius: 20px; border: 1px solid rgba(255,255,255,.3); background: rgba(30,40,70,.85); color: #fff; font: 600 14px system-ui, sans-serif; cursor: pointer; } #pcShare { background: #ffd77a; color: #14161b; border: none; }
#crosshair { position: fixed; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; z-index: 6; pointer-events: none; display: none; border: 2px solid rgba(255,255,255,.85); border-radius: 50%; box-shadow: 0 0 3px rgba(0,0,0,.8); }
#crosshair::after { content: ''; position: absolute; left: 8px; top: 8px; width: 2px; height: 2px; background: #fff; border-radius: 50%; }
body.walking.armed #crosshair { display: block; } body.killer #crosshair { border-color: rgba(255,90,90,.9); }
#weaponLine { font-size: 13px; color: #ffd77a; margin-top: 2px; } #weaponLine:empty { display: none; }
.killerOpt { grid-column: 1 / -1; color: #ff9b9b; }
#btnWeapon { right: 196px; bottom: max(20px, calc(env(safe-area-inset-bottom) + 4px)); width: 56px; height: 56px; font-size: 22px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.4); display: none; }
#btnFire { right: 20px; bottom: max(172px, calc(env(safe-area-inset-bottom) + 156px)); width: 66px; height: 66px; font-size: 12px; background: rgba(255,120,60,.3); border: 1px solid rgba(255,150,90,.7); display: none; }
body.walking #btnWeapon { display: flex; } body.walking.armed #btnFire { display: flex; } body.killer #btnFire { background: rgba(220,30,30,.35); }
#jumpCharge { position: fixed; left: 50%; transform: translateX(-50%); bottom: max(120px, calc(env(safe-area-inset-bottom) + 114px)); display: none; flex-direction: column; align-items: center; gap: 4px; z-index: 6; pointer-events: none; font: 700 11px system-ui, sans-serif; letter-spacing: .12em; color: #ffd77a; text-shadow: 0 1px 3px #000; }
#jumpCharge.on { display: flex; } #jumpCharge div { width: 170px; height: 9px; border-radius: 5px; background: rgba(0,0,0,.45); border: 1px solid rgba(255,215,122,.6); overflow: hidden; } #jumpCharge i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ffd77a, #ff7a3c); }
#ctxPrompt.visible { display: flex; animation: pop .25s ease-out; } @keyframes pop { from { transform: translateX(-50%) scale(.85); opacity: 0; } }
.key { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px; padding: 0 7px; box-sizing: border-box; border-radius: 6px; background: #f4f4f4; color: #111; font-weight: 800; font-size: 13px; box-shadow: 0 2px 0 #888; white-space: nowrap; }
#perfPanel { position: fixed; left: 10px; top: 220px; display: none; margin: 0; padding: 8px 10px; font: 11px/1.4 ui-monospace, Consolas, monospace; background: rgba(0,0,0,.65); color: #9fe08a; border-radius: 8px; z-index: 8; pointer-events: none; white-space: pre; }
#keyHints { position: fixed; left: 10px; bottom: 18px; display: none; gap: 10px; font-size: 12px; z-index: 3; pointer-events: none; color: rgba(255,255,255,.85); text-shadow: 0 1px 3px #000; }
#keyHints .key { min-width: 20px; height: 20px; font-size: 11px; padding: 0 5px; margin-right: 4px; }
body.desktop #keyHints { display: flex; flex-wrap: wrap; } body.desktop.nohints #keyHints { display: none; }
#helpPanel { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(420px, calc(100vw - 32px)); padding: 14px 16px; z-index: 20; display: none; font-size: 14px; }
#helpPanel.visible { display: block; }
.helpHead { display: flex; justify-content: space-between; margin-bottom: 10px; font-size: 16px; } #helpClose { cursor: pointer; padding: 0 6px; }
.helpGrid { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; align-items: center; margin-bottom: 10px; }
#minimap { position: fixed; top: max(12px, env(safe-area-inset-top)); right: 12px; width: 140px; height: 140px; border-radius: 50%; border: 2px solid rgba(255,255,255,.28); background: rgba(10,12,16,.55); pointer-events: auto; cursor: zoom-in; touch-action: none; z-index: 2; }
/* mappa grande ("pausa mappa" stile GTA) */
#bigMap { display: none; position: fixed; inset: 0; z-index: 40; background: #0e1116; }
#bigMap.visible { display: block; }
#bmView { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: grab; }
#bmCanvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.bmTop { position: absolute; top: max(8px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); display: flex; gap: 12px; align-items: center; padding: 6px 8px 6px 14px; max-width: calc(100vw - 24px); box-sizing: border-box; font-size: 14px; }
.bmTop b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.bmBtns { display: flex; gap: 6px; } .bmBtns button { min-width: 40px; height: 40px; border-radius: 20px; border: 1px solid rgba(255,255,255,.25); background: rgba(30,40,70,.85); color: #fff; font-size: 18px; cursor: pointer; }
.bmLegend { position: absolute; left: 12px; bottom: max(14px, env(safe-area-inset-bottom)); display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 6px 12px; font-size: 12px; max-width: calc(100vw - 24px); box-sizing: border-box; }
.bmLegend i { font-style: normal; margin-right: 3px; }
.bmAttr { position: absolute; right: 8px; bottom: 4px; font-size: 10px; color: rgba(255,255,255,.7); text-shadow: 0 1px 2px #000; }
#sideBtns { position: fixed; top: calc(max(12px, env(safe-area-inset-top)) + 150px); right: 12px; display: grid; grid-template-columns: repeat(2, 40px); gap: 8px; z-index: 4; pointer-events: auto; }
.sbtn { min-width: 40px; height: 40px; box-sizing: border-box; border-radius: 20px; display: flex; align-items: center; justify-content: center; gap: 4px; font-size: 16px; background: rgba(16,20,28,.7); border: 1px solid rgba(255,255,255,.2); color: #fff; user-select: none; -webkit-user-select: none; touch-action: none; cursor: pointer; }
.sbtn small { display: none; } .sbtn.pressed { background: rgba(255,255,255,.28); }
#attribution { position: fixed; bottom: 2px; left: 8px; right: 8px; font-size: 10px; color: rgba(255,255,255,.55); pointer-events: none; z-index: 2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px #000; }
#attribution .attrLogo { height: 12px; vertical-align: middle; }
#photoStatus { position: fixed; bottom: 16px; left: 8px; font-size: 12px; color: #ffb38a; pointer-events: none; z-index: 2; }

/* ---- comandi touch */
#touchControls { position: fixed; inset: 0; pointer-events: none; z-index: 1; }
#joyZone { position: fixed; left: 0; top: 30%; bottom: 0; width: 50%; pointer-events: auto; touch-action: none; }
#lookZone { position: fixed; right: 0; top: 30%; bottom: 0; width: 50%; pointer-events: auto; touch-action: none; }
body.desktop #joyZone { display: none; } body.desktop #lookZone { left: 0; top: 0; width: 100%; } body.desktop .abtn { display: none !important; }
#joyBase { display: none; position: fixed; width: 116px; height: 116px; border-radius: 50%; background: rgba(255,255,255,.10); border: 2px solid rgba(255,255,255,.35); pointer-events: none; }
#joyKnob { position: absolute; left: 33px; top: 33px; width: 50px; height: 50px; border-radius: 50%; background: rgba(255,255,255,.55); box-shadow: 0 2px 10px rgba(0,0,0,.35); }
.abtn { position: fixed; width: 74px; height: 74px; border-radius: 50%; display: flex; align-items: center; justify-content: center; text-align: center; color: #fff; font-size: 19px; font-weight: 700; pointer-events: auto; touch-action: none; user-select: none; -webkit-user-select: none; z-index: 3; }
#btnAction { right: 20px; bottom: max(34px, calc(env(safe-area-inset-bottom) + 14px)); background: rgba(159,216,138,.28); border: 1px solid rgba(159,216,138,.6); }
#btnBrake { right: 104px; bottom: max(20px, calc(env(safe-area-inset-bottom) + 4px)); width: 60px; height: 60px; font-size: 11px; background: rgba(255,120,120,.22); border: 1px solid rgba(255,120,120,.5); }
#btnSprint { right: 30px; bottom: max(124px, calc(env(safe-area-inset-bottom) + 104px)); width: 56px; height: 56px; font-size: 11px; background: rgba(138,182,255,.22); border: 1px solid rgba(138,182,255,.5); display: none; }
#btnRadio { right: 30px; bottom: max(124px, calc(env(safe-area-inset-bottom) + 104px)); width: 52px; height: 52px; font-size: 22px; background: rgba(255,215,122,.18); border: 1px solid rgba(255,215,122,.5); }
#btnJump { right: 104px; bottom: max(20px, calc(env(safe-area-inset-bottom) + 4px)); width: 60px; height: 60px; font-size: 11px; background: rgba(255,215,122,.22); border: 1px solid rgba(255,215,122,.55); display: none; }
#btnSiren { right: 104px; bottom: max(96px, calc(env(safe-area-inset-bottom) + 80px)); width: 56px; height: 56px; font-size: 22px; background: rgba(60,110,255,.25); border: 1px solid rgba(120,160,255,.6); display: none; } body.police #btnSiren { display: flex; }
body.walking #btnSprint, body.walking #btnJump { display: flex; } body.walking #btnBrake { display: none; } body.walking #btnRadio { right: 108px; }
#btnGasUp, #btnGasDown { right: 178px; width: 62px; height: 62px; font-size: 12px; line-height: 1.1; background: rgba(138,182,255,.22); border: 1px solid rgba(138,182,255,.55); display: none; }
#btnGasUp { bottom: max(100px, calc(env(safe-area-inset-bottom) + 84px)); } #btnGasDown { bottom: max(24px, calc(env(safe-area-inset-bottom) + 8px)); }
body.flying #btnGasUp, body.flying #btnGasDown { display: flex; }
/* paracadute: APRI VELA sopra il FRENO; nello strumento niente manetta */
body.skydive #btnJump { display: flex; bottom: max(96px, calc(env(safe-area-inset-bottom) + 80px)); }
#flightBox.sky .fCol:last-child { display: none; }
.abtn.pressed { filter: brightness(1.6); }
@media (max-height: 460px) {
  #btnAction { bottom: 14px; } #btnBrake { bottom: 10px; } #btnSprint, #btnRadio { bottom: 96px; } #btnJump { bottom: 10px; }
  #minimap { width: 110px; height: 110px; }
  .bmTop { font-size: 12px; } .bmTop b { max-width: 40vw; } .bmBtns button { min-width: 36px; height: 36px; }
  .bmLegend { bottom: 8px; font-size: 11px; max-width: calc(100vw - 140px); }
  #sideBtns { top: max(8px, env(safe-area-inset-top)); right: 132px; grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 34px; gap: 6px; }
  #btnGasUp { bottom: 84px; } #btnGasDown { bottom: 12px; }
  #pcImg { max-height: 62vh; } .pcCard { padding: 8px; gap: 6px; } .pcRow button { height: 36px; padding: 0 12px; } #pcFilters .opt { padding: 6px 9px; font-size: 13px; } #pcShoot, #pcClose { height: 38px; }
  #phone { right: 8px; bottom: 8px; width: 250px; height: calc(100vh - 16px); border-radius: 22px; } .phGrid { gap: 6px; } .phApp { padding: 6px 2px; } .phApp i { font-size: 22px; }
  #dialogBox { bottom: 64px; font-size: 14px; width: min(520px, calc(100vw - 300px)); }
  #menuBox { top: 8px; bottom: 8px; transform: none; max-height: none; width: min(380px, 54vw); right: 8px; padding: 8px; } .mbRow { padding: 7px 9px; } .mbHead { margin-bottom: 6px; } .mbHead i { font-size: 22px; }
  body.phoneOpen #dialogBox { left: calc((100vw - 266px) / 2); width: min(520px, calc(100vw - 290px)); }
  #newsBox { bottom: 116px; width: min(440px, calc(100vw - 340px)); font-size: 13px; padding: 6px 10px; } body.skydive #btnJump { bottom: 84px; }
  body.flying #flightBox, body.skydive #flightBox { top: 48px; } body.flying #hint, body.skydive #hint { top: 100px; }
  .sbtn { min-width: 34px; height: 34px; font-size: 14px; }
  #hint { top: 52px; }
  #streetName { bottom: auto; top: calc(max(8px, env(safe-area-inset-top)) + 118px); right: 12px; }   /* sotto la minimappa: non copre i pulsanti */
  #streetMain { font-size: 18px; }
  #flightWarn { top: auto; bottom: 118px; font-size: 14px; } #flightWarn.alarm { font-size: 20px; }
}
/* cartolina trovata (collezionabili.js) */
#cartolinaBox { position: fixed; left: 50%; bottom: 18%; transform: translate(-50%, 30px); width: min(440px, 86vw); padding: 14px 18px 12px; border-radius: 10px; background: #efe0bf; color: #4a2f17; border: 3px solid #8b5e34; box-shadow: 0 10px 30px rgba(0,0,0,.45); font-family: Georgia, serif; z-index: 25; opacity: 0; pointer-events: none; transition: opacity .35s, transform .35s; }
#cartolinaBox.visibile { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#cartolinaBox .cbTit { font: 600 12px system-ui, sans-serif; letter-spacing: .06em; text-transform: uppercase; color: #8b5e34; margin-bottom: 4px; }
#cartolinaBox b { display: block; font-size: 19px; margin-bottom: 6px; } #cartolinaBox p { margin: 0 0 6px; font-size: 14px; line-height: 1.35; } #cartolinaBox small { color: #8b5e34; font: 11px system-ui, sans-serif; }
@media (max-height: 450px) { #cartolinaBox { bottom: 12%; padding: 10px 14px 8px; } #cartolinaBox b { font-size: 16px; } #cartolinaBox p { font-size: 12.5px; } }
/* setaccio dell'oro della Bessa (bessa.js) */
#bateaBox { position: fixed; left: 50%; bottom: 14%; transform: translateX(-50%); width: min(380px, 84vw); padding: 12px 16px 14px; border-radius: 12px; background: rgba(18, 24, 32, .92); color: #f3e6b8; z-index: 25; text-align: center; font: 14px system-ui, sans-serif; touch-action: none; user-select: none; }
#bateaBox .btTit { font-weight: 700; margin-bottom: 8px; }
#bateaBox .btPiatto { width: 96px; height: 96px; margin: 0 auto 10px; border-radius: 50%; background: radial-gradient(circle at 50% 45%, #6b5a45, #3b3126 70%, #2a2219); box-shadow: inset 0 0 0 6px #5b4a36; position: relative; overflow: hidden; }
#bateaBox .btPiatto i { position: absolute; inset: 14px; border-radius: 50%; background: radial-gradient(circle, #c9b48a 0 30%, #9c8a66 31% 60%, rgba(156,138,102,0) 61%); transition: opacity .3s; }
#bateaBox .btBarra { position: relative; height: 18px; border-radius: 9px; background: #2b3442; margin: 0 6px 8px; overflow: hidden; }
#bateaBox .btBarra b { position: absolute; top: 0; bottom: 0; background: #3fae5a; border-radius: 9px; }
#bateaBox .btBarra span { position: absolute; top: -2px; bottom: -2px; width: 4px; margin-left: -2px; background: #ffd75e; border-radius: 2px; box-shadow: 0 0 6px #ffd75e; }
#bateaBox .btTesto { font-size: 13px; color: #d9e2ef; min-height: 18px; }
#veloZona { position: fixed; inset: 0; z-index: 28; display: flex; align-items: center; justify-content: center; padding: 16px; text-align: center; background: #05070d; color: #cfd8ef; font: 600 15px system-ui, sans-serif; opacity: 0; pointer-events: none; transition: opacity .35s; }
#veloZona.on { opacity: 1; pointer-events: auto; }
