:root {
  --ink: #2a2018;
  --paper: #f4ecdc;
  --accent: #b23a2f;
  --gold: #d8a93a;
  --panel: rgba(28, 22, 16, 0.7);
  --good: #4caf6e;
  --danger: #d8553f;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
  color: var(--paper);
  user-select: none;
  -webkit-user-select: none;
  /* Niente doppio-tap-zoom né selezione testo a furia di tap: si resta "in gioco"
     (i pannelli con overflow scorrono comunque, manipulation lo consente). */
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

#sceneRoot,
#sceneRoot canvas {
  display: block;
  width: 100vw;
  height: 100vh;
}

/* ---- Schermate (menu, selezione, risultati) ---- */
.screen {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(12, 9, 6, 0.72);
  z-index: 20;
  padding: 24px;
}

.screen.active {
  display: flex;
}

.panel {
  width: min(560px, 92vw);
  max-height: 94vh;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid rgba(216, 169, 58, 0.45);
  border-radius: 18px;
  padding: 22px 30px;
  text-align: center;
  backdrop-filter: blur(6px);
}

.kicker {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: 0.7;
}

.menu-panel h1 {
  margin: 0 0 14px;
  font-size: 38px;
  color: var(--gold);
}

.lede {
  opacity: 0.85;
  line-height: 1.5;
  margin-bottom: 26px;
}

.select-panel h2,
.results-panel h2 {
  margin-top: 0;
  color: var(--gold);
}

/* ---- Bottoni ---- */
.btn {
  cursor: pointer;
  border: none;
  border-radius: 10px;
  padding: 13px 30px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  transition: transform 0.08s ease, filter 0.15s ease;
}

.btn:hover {
  filter: brightness(1.1);
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.12);
}

.select-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 14px;
  flex-wrap: wrap;
}

/* ---- Griglia contrade ---- */
.contrada-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.contrada-card {
  --c1: #888;
  --c2: #555;
  --c3: #222;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 12px 10px;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  font-size: 12px;
  transition: transform 0.1s ease, border-color 0.15s ease;
}

.contrada-card {
  align-items: stretch;
}
.contrada-flag {
  width: 100%;
  height: 66px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.35);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  margin-bottom: 2px;
}

.contrada-card strong {
  font-size: 14px;
}

.contrada-card:hover {
  transform: translateY(-2px);
}

.contrada-card.selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(216, 169, 58, 0.35);
}

/* ---- Suggerimento comandi nel menu ---- */
.controls-hint {
  margin-top: 18px;
  font-size: 12px;
  opacity: 0.7;
  line-height: 2;
}

kbd {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(216, 169, 58, 0.4);
  border-radius: 5px;
  padding: 2px 7px;
  font-family: monospace;
}

/* ---- Selettore difficoltà ---- */
.difficulty-row {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.diff-btn {
  flex: 1 1 0;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 10px 6px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--paper);
  font-size: 13px;
  font-weight: 700;
  transition: transform 0.1s ease, border-color 0.15s ease, background 0.15s ease;
}

.diff-btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.14);
}

.diff-btn.selected {
  border-color: var(--gold);
  background: rgba(216, 169, 58, 0.22);
}

/* ---- Classifica finale ---- */
.final-ranking {
  list-style: none;
  margin: 0 0 6px;
  padding: 0;
  text-align: left;
  max-height: 40vh;
  overflow-y: auto;
}

.final-ranking li {
  display: grid;
  grid-template-columns: 24px 22px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 14px;
}

.final-ranking li:nth-child(odd) {
  background: rgba(255, 255, 255, 0.06);
}

.final-ranking li.player-result {
  background: rgba(216, 169, 58, 0.22);
  font-weight: 700;
}

.result-summary {
  opacity: 0.85;
  margin-bottom: 14px;
}

