:root {
  color-scheme: dark;
  --bg: #090b16;
  --bg-2: #0f1226;
  --panel: rgba(255, 255, 255, 0.04);
  --panel-2: rgba(255, 255, 255, 0.07);
  --line: rgba(255, 255, 255, 0.09);
  --text: #eef0ff;
  --muted: #9aa0c3;
  --accent: #ff3d6e;
  --accent-2: #21d4fd;
  --gold: #ffd23f;
  --silver: #cfd8ea;
  --bronze: #e39a62;
  --ok: #4ade80;
  --warn: #fbbf24;
  --err: #f87171;
  --land: #2a3160;
  --land-muted: #171b36;
  --ocean-hi: #172457;
  --ocean-lo: #060918;
  --radius: 16px;
  --font-display: 'Barlow Condensed', 'Arial Narrow', system-ui, sans-serif;
  --font-arcade: 'Bungee', 'Impact', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font-body);
  overflow-x: hidden;
}
a { color: inherit; }
img { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
code { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 0.86em; background: var(--panel-2); padding: 1px 5px; border-radius: 5px; }
[hidden] { display: none !important; }

/* ——— Sfondo ——— */
.bg-grid {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(255, 61, 110, 0.22), transparent 60%),
    radial-gradient(800px 500px at 100% 0%, rgba(33, 212, 253, 0.16), transparent 60%),
    radial-gradient(1000px 600px at 50% 120%, rgba(177, 108, 255, 0.18), transparent 60%),
    var(--bg);
}
.bg-grid::after {
  content: ''; position: absolute; left: -50%; right: -50%; bottom: -10%; height: 55%;
  background-image: linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 56px 56px;
  transform: perspective(500px) rotateX(62deg);
  transform-origin: bottom;
  mask-image: linear-gradient(to top, black, transparent 85%);
}

/* ——— Barra in alto ——— */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 20px;
  padding: 12px clamp(16px, 3vw, 36px);
  background: rgba(9, 11, 22, 0.72);
  backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; font-family: var(--font-arcade); font-size: 20px; letter-spacing: 0.02em; white-space: nowrap; }
.logo em { font-style: normal; color: var(--accent); text-shadow: 0 0 18px rgba(255, 61, 110, 0.6); }
.logo-flag { width: 28px; height: 28px; color: #fff; animation: wave 3s ease-in-out infinite; transform-origin: 20% 90%; }
@keyframes wave { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
.tabs { display: flex; gap: 4px; margin-left: auto; padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; }
.tabs a { display: flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px; transition: 0.2s; }
.tabs a:hover { color: var(--text); background: var(--panel-2); }
.tabs a.active { color: #fff; background: linear-gradient(135deg, var(--accent), #b026ff); box-shadow: 0 6px 20px -6px rgba(255, 61, 110, 0.7); }
.tabs .ico { font-size: 15px; }
.live { display: flex; align-items: center; gap: 6px; font: 700 11px var(--font-body); letter-spacing: 0.12em; color: var(--muted); }
.live i { width: 8px; height: 8px; border-radius: 50%; background: #555; }
.live.on i { background: var(--ok); box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7); animation: ping 2s infinite; }
.live.on { color: var(--ok); }
@keyframes ping { 70% { box-shadow: 0 0 0 8px rgba(74, 222, 128, 0); } 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); } }

/* ——— Layout generale ——— */
.view { max-width: 1320px; margin: 0 auto; padding: 28px clamp(16px, 3vw, 36px) 80px; outline: none; }
.view.enter > * { animation: rise 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.eyebrow { margin: 0 0 4px; font: 700 12px var(--font-body); letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent-2); }
.screen-title { font: 800 clamp(30px, 5vw, 48px)/1 var(--font-display); text-transform: uppercase; letter-spacing: 0.01em; margin: 0 0 24px; }
.hint { color: var(--muted); font-size: 13px; }
.loading, .empty { display: grid; place-items: center; text-align: center; padding: 80px 16px; color: var(--muted); }
.empty h2 { font: 800 30px var(--font-display); color: var(--text); margin: 8px 0; text-transform: uppercase; }
.empty p { max-width: 440px; margin: 0 0 20px; }
.empty-flag { font-size: 64px; animation: wave 3s ease-in-out infinite; }
.spinner { width: 44px; height: 44px; border: 4px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font-weight: 600; text-decoration: none; transition: 0.18s; white-space: nowrap; }
.btn:hover { background: rgba(255, 255, 255, 0.12); transform: translateY(-1px); }
.btn.primary { border: 0; background: linear-gradient(135deg, var(--accent), #b026ff); color: #fff; box-shadow: 0 10px 24px -10px rgba(255, 61, 110, 0.8); }
.btn.primary:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 10px; font-size: 13px; border-radius: 9px; }
.btn.danger:hover { background: rgba(248, 113, 113, 0.2); border-color: var(--err); color: var(--err); }

/* ——— Avatar ——— */
.avatar {
  --s: 40px;
  position: relative; display: inline-grid; place-items: center; flex: none;
  width: var(--s); height: var(--s); border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--pc) 85%, white), var(--pc) 55%, color-mix(in srgb, var(--pc) 45%, black));
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85), 0 0 0 4px var(--pc), 0 8px 24px -6px var(--pc);
  font-size: calc(var(--s) * 0.55); line-height: 1;
}
.avatar span { filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.35)); }
.avatar.xs { --s: 20px; box-shadow: 0 0 0 1.5px var(--pc); }
.avatar.sm { --s: 30px; box-shadow: 0 0 0 2px var(--pc); }
.avatar.lg { --s: 56px; }
.avatar.xl { --s: 84px; }
.avatar.xxl { --s: 110px; }
.avatar.xxxl { --s: clamp(96px, 16vw, 160px); box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.9), 0 0 0 9px var(--pc), 0 0 60px 0 var(--pc); }

