/* Turbo Royale — menu in stile "Supercell": sfondo blu a rombi, cornici spesse, testi con contorno,
   un solo colore forte per l'azione principale (giallo), navigazione fissa in basso. */

:root {
  /* tanica rossa della benzina: costo delle carte e indicatore del serbatoio */
  --can: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 56'%3E%3Cdefs%3E%3ClinearGradient id='b' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='%23ff8a5c'/%3E%3Cstop offset='.45' stop-color='%23ee3a1d'/%3E%3Cstop offset='1' stop-color='%23a8180a'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M12 11V6.5Q12 4 14.5 4H24.5Q27 4 27 6.5V11' fill='none' stroke='%235a0f05' stroke-width='5'/%3E%3Cpath d='M12 11V6.5Q12 4 14.5 4H24.5Q27 4 27 6.5V11' fill='none' stroke='%23d8321a' stroke-width='2.4'/%3E%3Cpath d='M33.5 12.5L38 5.5L44 9.5L39.5 16Z' fill='%233b3f4a' stroke='%23141418' stroke-width='2'/%3E%3Cpath d='M9 11H31L42 21V50.5Q42 54 38.5 54H9.5Q6 54 6 50.5V14Q6 11 9 11Z' fill='url(%23b)' stroke='%235a0f05' stroke-width='2.6' stroke-linejoin='round'/%3E%3Cpath d='M12 19L35 48M35 19L12 48' stroke='rgba(90,15,5,.35)' stroke-width='3.6' stroke-linecap='round'/%3E%3Cpath d='M9.5 16V48' stroke='rgba(255,255,255,.45)' stroke-width='2.6' stroke-linecap='round'/%3E%3C/svg%3E");
  --ink: #151820;
  --edge: #1a1d27;
  --edge-soft: rgba(19, 21, 29, 0.55);
  --blue-hi: #4e5775;
  --blue: #424a63;
  --blue-mid: #3b4258;
  --blue-lo: #33394d;
  --blue-deep: #282d3c;
  --gold-hi: #ffe676;
  --gold: #ffc61e;
  --gold-lo: #f39a12;
  --gold-edge: #8a4600;
  --green-hi: #9ff07a;
  --green: #47c13d;
  --green-edge: #1c6513;
  --red: #ff4d5e;
  --red-edge: #7d0f1c;
  --text: #ffffff;
  --muted: #e7e9ee;
  --yellow: #ffcd3c;
  --radius: 16px;
  --font-title: 'Lilita One', 'Arial Black', system-ui, sans-serif;
  --font-ui: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --outline: 0 2px 0 var(--ink), 1.5px 0 0 var(--ink), -1.5px 0 0 var(--ink), 0 -1.5px 0 var(--ink), 1px 1px 0 var(--ink),
    -1px 1px 0 var(--ink);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  color: var(--text);
  font-family: var(--font-ui);
  font-weight: 700;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: #394056;
  background-image: radial-gradient(130% 70% at 50% 0%, rgba(84, 94, 126, 0.35), transparent 60%),
    repeating-conic-gradient(from 45deg, rgba(255, 255, 255, 0.055) 0 25%, rgba(23, 25, 34, 0.07) 0 50%);
  background-size: 100% 100%, 76px 76px;
  background-attachment: fixed;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  -webkit-user-select: none;
  user-select: none;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
}

.outlined {
  font-family: var(--font-title);
  font-weight: 400;
  text-shadow: var(--outline);
}

/* illustrazioni del gioco (icons.js): grandi quanto il testo, come le emoji che hanno sostituito */
.gi {
  display: inline-block;
  flex: none;
  width: 1em;
  height: 1em;
  vertical-align: -0.2em;
  overflow: visible;
}

/* medaglie del piazzamento */
.place-badge {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  padding: 0 5px;
  border: 3px solid var(--edge);
  border-radius: 15px;
  background: linear-gradient(180deg, #4d546c, #363a49);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.45), 0 2px 0 var(--edge);
  font-family: var(--font-title);
  font-weight: 400;
  font-size: 16px;
  line-height: 1;
  color: #fff;
  text-shadow: var(--outline);
}

.place-badge.p1 {
  border-color: var(--gold-edge);
  background: linear-gradient(180deg, #fff3a6, #ffc61e 50%, #e58c00);
}

.place-badge.p2 {
  border-color: #2d2f34;
  background: linear-gradient(180deg, #ffffff, #dee1e8 50%, #8797ae);
}

.place-badge.p3 {
  border-color: #5a2a08;
  background: linear-gradient(180deg, #ffd2a6, #d0803f 50%, #8c4b1d);
}

.screen {
  display: none;
  position: fixed;
  inset: 0;
}

.screen.active {
  display: block;
}

/* ------------------------------------------------------------------ bottoni e cornici */

.btn {
  position: relative;
  border: 3px solid var(--edge);
  border-radius: 14px;
  padding: 10px 20px 12px;
  cursor: pointer;
  font-family: var(--font-title);
  font-size: 19px;
  letter-spacing: 0.3px;
  color: #fff;
  text-shadow: var(--outline);
  background: linear-gradient(180deg, var(--blue-hi), var(--blue-lo));
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.45), inset 0 -5px 0 rgba(0, 0, 0, 0.18), 0 4px 0 var(--edge);
  transition: transform 0.08s ease, filter 0.15s ease, box-shadow 0.08s ease;
  touch-action: manipulation;
}

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

.btn:active {
  transform: translateY(3px);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.45), inset 0 -5px 0 rgba(0, 0, 0, 0.18), 0 1px 0 var(--edge);
}

.btn:disabled {
  filter: grayscale(0.8) brightness(0.75);
  cursor: not-allowed;
  transform: none;
}

.btn-gold {
  border-color: var(--gold-edge);
  background: linear-gradient(180deg, var(--gold-hi), var(--gold) 45%, var(--gold-lo));
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.6), inset 0 -6px 0 rgba(160, 70, 0, 0.35), 0 4px 0 var(--gold-edge);
}

.btn-gold:active {
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.6), inset 0 -6px 0 rgba(160, 70, 0, 0.35), 0 1px 0 var(--gold-edge);
}

.btn-green {
  border-color: var(--green-edge);
  background: linear-gradient(180deg, var(--green-hi), var(--green));
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.5), inset 0 -5px 0 rgba(0, 60, 0, 0.3), 0 4px 0 var(--green-edge);
}

.btn-red {
  border-color: var(--red-edge);
  background: linear-gradient(180deg, #ff7d88, #e5323f);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.45), inset 0 -5px 0 rgba(90, 0, 10, 0.3), 0 4px 0 var(--red-edge);
}

.btn-wide {
  width: 100%;
  font-size: 22px;
  padding: 12px 18px 14px;
}

.btn-small {
  font-size: 15px;
  padding: 6px 12px 8px;
  border-radius: 11px;
}

.icon-btn {
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 3px solid var(--edge);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--blue-hi), var(--blue-lo));
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.45), 0 3px 0 var(--edge);
  font-size: 20px;
  cursor: pointer;
}

.icon-btn .gi {
  font-size: 28px;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.35));
}

.icon-btn:active {
  transform: translateY(2px);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.45), 0 1px 0 var(--edge);
}

.close-btn {
  width: 36px;
  height: 36px;
  border-color: var(--red-edge);
  background: linear-gradient(180deg, #ff7d88, #e5323f);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.45), 0 3px 0 var(--red-edge);
  font-family: var(--font-title);
  font-size: 18px;
  text-shadow: var(--outline);
}

.info-btn {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border: 2px solid var(--edge);
  border-radius: 50%;
  background: #fff;
  color: var(--blue-lo);
  font-family: Georgia, 'Times New Roman', serif;
  font-style: italic;
  font-weight: 900;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
}

.frame {
  position: relative;
  padding: 12px;
  border: 3px solid var(--edge);
  border-radius: 18px;
  background: linear-gradient(180deg, #3f465e, #363d51);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.28), 0 4px 0 var(--edge-soft);
}

.frame + .frame {
  margin-top: 14px;
}

.frame-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: -12px -12px 12px;
  padding: 8px 14px 9px;
  border-bottom: 3px solid var(--edge);
  border-radius: 15px 15px 0 0;
  background: linear-gradient(180deg, #505977, #434a64);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.35);
}

.frame-head h2 {
  margin: 0;
  font-family: var(--font-title);
  font-weight: 400;
  font-size: 21px;
  text-shadow: var(--outline);
}

.frame-head .sub {
  font-size: 13px;
  font-weight: 900;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 10px 3px;
  border-radius: 999px;
  background: rgba(19, 21, 29, 0.7);
  border: 2px solid rgba(255, 255, 255, 0.12);
  font-family: var(--font-title);
  font-size: 15px;
  text-shadow: var(--outline);
  white-space: nowrap;
}

.rarity-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--rarity);
  color: #14161b;
  font-size: 12.5px;
  font-weight: 900;
}

/* costo in elisir: goccia rosa con la punta in alto, sulle carte in gara, nei menu e sulla carta grande */
.cost {
  position: absolute;
  top: -8px;
  left: -8px;
  z-index: 2;
  width: 28px;
  height: 32px;
  display: grid;
  place-items: center;
  /* il numero sta sulla pancia della tanica, sotto il manico (em: le percentuali seguirebbero la carta) */
  padding-top: 0.4em;
  font-family: var(--font-title);
  font-weight: 400;
  font-size: 17px;
  line-height: 1;
  color: #fff;
  text-shadow: var(--outline);
}

.cost::before,
.fuel-can::before,
.drop-icon {
  content: '';
  background: var(--can) center / contain no-repeat;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.35));
}

.cost::before,
.fuel-can::before {
  position: absolute;
  inset: 0;
  z-index: -1;
}

/* cornici delle carte per rarità: argento, blu, viola con bagliore, arcobaleno che gira */
@property --spin {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}