/* ---- Celebrazione del vincitore (drappellone) ---- */
.winner-banner {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 18px;
  margin-bottom: 20px;
  border-radius: 14px;
  border: 1px solid rgba(216, 169, 58, 0.55);
  background: linear-gradient(135deg, rgba(216, 169, 58, 0.16), rgba(255, 255, 255, 0.04));
  text-align: left;
}
.winner-banner.player-win {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(216, 169, 58, 0.4), 0 8px 30px rgba(216, 169, 58, 0.25);
}
.winner-drappellone {
  flex: 0 0 auto;
  width: 58px;
  height: 84px;
  border-radius: 4px 4px 4px 10px / 4px 4px 18px 18px;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-top-width: 5px;
  overflow: hidden;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
  transform: rotate(-3deg);
}
.winner-flag {
  display: block;
  width: 100%;
  height: 100%;
}
.winner-text { display: flex; flex-direction: column; gap: 2px; }
.winner-kicker {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.9;
}
.winner-name {
  font-size: 26px;
  font-weight: 800;
  color: var(--gold);
  line-height: 1.1;
}
.winner-prize {
  font-size: 12px;
  opacity: 0.8;
  font-style: italic;
}

.leader-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

/* ---- HUD di gara ---- */
.hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: 10;
}

.hud.visible {
  opacity: 1;
}

.hud-corner {
  position: absolute;
  padding: 12px 16px;
  background: var(--panel);
  border: 1px solid rgba(216, 169, 58, 0.4);
  border-radius: 10px;
  backdrop-filter: blur(4px);
  line-height: 1.25;
}

.hud-top-left {
  top: 58px;               /* sotto il bottone "‹ Menu" in alto a sinistra */
  left: calc(env(safe-area-inset-left, 0px) + 18px);
}

.hud-top-right {
  top: 18px;
  right: calc(env(safe-area-inset-right, 0px) + 18px);
  text-align: right;
}

.hud-bottom-left {
  bottom: 18px;
  left: calc(env(safe-area-inset-left, 0px) + 18px);
  min-width: 210px;
}

.hud-label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.7;
}

.hud-sub {
  margin-top: 8px;
}

.hud-value {
  font-size: 26px;
  font-weight: 700;
}

.bar {
  height: 9px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
  margin-top: 5px;
}