/* ——— Chips classifiche ——— */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: thin; }
.chip { display: flex; align-items: center; gap: 8px; flex: none; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); font-weight: 600; transition: 0.2s; }
.chip:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.25); }
.chip.active { color: #111; background: var(--gold); border-color: var(--gold); box-shadow: 0 8px 24px -8px rgba(255, 210, 63, 0.8); }
.chip-emoji { font-size: 17px; }

/* ——— Arena ——— */
.hero { margin-bottom: 26px; }
.hero h1 { margin: 0; font: 800 clamp(34px, 6vw, 64px)/0.95 var(--font-display); text-transform: uppercase; letter-spacing: 0.005em; }
.hero-emoji { display: inline-block; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-5px) rotate(-4deg); } }
.hero-desc { max-width: 760px; color: var(--muted); margin: 12px 0 6px; }
.hero-meta { margin: 0 0 16px; font-size: 14px; color: var(--muted); }
.hero-meta b { color: var(--text); }

.arena-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; }

.first-banner {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 18px;
  padding: 18px 22px; margin-bottom: 26px; border-radius: var(--radius);
  background: linear-gradient(110deg, color-mix(in srgb, var(--pc) 32%, transparent), rgba(255, 255, 255, 0.03) 60%);
  border: 1px solid color-mix(in srgb, var(--pc) 55%, transparent);
}
.fb-glow { position: absolute; inset: -40%; background: conic-gradient(from 0deg, transparent, color-mix(in srgb, var(--pc) 40%, transparent), transparent 30%); animation: spin 8s linear infinite; opacity: 0.35; pointer-events: none; }
.fb-avatars { display: flex; position: relative; }
.fb-avatars .avatar + .avatar { margin-left: -14px; }
.fb-text { position: relative; display: flex; flex-direction: column; }
.fb-title { font: 700 12px var(--font-body); letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold); }
.fb-name { font: 800 clamp(26px, 4vw, 38px)/1.05 var(--font-display); text-transform: uppercase; }
.fb-sub { color: var(--muted); font-size: 14px; }
.fb-train { position: relative; margin-left: auto; font-size: 44px; animation: chug 0.9s ease-in-out infinite; }
@keyframes chug { 50% { transform: translateY(-3px) rotate(-2deg); } }