.r-common {
  --frame: linear-gradient(160deg, #ffffff, #c4d0e2 38%, #7d8ca6);
}

.r-rare {
  --frame: linear-gradient(160deg, #d6edff, #4aa8ff 40%, #0f5fc4);
}

.r-epic {
  --frame: linear-gradient(160deg, #f6d4ff, #c86bff 40%, #6d1fb5);
}

.r-legendary {
  --frame: conic-gradient(from var(--spin), #ff6fa5, #ffd43b, #7cf29b, #62d4ff, #c387ff, #ff6fa5);
  animation: legendFrame 4s linear infinite;
}

@keyframes legendFrame {
  to {
    --spin: 360deg;
  }
}

/* colori delle categorie di carte (carte in gara e nei menu) */
.cat-offense {
  --c1: #ff8061;
  --c2: #cf2f4b;
}

.cat-area {
  --c1: #b98bff;
  --c2: #6a35d0;
}

.cat-defense {
  --c1: #63c4ff;
  --c2: #2460d0;
}

.cat-speed {
  --c1: #72e494;
  --c2: #1c9454;
}

.cat-map {
  --c1: #48dccc;
  --c2: #0f7f88;
}

.bar {
  width: 100%;
  height: 14px;
  border-radius: 7px;
  overflow: hidden;
  background: var(--edge);
  border: 2px solid #0a1838;
}

.bar i {
  display: block;
  height: 100%;
  background: linear-gradient(180deg, #73c4ff, #2f86e8);
  transition: width 0.9s cubic-bezier(0.3, 1, 0.4, 1);
}

input {
  width: 100%;
  padding: 11px 14px;
  border: 3px solid var(--edge);
  border-radius: 12px;
  outline: none;
  background: #f4f8ff;
  color: #13265a;
  font-size: 18px;
  font-weight: 800;
  box-shadow: inset 0 3px 0 rgba(0, 0, 0, 0.12);
}

input:focus {
  border-color: var(--gold-edge);
  box-shadow: inset 0 3px 0 rgba(0, 0, 0, 0.12), 0 0 0 3px var(--gold);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  font-weight: 900;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: var(--edge);
}

.seg {
  border: 0;
  border-radius: 10px;
  padding: 9px 8px 10px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-title);
  font-size: 17px;
  cursor: pointer;
}

.seg.active {
  color: #fff;
  background: linear-gradient(180deg, var(--blue-hi), var(--blue-lo));
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.4);
  text-shadow: var(--outline);
}

/* ------------------------------------------------------------------ logo e accesso */

.logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: var(--font-title);
  line-height: 0.86;
  transform: rotate(-3deg);
  user-select: none;
}

.logo-deck {
  font-size: 64px;
  color: var(--gold);
  letter-spacing: 3px;
  text-shadow: 0 4px 0 var(--gold-edge), 2px 0 0 var(--gold-edge), -2px 0 0 var(--gold-edge), 0 -2px 0 var(--gold-edge),
    0 10px 20px rgba(0, 0, 0, 0.35);
}

.logo-racers {
  font-size: 78px;
  color: #fff;
  letter-spacing: 2px;
  text-shadow: 0 5px 0 var(--edge), 2px 0 0 var(--edge), -2px 0 0 var(--edge), 0 -2px 0 var(--edge), 0 12px 22px rgba(0, 0, 0, 0.35);
}

.auth-wrap {
  max-width: 440px;
  min-height: 100%;
  margin: 0 auto;
  padding: calc(36px + env(safe-area-inset-top)) 16px 30px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
}

#screen-auth,
#screen-install {
  overflow-y: auto;
}

.install-gate .auth-panel {
  text-align: center;
}

.install-gate h2,
.install-gate p {
  margin: 0;
}

.auth-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-hint {
  margin: 0;
  font-size: 13.5px;
  color: var(--muted);
}

.auth-error {
  margin: 0;
  padding: 9px 12px;
  border-radius: 10px;
  background: #ffe1e4;
  color: #8a0f1f;
  border: 2px solid var(--red-edge);
  font-size: 14px;
  font-weight: 900;
}

.auth-note {
  margin: 0;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

/* ------------------------------------------------------------------ struttura: barra alta, pagine, barra in basso */

.app-shell {
  position: relative;
  height: 100%;
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.topbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 12px 8px;
}

.player-chip {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}

.league-badge {
  flex: none;
  display: grid;
  place-items: center;
  font-size: 50px;
  filter: drop-shadow(0 3px 0 rgba(19, 21, 29, 0.55));
}

.player-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.12;
}

.player-name {
  font-family: var(--font-title);
  font-weight: 400;
  font-size: 19px;
  text-shadow: var(--outline);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-league {
  font-size: 12.5px;
  font-weight: 900;
  color: var(--muted);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
  white-space: nowrap;
}

.trophy-pill {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px 5px 8px;
  border-radius: 999px;
  border: 3px solid var(--edge);
  background: linear-gradient(180deg, #242834, #1a1d26);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.12);
  font-family: var(--font-title);
  font-size: 19px;
  color: var(--gold-hi);
  text-shadow: var(--outline);
}

.trophy-pill .gi {
  font-size: 30px;
  margin: -8px 0 -6px -6px;
}

.pages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 12px 18px;
  -webkit-overflow-scrolling: touch;
}

.page {
  display: none;
}

.page.active {
  display: block;
  animation: fadeUp 0.22s ease-out;
}

.tabbar {
  flex: none;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  align-items: end;
  gap: 2px;
  padding: 0 6px env(safe-area-inset-bottom);
  background: linear-gradient(180deg, #242835, #1a1c26);
  border-top: 3px solid #14161e;
  box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.22);
}

.tab {
  position: relative;
  height: 62px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border: 0;
  border-radius: 14px 14px 0 0;
  background: transparent;
  cursor: pointer;
}

.tab-icon {
  font-size: 34px;
  line-height: 1;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.45));
  transition: transform 0.15s ease;
}

.tab-label {
  display: none;
  font-family: var(--font-title);
  font-size: 13px;
  text-shadow: var(--outline);
}

.tab.active {
  height: 74px;
  margin-top: -12px;
  border: 3px solid #14161e;
  border-bottom: 0;
  background: linear-gradient(180deg, #4e5775, #3b4258);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.4);
}

.tab.active .tab-icon {
  transform: scale(1.18) translateY(-2px);
}

.tab.active .tab-label {
  display: block;
}

.tab-badge {
  position: absolute;
  top: 6px;
  right: calc(50% - 26px);
  min-width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 2px solid var(--red-edge);
  background: var(--red);
  font-family: var(--font-ui);
  font-weight: 900;
  font-size: 12px;
  animation: pulse 0.8s infinite alternate;
}

/* ------------------------------------------------------------------ pagina Gioca */

.play-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding-top: 4px;
}

.arena-stage {
  position: relative;
  width: min(100%, 430px);
  padding: 0 0 22px;
  border: 0;
  background: none;
  cursor: pointer;
}

/* l'isola dell'arena in 3D (scene/menu3d.js) che galleggia sopra la pagina */
.arena-3d {
  display: block;
  width: 124%;
  margin: 0 -12%;
  aspect-ratio: 16 / 11.5;
}

.stage-3d {
  display: block;
  width: 100%;
  height: 100%;
}

.arena-name {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  padding: 5px 22px 7px;
  border: 3px solid #12141b;
  border-radius: 12px;
  background: linear-gradient(180deg, #282b34, #1b1d25);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.2);
  font-family: var(--font-title);
  font-size: 20px;
  text-shadow: var(--outline);
  white-space: nowrap;
}

.trophy-bar {
  width: min(100%, 400px);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.tb-icon {
  flex: none;
  font-size: 34px;
  line-height: 1;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.4));
}

.tb-track {
  position: relative;
  flex: 1;
  height: 26px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 3px solid var(--edge);
  border-radius: 13px;
  background: #1d202b;
}

.tb-track i {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold-lo));
  transition: width 0.8s ease;
}

.tb-track b {
  position: relative;
  font-family: var(--font-title);
  font-weight: 400;
  font-size: 15px;
  text-shadow: var(--outline);
}

.btn-play {
  width: min(100%, 340px);
  margin-top: 4px;
  padding: 14px 20px 18px;
  font-size: 36px;
  letter-spacing: 1px;
  border-radius: 18px;
  animation: playGlow 2.2s ease-in-out infinite;
}

.play-note {
  margin: -4px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
}

/* ------------------------------------------------------------------ amici e lobby privata */

.friends-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: -2px;
}

.friends-icon {
  font-size: 18px;
  line-height: 1;
}

.friends-badge {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  border: 2px solid #fff;
  background: #e5323f;
  font-family: var(--font-ui);
  font-weight: 900;
  font-size: 12px;
  line-height: 18px;
  text-shadow: none;
}

.friends-card {
  width: min(460px, 94vw);
}

.fr-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.fr-section h3 {
  margin: 0;
  font-family: var(--font-title);
  font-weight: 400;
  font-size: 18px;
  text-shadow: var(--outline);
}

.fr-note {
  margin: 0 !important;
  font-size: 13px;
  color: var(--muted);
}

.fr-form {
  display: flex;
  gap: 8px;
}

.fr-form input {
  flex: 1;
  min-width: 0;
}

.fr-code-input {
  text-transform: uppercase;
  letter-spacing: 5px;
  text-align: center;
  font-family: var(--font-title);
}

/* (.popup ul darebbe rientro e colonna: qui servono liste piatte e la griglia dei piloti) */
.popup .fr-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fr-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 12px;
  background: rgba(19, 21, 29, 0.35);
}