.bar-fill {
  height: 100%;
  width: 100%;
  transform-origin: left center;
  background: linear-gradient(90deg, var(--gold), #f0d27a);
  transition: transform 0.12s linear;
}

.bar-fill.low {
  background: linear-gradient(90deg, var(--danger), #f08a6f);
}

.bar-fill.limited {
  animation: pulse 0.6s infinite alternate;
}

.bar-risk .bar-fill {
  background: linear-gradient(90deg, #4caf6e, var(--danger));
}

/* Nerbate: 5 "proiettili" in canna, come il caricatore di una pistola. */
.nerbate-pips {
  display: flex;
  gap: 4px;
  margin-top: 3px;
}
.nerbate-pips .pip {
  width: 15px;
  height: 7px;
  border-radius: 3px;
  background: #d68a2e;
  box-shadow: 0 0 4px #d68a2e88;
  transition: background 0.15s, box-shadow 0.15s, opacity 0.15s;
}
.nerbate-pips .pip.spent {
  background: #ffffff22;
  box-shadow: none;
}
.nerbate-pips .pip.recharging {
  background: #d68a2e;
  opacity: 0.4;
  animation: pulse 0.8s ease-in-out infinite alternate;
}

@keyframes pulse {
  from {
    opacity: 0.6;
  }
  to {
    opacity: 1;
  }
}

/* ---- Mini-mappa ---- */
#minimap {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 88px;
  height: 88px;
  border: 1px solid rgba(216, 169, 58, 0.5);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  z-index: 12;
  display: none;
}

/* ---- Pulsante cambio camera ---- */
.cam-button {
  position: absolute;
  top: 30px;
  right: calc(env(safe-area-inset-right, 0px) + 104px);
  pointer-events: auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(216, 169, 58, 0.5);
  background: var(--panel);
  color: var(--paper);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(4px);
}

.cam-button:active {
  transform: scale(0.94);
}

/* ---- Mini-classifica in gara ---- */
.leaderboard {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  list-style: none;
  margin: 0;
  padding: 8px 6px;
  width: min(280px, 70vw);
  background: var(--panel);
  border: 1px solid rgba(216, 169, 58, 0.35);
  border-radius: 10px;
  backdrop-filter: blur(4px);
}

.leader-row {
  display: grid;
  grid-template-columns: 18px 14px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 3px 8px;
  font-size: 12px;
  border-radius: 6px;
}

.leader-row.player {
  background: rgba(216, 169, 58, 0.22);
  font-weight: 700;
}

.leaderboard .leader-swatch {
  width: 10px;
  height: 10px;
}

/* ---- Messaggio centrale di gara ---- */
.race-message {
  position: absolute;
  top: 42%;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 30px;
  font-weight: 800;
  text-shadow: 0 4px 16px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.race-message.visible {
  opacity: 1;
}

.race-message.danger {
  color: var(--danger);
}

.race-message.good {
  color: var(--good);
}

/* ---- Vignettatura velocità ---- */
.speed-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.2s ease;
  box-shadow: inset 0 0 160px 40px rgba(255, 200, 80, 0.25);
}

.speed-vignette.boosting {
  opacity: 1;
}

.speed-vignette.braking {
  opacity: 0.7;
  box-shadow: inset 0 0 140px 30px rgba(220, 70, 50, 0.3);
}

/* ---- Controlli touch ---- */
.touch-controls {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: 15;
}

.touch-controls.visible {
  opacity: 1;
}

.touch-btn {
  pointer-events: auto;
  position: absolute;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 1px solid rgba(216, 169, 58, 0.5);
  background: var(--panel);
  color: var(--paper);
  font-size: 20px;
  font-weight: 700;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Freccette laterali piccole, in basso a DESTRA (spinta ai canapi).
   Rispettano la safe-area (notch/bordo arrotondato in landscape). */
.touch-lat-right {
  right: calc(env(safe-area-inset-right, 0px) + 22px);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 22px);
}

.touch-lat-left {
  right: calc(env(safe-area-inset-right, 0px) + 84px);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 22px);
}

/* Tasto NERBO: sopra le due frecce, largo quanto la coppia. Sferra una nerbata
   verso il rivale più vicino. Rosso per distinguerlo dai controlli di guida. */
.touch-nerb {
  width: 116px;
  height: 46px;
  right: calc(env(safe-area-inset-right, 0px) + 22px);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 84px);
  border-radius: 12px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.1em;
  background: rgba(160, 42, 32, 0.86);
  border-color: rgba(245, 160, 130, 0.6);
  color: #fff5ec;
}
.touch-nerb:active {
  background: rgba(200, 60, 46, 0.95);
  transform: scale(0.96);
}

/* Tastini ANDATURA, in basso a SINISTRA (▲ accelera · ▼ rallenta). Lo sterzo NON
   è più qui: si guida inclinando il dispositivo. Rispettano la safe-area. */
.touch-gait {
  left: calc(env(safe-area-inset-left, 0px) + 26px);
  width: 66px;
  height: 58px;
  border-radius: 13px;
  font-size: 24px;
  font-weight: 800;
  background: rgba(30, 22, 12, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
}
.touch-gait-up {
  bottom: calc(env(safe-area-inset-bottom, 0px) + 96px);
}
.touch-gait-down {
  bottom: calc(env(safe-area-inset-bottom, 0px) + 28px);
}
.touch-gait:active {
  background: rgba(216, 169, 58, 0.85);
  color: #1a1206;
  transform: scale(0.96);
}

/* I controlli touch si mostrano su TOUCH (telefono E iPad, a qualsiasi larghezza)
   e si nascondono su desktop. La classe la mette il JS (rilevamento pointer coarse). */
body:not(.touch-device) .touch-controls {
  display: none;
}

/* ---- HUD della rincorsa (solo per il giocatore di rincorsa) ---- */
.rincorsa-hud {
  position: fixed;
  right: calc(env(safe-area-inset-right, 0px) + 20px);
  bottom: 120px;
  padding: 16px 24px;
  border-radius: 14px;
  border: 2px solid rgba(216, 169, 58, 0.5);
  background: var(--panel);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
  z-index: 16;
  text-align: center;
}

.rincorsa-hud.visible {
  opacity: 1;
  transform: translateY(0);
}

.rincorsa-status {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.rincorsa-status.aspetta { color: var(--danger); }
.rincorsa-status.entrare { color: var(--good); }

/* ---- Mini-cam rincorsa (top-left, solo durante la mossa) ---- */
/* L'interno è trasparente: Three.js disegna la ripresa sul canvas dietro. */
.rincorsa-watcher {
  position: fixed;
  top: 58px;               /* sotto il bottone "‹ Menu" */
  left: calc(env(safe-area-inset-left, 0px) + 18px);
  width: 240px;
  height: 150px;
  border-radius: 8px;
  border: 2px solid rgba(216, 169, 58, 0.8);
  background: transparent;
  pointer-events: none;
  z-index: 16;
  overflow: hidden;
  opacity: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: opacity 0.35s ease;
}
.rincorsa-watcher.visible { opacity: 1; }
.rw-cam-label {
  align-self: flex-start;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--gold);
  background: rgba(14, 11, 7, 0.72);
  border-radius: 0 0 6px 0;
}
.rw-bottom-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px;
  background: rgba(14, 11, 7, 0.72);
  font-size: 11px;
  color: var(--paper);
}
.rw-status { font-weight: 700; }
.rw-status.alert { color: var(--danger); }
.rw-status.ready { color: var(--good); }
.rw-timer { opacity: 0.65; font-size: 10px; }

