:root {
  --ink: #1d2433;
  --paper: rgba(255, 252, 245, 0.94);
  --accent: #e4572e;
  --accent2: #1d3557;
  --good: #2e8b57;
  --bad: #c0392b;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #120d18; color: var(--ink);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-user-select: none; user-select: none; touch-action: none; }
#app, canvas { display: block; }
/* tutto lo schermo anche su iPhone come app dalla Home (lì inset:0 a volte lascia una striscia sotto) */
#app { position: fixed; top: 0; left: 0; right: 0; width: 100vw; height: 100vh; height: 100lvh; background: #bfd8ec; } /* larghezza dallo schermo, non dalla pagina: girando il telefono non resta mezza schermata nera */
#app canvas { width: 100% !important; height: 100% !important; }
button { font: inherit; cursor: pointer; }
[hidden] { display: none !important; }

.panel { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(420px, calc(100vw - 32px));
  max-height: calc(100vh - 32px); overflow: auto; background: var(--paper); border-radius: 18px; padding: 24px;
  box-shadow: 0 20px 60px rgba(20, 30, 50, 0.35); text-align: center; z-index: 10; }
.panel h1 { margin: 0; font-size: 44px; letter-spacing: -1px; color: var(--accent2); font-weight: 800; }
.panel h1::after { content: ""; display: block; width: 64px; height: 5px; margin: 8px auto 0; border-radius: 3px;
  background: linear-gradient(90deg, #009246 33%, #f4f1ea 33% 66%, #ce2b37 66%); }
.panel h2 { margin: 18px 0 10px; font-size: 18px; }
.tag { margin: 12px 0 4px; }
.city { margin: 0; font-weight: 700; color: var(--accent); font-size: 20px; }
#starts { display: grid; gap: 8px; }
.start { width: 100%; padding: 12px 14px; border: 0; border-radius: 12px; background: var(--accent2); color: #fff; font-weight: 600; }
.start:hover { filter: brightness(1.15); }
.start.alt { background: #6c757d; margin-top: 8px; }
#pause .start:first-of-type { margin-top: 4px; }
.link { background: none; border: 0; color: var(--accent2); text-decoration: underline; padding: 6px; }
.small { font-size: 13px; opacity: 0.75; }
.controls { margin-top: 14px; text-align: left; font-size: 13px; }
.controls summary { cursor: pointer; font-weight: 600; text-align: center; }
.credits { font-size: 11px; opacity: 0.6; margin: 8px 0 0; }
#loading { animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: 0.4; } }

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#hud button, #hud .pad { pointer-events: auto; }
.box { position: absolute; background: var(--paper); border-radius: 12px; padding: 8px 12px; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18); }
.tl { left: max(12px, env(safe-area-inset-left)); top: 12px; min-width: 150px; max-width: 46vw; }
.speed { font-size: 13px; } .speed b { font-size: 28px; font-variant-numeric: tabular-nums; }
#street { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#near { font-size: 12px; opacity: 0.75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.score { left: max(12px, env(safe-area-inset-left)); top: 108px; font-size: 13px; }
#minimap { position: absolute; right: max(12px, env(safe-area-inset-right)); top: 12px; width: 170px; height: 170px;
  border-radius: 50%; border: 4px solid #fff; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25); }
#mission { left: 50%; transform: translateX(-50%); top: 12px; text-align: center; max-width: min(420px, calc(100vw - 400px)); min-width: 200px; }
#mission .mt { font-size: 14px; } #mission .mt b { color: var(--accent); }
#mission .mr { font-size: 13px; font-variant-numeric: tabular-nums; }
#mTime.hurry { color: var(--bad); font-weight: 700; }
.tr-buttons { position: absolute; right: max(12px, env(safe-area-inset-right)); top: 196px; display: flex; gap: 8px; }
.tr-buttons { gap: 2px; padding: 4px; border-radius: 16px; background: rgba(26, 20, 24, 0.72); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25); backdrop-filter: blur(6px); }
.tr-buttons button { width: 40px; height: 40px; border: 0; border-radius: 12px; background: transparent; color: #fff; display: grid; place-items: center; padding: 0; cursor: pointer; }
.tr-buttons button svg { width: 22px; height: 22px; }
.tr-buttons button:hover, .tr-buttons button:active { background: rgba(255, 255, 255, 0.16); }
.tr-buttons #btnMap { color: #ffd23f; }
/* tutti i tasti dentro l'ingranaggio: si aprono in fila a sinistra, sopra i comandi di guida */
.tr-buttons { z-index: 30; }
#btnMenu { position: relative; transition: transform 0.25s; }
#btnMenu[aria-expanded="true"] { transform: rotate(60deg); background: rgba(255, 255, 255, 0.16); }
#trMenu { position: absolute; right: calc(100% + 6px); top: 0; display: flex; gap: 2px; padding: 4px; border-radius: 16px; background: rgba(26, 20, 24, 0.88); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3); backdrop-filter: blur(6px); }
#trMenu[hidden] { display: none; }
#trMenu button { position: relative; }
.tr-buttons:has(#chatBadge:not([hidden])) #btnMenu[aria-expanded="false"]::after { content: ""; position: absolute; top: 4px; right: 4px; width: 10px; height: 10px; border-radius: 50%; background: #ff3b4a; }

#touch { display: none; }
@media (pointer: coarse) {
  #touch { display: block; }
  .pad { position: absolute; bottom: max(18px, env(safe-area-inset-bottom)); display: flex; gap: 14px; }
  .pad.left { left: max(18px, env(safe-area-inset-left)); }
  .pad.right { right: max(18px, env(safe-area-inset-right)); }
  .pad button { width: 76px; height: 76px; border-radius: 50%; border: 0; font-size: 28px; color: #fff;
    background: rgba(29, 53, 87, 0.72); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3); touch-action: none; }
  .pad button.gas { background: rgba(46, 139, 87, 0.8); width: 88px; height: 88px; }
  .pad button.brake { background: rgba(192, 57, 43, 0.75); }
  .pad button.wheelie { display: none; background: rgba(230, 150, 20, 0.8); width: 60px; height: 60px; font-size: 28px; align-self: flex-start; margin-top: -28px; } /* a sinistra del freno: sopra al gas copriva l'ingranaggio e rubava il pollice */
  #touch.moto .pad button.wheelie { display: block; } /* impennata: solo coi mezzi a due ruote */
  .pad button.on { transform: scale(0.94); filter: brightness(1.3); }
}
@media (max-width: 700px) {
  #minimap { width: 120px; height: 120px; }
  .tr-buttons { top: 142px; }
  #mission { top: auto; bottom: 120px; max-width: calc(100vw - 32px); }
  .tl { max-width: calc(100vw - 160px); }
  .speed b { font-size: 22px; }
  .score { top: 96px; }
}

#toasts { position: fixed; left: 50%; transform: translateX(-50%); top: 84px; z-index: 20; display: grid; gap: 8px; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast { background: var(--paper); border-radius: 12px; padding: 10px 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  border-left: 6px solid var(--accent2); animation: tin 0.3s ease-out; transition: opacity 0.5s, transform 0.5s; }
.toast b { display: block; } .toast span { font-size: 13px; opacity: 0.8; }
.toast.good { border-color: var(--good); } .toast.bad { border-color: var(--bad); }
.toast.out { opacity: 0; transform: translateY(-10px); }
@keyframes tin { from { opacity: 0; transform: translateY(-10px); } }
@media (max-height: 500px) {
  .panel { padding: 14px 18px; }
  .panel h1 { font-size: 30px; }
  .tag { margin: 6px 0 2px; font-size: 13px; }
  .panel h2 { margin: 8px 0 6px; font-size: 15px; }
  #starts { grid-template-columns: 1fr 1fr; gap: 6px; }
  .start { padding: 8px 10px; }
}
.act { position: absolute; left: 50%; transform: translateX(-50%); bottom: 130px; pointer-events: auto; border: 0; border-radius: 14px;
  padding: 14px 20px; font-weight: 700; color: #fff; background: var(--accent); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3); animation: tin 0.25s ease-out; }
@media (pointer: fine) { .act { bottom: 40px; } .act::after { content: "  [E]"; opacity: 0.7; } }
.turbo { margin-top: 4px; font-weight: 800; color: #fff; background: var(--accent); border-radius: 6px; padding: 1px 6px; text-align: center; animation: blink 0.8s infinite; }
.toast.talk { border-color: #e0a100; font-style: italic; }

/* --- Stile "cartolina": menu caldo e invitante --- */
body { font-family: "Baloo 2", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
#menu { background: linear-gradient(160deg, rgba(43, 38, 74, 0.82), rgba(120, 52, 62, 0.78)); color: #fff7ea;
  border: 2px solid rgba(255, 214, 150, 0.45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
#menu .logo { display: flex; align-items: center; justify-content: center; gap: 8px; }
#menu .scoot { font-size: 44px; display: inline-block; animation: ride 2.4s ease-in-out infinite; }
@keyframes ride { 0%, 100% { transform: translateX(-4px) rotate(-3deg); } 50% { transform: translateX(4px) rotate(2deg); } }
#menu h1 { color: #ffd27a; font-size: 56px; font-weight: 800; text-shadow: 0 3px 0 #b5502f, 0 6px 18px rgba(0, 0, 0, 0.35); line-height: 1; }
#menu h1::after { display: none; }
#menu .city { color: #ffb58a; font-size: 18px; font-weight: 700; margin-top: 6px; }
#menu .tag { opacity: 0.85; }
#menu h2 { color: #ffe2b0; }
#menu .start { background: linear-gradient(180deg, #ffcf6e, #f39a3d); color: #3b1f12; font-weight: 800; font-size: 17px;
  box-shadow: 0 4px 0 #b5602a, 0 8px 16px rgba(0, 0, 0, 0.25); display: flex; align-items: center; gap: 10px; justify-content: center; transition: transform 0.1s; }
#menu .start:hover { transform: translateY(-2px); filter: none; }
#menu .start:active { transform: translateY(2px); box-shadow: 0 2px 0 #b5602a; }
#menu .start .ic { font-size: 20px; }
#menu .small, #menu .credits, #menu .controls { color: #f6e6cf; }
#menu .link { color: #ffd27a; }
#pause { font-family: "Baloo 2", system-ui, sans-serif; }
.box { border: 2px solid rgba(43, 45, 66, 0.08); }
.speed b { color: var(--accent); }

/* --- soldi, taxi, garage --- */
.money b { font-size: 22px; color: #1f8a4c; font-variant-numeric: tabular-nums; }
.money { position: relative; }
#gains { position: absolute; left: calc(100% + 6px); top: 0; display: flex; flex-direction: column; gap: 2px; pointer-events: none; }
.gain { font: 800 13px/1.1 "Baloo 2", system-ui, sans-serif; white-space: nowrap; color: #fff; padding: 1px 6px; border-radius: 8px; background: rgba(31, 138, 76, .85);
  animation: gainUp 1.3s ease-out forwards; font-variant-numeric: tabular-nums; }
.gain.down { background: rgba(214, 60, 60, .85); }
.gain.xp { background: rgba(40, 120, 190, .85); }
@keyframes gainUp { 0% { opacity: 0; transform: translateX(-6px); } 12% { opacity: 1; transform: none; } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-6px); } }
.menuTop { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 10px; gap: 8px; }
.wallet { background: rgba(0, 0, 0, 0.25); border-radius: 10px; padding: 6px 10px; }
.wallet b { color: #7dffb0; }
.wallet .safe { display: inline-block; width: 1.25em; height: 1.25em; vertical-align: -0.28em; background: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><rect x='2' y='3' width='20' height='17' rx='2.5' fill='%23596273' stroke='%23222' stroke-width='1.4'/><rect x='4.5' y='5.5' width='15' height='12' rx='1.5' fill='%237d8798' stroke='%23222' stroke-width='1'/><circle cx='12' cy='11.5' r='3.6' fill='%23d9dee6' stroke='%23222' stroke-width='1'/><path d='M12 8.6v1.4M12 13v1.4M9.1 11.5h1.4M13.5 11.5h1.4' stroke='%23222' stroke-width='1'/><circle cx='12' cy='11.5' r='1' fill='%23222'/><rect x='17' y='9.5' width='1.4' height='4' rx='.6' fill='%23ffd23f'/><rect x='4' y='20' width='3' height='2' fill='%23222'/><rect x='17' y='20' width='3' height='2' fill='%23222'/></svg>") center / contain no-repeat; } /* cassaforte al posto del portafoglio */
.gbtn { border: 0; border-radius: 12px; padding: 9px 14px; font-weight: 800; background: #2f6b5a; color: #fff; box-shadow: 0 3px 0 #1d4639; }
#taxi { left: max(12px, env(safe-area-inset-left)); bottom: 120px; top: auto; display: flex; gap: 8px; align-items: center; max-width: min(290px, 50vw); padding: 7px 10px;
  background: rgba(30, 24, 34, 0.92); color: #fff6e6; border: 2px solid #f1c40f; }
@media (pointer: fine) { #taxi { bottom: 16px; } }
#paxPic { width: 46px; height: 46px; image-rendering: pixelated; background: #f3e3c3; border-radius: 50%; border: 3px solid #f1c40f; flex: none; }
#taxi .tx { min-width: 0; font-size: 12px; line-height: 1.2; }
#taxi .tag2 { display: inline-block; background: #f1c40f; color: #222; font-weight: 800; border-radius: 6px; padding: 0 5px; font-size: 10px; }
#taxi b { display: block; font-size: 13px; }
#taxiTo { font-weight: 700; color: #ffd27a; }
#taxiFare { font-weight: 800; color: #7dffb0; font-size: 14px; }
.tbar { height: 5px; background: rgba(255, 255, 255, 0.15); border-radius: 3px; margin-top: 4px; overflow: hidden; }
.tbar i { display: block; height: 100%; background: linear-gradient(90deg, #f1c40f, #ff8a5a); width: 0; transition: width 0.3s; }
#taxi .link { color: #ffd27a; align-self: flex-start; }
@media (max-width: 700px) { #taxi { bottom: 120px; max-width: calc(100vw - 230px); } #paxPic { width: 36px; height: 36px; } }

#garage { position: fixed; inset: 0; z-index: 12; pointer-events: none; font-family: "Baloo 2", system-ui, sans-serif; }
.gPanel { pointer-events: auto; position: absolute; right: max(16px, env(safe-area-inset-right)); top: 16px; bottom: 16px; width: min(420px, 52vw);
  overflow: auto; background: rgba(32, 26, 38, 0.94); color: #fff6e6; border: 2px solid rgba(255, 210, 122, 0.5); border-radius: 18px; padding: 16px; }
.gHead { display: flex; justify-content: space-between; align-items: center; }
.gHead h2 { margin: 0; color: #ffd27a; font-size: 26px; }
.gTabs { display: flex; gap: 6px; margin: 10px 0; }
.gTabs button { flex: 1; border: 0; border-radius: 10px; padding: 8px; font-weight: 800; background: rgba(255, 255, 255, 0.08); color: #fff6e6; }
.gTabs button.on { background: #f39a3d; color: #3b1f12; }
.gGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 6px; }
.gVeh { border: 2px solid transparent; border-radius: 12px; padding: 6px; background: rgba(255, 255, 255, 0.07); color: #fff6e6; display: grid; justify-items: center; gap: 1px; }
.gVeh .ic { font-size: 24px; } .gVeh b { font-size: 13px; } .gVeh small { color: #7dffb0; }
.gVeh.on { border-color: #f39a3d; background: rgba(243, 154, 61, 0.18); }
.gCard { margin-top: 10px; background: rgba(0, 0, 0, 0.25); border-radius: 12px; padding: 10px 12px; }
.gCard h3 { margin: 0 0 4px; color: #ffd27a; } .gCard p { margin: 0 0 8px; font-size: 13px; opacity: 0.85; }
.gStat { display: grid; grid-template-columns: 110px 1fr; align-items: center; font-size: 12px; margin: 3px 0; }
.gStat i { height: 8px; border-radius: 4px; background: linear-gradient(90deg, #f39a3d var(--v), rgba(255, 255, 255, 0.12) var(--v)); }
.gCard .start { margin-top: 10px; }
.gCard .start:disabled { opacity: 0.6; cursor: default; }
.gRow { margin: 8px 0; }
.gLab { display: block; font-size: 12px; font-weight: 700; color: #ffd27a; margin-bottom: 3px; text-transform: uppercase; letter-spacing: 0.5px; }
.gOpts { display: flex; flex-wrap: wrap; gap: 5px; }
.gOpt { border: 2px solid transparent; border-radius: 8px; padding: 4px 9px; background: rgba(255, 255, 255, 0.09); color: #fff6e6; font-weight: 700; font-size: 13px; }
.gOpt.sw { width: 30px; height: 30px; padding: 0; border-radius: 50%; border-color: rgba(255, 255, 255, 0.3); }
.gOpt.on { border-color: #f39a3d; box-shadow: 0 0 0 2px #f39a3d; }
#gDone { margin-top: 12px; background: linear-gradient(180deg, #ffcf6e, #f39a3d); color: #3b1f12; font-weight: 800; }
@media (max-width: 700px) { .gPanel { width: 56vw; top: 8px; bottom: 8px; padding: 10px; } }
@media (pointer: coarse) and (max-height: 500px) {
  #taxi { left: 50%; transform: translateX(-50%); bottom: 4px; max-width: 30vw; padding: 3px 7px; gap: 5px; border-width: 1.5px; }
  #taxi .tx { font-size: 9.5px; line-height: 1.15; } #taxi b { font-size: 10.5px; } #taxiFare { font-size: 11px; } #taxi .tag2 { display: none; }
  #taxiLine { display: none; } #taxi .link { font-size: 10px; } #taxi .tbar { height: 3px; margin-top: 2px; }
  #paxPic { width: 26px; height: 26px; border-width: 2px; }
  .score div:not(.money) { display: none; }
  .tl #near { display: none; }
}
#settings { z-index: 14; }
.sRow { display: grid; grid-template-columns: 1fr 1.2fr; align-items: center; gap: 10px; margin: 8px 0; text-align: left; }
.sRow label { font-weight: 700; font-size: 14px; }
.sRow input[type=range] { width: 100%; accent-color: #f39a3d; }
.sRow select { font: inherit; padding: 6px 8px; border-radius: 8px; border: 1px solid rgba(0,0,0,0.2); background: #fff; color: #222; }
.gbtn.alt { background: #4a4f57; box-shadow: 0 3px 0 #2d3036; padding: 9px 11px; }
#settings .controls { margin-top: 6px; }
#quest { left: 50%; transform: translateX(-50%); top: 12px; min-width: 240px; max-width: min(440px, calc(100vw - 420px)); background: rgba(40, 22, 60, 0.92); color: #fff6e6; border: 2px solid #b06cff; text-align: left; }
#quest .tag2 { display: inline-block; background: #b06cff; color: #fff; font-weight: 800; border-radius: 6px; padding: 0 6px; font-size: 11px; }
#qGoal { font-size: 13px; color: #e8d6ff; }
.qrow { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: center; font-variant-numeric: tabular-nums; font-weight: 700; }
#qTime.hurry { color: #ff6b6b; }
#qBar { background: linear-gradient(90deg, #b06cff, #ff7ad9) !important; }
@media (pointer: coarse) and (max-height: 500px) { #quest { top: 6px; max-width: 40vw; padding: 4px 8px; font-size: 12px; } }
#rotate { display: none; }
@media (pointer: coarse) and (orientation: portrait) {
  #rotate { display: flex; position: fixed; top: 0; left: 0; right: 0; height: 100vh; height: 100lvh; z-index: 50; flex-direction: column; align-items: center; justify-content: center; gap: 12px; overflow: hidden;
    background: radial-gradient(ellipse at 50% 30%, #4a2f66 0%, #2a1b3c 45%, #120d18 100%); color: #fff6e6; text-align: center; padding: 24px 16px 110px; font-family: "Baloo 2", system-ui, sans-serif; }
  #rotate .stars { position: absolute; inset: 0; pointer-events: none; opacity: .7;
    background-image: radial-gradient(1.5px 1.5px at 12% 14%, #fff, transparent), radial-gradient(1px 1px at 30% 8%, #fff, transparent), radial-gradient(1.5px 1.5px at 72% 12%, #fff, transparent), radial-gradient(1px 1px at 88% 22%, #fff, transparent), radial-gradient(1px 1px at 52% 20%, #ffd27a, transparent), radial-gradient(1px 1px at 8% 34%, #fff, transparent), radial-gradient(1.5px 1.5px at 94% 40%, #fff, transparent);
    animation: twinkle 3s ease-in-out infinite alternate; }
  #rotate .sky { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 120px; pointer-events: none; }
  #rotate .rTitle { position: relative; font-size: clamp(34px, 10.5vw, 58px); font-weight: 800; line-height: .9; letter-spacing: 2px;
    background: linear-gradient(180deg, #ffe08a, #f39a3d 60%, #e0592a); -webkit-background-clip: text; background-clip: text; color: transparent;
    filter: drop-shadow(0 3px 0 #3b1f12) drop-shadow(0 8px 16px rgba(0,0,0,.5)); }
  #rotate .rTitle small { display: block; font-size: .34em; letter-spacing: 8px; color: #7fd6ff; -webkit-text-fill-color: #7fd6ff; margin-top: 4px; }
  /* gruppo come una locandina: i maestri dietro, tu (lui e lei) davanti */
  #rotate .cast { position: relative; width: min(100%, 460px); height: min(44vh, 400px, 92vw); margin-top: 4px; }
  #rotate .cast::after { content: ""; position: absolute; left: 6%; right: 6%; bottom: -4px; height: 22px; border-radius: 50%; background: radial-gradient(ellipse, rgba(0,0,0,.6), transparent 70%); z-index: 0; }
  #rotate .cast img { position: absolute; bottom: 0; height: 70%; width: auto; max-width: none; filter: drop-shadow(0 8px 12px rgba(0,0,0,.5)); animation: idle 2.6s ease-in-out infinite; z-index: 1; }
  #rotate .cast .c-mister { left: 0; bottom: 9%; height: 60%; filter: drop-shadow(0 8px 12px rgba(0,0,0,.5)) brightness(.88); animation-delay: -.4s; }
  #rotate .cast .c-nando { right: 0; bottom: 9%; height: 64%; filter: drop-shadow(0 8px 12px rgba(0,0,0,.5)) brightness(.88); animation-delay: -1.6s; }
  #rotate .cast .c-tubo { left: 50%; bottom: 17%; height: 58%; transform: translateX(-50%); animation-name: idleC; filter: drop-shadow(0 8px 12px rgba(0,0,0,.5)) brightness(.8); animation-delay: -.8s; z-index: 0; }
  #rotate .cast .c-lui { left: 20%; height: 74%; z-index: 2; animation-delay: -1.2s; }
  #rotate .cast .c-lei { right: 21%; height: 70%; z-index: 2; animation-delay: -2s; }
  #rotate .phone { position: relative; width: 44px; height: 76px; border: 4px solid #fff6e6; border-radius: 10px; margin: 14px 0 6px; animation: rot 2.2s ease-in-out infinite; box-shadow: 0 0 24px rgba(127,214,255,.35); }
  #rotate .phone i { position: absolute; inset: 5px 3px; border-radius: 3px; background: linear-gradient(160deg, #7fd6ff, #f39a3d); }
  #rotate .phone span { position: absolute; right: -34px; top: 18px; font-size: 26px; color: #ffd27a; font-weight: 800; animation: none; }
  #rotate b { position: relative; font-size: 24px; line-height: 1.1; }
  #rotate p { position: relative; opacity: .8; max-width: 320px; margin: 0; font-size: 14px; }
}
@keyframes idle { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes idleC { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, -5px); } }
@keyframes rot { 0%, 25% { transform: rotate(0); } 55%, 85% { transform: rotate(-90deg); } 100% { transform: rotate(0); } }
@keyframes twinkle { from { opacity: .4; } to { opacity: .85; } }
#bigmap { position: fixed; inset: 0; z-index: 15; background: #cfc6b4; font-family: "Baloo 2", system-ui, sans-serif; color: #fff6e6; }
#mapCv { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.mHead { position: absolute; top: max(8px, env(safe-area-inset-top)); left: max(10px, env(safe-area-inset-left)); right: max(10px, env(safe-area-inset-right)); display: flex; justify-content: space-between; align-items: center; pointer-events: none; }
.mHead > * { pointer-events: auto; }
.mTabs { display: flex; gap: 4px; background: rgba(26, 20, 24, 0.85); border-radius: 12px; padding: 4px; }
.mTabs button { border: 0; border-radius: 9px; padding: 6px 12px; font: inherit; font-weight: 800; background: transparent; color: #fff6e6; }
.mTabs button.on { background: #f39a3d; color: #3b1f12; }
.mX { border: 0; border-radius: 50%; width: 44px; height: 44px; font-size: 20px; background: rgba(26, 20, 24, 0.85); color: #fff; }
#mapDrawer { position: absolute; left: max(10px, env(safe-area-inset-left)); top: 64px; bottom: 12px; width: min(300px, 42vw); display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
#mapDrawerBtn { pointer-events: auto; align-self: flex-start; border: 0; border-radius: 12px; padding: 6px 12px; font: inherit; font-weight: 800; background: rgba(26, 20, 24, 0.85); color: #ffd27a; }
#mapDrawerBtn b { background: #ffcf3a; color: #1a1418; border-radius: 8px; padding: 0 6px; margin-left: 4px; }
#mapList { pointer-events: auto; display: none; overflow: auto; gap: 5px; align-content: start; background: rgba(26, 20, 24, 0.85); border-radius: 12px; padding: 6px; }
#mapDrawer.open #mapList { display: grid; }
#mapGoBtn { pointer-events: auto; align-self: flex-start; border: 0; border-radius: 12px; padding: 6px 12px; font: inherit; font-weight: 800; background: rgba(26, 20, 24, 0.85); color: #7dffb0; }
#goList { pointer-events: auto; display: none; overflow: auto; gap: 5px; align-content: start; background: rgba(26, 20, 24, 0.85); border-radius: 12px; padding: 6px; touch-action: pan-y; overscroll-behavior: contain; }
#mapDrawer.go #goList { display: grid; }
#mapDrawer.go #mapGoBtn { background: #2f9e5b; color: #fff; }
.goHead { border: 0; border-radius: 10px; padding: 8px 10px; font: inherit; font-weight: 800; text-align: left; background: rgba(255, 255, 255, 0.1); color: #fff; cursor: pointer; }
.goHead::after { content: ' ▸'; float: right; opacity: 0.7; }
.goHead.on { background: #ffd23f; color: #1a1418; }
.goHead.on::after { content: ' ▾'; }
.mEmpty { color: #ccc; font-size: 12px; padding: 6px; }
#heroWheel { position: absolute; top: 12px; right: calc(max(12px, env(safe-area-inset-right)) + 212px); width: 84px; height: 84px; border-radius: 50%; pointer-events: auto; cursor: pointer; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35); touch-action: manipulation; }
.mRow { display: flex; gap: 8px; align-items: center; text-align: left; border: 0; border-radius: 10px; padding: 5px 7px; background: rgba(255, 255, 255, 0.07); color: #fff6e6; font: inherit; }
.mRow:hover { background: rgba(255, 207, 58, 0.2); }
.mL { flex: none; width: 26px; height: 26px; border-radius: 50%; background: #ffcf3a; color: #1a1418; font-weight: 900; display: grid; place-items: center; border: 2px solid #1a1418; }
.mT b { display: block; font-size: 13px; line-height: 1.1; } .mT small { opacity: 0.7; font-size: 11px; }
.mZoom { position: absolute; right: max(12px, env(safe-area-inset-right)); bottom: 14px; display: flex; flex-direction: column; gap: 8px; }
.mZoom button { width: 46px; height: 46px; border-radius: 50%; border: 0; font-size: 22px; background: rgba(26, 20, 24, 0.85); color: #fff; }
#mpPill { font-size: 12px; font-weight: 700; color: #1f8a4c; }
#mpPanel { z-index: 14; }
#mpList { justify-content: center; margin: 8px 0; }
#mpList .gOpt { background: #2b2d42; }
#mpList .start { margin-top: 8px; }
#sName { font: inherit; padding: 6px 8px; border-radius: 8px; border: 1px solid rgba(0,0,0,0.2); }

/* pannelli scorrevoli anche sul telefono (il gioco blocca i gesti solo sulla scena) */
.panel, .gPanel, #mapList { touch-action: pan-y; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.panel { max-height: calc(100dvh - 24px); }
#settings { padding-bottom: 0; }
#sClose { position: sticky; bottom: 0; margin: 10px 0 0; box-shadow: 0 -8px 16px var(--paper); }
#settings .sTop { position: sticky; top: -24px; background: var(--paper); z-index: 1; display: flex; justify-content: space-between; align-items: center; padding: 4px 0 6px; }
#settings .sTop h2 { margin: 0; }
#settings .sX { border: 0; border-radius: 50%; width: 38px; height: 38px; font-size: 18px; background: #1d3557; color: #fff; }
@media (max-height: 500px) {
  #settings { width: min(720px, calc(100vw - 24px)); padding: 12px 16px 0; }
  #settings .sGrid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 18px; }
  .sRow { margin: 4px 0; } .sRow label { font-size: 12px; } .sRow select, #sName { padding: 3px 6px; font-size: 13px; }
  #settings .controls { font-size: 12px; }
}
.iosHint { margin-top: 8px; font-size: 12px; background: rgba(0, 0, 0, 0.25); border-radius: 10px; padding: 6px 10px; }
#clock { margin-left: 6px; font-size: 13px; font-weight: 700; color: #2b2d42; background: rgba(0,0,0,0.06); border-radius: 8px; padding: 1px 6px; }
/* Milano 1955: seppia e grana della pellicola */
body.era50 #app canvas { filter: sepia(0.85) contrast(1.08) brightness(0.98) saturate(0.9); }
body.era50 #app::after { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 1; opacity: 0.18; mix-blend-mode: multiply;
  background: repeating-radial-gradient(circle at 30% 40%, rgba(0,0,0,0.25) 0 1px, transparent 1px 3px), radial-gradient(ellipse at center, transparent 55%, rgba(40,25,10,0.7) 100%); }
#eraBadge { position: absolute; left: 50%; transform: translateX(-50%); top: 70px; background: #3a2a18; color: #f3e2c0; border: 2px solid #c9a46a; border-radius: 10px; padding: 3px 12px; font-weight: 800; font-family: Georgia, serif; }
#minimap { width: 200px; height: 200px; cursor: pointer; pointer-events: auto; }
.tr-buttons { top: 224px; }
@media (pointer: coarse) and (max-height: 500px) {
  #minimap { width: 150px; height: 150px; }
  #heroWheel { right: calc(max(12px, env(safe-area-inset-right)) + 160px); width: 64px; height: 64px; }
  .tr-buttons { top: 170px; }
  #mapDrawer { width: min(260px, 46vw); }
}
.lvRow { display: flex; gap: 6px; align-items: center; font-size: 12px; font-weight: 700; margin-top: 2px; }
#lvBadge { background: #1d6fd8; color: #fff; border-radius: 6px; padding: 0 6px; font-weight: 800; }
.xpWrap { height: 5px; background: rgba(0,0,0,0.12); border-radius: 3px; overflow: hidden; margin-top: 3px; min-width: 110px; }
#xpBar { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #7fd6ff, #1d6fd8); transition: width 0.4s; }
.gHeroes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 8px; }
.gHero { border: 2px solid transparent; border-radius: 12px; padding: 6px 4px; background: rgba(255,255,255,0.08); color: #fff6e6; display: grid; justify-items: center; gap: 1px; font: inherit; }
.gHero .ic { font-size: 22px; } .gHero b { font-size: 12px; line-height: 1.1; text-align: center; } .gHero small { color: #7fd6ff; font-size: 11px; }
.gHero.on { border-color: #f39a3d; background: rgba(243,154,61,0.18); }
.gRooms { font-weight: 700; color: #ffd27a; }
#quest.career { border-color: #7fd6ff; background: rgba(14, 40, 64, 0.92); }
#quest.career .tag2 { background: #7fd6ff; color: #0b2340; }
#askPanel { z-index: 16; } #askList { display: grid; gap: 8px; }
@media (pointer: coarse) and (max-height: 500px) { .score div.lvRow { display: flex; } .score div.xpWrap { display: block; } .score div.kmRow { display: flex; } }
/* chilometri percorsi: ogni km completato paga, e ogni km paga di più */
.kmRow { display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 800; margin-top: 4px; white-space: nowrap; }
#kmNext { color: #1f9d4a; }
.kmWrap { flex: 1; height: 6px; background: rgba(0,0,0,0.12); border-radius: 3px; overflow: hidden; min-width: 34px; }
#kmBar { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #b6f36b, #1fae46); transition: width 0.3s; }
.kmWrap.pop { animation: kmPop 0.6s ease-out; } @keyframes kmPop { 0% { transform: scale(1); } 40% { transform: scale(1.15, 2); box-shadow: 0 0 12px #3ddc84; } 100% { transform: scale(1); } }

#bizRate { font-size: 12px; font-weight: 800; color: #1a8a4a; margin-top: -2px; }
.score #bizRate:not([hidden]) { display: block; }

/* ricercato dalla polizia */
#wanted { margin-top: 4px; padding: 5px 8px; border-radius: 10px; background: #1a1418; color: #fff; font-size: 12px; font-weight: 700; line-height: 1.25; }
.score #wanted:not([hidden]) { display: block; }
#wanted b { display: block; font-size: 15px; color: #ffd23f; letter-spacing: 1px; }
#wanted b i { font-style: normal; color: rgba(255, 255, 255, 0.25); }
#wanted span { display: block; opacity: 0.9; }
#wanted u { display: block; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.2); margin-top: 3px; overflow: hidden; }
#wanted u s { display: block; height: 100%; background: #ff5a4f; text-decoration: none; }
#wanted.chase { animation: wantFlash 0.5s steps(1) infinite; }
#wanted.chase u s { background: #3ddc84; }
#wanted em { display: block; color: #ff5a4f; font-style: normal; font-weight: 900; }
@keyframes wantFlash { 0% { box-shadow: 0 0 0 3px #2a6bff; } 50% { box-shadow: 0 0 0 3px #ff2a2a; } }

/* gara con un pilota */
#raceHud { margin-top: 4px; padding: 5px 8px; border-radius: 10px; background: #1a1418; color: #fff; font-size: 12px; font-weight: 700; }
.score #raceHud:not([hidden]) { display: block; }
#raceHud b { color: #ff8a7a; }
#raceHud.ahead b { color: #7dffb0; }

/* negozio: guardaroba, modifiche, regalo */
.shopC .tier { display: inline-block; margin: 8px 0 4px; padding: 1px 8px; border-radius: 6px; font-size: 11px; font-weight: 800; color: #1a1418; text-transform: uppercase; letter-spacing: 0.5px; }
.shopList { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 6px; }
.shopIt { border: 2px solid var(--tc); border-radius: 12px; padding: 6px 4px; background: rgba(255,255,255,0.07); color: #fff6e6; display: grid; justify-items: center; gap: 1px; font: inherit; box-shadow: inset 0 0 12px -4px var(--tc); }
.shopIt .ic { font-size: 22px; } .shopIt b { font-size: 12px; line-height: 1.1; text-align: center; } .shopIt small { font-size: 11px; color: #ffd27a; }
.shopIt.on { background: color-mix(in srgb, var(--tc) 30%, transparent); }
.shopIt.locked { opacity: 0.72; } .shopIt.locked .ic { filter: grayscale(0.6); }
.dailyRow { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 6px; }
.dDay { border-radius: 8px; background: rgba(255,255,255,0.08); text-align: center; padding: 4px 1px; display: grid; }
.dDay small { font-size: 9px; opacity: 0.8; } .dDay b { font-size: 11px; color: #7dffb0; }
.dDay.got { opacity: 0.45; } .dDay.now { background: #f39a3d; } .dDay.now b { color: #3b1f12; } .dDay.now small { color: #3b1f12; }
/* Pass di Milano */
.passRow { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; margin-top: 8px; }
.passT { border: 2px solid #d21f2a; border-radius: 10px; background: rgba(255,255,255,0.07); color: #fff6e6; display: grid; justify-items: center; gap: 1px; padding: 5px 2px; font: inherit; }
.passT .ic { font-size: 20px; } .passT b { font-size: 10px; line-height: 1.1; text-align: center; } .passT small { font-size: 10px; color: #ffd27a; }
.passT.got { opacity: 0.5; } .passT.locked { opacity: 0.6; filter: grayscale(0.5); }
.passT.ready { background: #d21f2a; animation: passPulse 1s ease-in-out infinite alternate; } .passT.ready small { color: #fff; }
@keyframes passPulse { from { box-shadow: 0 0 0 0 #ffd23f; } to { box-shadow: 0 0 10px 2px #ffd23f; } }
/* Regalo di benvenuto: scelta del costume leggendario */
#starterPick { position: fixed; inset: 0; z-index: 9000; background: rgba(10, 6, 16, 0.82); display: grid; place-items: center; padding: 12px; overflow: auto; }
#starterPick .spBox { background: #241a30; color: #fff6e6; border: 2px solid #ffb830; border-radius: 16px; padding: 14px; max-width: 560px; width: 100%; text-align: center; box-shadow: 0 10px 40px #000a; }
#starterPick h2 { margin: 0 0 4px; color: #ffd27a; } #starterPick p { margin: 0 0 10px; font-size: 14px; opacity: 0.9; }
#starterPick .spRow { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#starterPick .spCard { border: 2px solid #ffb830; border-radius: 14px; background: radial-gradient(circle at 50% 35%, #4a3560, #1d1626); color: #fff6e6; display: grid; justify-items: center; gap: 4px; padding: 8px; font: inherit; cursor: pointer; }
#starterPick .spCard canvas { width: 96px; height: 144px; image-rendering: pixelated; }
#starterPick .spCard b { font-size: 15px; } #starterPick .spCard small { font-size: 12px; opacity: 0.85; }
#starterPick .spCard:active { transform: scale(0.97); }
@media (max-height: 520px) { #starterPick { place-items: start center; padding: 6px; } #starterPick .spBox { padding: 8px 10px; } #starterPick h2 { font-size: 18px; } #starterPick .spCard { padding: 4px 6px; gap: 2px; } #starterPick .spCard canvas { width: 48px; height: 72px; } #starterPick p { font-size: 11px; margin-bottom: 6px; } #starterPick .spCard small { font-size: 10.5px; line-height: 1.2; } #starterPick .spCard em { font-size: 10.5px; padding: 2px 4px; } }
.passLv { display: block; font-size: 13px; color: #ffd27a; }
.passBar { height: 10px; border-radius: 6px; background: rgba(255,255,255,0.12); overflow: hidden; margin: 4px 0; }
.passBar i { display: block; height: 100%; background: linear-gradient(90deg, #d21f2a, #ffd23f); }
.passEnd { font-size: 11px; opacity: 0.85; }
.passT.costume { border-color: #ffb830; background: color-mix(in srgb, #ffb830 18%, transparent); }
.passSouv { margin-top: 8px !important; font-size: 13px; }
#starterPick .spCard em { font-style: normal; font-weight: 800; font-size: 12px; color: #ffd23f; background: rgba(0,0,0,0.3); border-radius: 8px; padding: 4px 6px; }
/* mappa: spiegazione di quello che tocchi */
#mapInfo { position: absolute; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 5; width: min(360px, calc(100% - 32px)); background: #241a30; color: #fff6e6; border: 2px solid #ffd23f; border-radius: 14px; padding: 10px 34px 10px 12px; box-shadow: 0 8px 24px #0009; }
#mapInfo b { display: block; font-size: 15px; } #mapInfo p { margin: 4px 0 6px; font-size: 13px; opacity: 0.9; }
#mapInfo .mIx { position: absolute; right: 6px; top: 6px; background: none; border: 0; color: #fff6e6; font-size: 16px; }
#mapInfo .mIgo { font: inherit; font-weight: 800; background: #ffd23f; color: #1d1626; border: 0; border-radius: 10px; padding: 6px 12px; }
/* chat di gruppo */
#btnChat { position: relative; color: #7fd6ff; }
#chatBadge { position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; border-radius: 8px; background: #ff3b4a; color: #fff; font: 800 10px/16px system-ui; font-style: normal; padding: 0 3px; }
#chat { position: absolute; right: max(12px, env(safe-area-inset-right)); top: 64px; width: min(320px, 46vw); max-height: calc(100% - 190px); min-height: 160px; display: flex; flex-direction: column; background: rgba(30, 22, 40, 0.92); color: #fff6e6; border: 2px solid #7fd6ff; border-radius: 14px; pointer-events: auto; z-index: 15; overflow: hidden; }
#chat .cHead { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; background: rgba(127, 214, 255, 0.15); }
#chat .cHead button { background: none; border: 0; color: #fff6e6; font-size: 16px; }
#chatLog { flex: 1; overflow-y: auto; padding: 6px 10px; display: grid; gap: 4px; align-content: start; font-size: 13px; }
#chatLog .cMsg b { color: #7fd6ff; margin-right: 6px; } #chatLog .cMsg.me b { color: #ffd23f; }
#chatLog .cMsg span { overflow-wrap: anywhere; } #chatLog .cEmpty { opacity: 0.7; font-size: 12px; }
#chat .cRow { display: flex; gap: 6px; padding: 6px; }
#chatIn { flex: 1; min-width: 0; font: 600 14px system-ui; border: 0; border-radius: 10px; padding: 7px 10px; background: #fff6e6; color: #1d1626; }
#chatSend { border: 0; border-radius: 10px; background: #ffd23f; color: #1d1626; font: 900 16px system-ui; padding: 0 12px; }
@media (max-height: 500px) { #chat { top: 50px; max-height: calc(100% - 140px); } }
/* notifiche più piccole sul telefono in orizzontale */
@media (max-height: 500px) {
  #toasts { top: 8px; left: calc(max(12px, env(safe-area-inset-left)) + 240px); transform: none; width: max(220px, min(320px, calc(100vw - 560px))); }
  .toast { padding: 6px 10px; border-radius: 10px; }
  .toast b { font-size: 13px; } .toast span { font-size: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
}

/* regalo per chi sceglie il nome */
#nameBar { position: fixed; left: 50%; bottom: calc(max(12px, env(safe-area-inset-bottom)) + 96px); transform: translateX(-50%); z-index: 30; background: linear-gradient(#ffd23f, #ffb020); color: #2a1a06; border: 2px solid #fff3c0; border-radius: 999px; padding: 8px 16px; font: 800 14px system-ui, sans-serif; box-shadow: 0 6px 20px #0006; cursor: pointer; animation: nbPulse 1.4s ease-in-out infinite; white-space: nowrap; }
@keyframes nbPulse { 0%, 100% { transform: translateX(-50%) scale(1); } 50% { transform: translateX(-50%) scale(1.06); } }
#nameBox { position: fixed; inset: 0; z-index: 9000; background: rgba(10, 6, 16, 0.82); display: grid; place-items: center; padding: 12px; overflow: auto; }
#nameBox .nbBox { background: #241a30; color: #fff6e6; border: 2px solid #ffb830; border-radius: 16px; padding: 16px; max-width: 420px; width: 100%; text-align: center; box-shadow: 0 10px 40px #000a; }
#nameBox h2 { margin: 0 0 6px; color: #ffd27a; } #nameBox p { margin: 0 0 10px; font-size: 14px; opacity: 0.9; }
#nameBox .nbGift { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-bottom: 12px; }
#nameBox .nbGift span { background: rgba(255, 210, 63, 0.15); border: 1px solid #ffd23f; border-radius: 10px; padding: 4px 8px; font-weight: 800; font-size: 13px; }
#nameBox input { width: 100%; box-sizing: border-box; font: 800 18px system-ui, sans-serif; padding: 10px 12px; border-radius: 12px; border: 2px solid #ffb830; background: #fff8ec; color: #241a30; text-align: center; }
#nameBox small { display: block; min-height: 18px; color: #ff8a8a; margin-top: 4px; }
#nameBox .nbRow { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; margin-top: 4px; }
#nameBox .nbRow button { font: 900 15px system-ui, sans-serif; border: 0; border-radius: 12px; padding: 10px; cursor: pointer; }
#nbLater { background: #3a2f48; color: #fff6e6; } #nbOk { background: #ffd23f; color: #241a30; }
@media (max-height: 460px) { #nameBox p { font-size: 12px; margin-bottom: 6px; } #nameBox h2 { font-size: 18px; } }
@media (max-height: 460px) { #nameBar { font-size: 12px; padding: 5px 12px; bottom: auto; top: max(8px, env(safe-area-inset-top)); } #nameBar .nbx { display: none; } } /* sul telefono in alto e corto: in basso copriva il mezzo */

/* anteprima del regalo del nome */
#nameBox .nbPrev { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 8px; }
#nameBox .nbPrev canvas { max-width: 48%; height: auto; }
#nameBox .nbGift.small span { font-size: 11px; opacity: 0.85; border-style: dashed; }
/* classifica */
#btnBoard { font-size: 20px; line-height: 1; }
#board { position: absolute; right: max(12px, env(safe-area-inset-right)); top: 64px; width: min(320px, 46vw); max-height: calc(100% - 190px); min-height: 160px; display: flex; flex-direction: column; background: rgba(30, 22, 40, 0.94); color: #fff6e6; border: 2px solid #ffc93c; border-radius: 14px; pointer-events: auto; z-index: 15; overflow: hidden; }
#board .cHead { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; background: rgba(255, 201, 60, 0.18); }
#board .cHead button { background: none; border: 0; color: #fff6e6; font-size: 16px; }
#bSub { padding: 4px 10px; opacity: 0.75; font-size: 12px; }
#bList { overflow: auto; padding: 4px 8px 8px; display: grid; gap: 4px; }
.bRow { display: grid; grid-template-columns: 30px 1fr auto auto; gap: 6px; align-items: center; background: rgba(255, 255, 255, 0.06); border-radius: 8px; padding: 5px 8px; font-size: 14px; }
.bRow span { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bRow small { opacity: 0.7; } .bRow i { font-style: normal; font-weight: 900; color: #ffd23f; }
.bRow.me { background: rgba(255, 201, 60, 0.25); border: 1px solid #ffc93c; }
.bJoin { font: 900 13px system-ui, sans-serif; background: #ffd23f; color: #241a30; border: 0; border-radius: 10px; padding: 8px; cursor: pointer; }
.bWait { opacity: 0.7; text-align: center; margin: 10px 0; }
@media (max-height: 460px) {
  #nameBox .nbBox { padding: 10px 14px; }
  #nameBox .nbPrev canvas { max-height: 54px; width: auto; }
  #nameBox .nbPrev { margin-bottom: 4px; }
  #nameBox .nbGift { margin-bottom: 6px; } #nameBox .nbGift span { font-size: 11px; padding: 2px 6px; }
  #nameBox .nbGift.small { display: none; }
  #nameBox input { font-size: 16px; padding: 6px 10px; }
  #nameBox small { min-height: 12px; } #nameBox .nbRow button { padding: 8px; }
}
.bRow span em { display: block; font-style: normal; font-weight: 600; font-size: 11px; opacity: 0.8; }

/* premi dei campioni della settimana */
.bRule { font-size: 12px; opacity: 0.85; margin: 2px 0 4px; }
.bChamps { font-size: 12px; font-weight: 800; color: #ffd23f; background: rgba(255, 201, 60, 0.12); border-radius: 8px; padding: 5px 8px; }
#prizeBox { position: fixed; inset: 0; z-index: 9000; background: rgba(10, 6, 16, 0.82); display: grid; place-items: center; padding: 12px; overflow: auto; }
#prizeBox .nbBox { background: #241a30; color: #fff6e6; border: 2px solid #ffc93c; border-radius: 16px; padding: 14px; max-width: 560px; width: 100%; text-align: center; box-shadow: 0 10px 40px #000a; }
#prizeBox h2 { margin: 0 0 4px; color: #ffd27a; } #prizeBox p { margin: 0 0 8px; font-size: 14px; opacity: 0.9; }
.pzVeh { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 8px; }
.pzVeh button, .pzLooks button, .champRow button { font: 800 13px system-ui, sans-serif; background: #3a2f48; color: #fff6e6; border: 2px solid transparent; border-radius: 10px; padding: 6px 10px; cursor: pointer; }
.pzVeh button.on, .champRow button.on { border-color: #ffd23f; background: #4a3a20; }
.pzOpt { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; }
.pzBig { background: #33284a; border: 2px solid #ffc93c; border-radius: 14px; padding: 10px; color: #fff6e6; font: 700 13px system-ui, sans-serif; display: grid; gap: 6px; align-content: start; cursor: pointer; }
.pzBig b { font-size: 16px; } .pzBig small { display: block; opacity: 0.85; }
button.pzBig:disabled { opacity: 0.45; cursor: default; }
.pzLooks { cursor: default; } .pzLooks button { border-left: 14px solid var(--c); text-align: left; }
#pzErr { display: block; min-height: 16px; color: #ff8a8a; margin-top: 4px; }
#prizeBox .nbRow { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; margin-top: 4px; }
#prizeBox #nbLater { font: 900 14px system-ui, sans-serif; border: 0; border-radius: 12px; padding: 8px; background: #3a2f48; color: #fff6e6; }
.champBox { margin-top: 8px; background: rgba(255, 201, 60, 0.1); border: 1px solid #ffc93c; border-radius: 10px; padding: 6px 8px; display: grid; gap: 4px; }
.champRow { display: flex; flex-wrap: wrap; gap: 4px; } .champRow button { border-left: 10px solid var(--c, #888); font-size: 12px; padding: 4px 8px; }
@media (max-height: 460px) { #prizeBox p { font-size: 12px; } #prizeBox h2 { font-size: 18px; } .pzBig b { font-size: 14px; } }
.pzLooks { grid-template-columns: 1fr 1fr; } .pzLooks > span { grid-column: 1 / -1; }
@media (max-height: 460px) { #prizeBox .nbBox { padding: 8px 12px; } .pzVeh { margin-bottom: 4px; } .pzVeh button, .pzLooks button { padding: 4px 8px; font-size: 12px; } .pzBig { padding: 6px; gap: 4px; } }

/* --- Schermata d'inizio: la città dal vivo dietro, personaggi a sinistra, GIOCA enorme a destra --- */
#menu { left: 0; top: 0; transform: none; width: 100vw; max-width: none; height: 100dvh; max-height: none; border-radius: 0; padding: 18px 28px;
  display: flex; align-items: center; justify-content: center; gap: 28px; text-align: left; box-shadow: none; border: 0; backdrop-filter: none; -webkit-backdrop-filter: none;
  background: linear-gradient(90deg, rgba(25, 18, 40, 0.88) 0%, rgba(40, 24, 50, 0.55) 48%, rgba(30, 20, 40, 0.15) 75%, rgba(30, 20, 40, 0.45) 100%); }
#menu[hidden] { display: none; }
#menu .mnL { flex: 1 1 52%; max-width: 560px; display: flex; flex-direction: column; align-items: flex-start; }
#menu .mnR { flex: 0 1 380px; display: flex; flex-direction: column; gap: 8px; background: rgba(25, 18, 40, 0.6); padding: 16px 18px; border-radius: 20px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); max-height: calc(100dvh - 24px); overflow: auto; }
#menu .logo { justify-content: flex-start; }
#menu h1 { font-size: 64px; }
#menu .city { font-size: 20px; }
#menu .tag { margin: 4px 0 0; color: #f6e6cf; opacity: 0.9; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); }
#menu .mnL { justify-content: center; max-height: 100%; }
#menu .mCast { display: flex; align-items: flex-end; margin-top: 10px; height: 220px; }
#menu .mCast img { height: 82%; margin: 0 -14px; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.45)); animation: castIn 0.6s ease-out backwards, bob 3s ease-in-out infinite; }
#menu .mCast img.big { height: 100%; z-index: 1; }
#menu .mCast img:nth-child(2) { animation-delay: 0.1s, 0.4s; } #menu .mCast img:nth-child(3) { animation-delay: 0.2s, 0.8s; }
#menu .mCast img:nth-child(4) { animation-delay: 0.3s, 1.2s; } #menu .mCast img:nth-child(5) { animation-delay: 0.4s, 1.6s; }
@keyframes castIn { from { opacity: 0; transform: translateY(30px); } }
@keyframes bob { 50% { transform: translateY(-5px); } }
#menu .mChips { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
#menu .mChips li { background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 210, 122, 0.35); border-radius: 10px; padding: 5px 8px; font-size: 13px; font-weight: 700; line-height: 1.2; }
#menu #loading { animation: none; text-align: center; padding: 10px 0; }
#menu #loading b { display: block; font-size: 17px; animation: blink 1.2s infinite; }
#menu #loading .bar { display: block; height: 10px; margin-top: 8px; border-radius: 6px; background: rgba(255, 255, 255, 0.15); overflow: hidden; }
#menu #loading .bar i { display: block; height: 100%; width: 40%; border-radius: 6px; background: linear-gradient(90deg, #ffcf6e, #f39a3d); animation: load 1.4s ease-in-out infinite; }
@keyframes load { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
#menu #startBox { display: flex; flex-direction: column; gap: 8px; }
#menu #startBox[hidden] { display: none; }
#menu .play { width: 100%; border: 0; border-radius: 18px; padding: 16px 10px; font: inherit; font-size: 34px; font-weight: 800; letter-spacing: 1px; color: #3b1f12;
  background: linear-gradient(180deg, #ffe08a, #f39a3d); box-shadow: 0 6px 0 #b5602a, 0 0 0 0 rgba(255, 207, 110, 0.7); animation: playPulse 1.6s ease-out infinite; cursor: pointer; }
#menu .play:active { transform: translateY(4px); box-shadow: 0 2px 0 #b5602a; }
@keyframes playPulse { 0% { box-shadow: 0 6px 0 #b5602a, 0 0 0 0 rgba(255, 207, 110, 0.7); } 70% { box-shadow: 0 6px 0 #b5602a, 0 0 0 18px rgba(255, 207, 110, 0); } 100% { box-shadow: 0 6px 0 #b5602a, 0 0 0 0 rgba(255, 207, 110, 0); } }
#menu .playSub { margin: 0; text-align: center; font-size: 13px; opacity: 0.85; }
#menu .moreStarts summary { cursor: pointer; text-align: center; font-weight: 700; color: #ffd27a; list-style: none; padding: 4px; }
#menu .moreStarts summary::-webkit-details-marker { display: none; }
#menu .moreStarts #starts { margin-top: 6px; grid-template-columns: 1fr 1fr; gap: 6px; }
#menu .moreStarts .start { font-size: 14px; padding: 8px; }
#menu .menuTop { display: flex; gap: 6px; justify-content: center; align-items: center; }
#menu .menuTop .wallet[hidden] { display: none; }
#menu .controls, #menu .lang, #menu .credits { font-size: 12px; text-align: center; }
@media (max-height: 500px) {
  #menu { padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left)); gap: 14px; }
  #menu h1 { font-size: 40px; } #menu .scoot { font-size: 30px; } #menu .city { font-size: 15px; margin-top: 2px; } #menu .tag { font-size: 12px; }
  #menu .mCast { height: min(150px, 40dvh); margin-top: 4px; }
  #menu .mnR { padding: 10px 12px; gap: 6px; flex-basis: 330px; }
  #menu .mChips li { font-size: 11px; padding: 4px 6px; }
  #menu .play { font-size: 28px; padding: 10px; }
  #menu .controls, #menu .credits { display: none; }
}
@media (max-aspect-ratio: 1/1) { /* schermo verticale (computer stretto): uno sopra l'altro */
  #menu { flex-direction: column; overflow: auto; justify-content: flex-start; }
  #menu .mnL { align-items: center; } #menu .mnR { flex-basis: auto; width: min(420px, 100%); }
}

/* --- Copertina "wow": cielo azzurro acceso, raggi di sole, neve, logo giallo gigante, GIOCA verde (colori dei giochi casual più giocati) --- */
#menu { background: linear-gradient(180deg, #23c6ff 0%, #2f7bff 46%, rgba(60, 90, 255, 0.55) 70%, rgba(40, 40, 120, 0.15) 100%); overflow: hidden; }
#menu .snow { position: absolute; inset: -20% 0 0 0; pointer-events: none; opacity: 0.85;
  background-image: radial-gradient(3px 3px at 20px 30px, #fff 50%, transparent 52%), radial-gradient(2px 2px at 80px 120px, #fff 50%, transparent 52%), radial-gradient(4px 4px at 150px 70px, rgba(255,255,255,.9) 50%, transparent 52%), radial-gradient(2px 2px at 200px 180px, #fff 50%, transparent 52%), radial-gradient(3px 3px at 260px 20px, rgba(255,255,255,.8) 50%, transparent 52%);
  background-size: 300px 220px; animation: snow 9s linear infinite; }
@keyframes snow { to { transform: translateY(20%); background-position: 60px 220px; } }
#menu .mnL, #menu .mnR { position: relative; z-index: 1; }
#menu .mnL { align-items: center; text-align: center; }
#menu .logo { position: relative; justify-content: center; transform: rotate(-4deg); animation: logoIn 0.7s cubic-bezier(.2, 1.6, .4, 1) backwards; }
@keyframes logoIn { from { transform: rotate(-4deg) scale(0.3); opacity: 0; } }
#menu .scoot { font-size: 40px; filter: drop-shadow(0 3px 0 #141a5c); }
#menu h1 { font-size: 78px; letter-spacing: 1px; text-transform: uppercase; color: #ffd21f; line-height: 0.95;
  background: linear-gradient(180deg, #fff9a8 0%, #ffe23b 45%, #ffa400 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  -webkit-text-stroke: 10px #141a5c; paint-order: stroke fill; text-shadow: none; filter: drop-shadow(0 7px 0 #141a5c) drop-shadow(0 12px 14px rgba(0, 0, 0, 0.35)); }
#menu .sticker { position: absolute; right: -34px; top: -18px; width: 74px; height: 74px; display: grid; place-items: center; transform: rotate(14deg);
  font-weight: 800; font-size: 15px; color: #fff; letter-spacing: 0.5px; text-shadow: 0 2px 0 #8a0f2a;
  background: radial-gradient(circle, #ff4d6d 55%, #e3123f 56%); clip-path: polygon(50% 0, 61% 12%, 77% 6%, 80% 22%, 96% 25%, 90% 40%, 100% 52%, 89% 63%, 94% 79%, 78% 80%, 72% 96%, 58% 88%, 45% 100%, 36% 87%, 20% 93%, 18% 77%, 3% 72%, 11% 58%, 0 45%, 12% 34%, 7% 18%, 23% 17%, 30% 2%, 42% 11%);
  animation: wobble 1.8s ease-in-out infinite; }
@keyframes wobble { 50% { transform: rotate(4deg) scale(1.08); } }
#menu .city { margin-top: 8px; display: inline-block; padding: 4px 18px; background: #e3123f; color: #fff; border-radius: 8px; font-size: 18px; font-weight: 800;
  box-shadow: 0 4px 0 #8a0f2a; transform: rotate(-2deg); }
#menu .tag { color: #fff; opacity: 1; font-weight: 700; text-shadow: 0 2px 0 rgba(20, 26, 92, 0.6); margin-top: 8px; }
#menu .mCast { position: relative; justify-content: center; }
#menu .mCast img { position: relative; z-index: 1; filter: drop-shadow(0 6px 0 rgba(20, 26, 92, 0.45)) drop-shadow(0 12px 14px rgba(0, 0, 0, 0.3)); }
#menu .mCast img.big { z-index: 2; }
#menu .rays { position: absolute; left: 50%; top: 55%; width: 640px; height: 640px; margin: -320px 0 0 -320px; z-index: 0; border-radius: 50%; pointer-events: none;
  background: repeating-conic-gradient(from 0deg, rgba(255, 255, 255, 0.22) 0 10deg, rgba(255, 255, 255, 0) 10deg 22deg);
  -webkit-mask: radial-gradient(circle, #000 20%, transparent 68%); mask: radial-gradient(circle, #000 20%, transparent 68%); animation: spin 30s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#menu .mnR { background: rgba(255, 255, 255, 0.16); border: 2px solid rgba(255, 255, 255, 0.35); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); box-shadow: 0 10px 30px rgba(20, 26, 92, 0.25); }
#menu .mChips li { background: #fff; color: #141a5c; border: 0; box-shadow: 0 3px 0 rgba(20, 26, 92, 0.35); }
#menu .mChips li:nth-child(1) { transform: rotate(-1.5deg); } #menu .mChips li:nth-child(2) { transform: rotate(1.2deg); }
#menu .mChips li:nth-child(3) { transform: rotate(1deg); } #menu .mChips li:nth-child(4) { transform: rotate(-1deg); }
#menu .play { position: relative; overflow: hidden; color: #fff; letter-spacing: 2px; border: 4px solid #0d3b1a;
  background: linear-gradient(180deg, #7dff6b 0%, #36d33f 45%, #1ea52f 100%); text-shadow: 0 3px 0 #0d3b1a;
  box-shadow: 0 7px 0 #0d3b1a, 0 0 0 0 rgba(125, 255, 107, 0.7); animation: playPulse2 1.5s ease-out infinite; }
#menu .play::after { content: ""; position: absolute; top: -20%; bottom: -20%; width: 40%; left: -60%; transform: skewX(-20deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.65), transparent); animation: shine 2.6s ease-in-out infinite; }
@keyframes shine { 0%, 55% { left: -60%; } 100% { left: 130%; } }
@keyframes playPulse2 { 0% { box-shadow: 0 7px 0 #0d3b1a, 0 0 0 0 rgba(125, 255, 107, 0.75); transform: scale(1); } 50% { transform: scale(1.03); } 70% { box-shadow: 0 7px 0 #0d3b1a, 0 0 0 20px rgba(125, 255, 107, 0); } 100% { box-shadow: 0 7px 0 #0d3b1a, 0 0 0 0 rgba(125, 255, 107, 0); transform: scale(1); } }
#menu .play:active { transform: translateY(5px); box-shadow: 0 2px 0 #0d3b1a; }
#menu .playSub { color: #fff; font-weight: 700; text-shadow: 0 1px 2px rgba(20, 26, 92, 0.6); opacity: 1; }
#menu .moreStarts summary { color: #fff; text-shadow: 0 2px 0 rgba(20, 26, 92, 0.5); }
#menu #loading b { color: #fff; text-shadow: 0 2px 0 rgba(20, 26, 92, 0.6); }
#menu #loading .bar { background: rgba(20, 26, 92, 0.35); border: 2px solid #fff; height: 16px; border-radius: 10px; }
#menu #loading .bar i { background: linear-gradient(90deg, #7dff6b, #36d33f); }
#menu .progress, #menu .small { color: #fff; }
#menu .controls, #menu .credits, #menu .lang { color: #eaf4ff; }
@media (max-height: 500px) {
  #menu h1 { font-size: 50px; -webkit-text-stroke: 8px #141a5c; } #menu .scoot { font-size: 28px; }
  #menu .sticker { width: 56px; height: 56px; font-size: 12px; right: -30px; top: -16px; }
  #menu .city { font-size: 13px; padding: 2px 12px; margin-top: 6px; } #menu .tag { font-size: 12px; margin-top: 4px; }
  #menu .rays { width: 420px; height: 420px; margin: -210px 0 0 -210px; }
  #menu .play { font-size: 30px; }
}

/* telefono in verticale: stessa copertina accesa */
@media (orientation: portrait) and (max-width: 900px) {
  #rotate { background: linear-gradient(180deg, #23c6ff 0%, #2f7bff 60%, #3a3fcf 100%) !important; }
  #rotate::before { content: ""; position: absolute; left: 50%; top: 42%; width: 900px; height: 900px; margin: -450px 0 0 -450px; border-radius: 50%; pointer-events: none;
    background: repeating-conic-gradient(from 0deg, rgba(255, 255, 255, 0.2) 0 10deg, rgba(255, 255, 255, 0) 10deg 22deg);
    -webkit-mask: radial-gradient(circle, #000 15%, transparent 65%); mask: radial-gradient(circle, #000 15%, transparent 65%); animation: spin 30s linear infinite; }
  #rotate .sky g:first-child { fill: #1c2a8a; }
  #rotate .rTitle { color: transparent; background: linear-gradient(180deg, #fff9a8 0%, #ffe23b 45%, #ffa400 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
    -webkit-text-stroke: 9px #141a5c; paint-order: stroke fill; filter: drop-shadow(0 6px 0 #141a5c); transform: rotate(-4deg); text-shadow: none; }
  #rotate .rTitle small { -webkit-text-stroke: 0; color: #fff; -webkit-text-fill-color: #fff; background: #e3123f; display: inline-block; padding: 2px 14px; border-radius: 8px; letter-spacing: 4px; box-shadow: 0 4px 0 #8a0f2a; margin-top: 10px; }
  #rotate .cast img { filter: drop-shadow(0 6px 0 rgba(20, 26, 92, 0.45)) !important; }
  #rotate .phone { border-color: #fff; box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.25), 0 0 30px rgba(255, 255, 255, 0.6); }
  #rotate b { color: #fff; font-size: 28px; text-shadow: 0 3px 0 #141a5c; }
  #rotate p { color: #fff; opacity: 1; font-weight: 600; text-shadow: 0 1px 2px rgba(20, 26, 92, 0.7); }
}
/* logo a due strati: sotto il bordo blu spesso, sopra il riempimento giallo (funziona su tutti i telefoni) */
#menu h1 { position: relative; background: none; -webkit-background-clip: border-box; background-clip: border-box; color: #141a5c; -webkit-text-fill-color: #141a5c; -webkit-text-stroke: 10px #141a5c; }
#menu h1::after { content: attr(data-text); display: block; position: absolute; left: 0; top: 0; width: auto; height: auto; margin: 0; border-radius: 0; -webkit-text-stroke: 0;
  background: linear-gradient(180deg, #fff9a8 0%, #ffe23b 45%, #ffa400 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; }
@media (orientation: portrait) and (max-width: 900px) {
  #rotate .rTitle { background: none; -webkit-background-clip: border-box; background-clip: border-box; color: #141a5c; -webkit-text-fill-color: #141a5c; }
  #rotate .rTitle::after { content: attr(data-text); position: absolute; left: 0; right: 0; top: 0; text-align: center; -webkit-text-stroke: 0;
    background: linear-gradient(180deg, #fff9a8 0%, #ffe23b 45%, #ffa400 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; }
}
@media (max-height: 500px) { #menu h1 { -webkit-text-stroke: 8px #141a5c; } }
#menu .sticker { right: -62px; top: -40px; }
#menu .menuTop .gbtn { background: #fff; color: #141a5c; box-shadow: 0 4px 0 rgba(20, 26, 92, 0.45); }
@media (max-height: 500px) { #menu .sticker { right: -50px; top: -34px; } }

/* --- Invita un amico --- */
.invBtn { display: block; width: 100%; margin: 8px 0 4px; font: 900 15px system-ui, sans-serif; color: #fff; border: 3px solid #fff; border-radius: 14px; padding: 9px 12px; cursor: pointer;
  background: linear-gradient(90deg, #ff3b3b, #ff9a1f, #ffc81f, #3bdc4a, #26b6ff, #6a4dff, #c04dff); background-size: 200% 100%; animation: invRb 4s linear infinite; text-shadow: 0 2px 0 #0007; box-shadow: 0 4px 0 #0003; }
@keyframes invRb { to { background-position: 200% 0; } }
#pause .invPause { background: linear-gradient(90deg, #ff3b3b, #ff9a1f, #ffc81f, #3bdc4a, #26b6ff, #6a4dff, #c04dff); color: #fff; text-shadow: 0 2px 0 #0007; }
#invBox { position: fixed; inset: 0; z-index: 9000; background: rgba(10, 6, 16, 0.82); display: grid; place-items: center; padding: 12px; overflow: auto; }
#invBox .nbBox { background: #241a30; color: #fff6e6; border: 3px solid transparent; border-radius: 18px; padding: 14px 16px; max-width: 440px; width: 100%; text-align: center; box-shadow: 0 10px 40px #000a;
  background: linear-gradient(#241a30, #241a30) padding-box, linear-gradient(90deg, #ff3b3b, #ffc81f, #3bdc4a, #26b6ff, #c04dff) border-box; }
#invBox h2 { margin: 0 0 4px; color: #ffd27a; } #invBox p { margin: 0 0 6px; font-size: 14px; opacity: 0.92; }
#invPrev { width: 100%; max-width: 320px; height: auto; display: block; margin: 0 auto 6px; background: radial-gradient(#3a2d4a, #241a30 70%); border-radius: 12px; }
#invBox .invList { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 8px; }
#invBox .invIt { background: #33284200; border: 2px dashed #6c5a80; border-radius: 12px; padding: 6px 4px; color: #fff6e6; font: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 2px; align-items: center; justify-content: center; }
#invBox .invIt b { font-size: 13px; } #invBox .invIt small { font-size: 11px; opacity: 0.85; }
#invBox .invIt.on { border-style: solid; border-color: #3ddc84; background: rgba(61, 220, 132, 0.12); }
#invBox .invIt.sel { box-shadow: 0 0 0 3px #ffd23f; }
#invBox .invIt.cash { border-style: solid; border-color: #ffd23f; background: rgba(255, 210, 63, 0.12); cursor: default; }
#invBox .invN { font-size: 13px; margin-bottom: 8px; } #invBox .invN button { font: 800 12px system-ui; background: #3a2f48; color: #fff6e6; border: 0; border-radius: 8px; padding: 3px 8px; cursor: pointer; }
#invShare { width: 100%; font: 900 18px system-ui, sans-serif; background: linear-gradient(#4be36b, #1fae46); color: #fff; border: 3px solid #fff; border-radius: 14px; padding: 11px; cursor: pointer; text-shadow: 0 2px 0 #0005; box-shadow: 0 4px 0 #0e6b2a; }
#invMsg { display: block; min-height: 18px; margin: 6px 0; font-size: 12px; color: #bfe9ff; word-break: break-all; }
#invClose { background: #3a2f48; color: #fff6e6; border: 0; border-radius: 12px; padding: 8px 20px; font: 800 14px system-ui, sans-serif; cursor: pointer; }
@media (max-height: 460px) { #invBox p { font-size: 12px; } #invBox h2 { font-size: 18px; } #invPrev { max-height: 64px; width: auto; } #invShare { font-size: 15px; padding: 8px; } }
@media (max-height: 460px) { #invBox .nbBox { max-width: 640px; padding: 8px 14px; } #invBox p { margin-bottom: 2px; } #invPrev { max-height: 48px; margin-bottom: 4px; } #invBox .invList { margin-bottom: 4px; } #invBox .invIt { padding: 3px 4px; } #invBox .invN { margin-bottom: 4px; } #invMsg { margin: 3px 0; } #invClose { padding: 5px 16px; } }
/* GIOCA si può premere anche mentre Milano si costruisce */
#menu #loading #btnEarly { margin-bottom: 6px; }
#menu #loading #btnEarly.wait { filter: saturate(0.6); font-size: 24px; animation: blink 1.2s infinite; }

/* Attesa del caricamento: regali che cadono da acchiappare */
#attesaVideo { position: fixed; inset: 0; z-index: 40; background: #05070f; transition: opacity .6s; }
#attesaVideo.via { opacity: 0; pointer-events: none; }
#attesaVideo video { width: 100%; height: 100%; object-fit: contain; display: block; }
#attesaVideo .audio { position: absolute; top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); width: 48px; height: 48px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .7); background: rgba(0, 0, 0, .45); color: #fff; font-size: 22px; cursor: pointer; }
#attesaVideo .carica { position: absolute; left: max(12px, env(safe-area-inset-left)); top: max(12px, env(safe-area-inset-top)); width: min(260px, 55vw); text-align: left;
  color: #fff; font-weight: 800; font-size: 13px; text-shadow: 0 2px 3px #000; background: rgba(5, 7, 15, .6); padding: 8px 12px 10px; border-radius: 12px; }
#attesaVideo .carica > i { display: block; height: 8px; margin-top: 6px; border-radius: 6px; background: rgba(255, 255, 255, .25); overflow: hidden; }
#attesaVideo .carica > i > i { display: block; height: 100%; width: 5%; background: #ffd23f; transition: width .3s; }
/* telefono in orizzontale: interfaccia più piccola, si vede di più la strada */
@media (pointer: coarse) and (max-height: 500px) {
  #hud .tl, #hud .score { transform: scale(0.8); transform-origin: top left; }
  #minimap { width: 112px; height: 112px; }
  #heroWheel { right: calc(max(12px, env(safe-area-inset-right)) + 122px); width: 50px; height: 50px; }
  .tr-buttons { top: 132px; }
  .pad { gap: 10px; }
  .pad button { width: 62px; height: 62px; font-size: 24px; }
  .pad button.gas { width: 72px; height: 72px; }
  .pad button.wheelie { width: 50px; height: 50px; font-size: 22px; margin-top: -22px; }
}
/* schermata iniziale su schermi bassi: il riquadro di destra non deve uscire dallo schermo */
@media (max-height: 500px) {
  #menu .mnR { max-height: calc(100dvh - 16px); overflow-y: auto; gap: 5px; padding: 8px 10px; }
  #menu .playSub { display: none; }
  #menu .play { font-size: 24px; padding: 8px; }
  #menu .mChips { gap: 4px; } #menu .mChips li { font-size: 10.5px; padding: 3px 6px; }
}
/* avviso dopo il profilo azzerato (scuse + regalo) */
.avvisoBug { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(10, 8, 16, .82); }
.avvisoBug > div { max-width: 380px; background: #2a2030; color: #fff6e6; border-radius: 18px; padding: 20px 22px; text-align: center; font: 600 16px/1.4 system-ui, sans-serif; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); }
.avvisoBug h2 { margin: 0 0 8px; color: #ffd27a; }
.avvisoBug button { margin-top: 8px; }
/* --- Scritta «MILANO RUSH» uguale all'icona dell'app: nastro rosso + RUSH giallo in rilievo (font Luckiest Guy, licenza OFL) --- */
@font-face { font-family: 'Luckiest Guy'; src: url(font/luckiest-guy.woff2) format('woff2'); font-display: swap; }
.mrLogo { position: relative; display: inline-flex; flex-direction: column; align-items: center; margin: 0; font-family: 'Luckiest Guy', 'Baloo 2', system-ui, sans-serif; font-weight: 400; line-height: 1;
  text-transform: none; letter-spacing: 0; background: none !important; -webkit-text-stroke: 0 !important; color: #ffd23f; -webkit-text-fill-color: currentColor; text-shadow: none; }
#menu h1.mrLogo { font-size: 104px; -webkit-text-stroke: 0; background: none; color: #ffd23f; -webkit-text-fill-color: currentColor; }
#menu h1.mrLogo::after, .mrLogo::after, .mrLogo::before { content: none !important; display: none !important; }
.mrLogo .n { position: relative; z-index: 1; font-size: .36em; color: #fff; -webkit-text-fill-color: #fff; padding: .2em .75em .02em; background: #e63946; border: .11em solid #1d1020; border-radius: .2em;
  box-shadow: 0 .11em 0 #1d1020; letter-spacing: .05em; }
.mrLogo .r { display: block; margin-top: -.07em; font-size: 1em; color: #ffd23f; -webkit-text-fill-color: #ffd23f; letter-spacing: .03em; -webkit-text-stroke: .055em #1d1020; paint-order: stroke fill;
  text-shadow: 0 .018em 0 #f08a00, 0 .036em 0 #e07000, 0 .054em 0 #c85a00, 0 .075em 0 #1d1020, 0 .1em 0 #1d1020, 0 .14em .08em rgba(0, 0, 0, .4); }
@media (max-height: 500px) { #menu h1.mrLogo { font-size: 66px; } }
@media (max-width: 520px) and (min-height: 501px) { #menu h1.mrLogo { font-size: 80px; } }
#rotate .rLogo { font-size: clamp(64px, 21vw, 112px); transform: rotate(-4deg); margin-bottom: 6px; }

/* guida «Metti l'icona nella Home» (arrivo da ruota.html con ?home=1) */
#guidaHome { position: fixed; inset: 0; z-index: 9999; background: rgba(10, 14, 30, .78); display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding: 16px 16px calc(14px + env(safe-area-inset-bottom)); box-sizing: border-box; }
#guidaHome .gh { background: #fff; color: #1d1020; border: 4px solid #1d1020; border-radius: 18px; padding: 14px 16px; max-width: 380px; width: 100%; box-sizing: border-box; font: 700 16px/1.45 system-ui, sans-serif; }
#guidaHome ol { margin: 6px 0 10px; padding-left: 22px; }
#guidaHome button { display: block; width: 100%; border: 3px solid #1d1020; border-radius: 14px; padding: 10px; font: 900 18px system-ui, sans-serif; margin-top: 8px; }
#guidaHome .inst { background: #2ecc5a; color: #fff; }
#guidaHome .inst[hidden] { display: none; }
#guidaHome .ok { background: #ffd23f; color: #1d1020; }
#guidaHome .ghFreccia { font-size: 52px; color: #ffd23f; line-height: 1; margin-top: 6px; animation: ghGiu 1s ease-in-out infinite; }
@keyframes ghGiu { 50% { transform: translateY(8px); } }

/* === Schermata iniziale «idea 2»: la Notturna sotto i riflettori, GIOCA giallo in basso === */
#menu.m2 { display: block; padding: 0; overflow: hidden; text-align: center; color: #fff;
  background: radial-gradient(ellipse at 50% 72%, #7b2cff 0%, #3a0f7a 38%, #12061f 78%); }
#menu.m2[hidden] { display: none; }
#menu.m2 { height: 100vh; height: 100lvh; bottom: auto; } /* tutto lo schermo anche nell'app dalla Home (100dvh lasciava una striscia nera sotto) */
#menu.m2 .m2grid { position: absolute; left: -20%; right: -20%; bottom: 0; height: 26%; pointer-events: none; opacity: 0.55; transform: perspective(300px) rotateX(60deg); transform-origin: bottom;
  background: repeating-linear-gradient(90deg, rgba(255, 80, 220, 0.5) 0 2px, transparent 2px 60px), repeating-linear-gradient(0deg, rgba(255, 80, 220, 0.5) 0 2px, transparent 2px 30px); }
#menu.m2 .m2spot { position: absolute; left: 50%; top: 18%; width: min(90vw, 900px); height: 55%; transform: translateX(-50%); pointer-events: none;
  background: radial-gradient(ellipse at 50% 80%, rgba(255, 255, 255, 0.32), transparent 60%); }
#menu.m2 .m2top { position: absolute; top: max(10px, env(safe-area-inset-top)); left: max(14px, env(safe-area-inset-left)); right: max(14px, env(safe-area-inset-right)); display: flex; justify-content: space-between; align-items: center; z-index: 2; pointer-events: none; }
#menu.m2 .m2pill { background: rgba(0, 0, 0, 0.45); border: 2px solid rgba(255, 255, 255, 0.25); border-radius: 22px; padding: 7px 14px; font: 800 15px system-ui, sans-serif; color: #fff; }
#menu.m2 .m2pill[hidden] { display: none; }
#menu.m2 #menuWallet { margin-left: auto; } #menu.m2 #menuWallet b { color: #fff; }
#menu.m2 .logo { position: absolute; top: 1.5vh; left: 0; right: 0; display: block; transform: rotate(-3deg); z-index: 2; pointer-events: none; animation: logoIn 0.7s cubic-bezier(.2, 1.6, .4, 1) backwards; }
#menu.m2 h1.mrLogo { font-size: clamp(48px, 9vh, 96px); margin: 0; }
#menu.m2 .m2car { position: absolute; left: 50%; top: 17vh; width: min(52vw, 82vh, 760px); transform: translateX(-50%); z-index: 1; pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 62%, transparent 100%); mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 62%, transparent 100%);
  animation: m2car 0.8s cubic-bezier(.2, 1.3, .4, 1) backwards, m2bob 4s ease-in-out 0.8s infinite; }
@keyframes m2bob { 50% { transform: translateX(-50%) translateY(-8px); } }
@keyframes m2car { from { opacity: 0; transform: translateX(-50%) scale(0.7); } }
#menu.m2 .m2title { position: absolute; left: 0; right: 0; bottom: calc(15vh + 64px); z-index: 2; pointer-events: none; }
#menu.m2 .m2title small { display: block; font: 800 clamp(10px, 1.8vh, 15px) system-ui, sans-serif; letter-spacing: 0.25em; color: #ffb3f0; }
#menu.m2 .m2title b { display: block; font-family: 'Luckiest Guy', system-ui, sans-serif; font-weight: 400; font-size: clamp(26px, 6vh, 56px); letter-spacing: 0.03em; color: #fff; text-shadow: 0 0 16px #ff50dc, 0 3px 0 #3a0f7a; line-height: 1.05; }
#menu.m2 .m2stats { position: absolute; left: max(28px, env(safe-area-inset-left)); top: 32vh; width: clamp(140px, 20vw, 260px); text-align: left; font: 800 clamp(11px, 2vh, 16px) system-ui, sans-serif; z-index: 2; pointer-events: none; }
#menu.m2 .m2stats div { margin-bottom: 2.2vh; }
#menu.m2 .m2stats i { display: block; height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.2); margin-top: 5px; overflow: hidden; }
#menu.m2 .m2stats i::after { content: ''; display: block; height: 100%; width: var(--w); border-radius: 4px; background: linear-gradient(90deg, #ff50dc, #ffd23f); animation: m2bar 1.2s ease-out backwards; }
@keyframes m2bar { from { width: 0; } }
#menu.m2 #startBox { display: contents; } #menu.m2 #startBox[hidden] { display: none; }
#menu.m2 .play, #menu.m2 #loading { position: absolute; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(340px, 70vw); z-index: 3; }
#menu.m2 #loading { padding: 0; bottom: max(8px, env(safe-area-inset-bottom)); }
#menu.m2 #loading .play { position: relative; left: auto; bottom: auto; transform: none; width: 100%; }
#menu.m2 #loading b { font-size: 13px; color: #ffd6f6; text-shadow: none; margin-top: 4px; }
#menu.m2 #loading .bar { height: 8px; margin-top: 4px; border: 0; background: rgba(255, 255, 255, 0.18); }
#menu.m2 #loading .bar i { background: linear-gradient(90deg, #ff50dc, #ffd23f); }
#menu.m2 .play { height: clamp(52px, 11vh, 76px); padding: 0; border-radius: 18px; border: 4px solid #1d1020; color: #1d1020; text-shadow: none; letter-spacing: 1px;
  font-family: 'Luckiest Guy', system-ui, sans-serif; font-weight: 400; font-size: clamp(28px, 6vh, 44px); background: linear-gradient(#ffe46b, #ffb21a);
  box-shadow: 0 7px 0 #1d1020, 0 0 0 0 rgba(255, 210, 63, 0.7); animation: m2pulse 1.5s ease-out infinite; }
#menu.m2 .play:active { transform: translateX(-50%) translateY(5px); box-shadow: 0 2px 0 #1d1020; }
#menu.m2 #loading .play:active { transform: translateY(5px); }
@keyframes m2pulse { 0% { box-shadow: 0 7px 0 #1d1020, 0 0 0 0 rgba(255, 210, 63, 0.75); } 70% { box-shadow: 0 7px 0 #1d1020, 0 0 0 22px rgba(255, 210, 63, 0); } 100% { box-shadow: 0 7px 0 #1d1020, 0 0 0 0 rgba(255, 210, 63, 0); } }
#menu.m2 .playSub { position: absolute; left: 0; right: 0; bottom: calc(max(14px, env(safe-area-inset-bottom)) + clamp(52px, 11vh, 76px) + 14px); font-size: 12px; color: #ffd6f6; z-index: 2; pointer-events: none; display: none; }
#menu.m2 .m2tabs { position: absolute; right: max(16px, env(safe-area-inset-right)); top: 28vh; display: flex; flex-direction: column; gap: 1.4vh; width: clamp(150px, 18vw, 230px); z-index: 3; }
#menu.m2 .m2tab { display: block; width: 100%; text-align: left; padding: clamp(7px, 1.6vh, 12px) 14px; border-radius: 14px; background: rgba(0, 0, 0, 0.42); color: #fff; border: 2px solid rgba(255, 255, 255, 0.28);
  font: 800 clamp(12px, 2.2vh, 17px) system-ui, sans-serif; cursor: pointer; box-shadow: none; margin: 0; animation: none; }
#menu.m2 .m2tab:hover { border-color: #ffd23f; } #menu.m2 .m2tab:active { transform: translateY(2px); }
#menu.m2 .moreStarts { text-align: left; }
#menu.m2 .moreStarts summary { color: #ffb3f0; text-shadow: none; text-align: left; font-size: clamp(11px, 1.9vh, 14px); padding: 2px 4px; }
#menu.m2 .moreStarts #starts { position: absolute; right: 0; top: 100%; width: min(360px, 60vw); display: grid; background: rgba(18, 6, 31, 0.95); border: 2px solid rgba(255, 255, 255, 0.25); border-radius: 14px; padding: 8px; }
#menu.m2 #progress, #menu.m2 .iosHint { position: absolute; left: max(28px, env(safe-area-inset-left)); bottom: 16px; margin: 0; font-size: 12px; color: #ffd6f6; z-index: 2; text-align: left; max-width: 28vw; }
#menu.m2 .iosHint { bottom: 34px; }
#menu.m2 .m2foot { position: absolute; right: max(16px, env(safe-area-inset-right)); bottom: 8px; z-index: 2; display: flex; gap: 10px; align-items: center; font-size: 11px; }
#menu.m2 .m2foot .controls, #menu.m2 .m2foot .credits { display: none; }
#menu.m2 .m2foot .lang { color: #ffb3f0; font-size: 12px; }
#board.onMenu { position: fixed; z-index: 20; top: 70px; }
@media (max-height: 500px) {
  #menu.m2 .m2car { top: 15vh; width: min(46vw, 78vh); }
  #menu.m2 .m2stats { top: 30vh; } #menu.m2 .m2tabs { top: 24vh; }
  #menu.m2 .m2title { bottom: calc(14px + clamp(52px, 11vh, 76px) + 10px); }
  #menu.m2 .m2pill { font-size: 12px; padding: 4px 10px; }
  #menu.m2 .iosHint { top: max(10px, env(safe-area-inset-top)); bottom: auto; font-size: 10px; max-width: 26vw; padding: 4px 8px; }
}
/* telefono in verticale: tutto in colonna */
@media (max-aspect-ratio: 4/5) {
  #menu.m2 .logo { top: 7vh; } #menu.m2 h1.mrLogo { font-size: clamp(56px, 16vw, 90px); }
  #menu.m2 .m2car { top: 24vh; width: 92vw; }
  #menu.m2 .m2title { bottom: auto; top: calc(24vh + 50vw); }
  #menu.m2 .m2stats { display: none; }
  #menu.m2 .m2tabs { top: auto; right: 50%; transform: translateX(50%); bottom: calc(max(14px, env(safe-area-inset-bottom)) + 96px); width: min(360px, 88vw); display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  #menu.m2 .moreStarts { grid-column: 1 / -1; text-align: center; } #menu.m2 .moreStarts summary { text-align: center; }
  #menu.m2 .moreStarts #starts { top: auto; bottom: 100%; right: 50%; transform: translateX(50%); }
  #menu.m2 #progress, #menu.m2 .iosHint { display: none; }
}

/* "Gira il telefono" nello stile della nuova home (viola, griglia, Notturna) */
@media (orientation: portrait) {
  #rotate.r2 { background: radial-gradient(ellipse at 50% 62%, #7b2cff 0%, #3a0f7a 40%, #12061f 80%) !important; justify-content: flex-start; padding-top: max(7vh, env(safe-area-inset-top)); }
  #rotate.r2::before { display: none; }
  #rotate.r2 .sky, #rotate.r2 .cast { display: none; }
  #rotate.r2 .r2grid { position: absolute; left: -30%; right: -30%; bottom: 0; height: 30%; pointer-events: none; opacity: 0.55; transform: perspective(300px) rotateX(60deg); transform-origin: bottom;
    background: repeating-linear-gradient(90deg, rgba(255, 80, 220, 0.5) 0 2px, transparent 2px 50px), repeating-linear-gradient(0deg, rgba(255, 80, 220, 0.5) 0 2px, transparent 2px 26px); }
  #rotate.r2 .r2car { position: relative; width: min(96vw, 460px); margin: 4vh 0 0; pointer-events: none;
    -webkit-mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 62%, transparent 100%); mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 62%, transparent 100%);
    filter: drop-shadow(0 18px 18px rgba(0, 0, 0, 0.55)); animation: m2bobR 4s ease-in-out infinite; }
  @keyframes m2bobR { 50% { transform: translateY(-8px); } }
  #rotate.r2 .phone { margin-top: 3vh; border-color: #fff; box-shadow: 0 0 0 6px rgba(255, 80, 220, 0.25), 0 0 30px rgba(255, 80, 220, 0.6); }
  #rotate.r2 .phone i { background: linear-gradient(160deg, #ff5ad8, #ffd23c); }
  #rotate.r2 b { font-family: 'Luckiest Guy', system-ui, sans-serif; font-size: 34px; letter-spacing: 1px; color: #ffd23c; text-shadow: 0 3px 0 #12061f, 0 0 18px rgba(255, 210, 60, 0.45); }
  #rotate.r2 p { color: #ffd6f6; text-shadow: none; padding: 0 20px; }
}