.fr-row b {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fr-sub {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fr-sub .gi {
  vertical-align: -0.2em;
}

.fr-dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #7d8aa0;
}

.fr-dot.online {
  background: #4ade80;
  box-shadow: 0 0 6px #4ade80;
}

.fr-dot.lobby {
  background: #ffcd3c;
}

.fr-dot.racing {
  background: #4e5775;
}

.fr-x {
  flex: none;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}

.fr-lobby-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.fr-code {
  padding: 2px 12px 4px;
  border: 3px dashed rgba(255, 255, 255, 0.55);
  border-radius: 12px;
  background: rgba(19, 21, 29, 0.4);
  color: var(--gold-hi);
  font-family: var(--font-title);
  font-size: 26px;
  letter-spacing: 6px;
  text-shadow: var(--outline);
  cursor: pointer;
}

.popup .fr-members {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.fr-member {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 86px;
  padding: 6px;
  border-radius: 12px;
  background: rgba(19, 21, 29, 0.35);
  font-size: 13px;
  text-align: center;
}

.fr-member canvas {
  width: 66px;
  height: 44px;
}

.fr-member b {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fr-member .fr-sub {
  flex: none;
}

.fr-member.empty {
  justify-content: center;
  border: 2px dashed rgba(255, 255, 255, 0.22);
  background: transparent;
  color: var(--muted);
}

.fr-member.empty .btn {
  margin-top: 6px;
  font-size: 12px;
}

.fr-member.empty .btn svg,
.fr-bot-icon svg {
  width: 18px;
  height: 18px;
  vertical-align: -4px;
}

.fr-bot-icon svg {
  width: 40px;
  height: 40px;
}

.fr-bot-remove {
  position: absolute;
  top: 4px;
  right: 6px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
}

/* pronto: bordo verde */
.fr-member.ready {
  box-shadow: inset 0 0 0 2px #4cd964;
}

.fr-member.ready .fr-sub {
  color: #7dff9a;
  font-weight: 900;
}

.fr-deck {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.fr-deck-card {
  display: inline-flex;
  width: 34px;
  height: 34px;
  padding: 3px;
  border-radius: 8px;
  background: rgba(19, 21, 29, 0.45);
}

.fr-deck .btn {
  margin-left: auto;
}

/* fuori dalla finestra degli amici: riporta alla lobby (per esempio dopo aver cambiato il mazzo) */
.lobby-chip {
  position: fixed;
  left: 50%;
  bottom: calc(86px + env(safe-area-inset-bottom));
  z-index: 40;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: 3px solid var(--gold-edge);
  border-radius: 999px;
  background: linear-gradient(180deg, #ffd23f, #f5a623);
  color: #3a2600;
  font: inherit;
  font-size: 14px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  white-space: nowrap;
}

.lobby-chip span {
  font-size: 12px;
  font-weight: 900;
  opacity: 0.8;
}

.lobby-chip .gi {
  width: 20px;
  height: 20px;
}

.fr-host {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 18px;
}

.fr-tracks {
  grid-template-columns: 1fr 1fr;
}

.fr-laps {
  grid-template-columns: repeat(4, 1fr);
}

.fr-tracks .seg,
.fr-laps .seg {
  padding: 7px 6px 8px;
  font-size: 14px;
}

.seg:disabled {
  cursor: default;
}

/* invito di un amico: in alto, finché non rispondi (o per 25 secondi) */
.invite {
  position: fixed;
  top: 10px;
  left: 50%;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(440px, calc(100vw - 20px));
  padding: 10px 12px;
  border: 3px solid var(--edge);
  border-radius: 16px;
  background: linear-gradient(180deg, #3f465e, #363d51);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.3), 0 12px 30px rgba(0, 0, 0, 0.45);
  transform: translateX(-50%);
  animation: invitePop 0.25s ease-out;
}

.invite .inv-text {
  flex: 1;
  font-size: 14px;
}

@keyframes invitePop {
  from {
    transform: translate(-50%, -30px);
    opacity: 0;
  }
}

.chest-row-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
  font-family: var(--font-title);
  font-size: 17px;
  text-shadow: var(--outline);
}

.chest-row {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.cslot {
  position: relative;
  height: 128px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 6px 4px 7px;
  border: 3px solid var(--edge);
  border-radius: 14px;
  background: linear-gradient(180deg, #414861, #363c4f);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.28), 0 3px 0 var(--edge-soft);
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.cslot .chest-art {
  transform: scale(0.62);
  margin: -15px -17px;
}

.cslot-top {
  font-family: var(--font-title);
  font-size: 13.5px;
  line-height: 1.1;
  text-align: center;
  text-shadow: var(--outline);
  white-space: nowrap;
}

.cslot-bottom {
  font-size: 10.5px;
  font-weight: 900;
  color: var(--muted);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
  white-space: nowrap;
}

.cslot.empty {
  justify-content: center;
  border-style: dashed;
  background: rgba(29, 32, 43, 0.4);
  box-shadow: none;
  color: rgba(231, 233, 238, 0.7);
  font-family: var(--font-title);
  font-size: 13px;
  text-align: center;
  cursor: default;
}

.cslot.ready {
  border-color: var(--gold-edge);
  background: linear-gradient(180deg, var(--gold-hi), var(--gold-lo));
  animation: readyBounce 1s ease-in-out infinite;
}

.cslot.ready .cslot-top {
  font-size: 18px;
}

.daily-btn {
  margin-left: auto;
  padding: 3px 10px;
  border: 2px solid var(--edge);
  border-radius: 999px;
  background: rgba(29, 32, 43, 0.55);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.daily-btn.ready {
  border-color: var(--gold-edge);
  background: linear-gradient(180deg, var(--gold-hi), var(--gold-lo));
  color: #3b2600;
  cursor: pointer;
  animation: readyBounce 1s ease-in-out infinite;
}

/* voto di gradimento */
.nps-popup {
  max-width: 460px;
  text-align: center;
}

.nps-scale {
  display: grid;
  grid-template-columns: repeat(11, minmax(0, 1fr));
  gap: 3px;
  margin-top: 10px;
}

.nps-score {
  min-height: 40px;
  padding: 0;
  border: 2px solid var(--edge);
  border-radius: 8px;
  background: linear-gradient(180deg, #414861, #363c4f);
  color: inherit;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.nps-score[aria-pressed='true'] {
  border-color: var(--gold-edge);
  background: linear-gradient(180deg, var(--gold-hi), var(--gold-lo));
  color: #3b2600;
}

.nps-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.nps-more {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  text-align: left;
  font-weight: 700;
}

.nps-more textarea {
  width: 100%;
  padding: 8px;
  border: 2px solid var(--edge);
  border-radius: 8px;
  background: rgba(29, 32, 43, 0.6);
  color: inherit;
  font: inherit;
  resize: vertical;
}

.nps-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}

/* selettore Carte / Garage in cima alla scheda */
.collection-switch {
  position: sticky;
  top: 0;
  z-index: 6;
  margin-bottom: 8px;
}

.collection-switch .seg {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 7px 8px 8px;
}

/* miglioramento pronto: striscia verde, freccia e bordo che pulsa */
.upgrade-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 24px;
  width: 100%;
  padding: 2px 4px;
  border: 2px solid var(--green-edge);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--green-hi), var(--green));
  color: #fff;
  font-family: var(--font-title);
  font-size: 12.5px;
  line-height: 1;
  text-shadow: var(--outline);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.45);
  animation: upgradePulse 1.1s ease-in-out infinite;
}

.upgrade-strip.poor {
  border-color: var(--edge);
  background: linear-gradient(180deg, #5b6480, #454c64);
  animation: none;
}

.up-arrow {
  flex: none;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 9px solid #fff;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.6));
}

.ctile.upgradable .ctile-art,
.vehicle-tile.upgradable {
  outline: 3px solid var(--green);
  outline-offset: 0;
  box-shadow: 0 0 14px 2px color-mix(in srgb, var(--green) 70%, transparent);
}

.up-badge,
.up-count {
  border-color: var(--green-edge);
  background: var(--green);
  color: #fff;
}

.up-count {
  min-width: 20px;
  padding: 0 5px;
  border: 2px solid var(--green-edge);
  border-radius: 10px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
  line-height: 16px;
  text-shadow: none;
}

@keyframes upgradePulse {
  50% {
    filter: brightness(1.2);
    transform: scale(1.03);
  }
}

/* ------------------------------------------------------------------ scuderie */
.crest {
  flex: none;
  display: inline-block;
  vertical-align: middle;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.35));
}

.team-intro,
.team-note,
.team-count {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.team-note {
  margin: 8px 0 0;
  text-align: center;
}

.team-count {
  margin: 10px 0;
  text-align: center;
}

.team-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.team-title {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}

.team-title h2 {
  margin: 0;
  font-family: var(--font-title);
  font-size: 22px;
  font-weight: 400;
  line-height: 1.1;
  overflow-wrap: anywhere;
  text-shadow: var(--outline);
}

.team-title span {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
}

.team-trophies {
  flex: none;
}

.team-tabs {
  margin-bottom: 10px;
}

.team-tabs .seg {
  padding: 7px 8px 8px;
}

.team-search,
.team-field input {
  width: 100%;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 2px solid var(--edge);
  border-radius: 10px;
  background: rgba(29, 32, 43, 0.6);
  color: inherit;
  font: inherit;
  font-weight: 700;
}

.team-field {
  display: grid;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 13px;
  font-weight: 800;
}

.team-row {
  width: 100%;
  border: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.team-member,
.team-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.team-member .rank-name,
.team-row .rank-name {
  flex: 1;
  min-width: 0;
}

.team-row .rank-name b,
.team-member .rank-name b {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-row .rank-name span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-member .rank-name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-captain .gi {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
}

.presence-dot {
  flex: none;
  width: 10px;
  height: 10px;
  margin-left: 2px;
  border-radius: 50%;
  background: #5b6480;
}

.presence-dot.online,
.presence-dot.lobby {
  background: var(--green);
}

.presence-dot.racing {
  background: var(--gold);
}

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

.team-popup-list {
  max-height: 44vh;
  overflow-y: auto;
  margin-bottom: 12px;
}

.crest-preview {
  display: grid;
  place-items: center;
  margin-bottom: 8px;
}

.crest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}

.crest-choice {
  display: grid;
  place-items: center;
  padding: 4px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: rgba(29, 32, 43, 0.6);
  cursor: pointer;
}

.crest-choice.active,
.crest-color.active {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--gold) 40%, transparent);
}

.crest-colors {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}

.crest-color {
  aspect-ratio: 1;
  border: 2px solid var(--edge);
  border-radius: 10px;
  background: var(--swatch);
  cursor: pointer;
}

/* presentazione e risultato 2 contro 2 */
.vs-team {
  display: grid;
  gap: 6px;
}

.vs-team-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-title);
  font-size: 16px;
  text-shadow: var(--outline);
}

.vs-team-head b {
  font-weight: 400;
}

.vs-versus {
  font-family: var(--font-title);
  font-size: 18px;
  text-align: center;
  text-shadow: var(--outline);
}

.st-team {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 2px 0 4px;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.team-score-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
}

.team-score-result span {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: 0;
  opacity: 0.65;
}

.team-score-result span.won {
  opacity: 1;
}

.team-score-result small {
  max-width: 100%;
  overflow: hidden;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-score-result b {
  font-family: var(--font-title);
  font-size: 30px;
  font-weight: 400;
  text-shadow: var(--outline);
}

/* ------------------------------------------------------------------ pagina Carte */

.deck-stats {
  display: flex;
  align-items: center;
  gap: 8px;
}

.elixir-avg {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.drop-icon {
  display: inline-block;
  width: 14px;
  height: 17px;
  margin: 0 4px 0 2px;
  vertical-align: -3px;
}

.deck-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 10px;
  max-width: 400px;
  margin: 0 auto;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 8px;
}

.section-label {
  margin: 16px 0 10px;
  font-family: var(--font-title);
  font-weight: 400;
  font-size: 17px;
  text-align: center;
  text-shadow: var(--outline);
}

.ctile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 0;
  border: 0;
  background: none;
  text-align: center;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.ctile:active {
  transform: scale(0.96);
}

.ctile-art {
  position: relative;
  aspect-ratio: 5 / 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 9% 2px 21px;
  border: 4px solid transparent;
  border-radius: 13px;
  background: radial-gradient(circle at 50% 38%, rgba(255, 255, 255, 0.45), transparent 60%) padding-box,
    linear-gradient(165deg, var(--c1), var(--c2)) padding-box, var(--frame) border-box;
  box-shadow: 0 0 0 2px var(--edge), inset 0 -6px 0 rgba(0, 0, 0, 0.18), 0 4px 0 var(--edge-soft);
}

.ctile-icon {
  font-size: clamp(34px, 11vw, 52px);
  line-height: 1;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.25));
}

.ctile-name {
  margin: auto 0 3px;
  padding: 0 2px;
  font-family: var(--font-title);
  font-size: 11px;
  line-height: 1.02;
  text-shadow: var(--outline);
}

.card-grid .ctile-art {
  aspect-ratio: 4 / 5;
}

.card-grid .ctile-icon {
  font-size: clamp(28px, 9vw, 44px);
}

.card-grid .ctile-name {
  font-size: 10px;
}

.ctile .cost {
  top: -9px;
  left: -9px;
  width: 25px;
  height: 29px;
  font-size: 15px;
}

.ctile-level {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 2px 0 3px;
  border-radius: 0 0 9px 9px;
  background: rgba(19, 21, 29, 0.6);
  font-family: var(--font-title);
  font-size: 12px;
  text-shadow: var(--outline);
}

.ctile-bar {
  position: relative;
  height: 17px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 2px solid #14161e;
  border-radius: 8px;
  background: var(--edge);
}

.ctile-bar i {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(180deg, #535d7d, #404860);
}

.ctile-bar.max i {
  background: linear-gradient(180deg, var(--gold-hi), var(--gold-lo));
}

.ctile-bar b {
  position: relative;
  font-size: 10.5px;
  font-weight: 900;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.7);
}

.ctile-note {
  font-size: 10.5px;
  font-weight: 900;
  line-height: 1.15;
  color: var(--muted);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
}

.ctile.locked .ctile-art {
  background: linear-gradient(165deg, #2d2f36, #1e2024) padding-box, linear-gradient(160deg, #75809b, #2c2e33) border-box;
}

.ctile.locked .ctile-icon {
  filter: grayscale(1) brightness(0.7);
  opacity: 0.55;
}

.ctile.locked .cost {
  filter: grayscale(0.9);
}

.ctile-lock {
  position: absolute;
  bottom: 4px;
  font-size: 20px;
}

/* modifica del mazzo: posti vuoti, carta trascinata, posto su cui cadrebbe */
.ctile {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.deck-empty {
  cursor: default;
}

.deck-empty .ctile-art {
  display: grid;
  place-content: center;
  padding: 0;
  border: 3px dashed rgba(255, 255, 255, 0.35);
  background: rgba(19, 21, 29, 0.35);
  box-shadow: none;
}

.deck-plus {
  font-family: var(--font-title);
  font-size: 38px;
  color: rgba(255, 255, 255, 0.4);
}

.ctile.dragging {
  opacity: 0.3;
}

.drag-ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
  pointer-events: none;
  transition: none;
  filter: drop-shadow(0 14px 16px rgba(0, 0, 0, 0.45));
}

.drag-ghost .ctile-art {
  aspect-ratio: auto;
}

.drag-ghost .upgrade-strip,
.drag-ghost .ctile-bar,
.drag-ghost .ctile-note {
  display: none;
}

.dragging-card .deck-grid .ctile-art {
  box-shadow: 0 0 0 2px var(--edge), 0 0 0 5px rgba(255, 255, 255, 0.28);
}

.deck-grid .drop-over .ctile-art {
  transform: scale(1.06);
  box-shadow: 0 0 0 3px #fff, 0 0 18px rgba(255, 255, 255, 0.85);
}

.deck-source.drop-over::after {
  content: 'Rilascia qui per togliere la carta dal mazzo';
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 20px;
  border: 3px dashed rgba(255, 255, 255, 0.85);
  border-radius: inherit;
  background: rgba(19, 21, 28, 0.72);
  font-family: var(--font-title);
  font-size: 19px;
  text-align: center;
  text-shadow: var(--outline);
}

.deck-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 400px;
  margin: 14px auto 0;
}

.deck-hint {
  flex: 1;
  font-size: 12.5px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--muted);
}

.deck-hint.warn {
  color: #ffd166;
}

.deck-grid.swapping .ctile-art {
  animation: wiggle 0.3s ease-in-out infinite alternate;
  box-shadow: 0 0 0 3px #fff, 0 0 16px rgba(255, 255, 255, 0.75);
}

.swap-banner {
  position: fixed;
  left: 50%;
  bottom: calc(86px + env(safe-area-inset-bottom));
  z-index: 40;
  width: min(560px, 92vw);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 10px 16px;
  transform: translateX(-50%);
  border: 3px solid #14161e;
  border-radius: 16px;
  background: linear-gradient(180deg, #262a37, #1a1d26);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
  animation: fadeUp 0.2s ease-out;
}

.swap-banner span {
  flex: 1;
  font-size: 14.5px;
}

/* ------------------------------------------------------------------ pagina Leghe */

.league-card {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.league-card > canvas {
  width: 128px;
  height: 88px;
  border-radius: 12px;
  border: 3px solid var(--edge);
  background: radial-gradient(circle at 50% 35%, #cfd3de, #434b65 70%, #3b4258);
}

.league-card.locked > canvas {
  filter: grayscale(0.75) brightness(0.6);
}

.league-card.current {
  border-color: var(--gold-edge);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.28), 0 0 0 3px var(--gold), 0 4px 0 var(--edge-soft);
}

.league-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-title);
  font-size: 19px;
  text-shadow: var(--outline);
}

.league-title .gi {
  font-size: 30px;
}

.league-map {
  font-size: 13.5px;
  font-weight: 900;
  color: var(--muted);
}

.league-unlocks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin-top: 6px;
  font-size: 13px;
}