/* Durante la mossa la "Posizione" top-left è nascosta (sostituita dalla mini-cam) */
.hud.mode-mossa .hud-top-left { display: none; }

@media (max-width: 900px) {
  .rincorsa-hud {
    right: calc(env(safe-area-inset-right, 0px) + 14px);
    bottom: 178px;
  }
  /* Telefono: riquadro rincorsa in alto a DESTRA (a sinistra copriva il pannello
     Andatura/Stamina). Dimensioni contenute così sta tutto nell'inquadratura. */
  .rincorsa-watcher {
    left: auto;
    right: calc(env(safe-area-inset-right, 0px) + 10px);
    top: calc(env(safe-area-inset-top, 0px) + 8px);
    width: 150px;
    height: 92px;
  }
  .rw-cam-label { font-size: 11px; }

  /* Telefono: via la roba che ingombra lo schermo durante la corsa. */
  .leaderboard { display: none !important; }
  #minimap { display: none !important; }
  /* Il pannello Andatura/Stamina/Rischio starebbe sopra il joystick: alzalo. */
  .hud-bottom-left {
    bottom: 150px;
    left: calc(env(safe-area-inset-left, 0px) + 12px);
    min-width: 0;
    transform: scale(0.9);
    transform-origin: bottom left;
  }
}

/* ---- Bottone "‹ Menu" fisso in alto a sinistra (torna al menu, taglia audio) ---- */
#menuHomeBtn {
  position: fixed;
  top: 12px;
  left: calc(env(safe-area-inset-left, 0px) + 12px);
  z-index: 75;
  pointer-events: auto;
  padding: 7px 14px;
  border-radius: 10px;
  border: 1px solid rgba(216, 169, 58, 0.55);
  background: rgba(20, 14, 8, 0.82);
  color: var(--paper);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(4px);
  -webkit-tap-highlight-color: transparent;
}

#menuHomeBtn:hover { filter: brightness(1.15); }
#menuHomeBtn:active { transform: scale(0.95); }

/* ---- "Salta all'avvio" (solo mentre assisti alla mossa della rivale) ---- */
#spectateSkipBtn {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 56;
  pointer-events: auto;
  padding: 10px 22px;
  border-radius: 11px;
  border: 1px solid rgba(216, 169, 58, 0.6);
  background: rgba(240, 203, 53, 0.92);
  color: #1a1206;
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.5);
  -webkit-tap-highlight-color: transparent;
}

#spectateSkipBtn:hover { filter: brightness(1.08); }
#spectateSkipBtn:active { transform: translateX(-50%) scale(0.96); }

/* ---- Evidenziazione del pulsante "a fuoco" (navigazione con INVIO/frecce/gamepad) ---- */
.btn:focus-visible,
.cmp-btn:focus-visible,
.pc-card:focus-visible,
.sf-card:focus-visible,
.contrada-card:focus-visible,
.diff-btn:focus-visible,
#estrGoBtn:focus-visible,
#estrSkipBtn:focus-visible,
#trattaGoBtn:focus-visible,
#trattaSkipBtn:focus-visible,
#sfConfirmBtn:focus-visible,
#sfGoBtn:focus-visible,
#menuHomeBtn:focus-visible {
  outline: 3px solid #f0cb35;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(240, 203, 53, 0.35);
}