.podium { display: grid; grid-template-columns: repeat(3, 1fr); align-items: end; gap: 14px; margin: 0 auto 30px; max-width: 760px; }
.podium-1 { grid-template-columns: minmax(0, 260px); justify-content: center; }
.podium-2 { grid-template-columns: repeat(2, minmax(0, 260px)); justify-content: center; }
.podium-step { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 0; background: none; border: 0; text-align: center; }
.podium-who { display: flex; flex-direction: column; align-items: center; gap: 10px; position: relative; }
.podium-name { font: 700 20px var(--font-display); text-transform: uppercase; letter-spacing: 0.03em; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-1 .podium-who::before { content: '👑'; position: absolute; top: -34px; font-size: 32px; animation: bob 2s ease-in-out infinite; filter: drop-shadow(0 4px 10px rgba(255, 210, 63, 0.6)); }
.podium-block {
  --metal: var(--bronze);
  position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding: 14px 8px; border-radius: 14px 14px 6px 6px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--pc) 55%, #10132a), #10132a 85%);
  border-top: 4px solid var(--metal);
  box-shadow: 0 -10px 40px -18px var(--pc), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transform-origin: bottom; animation: grow 0.8s cubic-bezier(0.2, 0.9, 0.2, 1.1) both;
  transition: transform 0.2s;
}
.podium-step:hover .podium-block { transform: translateY(-4px); }
.rank-1 .podium-block { --metal: var(--gold); height: 245px; animation-delay: 0.25s; }
.rank-2 .podium-block { --metal: var(--silver); height: 200px; animation-delay: 0.1s; }
.rank-3 .podium-block { height: 170px; }
@keyframes grow { from { transform: scaleY(0.1); opacity: 0; } }
.podium-rank { position: absolute; bottom: 6px; font: 400 54px/1 var(--font-arcade); color: rgba(255, 255, 255, 0.08); }
.podium-count { font: 400 clamp(40px, 6vw, 60px)/1 var(--font-arcade); color: #fff; text-shadow: 0 0 24px var(--pc), 0 3px 0 rgba(0, 0, 0, 0.4); }
.podium-total { font-size: 12px; color: rgba(255, 255, 255, 0.7); margin-top: 6px; }

.ranking { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rank-row {
  display: grid; grid-template-columns: 34px auto minmax(0, 1fr) auto; align-items: center; gap: 14px;
  padding: 12px 16px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line);
  cursor: pointer; transition: 0.2s; animation: rise 0.5s both; animation-delay: calc(var(--i, 0) * 40ms);
}
.rank-row:hover, .rank-row:focus-visible { background: var(--panel-2); border-color: color-mix(in srgb, var(--pc) 60%, transparent); transform: translateX(4px); outline: none; }
.rr-rank { font: 400 22px var(--font-arcade); color: var(--muted); text-align: center; }
.rr-body { min-width: 0; }
.rr-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 7px; }
.rr-name { font: 700 19px var(--font-display); text-transform: uppercase; letter-spacing: 0.03em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rr-flags { display: flex; gap: 4px; flex: none; }
.rr-score { display: flex; flex-direction: column; align-items: flex-end; min-width: 54px; }
.rr-score b { font: 400 26px/1 var(--font-arcade); }
.rr-score small { color: var(--muted); font-size: 12px; }
.mini-flag { width: 20px; height: 15px; border-radius: 3px; object-fit: cover; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15); flex: none; }