.league-cards {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  font-size: 26px;
}

.league-cars {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 3px;
}

/* auto della lega: bordo del colore della rarità */
.league-vehicle {
  display: inline-flex;
  border-radius: 9px;
  border: 2px solid color-mix(in srgb, var(--rarity) 70%, transparent);
  background: rgba(0, 0, 0, 0.22);
}

.league-unlocks canvas {
  width: 56px;
  height: 38px;
  border: 0;
  border-radius: 0;
  background: none;
  vertical-align: middle;
}

.league-state {
  position: absolute;
  top: 8px;
  right: 10px;
}

.league-progress {
  margin-top: 8px;
}

/* ------------------------------------------------------------------ pagina Garage */

.garage-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.garage-canvas {
  overflow: hidden;
  width: 100%;
  height: 260px;
  border-radius: 14px;
  border: 3px solid var(--edge);
  background: radial-gradient(circle at 50% 40%, #363c4e, #1e212c);
}

.garage-caption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.garage-caption b {
  font-family: var(--font-title);
  font-weight: 400;
  font-size: 24px;
  text-shadow: var(--outline);
}

.garage-caption span:not(.rarity-pill) {
  font-weight: 900;
}

.garage-note {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
}

.car-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.vehicle-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
  padding: 6px 4px 8px;
  border: 3px solid color-mix(in srgb, var(--rarity) 45%, var(--edge));
  border-radius: 14px;
  background: linear-gradient(180deg, #3b4155, #2f3445);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.2);
  color: inherit;
  font: inherit;
  text-align: center;
  cursor: pointer;
}

.vehicle-tile canvas {
  width: 100%;
  max-width: 100px;
  height: 64px;
}

.vehicle-tile b {
  font-family: var(--font-title);
  font-weight: 400;
  font-size: 14px;
  line-height: 1.1;
  text-shadow: var(--outline);
}

.vehicle-tile.selected {
  border-color: var(--gold-edge);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.2), 0 0 0 3px var(--gold);
}

.vehicle-tile.locked canvas {
  filter: brightness(0.35) grayscale(0.5);
}

/* livello dell'auto: tre pallini */
.car-pips {
  display: flex;
  gap: 3px;
}

.car-pips i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.4);
}

.car-pips i.on {
  background: var(--rarity);
  box-shadow: 0 0 6px color-mix(in srgb, var(--rarity) 70%, transparent);
}

.car-progress {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 0 4px;
}

.car-progress .bar {
  flex: 1;
  height: 7px;
}

.car-progress small,
.car-lock,
.car-max {
  font-size: 10.5px;
  font-weight: 900;
  color: var(--muted);
}

.car-max {
  color: var(--gold);
}

.level-tabs {
  display: flex;
  gap: 6px;
}

.level-tab {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border: 2px solid var(--edge);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
  color: inherit;
  font: inherit;
  font-size: 12.5px;
  font-weight: 900;
  cursor: pointer;
}

.level-tab b {
  font-family: var(--font-title);
  font-weight: 400;
}

.level-tab.active {
  border-color: var(--gold-edge);
  background: linear-gradient(180deg, #ffd23f, #f5a623);
  color: #3a2600;
}

.level-tab.locked:not(.active) {
  opacity: 0.7;
}

.garage-level {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 13px;
  font-weight: 900;
  text-align: center;
}

.level-parts {
  font-size: 12px;
  color: var(--gold);
}

/* ------------------------------------------------------------------ pagina Classifica */

.rank-me {
  margin-bottom: 10px;
  padding: 9px 12px;
  border: 3px solid var(--gold-edge);
  border-radius: 12px;
  background: linear-gradient(180deg, #ffe58a, #f6b52c);
  color: #3a2200;
  font-weight: 900;
  font-size: 14.5px;
  text-align: center;
}

.rank-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rank-row {
  display: grid;
  grid-template-columns: 34px 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 3px solid var(--edge);
  border-radius: 12px;
  background: linear-gradient(180deg, #3b4155, #2f3445);
}

.rank-row.me {
  border-color: var(--gold-edge);
  box-shadow: 0 0 0 2px var(--gold);
}

.rank-pos {
  text-align: center;
}

.rank-row canvas {
  width: 58px;
  height: 40px;
}

.rank-name {
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.rank-name b {
  font-size: 15.5px;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-name span {
  font-size: 11.5px;
  font-weight: 900;
  color: var(--muted);
}

.rank-gap {
  text-align: center;
  color: var(--muted);
  font-weight: 900;
}

/* ------------------------------------------------------------------ finestre */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 14px;
  background: rgba(15, 16, 22, 0.62);
  backdrop-filter: blur(2px);
}

.popup {
  position: relative;
  width: min(520px, 94vw);
  max-height: 90vh;
  overflow: auto;
  padding: 16px;
  border: 3px solid var(--edge);
  border-radius: 20px;
  background: linear-gradient(180deg, #3f465e, #363d51);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.3), 0 24px 50px rgba(0, 0, 0, 0.45);
  animation: pop 0.22s ease-out;
}

.popup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.popup-head h2 {
  margin: 0;
  font-family: var(--font-title);
  font-weight: 400;
  font-size: 24px;
  text-shadow: var(--outline);
}

.popup p {
  margin: 0 0 10px;
}

.popup ul {
  margin: 0 0 12px;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14.5px;
}

.menu-label {
  font-family: var(--font-title);
  font-size: 15px;
  text-shadow: var(--outline);
  margin-bottom: -4px;
}

.camera-choice {
  flex-wrap: wrap;
}

.camera-choice .seg {
  flex: 1 1 40%;
  font-size: 14px;
  padding: 7px 6px;
}

.menu-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.menu-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.menu-row .btn {
  padding-left: 8px;
  padding-right: 8px;
  font-size: 16px;
}

.chest-types {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chest-type {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 2px;
  border: 2px solid var(--edge);
  border-radius: 12px;
  background: rgba(19, 21, 29, 0.35);
  font-size: 12.5px;
}

.chest-type div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chest-type b {
  font-size: 14px;
}

.chest-type span {
  color: var(--muted);
}

/* dettaglio carta */

.detail-card {
  width: min(560px, 94vw);
}

.detail {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.detail-info h2 {
  margin: 0 40px 6px 0;
  font-family: var(--font-title);
  font-weight: 400;
  font-size: 26px;
  line-height: 1.05;
  text-shadow: var(--outline);
}

.detail-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.detail-info p {
  font-weight: 700;
  font-size: 14.5px;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-bottom: 10px;
  font-size: 12.5px;
  color: var(--muted);
}

.detail-tags .gi {
  font-size: 17px;
  vertical-align: -0.3em;
}

.detail-stats {
  width: 100%;
  margin-bottom: 10px;
  border-collapse: collapse;
  font-size: 14.5px;
  background: rgba(19, 21, 29, 0.3);
  border-radius: 10px;
  overflow: hidden;
}

.detail-stats th {
  padding: 5px 8px;
  text-align: left;
  font-size: 12px;
  color: var(--muted);
}

.detail-stats td {
  padding: 6px 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.detail-stats td.up {
  color: var(--green-hi);
  font-weight: 900;
}

.detail-progress {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--muted);
}

.detail-locked,
.detail-max {
  margin: 0 0 12px;
  padding: 9px 11px;
  border-radius: 12px;
  background: rgba(19, 21, 29, 0.35);
  font-size: 13.5px;
}

.detail-max {
  color: var(--gold-hi);
  font-weight: 900;
}

.detail-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
}

/* ------------------------------------------------------------------ ricerca avversari e presentazione */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 16px;
  background-color: #303548;
  background-image: radial-gradient(90% 60% at 50% 40%, rgba(84, 94, 126, 0.35), transparent 70%),
    repeating-conic-gradient(from 45deg, rgba(255, 255, 255, 0.05) 0 25%, rgba(23, 25, 34, 0.08) 0 50%);
  background-size: 100% 100%, 76px 76px;
}

.mm-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.mm-wheel {
  position: relative;
  width: 128px;
  height: 128px;
  margin-bottom: 8px;
  border-radius: 50%;
  background: radial-gradient(circle, #e7e9ee 0 16%, #9aa3b5 17% 24%, transparent 25%),
    repeating-conic-gradient(#2b2f3a 0 10deg, #3a3f4d 10deg 20deg);
  box-shadow: 0 0 0 12px #16171d, 0 0 0 15px var(--edge), 0 12px 24px rgba(0, 0, 0, 0.4);
  animation: spin 0.9s linear infinite;
}

.mm-wheel span {
  position: absolute;
  inset: 26px;
  border-radius: 50%;
  background: repeating-conic-gradient(transparent 0 52deg, #dde0e7 52deg 60deg);
}

.mm-title {
  margin: 0;
  font-family: var(--font-title);
  font-weight: 400;
  font-size: 34px;
  text-shadow: var(--outline);
}

.mm-status {
  margin: 0;
  font-size: 16px;
  font-weight: 900;
}

.mm-time {
  font-family: var(--font-title);
  font-size: 30px;
  color: var(--gold-hi);
  text-shadow: var(--outline);
  font-variant-numeric: tabular-nums;
}

.mm-online {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--muted);
}

.vs-box {
  width: min(520px, 94vw);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.vs-map {
  margin: 0;
  text-align: center;
  font-weight: 900;
  font-size: 15px;
  color: var(--muted);
}

.vs-map .gi {
  font-size: 24px;
  vertical-align: -0.3em;
}

.vs-title {
  margin: 0 0 6px;
  text-align: center;
  font-family: var(--font-title);
  font-weight: 400;
  font-size: 46px;
  color: var(--gold-hi);
  text-shadow: var(--outline), 0 8px 18px rgba(0, 0, 0, 0.35);
  animation: vsTitle 0.5s cubic-bezier(0.2, 1.6, 0.4, 1);
}

.vs-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.vs-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 8px;
  border: 3px solid var(--edge);
  border-left: 10px solid var(--c);
  border-radius: 16px;
  background: linear-gradient(180deg, #414861, #363c4f);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.28), 0 4px 0 var(--edge-soft);
  animation: vsIn 0.45s ease-out both;
}

.vs-row canvas {
  width: 88px;
  height: 58px;
}

.vs-row.me {
  border-color: var(--gold-edge);
  border-left-color: var(--c);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.28), 0 0 0 3px var(--gold);
}

.vs-name {
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.vs-name b {
  font-family: var(--font-title);
  font-weight: 400;
  font-size: 19px;
  text-shadow: var(--outline);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vs-name span {
  font-size: 12px;
  font-weight: 900;
  color: var(--muted);
}

/* ------------------------------------------------------------------ risultati */

/* ------------------------------------------------------------------ replay e momenti salienti */

/* nel replay restano classifica e minimappa; carte, benzina e avvisi spariscono */
/* giro televisivo prima del via: bande nere da diretta, interfaccia di gara nascosta, nome del posto in basso */
#screen-race::before,
#screen-race::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  z-index: 4;
  height: 0;
  background: #0b0b0e;
  pointer-events: none;
  transition: height 0.45s ease;
}

#screen-race::before {
  top: 0;
}

#screen-race::after {
  bottom: 0;
}

#screen-race.flyover::before,
#screen-race.flyover::after {
  height: 9vh;
}

#screen-race #hud {
  transition: opacity 0.4s ease;
}

#screen-race.flyover #hud {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.flyover-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(9vh + 18px);
  z-index: 5;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.flyover-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 8px 18px 10px;
  border-left: 5px solid var(--gold-hi);
  border-radius: 6px;
  background: rgba(16, 18, 24, 0.78);
  color: #fff;
  animation: flyover-in 0.5s ease both;
}

.flyover-card span {
  color: var(--gold-hi);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.flyover-card b {
  font-family: var(--font-title);
  font-size: 24px;
  text-shadow: var(--outline);
}

@keyframes flyover-in {
  from {
    opacity: 0;
    transform: translateX(-24px);
  }
}

#screen-race.replay .bottom-bar,
#screen-race.replay #lapbox,
#screen-race.replay #banner,
#screen-race.replay #feed,
#screen-race.replay #warning,
#screen-race.replay #btn-mute,
#screen-race.replay #ping,
#screen-race.replay .danger-edge {
  display: none;
}

#screen-race.replay .world-overlay {
  pointer-events: none;
}

.replay-ui {
  position: absolute;
  inset: 0;
  z-index: 30;
  pointer-events: none;
}

.replay-caption {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top));
  left: 50%;
  width: min(520px, 92vw);
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 16px 11px;
  transform: translateX(-50%);
  border: 3px solid var(--gold-edge);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(40, 24, 0, 0.82), rgba(14, 10, 30, 0.86));
  box-shadow: 0 0 22px rgba(255, 210, 63, 0.45);
  text-align: center;
  animation: vsIn 0.35s cubic-bezier(0.2, 1.4, 0.4, 1);
}