/* ---- Tap multipli: niente selezione testo/zoom, si resta in "modalità gioco" ---- */
#sceneRoot,
#sceneRoot canvas,
.hud,
.touch-controls,
#menuHomeBtn {
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* I campi di testo devono restare scrivibili e selezionabili. */
input,
textarea {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

/* ---- Menu: i due tasti (Gioca / Albo) ---- */
.menu-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  margin: 4px 0 2px;
}

/* ---- Home: sostegno al gioco (dona / consiglio) in basso a destra ---- */
.home-support {
  position: absolute;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  z-index: 5;
}
.support-btn {
  font: inherit;
  font-size: 13.5px;
  font-weight: 700;
  padding: 9px 15px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid rgba(240, 203, 53, 0.5);
  background: rgba(20, 14, 8, 0.72);
  color: #f3e7cf;
  backdrop-filter: blur(4px);
  transition: transform 0.12s ease, background 0.12s ease;
  max-width: min(320px, 82vw);
  text-align: center;
}
.support-btn:hover { transform: translateY(-1px); }
.support-donate {
  background: #f0cb35;
  color: #1a1206;
  border-color: #f0cb35;
}
.support-donate:hover { background: #f5d34e; }
.support-suggest:hover { background: rgba(240, 203, 53, 0.14); }
@media (max-width: 640px) {
  .home-support { right: 10px; bottom: 10px; gap: 6px; }
  .support-btn { font-size: 12px; padding: 7px 11px; }
}

/* ---- Albo delle Vittorie ---- */
#alboOverlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(ellipse at 50% 28%, rgba(40, 26, 14, 0.85), rgba(14, 10, 6, 0.96));
}

.albo-panel {
  width: min(880px, 96vw);
  max-height: 92vh;
  overflow: auto;
  background: rgba(26, 19, 11, 0.97);
  border: 1px solid rgba(240, 203, 53, 0.4);
  border-radius: 18px;
  padding: 24px 26px;
  text-align: center;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
}

.albo-title {
  font-size: 27px;
  font-weight: 800;
  color: #f0cb35;
  letter-spacing: 0.04em;
}

.albo-sub {
  font-size: 13px;
  opacity: 0.75;
  margin: 4px 0 18px;
}

.albo-cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.albo-col {
  background: rgba(18, 13, 8, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 12px 12px 14px;
  text-align: left;
  max-height: 62vh;
  overflow-y: auto;
}

.albo-col-head {
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #f0cb35;
  margin-bottom: 10px;
  text-align: center;
}

.albo-row {
  display: grid;
  grid-template-columns: 1.6em 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  border-radius: 7px;
  font-size: 14px;
}

.albo-row:nth-child(even) { background: rgba(255, 255, 255, 0.04); }
.albo-rank { text-align: center; opacity: 0.85; }
.albo-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.albo-wins { color: #7fd98c; font-weight: 800; }
.albo-empty { font-size: 13px; opacity: 0.6; padding: 6px; }

#alboCloseBtn { margin-top: 20px; }

@media (max-width: 720px) {
  .albo-cols { grid-template-columns: 1fr; }
}

/* ---- Avviso "gira il telefono in orizzontale": solo su touch in PORTRAIT ---- */
#rotateHint { display: none; }
@media (orientation: portrait) and (pointer: coarse) {
  #rotateHint {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 100000;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    text-align: center;
    color: #f3e7cf;
    font-family: inherit;
    padding: 24px;
    background: radial-gradient(1100px 700px at 50% -10%, #3a2a17 0%, #17110a 62%, #0d0906 100%);
  }
  #rotateHint .rh-emoji { font-size: 64px; animation: rhSpin 2.4s ease-in-out infinite; }
  #rotateHint .rh-title { font-size: 28px; font-weight: 800; color: #f0cb35; }
  #rotateHint .rh-sub { font-size: 16px; opacity: 0.85; }
}
@keyframes rhSpin { 0%, 55%, 100% { transform: rotate(0deg); } 78% { transform: rotate(90deg); } }