.bar { height: 10px; border-radius: 99px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.bar.thin { height: 6px; }
.bar-fill {
  height: 100%; width: var(--w); border-radius: inherit;
  background: linear-gradient(90deg, color-mix(in srgb, var(--pc, var(--accent)) 60%, transparent), var(--pc, var(--accent)));
  box-shadow: 0 0 14px var(--pc, var(--accent));
  animation: fill 1.1s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes fill { from { width: 0; } }

.arena-side { display: grid; gap: 18px; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { padding: 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.stat:first-child { grid-column: 1 / -1; }
.stat:nth-child(2):last-child { grid-column: 1 / -1; }
.stat-label { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.stat-value { font: 700 15px var(--font-body); }
.stat-value b { font: 400 30px/1 var(--font-arcade); }
.stat-value small { color: var(--muted); font-weight: 500; }
.stat-value.with-flag { display: flex; align-items: center; gap: 8px; }
.stat-value.with-flag .flag { width: 30px; height: 22px; border-radius: 4px; object-fit: cover; flex: none; }
.stat:has(.with-flag) { grid-column: 1 / -1; }

.feed { padding: 16px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.feed h3 { margin: 0 0 10px; font: 700 13px var(--font-body); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.feed ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.feed li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.35; }
.feed-flag { width: 28px; height: 21px; border-radius: 4px; object-fit: cover; flex: none; margin-top: 1px; box-shadow: 0 0 0 2px var(--pc); }
.feed-emoji { width: 28px; text-align: center; font-size: 18px; flex: none; }
.feed-who { color: var(--pc); font-weight: 700; }
.feed time { display: block; color: var(--muted); font-size: 12px; }

/* ——— Mappa ——— */
.map-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 14px; }
.seg { display: flex; padding: 4px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.seg button { padding: 7px 12px; border: 0; border-radius: 9px; background: none; color: var(--muted); font-weight: 600; }
.seg button.active { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.map-players, .pchips { display: flex; flex-wrap: wrap; gap: 6px; }
.pchip { --pc: var(--accent); display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px 6px 7px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); font-weight: 600; font-size: 14px; text-decoration: none; transition: 0.2s; }
.pchip:hover { color: var(--text); }
.pchip.active { color: #fff; background: color-mix(in srgb, var(--pc) 30%, transparent); border-color: var(--pc); box-shadow: 0 0 20px -6px var(--pc); }
.select-wrap { display: flex; align-items: center; gap: 8px; margin-left: auto; font-size: 13px; color: var(--muted); }
select, input[type=search], input:not([type]), input[type=password], input[type=text], textarea {
  background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; color: var(--text); min-width: 0;
}
select:focus, input:focus, textarea:focus { outline: 2px solid var(--accent-2); outline-offset: 1px; }
.map-stage { position: relative; height: min(76vh, 780px); min-height: 420px; border-radius: 22px; overflow: hidden; background: radial-gradient(circle at 50% 45%, rgba(33, 212, 253, 0.08), transparent 60%), rgba(0, 0, 0, 0.25); border: 1px solid var(--line); touch-action: none; }
.map-stage svg { width: 100%; height: 100%; display: block; cursor: grab; }
.map-stage svg:active { cursor: grabbing; }
.atmo { fill: rgba(33, 212, 253, 0.35); }
.sphere { stroke: rgba(33, 212, 253, 0.35); stroke-width: 1; vector-effect: non-scaling-stroke; }
.graticule { fill: none; stroke: rgba(255, 255, 255, 0.06); stroke-width: 0.6; vector-effect: non-scaling-stroke; }
.land { stroke: var(--bg); stroke-width: 0.6; vector-effect: non-scaling-stroke; transition: filter 0.15s; }
.land:hover { filter: brightness(1.35); }
.marker circle { stroke: rgba(255, 255, 255, 0.55); stroke-width: 1; vector-effect: non-scaling-stroke; }
.marker.visited circle { stroke: #fff; stroke-width: 1.5; }
.marker:hover circle { stroke: var(--gold); }
.pin { cursor: pointer; }
.pin-inner { animation: plant 0.6s cubic-bezier(0.3, 1.6, 0.5, 1) both; transform-box: fill-box; }
@keyframes plant { from { transform: translateY(-46px); opacity: 0; } 60% { opacity: 1; } }
.pin-shadow { fill: rgba(0, 0, 0, 0.45); }
.pin-pole { stroke: #f2f2f2; stroke-width: 1.4; stroke-linecap: round; }
.pin-frame { fill: #fff; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5)); }
.pin-knob { fill: var(--gold); }
.pin:hover .pin-frame { fill: var(--gold); }
.map-legend { position: absolute; left: 16px; bottom: 16px; padding: 12px 14px; border-radius: 14px; background: rgba(9, 11, 22, 0.75); backdrop-filter: blur(10px); border: 1px solid var(--line); font-size: 13px; }
.lg-title { display: block; color: var(--muted); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 700; margin-bottom: 6px; }
.lg-scale { display: flex; gap: 3px; }
.lg-scale span { min-width: 26px; padding: 3px 6px; border-radius: 6px; text-align: center; font-weight: 700; color: #111; font-size: 12px; }
.lg-player { display: flex; align-items: center; gap: 10px; }
.lg-player b { display: block; font: 700 17px var(--font-display); text-transform: uppercase; }
.lg-player span { color: var(--muted); }
.map-hint { position: absolute; right: 16px; bottom: 16px; color: var(--muted); font-size: 12px; pointer-events: none; }

.tooltip { position: fixed; left: 0; top: 0; z-index: 100; pointer-events: none; min-width: 200px; max-width: 280px; padding: 12px; border-radius: 14px; background: rgba(15, 18, 38, 0.95); border: 1px solid rgba(255, 255, 255, 0.14); box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.7); backdrop-filter: blur(10px); font-size: 13px; }
.tt-head { display: flex; gap: 10px; align-items: center; }
.tt-head b { display: block; font: 700 18px/1.1 var(--font-display); text-transform: uppercase; }
.tt-head small { color: var(--muted); }
.tt-flag { width: 40px; height: 30px; border-radius: 5px; object-fit: cover; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2); }
.tt-note { margin-top: 8px; color: var(--warn); font-size: 12px; }
.tt-who { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 5px; }
.tt-who span { padding: 2px 8px; border-radius: 99px; background: color-mix(in srgb, var(--pc) 28%, transparent); border: 1px solid var(--pc); font-weight: 600; }
.tt-who em { color: var(--muted); }

/* ——— Selezione giocatori ——— */
.char-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
.char-card {
  position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 26px 16px 18px; border-radius: 20px; text-align: center;
  background:
    repeating-linear-gradient(135deg, color-mix(in srgb, var(--pc) 12%, transparent) 0 14px, transparent 14px 28px),
    linear-gradient(180deg, color-mix(in srgb, var(--pc) 30%, #10132a), #0d1022 70%);
  border: 2px solid color-mix(in srgb, var(--pc) 50%, transparent);
  transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
  animation: rise 0.5s both; animation-delay: calc(var(--i) * 70ms);
}
.char-card:hover { transform: translateY(-6px) scale(1.02); border-color: var(--pc); box-shadow: 0 20px 50px -14px var(--pc); }
.char-card:hover .char-portrait { transform: scale(1.08) rotate(-4deg); }
.char-portrait { transition: transform 0.3s cubic-bezier(0.3, 1.6, 0.5, 1); margin-bottom: 4px; }
.char-rank { position: absolute; top: 10px; left: 14px; font: 400 20px var(--font-arcade); color: rgba(255, 255, 255, 0.5); }
.char-name { font: 800 26px/1 var(--font-display); text-transform: uppercase; letter-spacing: 0.03em; }
.char-total { color: var(--muted); font-size: 13px; }
.char-total b { color: var(--text); font-size: 15px; }
.char-boards { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; margin-top: 4px; }
.cb { position: relative; display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 8px; background: rgba(0, 0, 0, 0.3); font: 700 13px var(--font-body); }
.cb i { font-style: normal; }
.cb.top { background: rgba(255, 210, 63, 0.2); box-shadow: inset 0 0 0 1px var(--gold); }
.cb em { position: absolute; top: -9px; right: -6px; font-size: 12px; font-style: normal; }

/* ——— Profilo ——— */
.back { display: inline-block; margin-bottom: 18px; color: var(--muted); text-decoration: none; font-weight: 600; }
.back:hover { color: var(--text); }
.profile-head { display: flex; align-items: center; gap: clamp(20px, 4vw, 44px); padding: 28px; border-radius: 24px; margin-bottom: 22px;
  background: radial-gradient(600px 300px at 0% 50%, color-mix(in srgb, var(--pc) 35%, transparent), transparent 70%), var(--panel);
  border: 1px solid var(--line); }
.ph-portrait { animation: float 4s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-8px); } }
.ph-text h1 { margin: 0; font: 800 clamp(40px, 8vw, 84px)/0.9 var(--font-display); text-transform: uppercase; color: #fff; text-shadow: 0 0 40px var(--pc); }
.ph-stats { display: flex; flex-wrap: wrap; gap: 18px; margin: 14px 0 6px; color: var(--muted); }
.ph-stats b { font: 400 28px var(--font-arcade); color: var(--text); margin-right: 4px; }
.ph-last { margin: 0 0 14px; color: var(--muted); font-size: 13px; }
.ph-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.board-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 22px; }
.board-card { padding: 14px 16px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.board-card { text-align: left; cursor: pointer; transition: 0.2s; }
.board-card:hover { background: var(--panel-2); }
.board-card.selected { border-color: var(--pc); box-shadow: 0 0 0 1px var(--pc), 0 0 30px -12px var(--pc); }
.wall-hint { margin: 0 0 10px; }
.all-card .bc-score small { margin-left: 2px; }
.wall-head h2 { font: 800 30px var(--font-display); text-transform: uppercase; margin: 10px 0 2px; }
.wall-head .hint { margin: 0; max-width: 760px; }
.flag-tile small { color: var(--muted); font-size: 11px; font-weight: 500; }
.flag-tile.off { opacity: 0.55; }
.flag-tile.off .tile-flag { filter: grayscale(0.8); }
.off-wall h2 small { color: var(--warn); background: rgba(251, 191, 36, 0.15); }
.board-card.is-top { border-color: var(--gold); box-shadow: 0 0 30px -12px var(--gold); }
.bc-head { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.bc-head b { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bc-score { display: flex; align-items: baseline; gap: 6px; margin: 8px 0; }
.bc-score b { font: 400 32px/1 var(--font-arcade); }
.bc-score small { color: var(--muted); }
.bc-rank { margin-left: auto; font-weight: 700; font-size: 13px; }
.continent-bars { padding: 18px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); margin-bottom: 26px; display: grid; gap: 10px; }
.cbar { display: grid; grid-template-columns: 150px 1fr 60px; gap: 12px; align-items: center; font-weight: 600; font-size: 14px; }
.cbar-n { text-align: right; font-weight: 700; }
.cbar-n small { color: var(--muted); font-weight: 500; }
.continent-bars .hint { margin: 0; }
.flag-wall h2 { font: 800 26px var(--font-display); text-transform: uppercase; margin: 26px 0 12px; display: flex; align-items: center; gap: 8px; }
.flag-wall h2 small { font: 400 15px var(--font-arcade); color: var(--pc); padding: 2px 10px; border-radius: 99px; background: color-mix(in srgb, var(--pc) 20%, transparent); }
.flag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; }
.flag-tile { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); font-size: 13px; font-weight: 600; line-height: 1.2;
  animation: pop 0.45s cubic-bezier(0.3, 1.6, 0.5, 1) both; animation-delay: calc(var(--i) * 25ms); transition: transform 0.2s; }
.flag-tile:hover { transform: translateY(-3px) rotate(-1.5deg); }
.tile-flag { width: 100%; height: auto; aspect-ratio: 4 / 3; border-radius: 7px; object-fit: cover; box-shadow: 0 6px 14px -6px rgba(0, 0, 0, 0.7); }
.flag-tile.exclusive { border-color: var(--gold); background: linear-gradient(160deg, rgba(255, 210, 63, 0.18), var(--panel) 60%); }
.flag-tile .star { position: absolute; top: -8px; right: -6px; font-style: normal; font-size: 18px; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6)); }
@keyframes pop { from { opacity: 0; transform: scale(0.6); } }

/* ——— Duello ——— */
.fighter-pickers { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.picker { display: flex; flex-wrap: wrap; gap: 6px; }
.picker-b { justify-content: flex-end; }
.picker button { padding: 3px; border-radius: 50%; border: 2px solid transparent; background: none; opacity: 0.55; transition: 0.2s; }
.picker button:hover { opacity: 1; }
.picker button.active { opacity: 1; border-color: var(--pc); box-shadow: 0 0 16px var(--pc); }
.vs-stage { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; padding: 30px 0 10px; }
.fighter { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.fighter.left { animation: slideL 0.6s cubic-bezier(0.2, 0.9, 0.2, 1) both; }
.fighter.right { animation: slideR 0.6s cubic-bezier(0.2, 0.9, 0.2, 1) both; }
@keyframes slideL { from { transform: translateX(-80px); opacity: 0; } }
@keyframes slideR { from { transform: translateX(80px); opacity: 0; } }
.f-name { font: 800 clamp(24px, 4vw, 40px)/1 var(--font-display); text-transform: uppercase; text-shadow: 0 0 24px var(--pc); text-align: center; }
.f-wins { font: 400 clamp(40px, 7vw, 72px)/1 var(--font-arcade); color: var(--pc); text-shadow: 0 4px 0 rgba(0, 0, 0, 0.5); }
.vs span { display: block; font: 400 clamp(56px, 11vw, 120px)/1 var(--font-arcade); font-style: italic;
  background: linear-gradient(180deg, #fff 0%, var(--gold) 45%, var(--accent) 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 6px 0 rgba(0, 0, 0, 0.5)) drop-shadow(0 0 30px rgba(255, 61, 110, 0.6));
  animation: slam 0.5s 0.4s cubic-bezier(0.3, 1.8, 0.5, 1) both; }
@keyframes slam { from { transform: scale(3) rotate(-12deg); opacity: 0; } }
.verdict { text-align: center; font: 400 clamp(20px, 3.4vw, 34px) var(--font-arcade); margin: 6px 0 26px; animation: rise 0.5s 0.8s both; }
.verdict small { display: block; font: 600 13px var(--font-body); color: var(--muted); letter-spacing: 0.12em; text-transform: uppercase; margin-top: 4px; }
.rounds { display: grid; gap: 10px; margin-bottom: 30px; }
.round { display: grid; grid-template-columns: 44px 1fr minmax(120px, 220px) 1fr 44px; align-items: center; gap: 12px; }
.r-score { font: 400 22px var(--font-arcade); text-align: center; }
.round.a-wins .r-score.a, .round.b-wins .r-score.b { color: var(--gold); text-shadow: 0 0 14px rgba(255, 210, 63, 0.7); }
.r-name { text-align: center; font-size: 13px; font-weight: 600; color: var(--muted); line-height: 1.2; }
.r-name i { display: block; font-style: normal; font-size: 20px; }
.hp { height: 18px; border-radius: 4px; background: rgba(255, 255, 255, 0.06); overflow: hidden; border: 2px solid rgba(255, 255, 255, 0.15); transform: skewX(-14deg); display: flex; }
.hp.left { justify-content: flex-end; }
.hp-fill { width: var(--w); background: linear-gradient(180deg, color-mix(in srgb, var(--pc) 70%, white), var(--pc) 50%, color-mix(in srgb, var(--pc) 60%, black)); box-shadow: 0 0 16px var(--pc); animation: fill 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.duel-flags { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.df-col { padding: 16px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--pc); }
.df-col h3 { margin: 0 0 10px; font: 800 20px var(--font-display); text-transform: uppercase; display: flex; justify-content: space-between; }
.df-col h3 small { font: 400 18px var(--font-arcade); color: var(--pc); }
.df-list { display: flex; flex-wrap: wrap; gap: 6px; }
.df-item { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px 4px 5px; border-radius: 8px; background: rgba(0, 0, 0, 0.25); font-size: 13px; }
.df-list em { color: var(--muted); }

/* ——— Admin ——— */
.admin-head { display: flex; justify-content: space-between; align-items: flex-start; }
.subtabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.subtabs a { padding: 8px 14px; border-radius: 10px; text-decoration: none; color: var(--muted); font-weight: 600; background: var(--panel); border: 1px solid var(--line); }
.subtabs a.active { color: #111; background: var(--accent-2); border-color: var(--accent-2); }
.admin-body { display: grid; gap: 18px; }
.panel { padding: 20px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); }
.panel h2 { margin: 0 0 14px; font: 800 24px var(--font-display); text-transform: uppercase; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.panel h2 small { color: var(--muted); font: 600 14px var(--font-body); }
.row-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row-form input:first-child { flex: 1 1 180px; }
.emoji-input { width: 120px; }
input[type=color] { width: 44px; height: 38px; padding: 2px; border-radius: 10px; border: 1px solid var(--line); background: transparent; }
.admin-players { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.admin-players li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px; border-radius: 12px; background: rgba(0, 0, 0, 0.2); border-left: 4px solid var(--pc); }
.ap-name { flex: 1 1 160px; font-weight: 600; }
.ap-emoji { width: 70px; text-align: center; }
.ap-count { color: var(--muted); font-weight: 600; min-width: 56px; }
.flag-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 16px 0 4px; }
.flag-tools input[type=search] { flex: 1 1 220px; }
.ft-count { margin-left: auto; color: var(--muted); font-size: 13px; font-weight: 600; }
.check { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 14px; cursor: pointer; }
.admin-flags { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.aflag { position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 5px; padding: 7px; border-radius: 11px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.2); text-align: left; font-size: 12.5px; font-weight: 600; line-height: 1.2; transition: 0.15s; }
.aflag small { color: var(--muted); font-size: 10.5px; font-weight: 500; }
.aflag-img { width: 100%; height: auto; aspect-ratio: 4 / 3; border-radius: 6px; object-fit: cover; filter: grayscale(1) brightness(0.55); transition: filter 0.2s; }
.aflag:hover .aflag-img { filter: grayscale(0.4) brightness(0.85); }
.aflag.planted { border-color: var(--ok); background: rgba(74, 222, 128, 0.1); box-shadow: 0 0 18px -8px var(--ok); }
.aflag.planted .aflag-img { filter: none; }
.aflag.planted::after { content: '🚩'; position: absolute; top: -7px; right: -5px; font-size: 16px; }
.aflag.home { cursor: default; border-color: var(--gold); background: rgba(255, 210, 63, 0.1); box-shadow: none; }
.aflag.home::after { content: '🏠'; }
.ap-home { max-width: 190px; }
.aflag.pop { animation: pop 0.4s cubic-bezier(0.3, 1.8, 0.5, 1); }
.import-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }
.import-grid > div:first-child { display: grid; gap: 12px; align-content: start; }
.field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.field textarea { font: 13px/1.5 ui-monospace, Menlo, monospace; resize: vertical; }
.drop { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 22px; border-radius: 14px; border: 2px dashed rgba(255, 255, 255, 0.2); text-align: center; cursor: pointer; transition: 0.2s; }
.drop:hover, .drop.over { border-color: var(--accent-2); background: rgba(33, 212, 253, 0.07); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop-ico { font-size: 30px; }
.drop small { color: var(--muted); }
.import-help { font-size: 14px; color: var(--muted); }
.import-help h3 { margin: 0 0 8px; color: var(--text); font: 800 18px var(--font-display); text-transform: uppercase; }
.import-help b { color: var(--text); }
.import-help pre { margin: 6px 0 12px; padding: 10px 12px; border-radius: 10px; background: rgba(0, 0, 0, 0.35); color: #cfe9ff; font-size: 12.5px; white-space: pre-wrap; }
.import-help a { color: var(--accent-2); }
.preview-sum { display: flex; flex-wrap: wrap; gap: 14px; font-weight: 700; margin: 0 0 14px; }
.preview-sum .ok { color: var(--ok); } .preview-sum .guess { color: var(--warn); } .preview-sum .bad { color: var(--err); }
.pv-group { padding: 14px 0; border-top: 1px solid var(--line); }
.pv-group h3 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 10px; font: 800 20px var(--font-display); text-transform: uppercase; }
.pv-group h3 small { color: var(--muted); font: 500 13px var(--font-body); text-transform: none; }
.pv-count { margin-left: auto; font: 600 13px var(--font-body); color: var(--muted); text-transform: none; }
.badge { padding: 2px 8px; border-radius: 6px; background: var(--accent-2); color: #111; font: 700 11px var(--font-body); letter-spacing: 0.08em; }
.pv-items { display: flex; flex-wrap: wrap; gap: 6px; }
.pv-item { display: inline-flex; align-items: center; gap: 6px; padding: 4px 4px 4px 7px; border-radius: 9px; font-size: 13px; border: 1px solid; }
.pv-item.ok { border-color: rgba(74, 222, 128, 0.5); background: rgba(74, 222, 128, 0.08); }
.pv-item.guess { border-color: rgba(251, 191, 36, 0.6); background: rgba(251, 191, 36, 0.1); }
.pv-item.bad { border-color: rgba(248, 113, 113, 0.6); background: rgba(248, 113, 113, 0.1); }
.pv-item.skip { border-color: var(--line); opacity: 0.45; text-decoration: line-through; }
.pv-item.already { border-style: dashed; }
.pv-item small { color: var(--muted); }
.pv-item i { font-style: normal; color: var(--ok); }
.pv-item select { padding: 3px 6px; font-size: 12.5px; max-width: 190px; }
.pv-x { border: 0; background: rgba(255, 255, 255, 0.08); color: var(--muted); border-radius: 6px; width: 22px; height: 22px; line-height: 1; }
.pv-x:hover { color: var(--text); background: rgba(255, 255, 255, 0.18); }
.pv-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 16px; }
.pv-actions .btn.primary { margin-left: auto; }
.import-done ul { padding-left: 18px; }
.boards-editor { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 16px; }
.boards-editor textarea { width: 100%; font: 12.5px/1.5 ui-monospace, Menlo, monospace; resize: vertical; }
.boards-side h3 { margin: 0 0 8px; font: 800 16px var(--font-display); text-transform: uppercase; }
.boards-check { padding: 12px; border-radius: 12px; background: rgba(74, 222, 128, 0.08); border: 1px solid rgba(74, 222, 128, 0.35); margin-bottom: 16px; font-size: 13px; }
.boards-check ul, .tag-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.boards-check li b { float: right; }
.boards-check.err { background: rgba(248, 113, 113, 0.1); border-color: var(--err); }
.tag-list li { display: flex; justify-content: space-between; }
.tag-list small { color: var(--muted); }

.login { display: grid; place-items: center; padding: 40px 0; }
.login-card { width: min(380px, 100%); display: grid; gap: 12px; text-align: center; padding: 34px 26px; border-radius: 22px; background: var(--panel); border: 1px solid var(--line); }
.login-card h1 { margin: 0; font: 800 34px var(--font-display); text-transform: uppercase; }
.login-card p { margin: 0 0 6px; color: var(--muted); }
.login-flag { font-size: 48px; }
.login-card .error { color: var(--err); margin: 0; }
.shake { animation: shake 0.4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* ——— Toast ——— */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: grid; gap: 10px; width: min(360px, calc(100vw - 32px)); }
.toast { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 14px; background: rgba(15, 18, 38, 0.96); border: 1px solid rgba(255, 255, 255, 0.14); box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.8); font-size: 14px; animation: toastIn 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
.toast.plant { border-color: var(--gold); }
.toast.ok { border-color: var(--ok); }
.toast.err { border-color: var(--err); }
.toast.out { animation: toastOut 0.4s both; }
.toast-flag { width: 44px; height: 33px; border-radius: 5px; object-fit: cover; flex: none; animation: wave 1.2s ease-in-out 2; }
.toast-emoji { font-size: 28px; }
@keyframes toastIn { from { transform: translateX(110%); } }
@keyframes toastOut { to { transform: translateX(110%); opacity: 0; } }

/* ——— Responsive ——— */
@media (max-width: 1040px) {
  .arena-grid { grid-template-columns: 1fr; }
  .arena-side { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .topbar { gap: 10px; flex-wrap: wrap; }
  .tabs { order: 3; width: 100%; justify-content: space-between; margin: 0; }
  .tabs a { flex: 1; justify-content: center; padding: 7px 4px; flex-direction: column; gap: 0; font-size: 11px; }
  .live { margin-left: auto; }
  .arena-side { grid-template-columns: 1fr; }
  .podium { gap: 8px; }
  .podium .avatar.xl { --s: 60px; }
  .rank-1 .podium-block { height: 170px; } .rank-2 .podium-block { height: 135px; } .rank-3 .podium-block { height: 110px; }
  .podium-name { font-size: 16px; }
  .rank-row { grid-template-columns: 24px auto minmax(0, 1fr) auto; gap: 10px; padding: 10px 12px; }
  .rr-flags { display: none; }
  .profile-head { flex-direction: column; text-align: center; }
  .ph-stats, .ph-actions { justify-content: center; }
  .cbar { grid-template-columns: 110px 1fr 50px; font-size: 13px; }
  .round { grid-template-columns: 30px 1fr 90px 1fr 30px; gap: 6px; }
  .duel-flags, .import-grid, .boards-editor { grid-template-columns: 1fr; }
  .select-wrap { margin-left: 0; width: 100%; }
  .select-wrap select { flex: 1; }
  .map-stage { height: 64vh; min-height: 360px; }
  .map-hint { display: none; }
  .fb-train { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}

/* La classifica scelta nel profilo deve distinguersi anche dalle card "prima posizione". */
.board-card.selected { background: color-mix(in srgb, var(--pc) 24%, transparent); border-color: var(--pc); box-shadow: 0 0 0 2px var(--pc), 0 10px 30px -12px var(--pc); }