.replay-caption b {
  font-family: var(--font-title);
  font-weight: 400;
  font-size: 23px;
  color: var(--gold-hi);
  text-shadow: var(--outline);
}

.replay-caption .gi {
  font-size: 1.1em;
  vertical-align: -0.2em;
}

.replay-caption span {
  font-size: 14px;
  font-weight: 800;
}

/* nel momento saliente conta solo la scena: niente classifica né minimappa sotto la didascalia */
#screen-race.replay-moment .standings,
#screen-race.replay-moment .minimap-wrap {
  display: none;
}

.replay-panel {
  position: absolute;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom));
  width: min(560px, 94vw);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  transform: translateX(-50%);
  border: 3px solid var(--edge);
  border-radius: 18px;
  background: rgba(16, 18, 23, 0.82);
  backdrop-filter: blur(6px);
  pointer-events: auto;
}

.replay-ui.moment .replay-panel {
  width: auto;
  min-width: min(320px, 90vw);
}

.replay-ui.moment [data-full] {
  display: none;
}

.replay-cams {
  grid-template-columns: repeat(5, 1fr);
}

.replay-cams .seg {
  padding: 6px 4px 7px;
  font-size: 15px;
}

.replay-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.replay-btn {
  flex: none;
  min-width: 42px;
  height: 36px;
  padding: 0 8px;
  border: 2px solid var(--edge);
  border-radius: 10px;
  background: linear-gradient(180deg, var(--blue-hi), var(--blue-lo));
  color: #fff;
  font-family: var(--font-title);
  font-size: 16px;
  text-shadow: var(--outline);
  cursor: pointer;
}

.replay-track {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.replay-track input {
  width: 100%;
  accent-color: var(--gold);
}

/* stelline dei momenti salienti sulla barra del tempo */
.replay-marks {
  position: absolute;
  left: 8px;
  right: 8px;
  top: -7px;
  height: 0;
  pointer-events: none;
}

.replay-marks i {
  position: absolute;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  clip-path: polygon(50% 0, 63% 35%, 100% 38%, 71% 61%, 80% 100%, 50% 78%, 20% 100%, 29% 61%, 0 38%, 37% 35%);
  background: var(--gold-hi);
}

.replay-time {
  flex: none;
  min-width: 56px;
  font-weight: 900;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.replay-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.replay-status {
  flex: 1;
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
}

.rec-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 4px;
  border-radius: 50%;
  background: #ff3b4e;
  vertical-align: -1px;
  animation: pulse 0.8s ease-in-out infinite alternate;
}

/* risultati: momenti salienti da rivedere e tasto replay */
.results-moments {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.results-moments:empty {
  display: none;
}

.moments-title {
  font-family: var(--font-title);
  font-size: 16px;
  text-shadow: var(--outline);
}

.moment {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border: 2px solid rgba(255, 210, 63, 0.6);
  border-radius: 12px;
  background: rgba(19, 21, 29, 0.45);
  color: #fff;
  text-align: left;
  cursor: pointer;
}

.moment > .gi {
  flex: none;
  font-size: 26px;
}

.moment-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.moment-text b {
  font-family: var(--font-title);
  font-weight: 400;
  font-size: 16px;
  color: var(--gold-hi);
  text-shadow: var(--outline);
}

.moment-text small {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--muted);
}

.moment-text .gi {
  font-size: 1.2em;
  vertical-align: -0.25em;
}

.moment-play {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold-lo));
  color: #3a2200;
  font-size: 14px;
}

.results-actions {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 10px;
}

.results-actions .btn {
  font-size: 20px;
}

.results-actions .btn:only-child,
.results-actions .hidden + .btn {
  grid-column: 1 / -1;
}

/* durante la festa sul podio i risultati stanno in basso, senza velo scuro: il podio resta in vista */
#screen-race.podium .hud {
  display: none;
}

#results.celebrate {
  place-items: end center;
  background: transparent;
  backdrop-filter: none;
  pointer-events: none;
}

#results.celebrate .results-card {
  max-height: 58vh;
  overflow-y: auto;
  pointer-events: auto;
  animation: podiumCard 0.4s cubic-bezier(0.2, 1.3, 0.4, 1);
}

@keyframes podiumCard {
  from {
    transform: translateY(60px);
    opacity: 0;
  }
}

@media (max-width: 560px) {
  #results.celebrate .results-card {
    gap: 8px;
    padding: 12px;
  }

  #results.celebrate .results-banner {
    font-size: 32px;
  }

  #results.celebrate .reward-trophies {
    font-size: 24px;
    padding: 4px 12px 5px 8px;
  }

  #results.celebrate .res-row {
    padding: 3px 8px;
  }
}

.results-card {
  width: min(500px, 94vw);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.results-banner {
  margin-top: -2px;
  text-align: center;
  font-family: var(--font-title);
  font-size: 44px;
  line-height: 1;
  text-shadow: var(--outline), 0 6px 14px rgba(0, 0, 0, 0.3);
  animation: vsTitle 0.5s cubic-bezier(0.2, 1.6, 0.4, 1);
}

.results-banner.win {
  color: var(--gold-hi);
}

.results-banner small {
  display: block;
  margin-top: 4px;
  font-size: 16px;
  color: var(--muted);
}

.results-rewards {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 14px;
}

.reward-trophies {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px 8px 10px;
  border: 3px solid var(--edge);
  border-radius: 16px;
  background: #1d202b;
  font-family: var(--font-title);
  font-size: 32px;
  text-shadow: var(--outline);
}

.reward-trophies.up {
  color: var(--green-hi);
}

.reward-trophies.down {
  color: #ff9aa5;
}

.reward-trophies small {
  font-size: 15px;
  color: var(--muted);
}

.reward-chest {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 12px 2px 0;
  border: 3px solid var(--gold-edge);
  border-radius: 16px;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold-lo));
  color: #3a2200;
  font-weight: 900;
  font-size: 14px;
}

.reward-chest .chest-art {
  transform: scale(0.55);
  margin: -18px -20px;
}

.reward-line {
  width: 100%;
  padding: 7px 10px;
  border-radius: 12px;
  background: rgba(19, 21, 29, 0.35);
  font-size: 14px;
  text-align: center;
}

.reward-line.promo {
  color: var(--gold-hi);
}

/* record del tracciato battuto: riga dorata che brilla */
.reward-line.record {
  border: 2px solid var(--gold-hi);
  background: linear-gradient(180deg, rgba(255, 210, 63, 0.28), rgba(140, 80, 0, 0.3));
  box-shadow: 0 0 18px rgba(255, 210, 63, 0.55);
  color: #fff;
  font-weight: 900;
  animation: recordGlow 1.2s ease-in-out infinite alternate;
}

.reward-line.record .record-time {
  color: var(--gold-hi);
  font-family: var(--font-title);
  font-weight: 400;
  font-size: 19px;
  text-shadow: var(--outline);
}

.reward-line.record small {
  display: block;
  font-weight: 800;
  color: var(--muted);
}

@keyframes recordGlow {
  to {
    box-shadow: 0 0 28px rgba(255, 210, 63, 0.9);
  }
}

.play-record,
.vs-record {
  margin: 0;
  text-align: center;
  font-size: 13.5px;
  font-weight: 800;
  color: var(--gold-hi);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
}

.play-record b,
.vs-record b {
  color: #fff;
}

.play-record {
  margin-top: -6px;
}

.vs-record {
  margin-top: -8px;
  font-size: 15px;
}

.reward-line.down,
.reward-line.lost {
  color: #ffc2c8;
}

.results-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.res-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 3px solid var(--edge);
  border-left: 8px solid var(--c);
  border-radius: 12px;
  background: linear-gradient(180deg, #3b4155, #2f3445);
}

.res-row.me {
  border-color: var(--gold-edge);
  border-left-color: var(--c);
  box-shadow: 0 0 0 2px var(--gold);
}

.res-place {
  text-align: center;
}

.res-name {
  min-width: 0;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.res-time {
  font-weight: 900;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.res-trophies {
  margin-left: 4px;
  font-size: 12.5px;
}

.res-trophies.up {
  color: var(--green-hi);
}

.res-trophies.down {
  color: #ff9aa5;
}

/* ------------------------------------------------------------------ avvisi */

.conn-overlay {
  position: fixed;
  top: 16px;
  left: 50%;
  z-index: 95;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  transform: translateX(-50%);
  border: 3px solid var(--edge);
  border-radius: 999px;
  background: #1a1d26;
  font-weight: 900;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  max-width: 92vw;
  padding: 9px 16px;
  border: 3px solid var(--edge);
  border-radius: 14px;
  background: #1a1d26;
  font-weight: 900;
  text-align: center;
  animation: feedIn 0.2s ease-out;
  transition: opacity 0.4s;
}

.toast.error {
  border-color: var(--red-edge);
  background: #5a1020;
}

.toast.success {
  border-color: var(--green-edge);
  background: #145a24;
}

/* ------------------------------------------------------------------ gara (HUD) */

#screen-race {
  overflow: hidden;
  background: #5ea83f;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#world,
.world-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.world-overlay {
  pointer-events: none;
}

.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hud-panel {
  background: rgba(16, 18, 23, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 14px;
  backdrop-filter: blur(4px);
}

.standings {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 6px;
  min-width: 230px;
  transition: opacity 0.2s;
}

.st-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 9px;
  font-weight: 800;
  font-size: 14px;
}

.st-row.me {
  background: rgba(255, 255, 255, 0.14);
}

.st-pos {
  font-family: var(--font-title);
  width: 24px;
  text-align: center;
  font-size: 19px;
}

.st-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.6);
  flex: none;
}

.st-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 110px;
}

.st-fx {
  font-size: 12px;
  letter-spacing: 1px;
}

.st-gap {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 12.5px;
  min-width: 52px;
  text-align: right;
}

.lapbox {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 20px 8px;
  text-align: center;
}

.lap {
  font-family: var(--font-title);
  font-size: 28px;
  letter-spacing: 1px;
}

.timer {
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  color: var(--muted);
  font-size: 15px;
}

.x2-badge {
  margin-top: 4px;
  font-family: var(--font-title);
  font-size: 15px;
  background: linear-gradient(90deg, #ffb020, #ff5a1f);
  border-radius: 8px;
  padding: 2px 10px;
  animation: pulse 0.9s infinite alternate;
}

.minimap-wrap {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 6px;
  transition: opacity 0.2s;
}

#minimap {
  width: 230px;
  height: 170px;
  display: block;
}

.feed {
  position: absolute;
  top: 204px;
  right: 12px;
  width: 290px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: flex-end;
  transition: opacity 0.2s;
}

.feed-item {
  background: rgba(16, 18, 23, 0.74);
  border-radius: 10px;
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 800;
  animation: feedIn 0.25s ease-out;
  transition: opacity 0.6s ease;
  max-width: 100%;
}

.feed-item .gi,
.chip .gi,
.warning .gi,
.st-fx .gi {
  font-size: 1.4em;
  vertical-align: -0.32em;
}

.banner .gi {
  font-size: 1.1em;
  vertical-align: -0.15em;
}

.feed-item.mine {
  box-shadow: inset 0 0 0 2px rgba(255, 205, 60, 0.6);
}

.feed-item .who {
  font-weight: 900;
}

.warning {
  position: absolute;
  top: 108px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(90deg, #ff3b4e, #ff7a3b);
  padding: 8px 20px;
  border-radius: 999px;
  font-family: var(--font-title);
  font-size: 21px;
  white-space: nowrap;
  box-shadow: 0 0 30px rgba(255, 60, 60, 0.65), 0 4px 0 rgba(0, 0, 0, 0.25);
  animation: wobble 0.35s infinite alternate;
}

.warning.soft {
  background: linear-gradient(90deg, #ff9f2e, #ffcd3c);
  color: #2a1700;
  box-shadow: 0 0 20px rgba(255, 180, 40, 0.5);
  animation: none;
}

.banner {
  position: absolute;
  top: 30%;
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--font-title);
  pointer-events: none;
}

.banner .b {
  display: inline-block;
  font-size: 72px;
  color: #fff;
  text-shadow: 0 6px 0 rgba(0, 0, 0, 0.35), 0 0 40px rgba(0, 0, 0, 0.35);
  animation: bannerIn 1.5s ease-out forwards;
}

.banner .b.small {
  font-size: 40px;
}

.banner .b.gold {
  color: var(--yellow);
  text-shadow: 0 6px 0 #b35a00, 0 0 40px rgba(0, 0, 0, 0.35);
}

.banner .b.fuel {
  color: #ffd27a;
  text-shadow: 0 6px 0 #a64a00, 0 0 40px rgba(0, 0, 0, 0.35);
}

.banner .b.purple {
  color: #f3b6ff;
  text-shadow: 0 6px 0 #6c1bbf, 0 0 40px rgba(0, 0, 0, 0.35);
}

.banner .b.count {
  font-size: 140px;
  animation: countIn 0.9s ease-out forwards;
}

/* vassoio in basso: carte grandi con il costo sotto (come in Clash Royale) e il serbatoio della benzina */
.bottom-bar {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: min(560px, 100%);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 10px 14px calc(12px + env(safe-area-inset-bottom));
  border-radius: 22px 22px 0 0;
  background: linear-gradient(180deg, rgba(16, 18, 23, 0.5), rgba(16, 18, 23, 0.86));
  box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.1);
  pointer-events: none;
}

.status-chips {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  margin-bottom: 8px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.chip {
  background: rgba(16, 18, 23, 0.8);
  border-radius: 999px;
  padding: 3px 11px;
  font-weight: 900;
  font-size: 13px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-variant-numeric: tabular-nums;
}

.chip.bad {
  border-color: rgba(255, 90, 90, 0.7);
  background: rgba(90, 10, 20, 0.8);
}

.chip.good {
  border-color: rgba(90, 220, 255, 0.7);
}

.hand-row {
  display: flex;
  align-items: flex-end;
  gap: 14px;
}

.next-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.next-label {
  font-size: 11px;
  text-transform: uppercase;
  color: #fff;
  font-weight: 900;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.hand {
  display: flex;
  gap: 10px;
}

.card {
  position: relative;
  width: 108px;
  height: 140px;
  border-radius: 14px;
  border: 4px solid transparent;
  padding: 0;
  cursor: pointer;
  color: #fff;
  background: radial-gradient(circle at 50% 36%, rgba(255, 255, 255, 0.45), transparent 60%) padding-box,
    linear-gradient(165deg, var(--c1), var(--c2)) padding-box, var(--frame, linear-gradient(#dde0e7, #7d8ca6)) border-box;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.22), 0 0 0 2px var(--edge), 0 8px 16px rgba(0, 0, 0, 0.35);
  transition: transform 0.12s ease, filter 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  touch-action: manipulation;
}

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

.card .card-icon {
  font-size: 54px;
  line-height: 1;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.25));
}

.card .card-name {
  font-family: var(--font-title);
  font-size: 14px;
  line-height: 1.05;
  text-align: center;
  padding: 0 6px;
  margin-top: 6px;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
}

.card .card-variant {
  display: block;
  font-family: var(--font-ui);
  font-size: 9.5px;
  font-weight: 900;
  text-transform: uppercase;
  opacity: 0.92;
}

.card .card-tags {
  position: absolute;
  bottom: 5px;
  display: flex;
  gap: 2px;
  font-size: 15px;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.35));
}

.card .cost {
  top: -10px;
  left: -10px;
  width: 34px;
  height: 34px;
  font-size: 20px;
  z-index: 2;
}

.card .card-key {
  position: absolute;
  top: 5px;
  right: 8px;
  font-size: 12px;
  font-weight: 900;
  opacity: 0.75;
}

.card .card-as {
  position: absolute;
  top: 6px;
  left: 28px;
  font-size: 15px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 6px;
  padding: 0 4px;
}

.card .card-charge {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: rgba(10, 8, 30, 0.6);
  transform-origin: top;
  transform: scaleY(0);
  pointer-events: none;
}

.card .card-why {
  position: absolute;
  left: 5px;
  right: 5px;
  bottom: 22px;
  font-size: 10.5px;
  font-weight: 900;
  line-height: 1.15;
  background: rgba(0, 0, 0, 0.68);
  border-radius: 6px;
  padding: 2px 3px;
  text-align: center;
  display: none;
}

.card.unaffordable {
  filter: saturate(0.6);
}

.card.invalid {
  filter: grayscale(0.85) brightness(0.8);
}

.card.invalid .card-why {
  display: block;
}

.card.suggest {
  animation: suggest 0.45s infinite alternate;
}

.card.played {
  animation: playOut 0.35s ease-out;
}

.card.denied {
  animation: denied 0.35s;
}

.card.mini {
  width: 64px;
  height: 84px;
  border-radius: 10px;
  pointer-events: none;
}

.card.mini .card-icon {
  font-size: 36px;
}

.card.mini .card-name {
  font-size: 9.5px;
  margin-top: 3px;
}

.card.mini .cost {
  width: 24px;
  height: 24px;
  font-size: 14px;
  top: -7px;
  left: -7px;
}

.card.mini .card-tags,
.card.mini .card-key,
.card.mini .card-variant {
  display: none;
}

/* carte in gara: solo icona grande e costo sotto al centro; nome e dettagli nel suggerimento al passaggio */
#hud .card {
  width: 92px;
  height: 112px;
  border-width: 4px;
  border-radius: 14px;
}

#hud .card .card-icon {
  font-size: 50px;
  margin-bottom: 8px;
}

#hud .card .card-name,
#hud .card .card-tags,
#hud .card .card-level {
  display: none;
}

#hud .card .cost {
  top: auto;
  bottom: -14px;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 37px;
  font-size: 18px;
}

#hud .card .card-why {
  bottom: 22px;
}

#hud .card.unaffordable {
  filter: saturate(0.35) brightness(0.88);
}

#hud .card.mini {
  width: 54px;
  height: 66px;
  border-width: 3px;
  border-radius: 10px;
}

#hud .card.mini .card-icon {
  font-size: 28px;
  margin-bottom: 4px;
}

#hud .card.mini .cost {
  width: 22px;
  height: 25px;
  font-size: 13px;
  bottom: -10px;
}

/* Congelamento abilità: brina sulle carte che si assottiglia con i secondi (--frost) e alla fine si rompe */
#hud .card .card-frost {
  position: absolute;
  inset: -4px;
  z-index: 3;
  border-radius: 14px;
  border: 2px solid rgba(231, 233, 238, 0.95);
  background: linear-gradient(160deg, rgba(231, 233, 238, 0.8), rgba(220, 223, 231, 0.4) 50%, rgba(80, 89, 120, 0.62));
  box-shadow: inset 0 0 14px rgba(255, 255, 255, 0.85), 0 0 12px rgba(199, 204, 216, 0.75);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#hud .card .card-frost svg {
  display: block;
  width: 100%;
  height: 100%;
}

#hud .hand.frozen .card .card-frost {
  visibility: visible;
  opacity: var(--frost, 1);
  animation: frostIn 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.25) backwards;
}

#hud .hand.frozen .card:nth-child(2) .card-frost {
  animation-delay: 0.05s;
}

#hud .hand.frozen .card:nth-child(3) .card-frost {
  animation-delay: 0.1s;
}

#hud .hand.frozen .card:nth-child(4) .card-frost {
  animation-delay: 0.15s;
}

#hud .hand.frozen .card.invalid {
  filter: saturate(0.55);
}

#hud .hand.frozen .card .card-why {
  display: none;
}

#hud .hand.thawed .card .card-frost {
  visibility: visible;
  animation: frostBreak 0.45s ease-in forwards;
}

@keyframes frostIn {
  from {
    opacity: 0;
    transform: scale(1.35);
  }

  60% {
    transform: scale(0.95);
  }
}

@keyframes frostBreak {
  from {
    opacity: 0.8;
  }

  25% {
    opacity: 0.8;
    transform: scale(1.05) rotate(-2deg);
  }

  to {
    opacity: 0;
    transform: translateY(24px) scale(0.86) rotate(5deg);
  }
}

.ice-shard {
  position: absolute;
  left: 0;
  top: 0;
  width: 9px;
  height: 12px;
  margin: -6px 0 0 -4.5px;
  clip-path: polygon(50% 0, 100% 70%, 35% 100%, 0 40%);
  background: linear-gradient(160deg, #ffffff, #dee1e8);
  pointer-events: none;
}

.fuel {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

/* tanica con la benzina che hai: il numero sta sulla pancia della tanica */
.fuel-can {
  position: relative;
  z-index: 0;
  flex: none;
  width: 40px;
  height: 46px;
  padding-top: 12px;
  font-family: var(--font-title);
  font-size: 21px;
  display: grid;
  place-items: center;
  color: #fff;
  text-shadow: var(--outline);
}

/* serbatoio: benzina color ambra con un riflesso che scorre, tacche ogni unità */
.fuel-bar {
  position: relative;
  flex: 1;
  height: 22px;
  border-radius: 11px;
  background: linear-gradient(180deg, #1a1208, #2c1e0c);
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6), 0 0 0 2px rgba(255, 190, 90, 0.28), 0 4px 10px rgba(0, 0, 0, 0.35);
}

.fuel-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 40%;
  overflow: hidden;
  background: linear-gradient(180deg, #fff3b0 0%, #ffc933 32%, #ff9a0a 68%, #e45d00 100%);
}

.fuel-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.45) 45%, transparent 60%) 0 0 / 200% 100%;
  animation: fuelShine 2.4s linear infinite;
}

@keyframes fuelShine {
  from {
    background-position: 150% 0;
  }

  to {
    background-position: -50% 0;
  }
}

.fuel-bar.x2 .fuel-fill {
  background: linear-gradient(180deg, #ffe0ea, #ff8a5c 35%, #ff4d3d 70%, #c4210f);
}

.fuel-ticks {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent 0,
    transparent calc(10% - 2px),
    rgba(20, 10, 0, 0.55) calc(10% - 2px),
    rgba(20, 10, 0, 0.55) 10%
  );
}

.danger-edge {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  box-shadow: inset 0 0 140px 40px rgba(255, 30, 40, 0.6);
  transition: opacity 0.2s;
}

.danger-edge.on {
  animation: dangerPulse 0.45s infinite alternate;
}

/* benzina rubata: tanica che trema, serbatoio che lampeggia di rosso, gocce risucchiate in un vortice */
.fuel.drained .fuel-can {
  animation: canShake 0.5s;
}

.fuel.drained .fuel-bar {
  animation: barDrained 0.8s;
}

.fuel.gained .fuel-can {
  animation: canGulp 0.5s 0.45s;
}

.fuel.gained .fuel-bar {
  animation: barGained 0.9s 0.45s;
}

.fuel-lost {
  position: absolute;
  top: 0;
  bottom: 0;
  transform-origin: left;
  background: linear-gradient(180deg, #ffffff, #ffd27a 40%, #ff5a3c);
  pointer-events: none;
}

.fuel-drop {
  position: absolute;
  left: 0;
  top: 0;
  width: 9px;
  height: 12px;
  margin: -6px 0 0 -4.5px;
  border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
  background: radial-gradient(circle at 38% 32%, #fffbe0, #ffc933 40%, #e45d00);
  box-shadow: 0 0 6px rgba(255, 170, 40, 0.8);
  pointer-events: none;
}

.fuel-vortex {
  position: absolute;
  width: 64px;
  height: 64px;
  margin: -32px 0 0 -32px;
  filter: drop-shadow(0 0 6px rgba(255, 190, 60, 0.8));
  pointer-events: none;
}

.fuel-vortex svg {
  display: block;
  width: 100%;
  height: 100%;
}

.fuel-float {
  position: absolute;
  font-family: var(--font-title);
  font-size: 26px;
  text-shadow: var(--outline);
  white-space: nowrap;
  pointer-events: none;
}

.fuel-float.bad {
  color: #ff6b6b;
}

.fuel-float.good {
  color: #7dff9a;
}

@keyframes canShake {
  20% {
    transform: translateX(-4px) rotate(-9deg);
  }

  40% {
    transform: translateX(4px) rotate(8deg);
  }

  60% {
    transform: translateX(-3px) rotate(-5deg);
  }

  80% {
    transform: translateX(2px) rotate(3deg);
  }
}

@keyframes barDrained {
  from {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6), 0 0 0 2px rgba(255, 90, 60, 0.95), 0 0 20px rgba(255, 60, 40, 0.85);
  }
}

@keyframes canGulp {
  35% {
    transform: scale(1.25) rotate(-6deg);
  }

  70% {
    transform: scale(0.95);
  }
}

@keyframes barGained {
  from {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6), 0 0 0 2px rgba(120, 255, 160, 0.95), 0 0 20px rgba(90, 255, 140, 0.85);
  }
}

.hud-btn {
  position: absolute;
  bottom: 14px;
  right: 14px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(16, 18, 23, 0.7);
  font-size: 20px;
  cursor: pointer;
  pointer-events: auto;
}

.ping {
  position: absolute;
  bottom: 4px;
  left: 10px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.75);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.card .card-level {
  position: absolute;
  top: 24px;
  right: 6px;
  padding: 1px 5px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.35);
  font-size: 10px;
  font-weight: 900;
}

.card.mini .card-level {
  display: none;
}

/* carta grande (dettaglio e bauli) */

.card.big-card {
  width: 176px;
  height: 230px;
  justify-content: flex-start;
  padding-top: 16px;
  border-width: 7px;
  border-radius: 22px;
  cursor: default;
  justify-self: center;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.22), 0 0 0 3px var(--edge), 0 0 34px color-mix(in srgb, var(--rarity) 55%, transparent);
}

.card.big-card:hover {
  transform: none;
}

.card.big-card .card-icon {
  font-size: 104px;
}

.card.big-card .card-name {
  font-size: 22px;
  margin-top: 10px;
}

.card.big-card .card-variant {
  font-size: 12px;
}

.card.big-card .cost {
  top: -12px;
  left: -12px;
  width: 40px;
  height: 47px;
  font-size: 26px;
}

.card.big-card .card-level {
  top: auto;
  right: auto;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 12px;
  border-radius: 999px;
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 400;
}

.card.big-card.locked {
  filter: grayscale(0.9) brightness(0.75);
}

/* ------------------------------------------------------------------ bauli */

.chest-art {
  position: relative;
  flex: none;
  width: 92px;
  height: 78px;
}

.chest-art .chest-lid {
  position: absolute;
  left: 6px;
  right: 6px;
  top: 4px;
  height: 31px;
  border-radius: 18px 18px 5px 5px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--chest) 55%, #fff), var(--chest) 75%);
  box-shadow: 0 0 0 3px var(--chest-dark), inset 0 -5px 0 rgba(0, 0, 0, 0.18);
  transform-origin: 50% 100%;
  transition: transform 0.45s cubic-bezier(0.2, 1.6, 0.4, 1);
  z-index: 1;
}

.chest-art .chest-body {
  position: absolute;
  left: 6px;
  right: 6px;
  top: 35px;
  bottom: 4px;
  border-radius: 4px 4px 11px 11px;
  background: linear-gradient(180deg, var(--chest), color-mix(in srgb, var(--chest) 55%, var(--chest-dark)));
  box-shadow: 0 0 0 3px var(--chest-dark), inset 0 -6px 0 rgba(0, 0, 0, 0.22);
}

.chest-art .chest-lid::before,
.chest-art .chest-lid::after,
.chest-art .chest-body::before,
.chest-art .chest-body::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 8px;
  background: var(--chest-dark);
  opacity: 0.75;
}

.chest-art .chest-lid::before,
.chest-art .chest-body::before {
  left: 14px;
}

.chest-art .chest-lid::after,
.chest-art .chest-body::after {
  right: 14px;
}

.chest-art .chest-lock {
  position: absolute;
  left: 50%;
  top: 27px;
  width: 18px;
  height: 22px;
  margin-left: -9px;
  border-radius: 5px;
  background: linear-gradient(#ffe27a, #d4a017);
  box-shadow: 0 0 0 2px #6b4500, 0 3px 4px rgba(0, 0, 0, 0.35);
  z-index: 2;
}

.chest-art .chest-lock::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 7px;
  width: 6px;
  height: 8px;
  border-radius: 3px;
  background: #6b4500;
}

.chest-art.chest-magic {
  filter: drop-shadow(0 0 10px rgba(200, 107, 255, 0.7));
}

.chest-art.chest-legendary {
  filter: drop-shadow(0 0 12px rgba(255, 138, 61, 0.8));
}

.chest-art.small {
  transform: scale(0.5);
  margin: -19px -23px;
}

.chest-art.shake {
  animation: chestShake 1.1s ease-in-out infinite;
}

/* apertura del baule */

.chest-open {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--chest, #ffcd3c) 35%, #1e2029), #0e1014 72%);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.chest-open-rays {
  position: absolute;
  inset: -60%;
  background: repeating-conic-gradient(from 0deg, rgba(255, 255, 255, 0.09) 0deg 9deg, transparent 9deg 18deg);
  animation: spin 22s linear infinite;
  opacity: 0;
  transition: opacity 0.5s;
  pointer-events: none;
}

.chest-open.opened .chest-open-rays {
  opacity: 1;
}

.chest-open-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 20px;
}

.chest-big {
  position: relative;
  transform: scale(2.4);
  margin: 72px 90px;
}

.chest-big::before {
  content: '';
  position: absolute;
  inset: -40px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 245, 200, 0.95), rgba(255, 220, 120, 0) 65%);
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.35s ease, transform 0.5s ease;
}

.chest-open.opened .chest-big::before {
  opacity: 1;
  transform: scale(1.3);
}

.chest-open.opened .chest-lid {
  transform: translateY(-22px) rotate(-16deg);
}

.chest-open.opened .chest-lock {
  opacity: 0;
}

.chest-open.opened .chest-art.shake {
  animation: none;
}

.chest-title {
  font-family: var(--font-title);
  font-size: 34px;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.35);
}

.chest-open-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 7vh;
  text-align: center;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.85);
  animation: pulse 0.9s infinite alternate;
  pointer-events: none;
}

.reward {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.pop {
  animation: rewardIn 0.45s cubic-bezier(0.2, 1.5, 0.4, 1);
}

.reward-badge {
  padding: 4px 18px;
  border-radius: 999px;
  font-family: var(--font-title);
  font-size: 26px;
  color: #2a1700;
  background: linear-gradient(90deg, #ffe27a, #ffb21f);
  box-shadow: 0 4px 0 #b36b00;
}

.reward-badge.new {
  color: #fff;
  background: linear-gradient(90deg, #4ade80, #1f9e58);
  box-shadow: 0 4px 0 #11663a;
}

.reward-badge.up {
  color: #fff;
  background: linear-gradient(90deg, #d27bff, #6c1bbf);
  box-shadow: 0 4px 0 #3e0e74;
}

.reward-amount {
  font-family: var(--font-title);
  font-size: 46px;
  line-height: 1;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.4);
}

.reward-progress {
  width: min(320px, 80vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  font-size: 14px;
}

.reward-progress .bar i {
  transition-duration: 1.2s;
}

.reward-levelup {
  font-family: var(--font-title);
  font-size: 24px;
  color: #f3b6ff;
}

.reward-car {
  width: 300px;
  height: 200px;
  filter: drop-shadow(0 0 24px color-mix(in srgb, var(--rarity) 60%, transparent));
}

/* l'auto sale di livello: i pezzi montati compaiono uno alla volta */
.reward-car.level-up {
  width: min(360px, 90vw);
  height: 240px;
}

.reward-parts {
  list-style: none;
  margin: 2px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  max-width: 340px;
  min-height: 28px;
}

.reward-parts li {
  font-weight: 800;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--rarity) 30%, rgba(255, 255, 255, 0.08));
  border: 1px solid color-mix(in srgb, var(--rarity) 70%, transparent);
}

.reward-amount small {
  font-size: 0.6em;
  opacity: 0.8;
  margin-left: 6px;
}

.reward-name {
  font-family: var(--font-title);
  font-size: 32px;
}

.summary {
  width: min(580px, 92vw);
  padding: 22px;
  border-radius: 22px;
  background: rgba(16, 18, 23, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.15);
  text-align: center;
  cursor: default;
}

.summary h2 {
  margin: 0;
  font-family: var(--font-title);
  font-weight: 400;
  font-size: 30px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin: 16px 0 18px;
}

.summary-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 8px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 2px var(--rarity);
}

.summary-item .summary-icon {
  font-size: 38px;
  line-height: 1;
  color: inherit;
}

.summary-item b {
  font-size: 14px;
}

.summary-item span {
  font-size: 12.5px;
  color: var(--muted);
}

.summary-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

/* riepilogo del baule nello stile dei menu */
.summary {
  background: linear-gradient(180deg, #3f465e, #363d51);
  border: 3px solid var(--edge);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.3);
}

.summary h2 {
  text-shadow: var(--outline);
}

.summary-item {
  background: rgba(19, 21, 29, 0.35);
}

.reward-progress .bar {
  height: 16px;
}

/* ------------------------------------------------------------------ animazioni */

@keyframes pulse {
  from {
    filter: brightness(1);
  }
  to {
    filter: brightness(1.35);
  }
}

@keyframes feedIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes wobble {
  from {
    transform: translateX(-50%) rotate(-1.5deg) scale(1);
  }
  to {
    transform: translateX(-50%) rotate(1.5deg) scale(1.05);
  }
}

@keyframes bannerIn {
  0% {
    opacity: 0;
    transform: scale(2.2);
  }
  15% {
    opacity: 1;
    transform: scale(0.95);
  }
  25% {
    transform: scale(1);
  }
  75% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }
}

@keyframes countIn {
  0% {
    opacity: 0;
    transform: scale(2.5);
  }
  25% {
    opacity: 1;
    transform: scale(1);
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: scale(0.8);
  }
}

@keyframes suggest {
  from {
    box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.25), 0 0 0 3px #fff, 0 0 14px 4px #5ce1ff;
  }
  to {
    box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.25), 0 0 0 3px #fff, 0 0 30px 12px #5ce1ff;
    transform: translateY(-6px);
  }
}

@keyframes playOut {
  0% {
    transform: translateY(-30px) scale(1.08);
    filter: brightness(1.6);
  }
  100% {
    transform: none;
    filter: none;
  }
}

@keyframes denied {
  0%,
  100% {
    transform: none;
  }
  20% {
    transform: translateX(-8px);
  }
  40% {
    transform: translateX(8px);
  }
  60% {
    transform: translateX(-5px);
  }
  80% {
    transform: translateX(5px);
  }
}

@keyframes dangerPulse {
  from {
    opacity: 0.35;
  }
  to {
    opacity: 1;
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes readyBounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

@keyframes chestShake {
  0%,
  60%,
  100% {
    transform: rotate(0);
  }
  70% {
    transform: rotate(-5deg) scale(1.03);
  }
  80% {
    transform: rotate(5deg) scale(1.03);
  }
  90% {
    transform: rotate(-3deg);
  }
}

@keyframes chestWobble {
  0%,
  100% {
    transform: rotate(0);
  }
  50% {
    transform: rotate(-2deg) translateY(-2px);
  }
}

@keyframes rewardIn {
  from {
    opacity: 0;
    transform: scale(0.6) translateY(30px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes playGlow {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.12);
  }
}

@keyframes wiggle {
  from {
    transform: rotate(-2.5deg);
  }
  to {
    transform: rotate(2.5deg);
  }
}

@keyframes vsIn {
  from {
    opacity: 0;
    transform: translateX(-40px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes vsTitle {
  from {
    opacity: 0;
    transform: scale(1.8);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ------------------------------------------------------------------ gara su schermi piccoli */

@media (max-height: 620px), (max-width: 820px) {
  .card {
    width: 80px;
    height: 104px;
    border-radius: 12px;
  }

  .card .card-icon {
    font-size: 32px;
  }

  .card .card-name {
    font-size: 11px;
    margin-top: 3px;
  }

  .card .card-tags {
    display: none;
  }

  .card .card-level {
    top: auto;
    right: auto;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    white-space: nowrap;
  }

  .card .cost {
    width: 26px;
    height: 26px;
    font-size: 15px;
    top: -7px;
    left: -7px;
  }

  .card.mini {
    width: 50px;
    height: 66px;
  }

  .card.mini .card-icon {
    font-size: 24px;
  }

  .card.mini .card-name {
    display: none;
  }

  .hand {
    gap: 7px;
  }

  .hand-row {
    gap: 8px;
  }

  .fuel-can {
    width: 34px;
    height: 39px;
    padding-top: 10px;
    font-size: 18px;
  }

  .fuel-bar {
    height: 18px;
  }

  .standings {
    min-width: 0;
    transform: scale(0.82);
    transform-origin: top left;
  }

  #minimap {
    width: 150px;
    height: 110px;
  }

  .feed {
    top: 140px;
    width: 220px;
  }

  .feed-item {
    font-size: 11.5px;
  }

  .lap {
    font-size: 21px;
  }

  .warning {
    top: 80px;
    font-size: 16px;
  }

  .banner .b {
    font-size: 48px;
  }

  .banner .b.count {
    font-size: 96px;
  }

    .bottom-bar {
    bottom: 6px;
    gap: 5px;
  }
}

/* Telefono in verticale: l'essenziale, piccolo e ai bordi, così resta spazio per la pista. In alto classifica
   compatta, giro e minimappa; in basso le carte (solo icona e costo) e la benzina. Niente cronaca delle azioni. */
@media (max-width: 560px) {
  .feed,
  .ping,
  .timer {
    display: none !important;
  }

  .hud-panel {
    background: rgba(16, 18, 23, 0.5);
    border-radius: 10px;
    backdrop-filter: none;
  }

  .standings {
    top: 8px;
    left: 8px;
    padding: 3px;
    min-width: 0;
    transform: none;
  }

  .st-row {
    gap: 4px;
    padding: 1px 5px;
    font-size: 11px;
    border-radius: 6px;
  }

  .st-pos {
    width: 12px;
    font-size: 13px;
  }

  .st-dot {
    width: 8px;
    height: 8px;
    box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.6);
  }

  .st-name {
    max-width: 64px;
  }

  .st-fx,
  .st-gap {
    display: none;
  }

  .st-row.me .st-gap {
    display: inline;
    min-width: 0;
    font-size: 10px;
  }

  .lapbox {
    top: 8px;
    bottom: auto;
    padding: 2px 10px 3px;
  }

  .lap {
    font-size: 14px;
  }

  .x2-badge {
    margin-top: 2px;
    font-size: 10px;
    padding: 1px 6px;
  }

  .minimap-wrap {
    top: 8px;
    right: 8px;
    padding: 3px;
  }

  #minimap {
    width: 104px;
    height: 78px;
  }

  .hud-btn {
    bottom: auto;
    top: 98px;
    right: 8px;
    width: 30px;
    height: 30px;
    font-size: 14px;
  }

  .warning {
    top: 40px;
    font-size: 12px;
    padding: 4px 10px;
  }

  .status-chips {
    min-height: 20px;
    gap: 4px;
  }

  .chip {
    padding: 1px 7px;
    font-size: 11px;
  }

  .chip .chip-text {
    display: none;
  }

  .banner .b {
    font-size: 40px;
  }

  .banner .b.count {
    font-size: 80px;
  }

  .bottom-bar {
    bottom: 4px;
    gap: 4px;
  }

  #hud .card {
    width: 68px;
    height: 84px;
    border-width: 3px;
    border-radius: 12px;
  }

  #hud .card .card-icon {
    font-size: 36px;
    margin-bottom: 6px;
  }

  #hud .card .card-key {
    display: none;
  }

  #hud .card .cost {
    width: 26px;
    height: 30px;
    font-size: 15px;
    bottom: -11px;
  }

  #hud .card .card-why {
    bottom: 16px;
    font-size: 8px;
  }

  #hud .card.mini {
    width: 44px;
    height: 54px;
  }

  #hud .card.mini .card-icon {
    font-size: 22px;
  }

  .bottom-bar {
    gap: 14px;
    padding: 6px 8px calc(8px + env(safe-area-inset-bottom));
    border-radius: 18px 18px 0 0;
  }

  .hand {
    gap: 6px;
  }

  .hand-row {
    gap: 6px;
  }

  .next-label {
    font-size: 8px;
  }

  .fuel-can {
    width: 32px;
    height: 37px;
    padding-top: 10px;
    font-size: 17px;
  }

  .fuel-bar {
    height: 16px;
  }
}

/* ------------------------------------------------------------------ menu su schermi piccoli */

@media (max-width: 420px) {
  .logo-deck {
    font-size: 52px;
  }

  .logo-racers {
    font-size: 62px;
  }

  .card-grid {
    gap: 8px 6px;
  }

  .ctile-name {
    font-size: 10px;
  }

  .cslot {
    height: 118px;
  }

  .cslot-top {
    font-size: 12px;
  }

  .detail {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
  }

  .detail-info {
    width: 100%;
  }

  .league-card {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .league-card > canvas {
    width: 96px;
    height: 66px;
  }
}

@media (max-height: 720px) {
  .arena-stage {
    width: min(100%, 340px);
  }

  .btn-play {
    padding: 10px 20px 14px;
    font-size: 30px;
  }
}

/* carta di scorciatoia o Map trigger quando è il momento: alone che pulsa e secondi che restano, senza coprire niente */
.card.opportunity {
  animation: card-chance 0.8s ease-in-out infinite;
  z-index: 2;
}

.card.opportunity:not(.opportunity-ready) {
  animation: none;
  box-shadow: 0 0 0 2px rgba(255, 210, 63, 0.55);
}

.card-now {
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  padding: 1px 8px;
  border-radius: 999px;
  background: #ffd23f;
  color: #2a1b00;
  font: 400 13px/1.25 var(--font-title);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
  pointer-events: none;
  white-space: nowrap;
}

@keyframes card-chance {
  0%,
  100% {
    box-shadow: 0 0 0 3px #ffd23f, 0 0 10px 2px rgba(255, 210, 63, 0.55);
    transform: translateY(-3px);
  }
  50% {
    box-shadow: 0 0 0 3px #ffe98a, 0 0 24px 8px rgba(255, 210, 63, 0.85);
    transform: translateY(-7px);
  }
}

.flyover-tagged span {
  display: inline-block;
  padding: 1px 10px;
  border-radius: 4px;
  background: #ffd23f;
  color: #2a1b00;
}

/* gemma della rarità: forma e colore cambiano, così si distingue anche senza leggere e con i colori che si vedono male */
.rarity-gem {
  position: absolute;
  top: -7px;
  right: -7px;
  z-index: 2;
  width: 17px;
  height: 17px;
  background: #b8c4d6;
  border: 2px solid var(--edge);
  border-radius: 50%;
}

.r-rare .rarity-gem {
  background: #4aa8ff;
  border-radius: 3px;
  transform: rotate(45deg) scale(0.86);
}

.r-epic .rarity-gem {
  background: #c86bff;
  border: 0;
  clip-path: polygon(50% 0, 100% 38%, 82% 100%, 18% 100%, 0 38%);
}

.r-legendary .rarity-gem {
  width: 21px;
  height: 21px;
  background: linear-gradient(135deg, #fff2a8, #ffd43b 55%, #ff9f1c);
  border: 0;
  clip-path: polygon(50% 0, 62% 35%, 100% 38%, 70% 60%, 80% 100%, 50% 76%, 20% 100%, 30% 60%, 0 38%, 38% 35%);
}

.ctile-art.r-epic {
  box-shadow: 0 0 0 2px var(--edge), inset 0 -6px 0 rgba(0, 0, 0, 0.18), 0 4px 0 var(--edge-soft), 0 0 12px rgba(200, 107, 255, 0.55);
}

.ctile-art.r-legendary {
  box-shadow: 0 0 0 2px var(--edge), inset 0 -6px 0 rgba(0, 0, 0, 0.18), 0 4px 0 var(--edge-soft), 0 0 16px rgba(255, 212, 59, 0.7);
}

.ctile-art.r-common .ctile-icon {
  filter: saturate(0.92) drop-shadow(0 3px 0 rgba(0, 0, 0, 0.25));
}

/* i mazzi salvati */
.deck-slots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 14px;
}

.deck-slot {
  padding: 8px 4px;
  border: 2px solid var(--edge);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: inherit;
  font-family: var(--font-title);
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.deck-slot.active {
  background: linear-gradient(180deg, #ffe07a, #ffbe2e);
  color: #3b2a00;
  box-shadow: 0 2px 0 var(--edge-soft);
}

.deck-slot.empty:not(.active) {
  opacity: 0.72;
  border-style: dashed;
}

.deck-inuse {
  font-style: normal;
}

/* statistiche del mazzo: esagono, equilibrio e consiglio */
.deck-overview {
  display: grid;
  grid-template-columns: minmax(0, 250px) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-top: 12px;
  padding: 6px 12px;
  border-radius: 12px;
  background: rgba(10, 14, 36, 0.28);
}

.hex-chart {
  display: block;
  width: 100%;
  overflow: visible;
}

.hex-ring,
.hex-spoke {
  fill: none;
  stroke: rgba(255, 255, 255, 0.16);
  stroke-width: 1;
}

.hex-shape {
  fill: rgba(255, 201, 60, 0.32);
  stroke: #ffc93c;
  stroke-width: 2;
  stroke-linejoin: round;
}

.hex-dot {
  fill: #ffc93c;
  stroke: #1c2030;
  stroke-width: 2;
}

.hex-label {
  fill: rgba(255, 255, 255, 0.72);
  font: 800 11px Nunito, system-ui, sans-serif;
}

.hex-value {
  fill: #fff;
  font: 900 13px Nunito, system-ui, sans-serif;
}

.hex-side {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.hex-balance {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.hex-balance b {
  font-family: var(--font-title);
  font-size: 34px;
  font-weight: 400;
}

.hex-balance span {
  margin-top: 3px;
  font-size: 12px;
  font-weight: 800;
  opacity: 0.72;
}

.overview-advice {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
}

@media (max-width: 420px) {
  .deck-overview {
    grid-template-columns: minmax(0, 1fr) 96px;
    padding: 4px 8px;
  }
}

/* scelta rapida nella home */
.play-decks {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

.play-deck {
  display: flex;
  gap: 5px;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 6px 2px;
  border: 2px solid var(--edge);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: inherit;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.play-deck b {
  font-family: var(--font-title);
  font-size: 12px;
  font-weight: 400;
}

.play-deck small {
  display: inline-flex;
  gap: 1px;
  align-items: center;
  font-size: 10px;
  font-weight: 800;
  opacity: 0.85;
}

.play-deck .drop-icon {
  width: 10px;
  height: 12px;
}

.play-deck.active {
  background: linear-gradient(180deg, #ffe07a, #ffbe2e);
  color: #3b2a00;
}

.play-deck.empty {
  border-style: dashed;
  opacity: 0.75;
}

/* video dimostrativo nel dettaglio carta */
.detail-demo {
  overflow: hidden;
  margin: 6px 0 8px;
  aspect-ratio: 16 / 9;
  border: 2px solid var(--edge);
  border-radius: 12px;
  background: #1c2541;
}

.detail-demo video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 420px) {
  /* sul telefono la carta si stringe per lasciare spazio al video */
  .card.big-card {
    width: 118px;
    height: 154px;
    padding-top: 8px;
    border-width: 5px;
    border-radius: 16px;
  }

  .card.big-card .card-icon {
    font-size: 54px;
    margin-bottom: 0;
  }

  /* il nome è scritto subito sotto, più grande */
  .card.big-card .card-name {
    display: none;
  }
}
