/* ================================================================
   IKASEARCH — Design System v2.1
   Mobile-First · Touch-Optimized · Readable
   Sostituisce css/style.css
   ================================================================ */

/* ── 1. TOKENS / VARIABILI ──────────────────────────────────── */
:root {
  /* Colori brand */
  --cyan:        #00e5ff;
  --cyan-dim:    rgba(0, 229, 255, 0.15);
  --cyan-border: rgba(0, 229, 255, 0.25);
  --cyan-glow:   rgba(0, 229, 255, 0.4);
  --magenta:     #d946ef;
  --magenta-dim: rgba(217, 70, 239, 0.12);

  /* Semantici */
  --success:     #22c55e;
  --success-dim: rgba(34, 197, 94, 0.12);
  --danger:      #f43f5e;
  --danger-dim:  rgba(244, 63, 94, 0.12);
  --warning:     #f59e0b;
  --warning-dim: rgba(245, 158, 11, 0.12);

  /* Meraviglie */
  --efesto:   #f97316;
  --poseidone:#3b82f6;
  --colosso:  #f59e0b;

  /* Sfondi */
  --bg-0: #04040c;
  --bg-1: #080812;
  --bg-2: #0d0d1a;
  --bg-3: #121220;
  --bg-card: rgba(13, 13, 26, 0.95);
  --bg-nav:  rgba(4, 4, 12, 0.97);

  /* Bordi */
  --border-0: rgba(255, 255, 255, 0.04);
  --border-1: rgba(255, 255, 255, 0.08);
  --border-2: rgba(0, 229, 255, 0.18);

  /* Testo */
  --text-0: #f0f4ff;
  --text-1: #c8d4e8;
  --text-2: #8899b8;
  --text-3: #4a5a78;

  /* Dimensioni - AUMENTATE PER MOBILE */
  --nav-h:     56px;
  --botnav-h:  64px; /* Più alto per touch */
  --sidebar-w: 240px;
  --r-sm:  8px;
  --r-md:  12px;
  --r-lg:  16px;
  --r-xl:  22px;
  --r-full: 999px;

  /* Transizioni */
  --t-fast: 150ms ease;
  --t-med:  250ms ease;

  /* ── ALIAS LEGACY ──────────────────────────────────────────── */
  --primary:        var(--cyan);
  --primary-glow:   var(--cyan-glow);
  --secondary:      var(--magenta);
  --secondary-glow: rgba(217, 70, 239, 0.4);
  --accent:         var(--danger);
  --error:          var(--danger);
  --border:         var(--border-1);
  --text-muted:     var(--text-2);
  --darker:         var(--bg-0);
  --dark:           var(--bg-1);
  --card-bg:        var(--bg-card);
  --transition:     var(--t-med);
}

/* ════════════════════════════════════════════════════════════════
   LIGHT THEME — "Carta Calda"
   Filosofia: inchiostro scuro su carta calda, mai bianco puro,
   mai neon. I colori neon del dark (cyan #00e5ff, verde #00ff88)
   su sfondo chiaro sono illeggibili → rimpiazzati con versioni
   profonde e sature che funzionano su bg caldo.
   ════════════════════════════════════════════════════════════════ */
html.theme-light {
  /* ── Sfondi: carta calda, mai bianco puro ─────────────────── */
  --bg-0:    #e8e4dc;   /* pagina — leggermente più chiara per miglior contrasto */
  --bg-1:    #f2efe6;   /* sfondo principale — pergamena più luminosa */
  --bg-2:    #faf7f0;   /* card interna / input — quasi bianco caldo */
  --bg-3:    #e6e2da;   /* rientranze, sezioni nested — più contrasto */
  --bg-card: rgba(250,247,240,0.98);   /* card principale più chiara */
  --bg-nav:  rgba(242,239,230,0.98);   /* nav + sidebar */

  /* ── Bordi: sepia caldo ───────────────────────────────────── */
  --border-0: rgba(100,80,50,0.12);  /* più visibile */
  --border-1: rgba(90,70,40,0.22);   /* maggior contrasto */
  --border-2: rgba(0,80,170,0.35);   /* blu più definito */

  /* ── Testo: inchiostro caldo — contrasto migliorato ──────── */
  --text-0: #1a1510;   /* titoli — più scuro per miglior leggibilità */
  --text-1: #2d261e;   /* body — marrone più scuro */
  --text-2: #554838;   /* secondario — più contrasto */
  --text-3: #7a6e56;   /* muted / placeholder — più scuro */

  /* ── Accenti: profondi e leggibili su carta ──────────────── */
  /* Blu: più scuro per miglior contrasto */
  --cyan:        #004d94;
  --cyan-dim:    rgba(0,77,148,0.10);
  --cyan-border: rgba(0,77,148,0.30);
  --cyan-glow:   rgba(0,77,148,0.18);
  --primary:     #004d94;
  --primary-glow: rgba(0,77,148,0.18);

  /* Viola: più scuro e saturo */
  --magenta:     #6a1696;
  --magenta-dim: rgba(106,22,150,0.10);

  /* Verde scuro: miglior contrasto */
  --success:     #125a30;
  --success-dim: rgba(18,90,48,0.10);

  /* Rosso scuro: più profondo */
  --danger:      #a0182e;
  --danger-dim:  rgba(160,24,46,0.10);

  /* Ambra scura: più scura e leggibile */
  --warning:     #8a5800;
  --warning-dim: rgba(138,88,0,0.10);

  /* Meraviglie — versioni più scure per miglior contrasto */
  --efesto:   #b04a00;
  --poseidone:#175388;
  --colosso:  #8a5800;
}

/* ── Body ──────────────────────────────────────────────────── */
html.theme-light body {
  background: var(--bg-1) !important;
  color: var(--text-1);
  line-height: 1.6;  /* migliora la leggibilità */
  font-smooth: always;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Sfondo decorativo: via */
html.theme-light .cyber-bg,
html.theme-light .grid-overlay,
html.theme-light .scanline { display: none !important; }

/* ── Nav superiore ─────────────────────────────────────────── */
html.theme-light .top-nav {
  background: var(--bg-nav) !important;
  border-bottom: 1px solid var(--border-1) !important;
  box-shadow: 0 2px 8px rgba(90,70,40,0.10) !important;
}
html.theme-light .nav-link {
  color: var(--text-2) !important;
  font-weight: 500;
  background: transparent !important;
  border: none !important;
  text-shadow: none !important;
  box-shadow: none !important;
}
html.theme-light .nav-link:hover {
  color: var(--cyan) !important;
  background: var(--cyan-dim) !important;
  text-shadow: none !important;
}
html.theme-light .nav-link.active {
  color: #fff !important;
  background: var(--cyan) !important;
  font-weight: 600;
  text-shadow: none !important;
  box-shadow: none !important;
}
html.theme-light .nav-server select,
html.theme-light .ika-dd-trigger {
  background: var(--bg-3) !important;
  border: 1px solid var(--border-1) !important;
  color: var(--text-1) !important;
}
html.theme-light .nav-hamburger {
  background: var(--bg-3) !important;
  border: 1px solid var(--border-1) !important;
  color: var(--text-1) !important;
}

/* ── Sidebar ───────────────────────────────────────────────── */
html.theme-light .info-sidebar {
  background: var(--bg-nav) !important;
  border-right: 1px solid var(--border-1) !important;
}
html.theme-light .sb-username { 
  color: var(--text-0) !important;
  font-weight: 600;
}
/* Sb-card: nessun bordo, nessuno sfondo — solo testo, fill blu su hover/active */
html.theme-light .sb-card {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}
html.theme-light .sb-card:hover {
  background: var(--cyan-dim) !important;
  border-color: transparent !important;
  transform: translateX(2px);
}
html.theme-light .sb-card.active,
html.theme-light .sb-card[aria-current="page"] {
  background: var(--cyan) !important;
  border-color: transparent !important;
  color: #fff !important;
}

/* Colori testo per ogni variante nel light */
html.theme-light .sb-card-profile { color: var(--cyan) !important; }
html.theme-light .sb-card-profile .sb-card-icon { background: var(--cyan-dim) !important; color: var(--cyan) !important; }
html.theme-light .sb-card-profile:hover { color: var(--cyan) !important; }

html.theme-light .sb-card-admin { color: var(--danger) !important; }
html.theme-light .sb-card-admin .sb-card-icon { background: var(--danger-dim) !important; color: var(--danger) !important; }
html.theme-light .sb-card-admin:hover { color: var(--danger) !important; background: var(--danger-dim) !important; }

html.theme-light .sb-card-premium { color: var(--magenta) !important; }
html.theme-light .sb-card-premium .sb-card-icon { background: var(--magenta-dim) !important; color: var(--magenta) !important; }
html.theme-light .sb-card-premium:hover { color: var(--magenta) !important; background: var(--magenta-dim) !important; }

html.theme-light .sb-card-logout { color: var(--text-3) !important; }
html.theme-light .sb-card-logout .sb-card-icon { background: var(--bg-3) !important; color: var(--text-3) !important; }
html.theme-light .sb-card-logout:hover { color: var(--text-1) !important; background: var(--bg-3) !important; }
html.theme-light .sbsrv-trigger {
  background: var(--bg-3) !important;
  border: 1px solid var(--border-1) !important;
  color: var(--text-1) !important;
}
html.theme-light .sbsrv-menu {
  background: var(--bg-2) !important;
  border: 1px solid var(--border-1) !important;
  box-shadow: 0 6px 20px rgba(90,70,40,0.12) !important;
}
html.theme-light .sbsrv-item { color: var(--text-1) !important; }
html.theme-light .sbsrv-item:hover { 
  background: var(--cyan-dim) !important;
  color: var(--cyan) !important;
}
html.theme-light .sbsrv-item.active { 
  background: rgba(0,77,148,0.12) !important;
  font-weight: 600;
}
html.theme-light .user-status {
  background: var(--bg-3) !important;
  border: 1px solid var(--border-1) !important;
}

/* ── Bottom nav ────────────────────────────────────────────── */
html.theme-light .bottom-nav {
  background: var(--bg-nav) !important;
  border-top: 1px solid var(--border-1) !important;
}
html.theme-light .bottom-nav-item { 
  color: var(--text-3) !important;
  font-weight: 500;
}
html.theme-light .bottom-nav-item.active { 
  color: var(--cyan) !important;
  font-weight: 600;
}

/* ── Footer ────────────────────────────────────────────────── */
html.theme-light footer {
  background: var(--bg-3) !important;
  border-top: 1px solid var(--border-1) !important;
  color: var(--text-2) !important;
}
html.theme-light footer a { 
  color: var(--cyan) !important;
  font-weight: 500;
}

/* ── Input / textarea / select ─────────────────────────────── */
html.theme-light input,
html.theme-light textarea,
html.theme-light select {
  background: var(--bg-2) !important;
  color: var(--text-1) !important;
  border: 1px solid var(--border-1) !important;
  padding: 8px 12px;  /* miglior touch target */
}
html.theme-light input:focus,
html.theme-light textarea:focus,
html.theme-light select:focus {
  border-color: var(--cyan) !important;
  box-shadow: 0 0 0 3px var(--cyan-dim) !important;
  outline: none;
}

/* ── Section header ────────────────────────────────────────── */
html.theme-light .section-header {
  border-bottom: 2px solid var(--border-1) !important;
  padding-bottom: 12px;
  margin-bottom: 20px;
}
html.theme-light .section-header h1,
html.theme-light .section-header h2 { 
  color: var(--text-0) !important;
  font-weight: 700;
}

/* ── Feed cards ────────────────────────────────────────────── */
html.theme-light .feed-card {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-1) !important;
  color: var(--text-1) !important;
  transition: all 0.2s ease;
}
html.theme-light .feed-card:hover {
  border-color: var(--border-2) !important;
  box-shadow: 0 4px 16px rgba(90,70,40,0.08) !important;
}

/* Badge evento NEW / LOST */
html.theme-light .event-badge {
  background: var(--bg-3) !important;
  color: var(--text-2) !important;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
}
html.theme-light .event-badge.new {
  background: var(--cyan-dim) !important;
  color: var(--cyan) !important;
  border: 1px solid var(--cyan-border) !important;
}
html.theme-light .event-badge.lost {
  background: var(--danger-dim) !important;
  color: var(--danger) !important;
  border: 1px solid rgba(160,24,46,0.30) !important;
}

/* Pillole ora / id / miracoli */
html.theme-light .feed-time { 
  background: var(--bg-3) !important; 
  color: var(--text-2) !important;
  font-size: 0.9em;
  padding: 3px 8px;
}
html.theme-light .event-id { 
  background: var(--bg-3) !important; 
  color: var(--text-2) !important;
  font-family: monospace;
  font-weight: 600;
}
html.theme-light .feed-footer { 
  border-top: 1px solid var(--border-1) !important;
  padding-top: 12px;
  margin-top: 12px;
}

/* ── Tag player / città / coords / ally ─────────────────────── */
html.theme-light .tag-player,
html.theme-light .player-name {
  background: var(--cyan-dim) !important;
  border: 1px solid var(--cyan-border) !important;
  color: var(--cyan) !important;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 6px;
}
html.theme-light .tag-city,
html.theme-light .city-name {
  background: var(--cyan-dim) !important;
  border: 1px solid var(--cyan-border) !important;
  color: var(--cyan) !important;
  font-weight: 600;
}
html.theme-light .tag-coords,
html.theme-light .coords {
  background: var(--warning-dim) !important;
  border: 1px solid rgba(138,88,0,0.30) !important;
  color: var(--warning) !important;
  font-weight: 600;
  font-family: monospace;
}
html.theme-light .tag-ally,
html.theme-light .ally-tag {
  background: var(--magenta-dim) !important;
  border: 1px solid rgba(106,22,150,0.30) !important;
  color: var(--magenta) !important;
  font-weight: 600;
}
html.theme-light .ally-tag.ally-tag--indep {
  background: var(--bg-3) !important;
  border: 1px solid var(--border-1) !important;
  color: var(--text-3) !important;
}
html.theme-light .action-text { 
  color: var(--text-2) !important;
  font-weight: 500;
}
html.theme-light .server-tag {
  background: var(--cyan-dim) !important;
  border: 1px solid var(--cyan-border) !important;
  color: var(--cyan) !important;
  font-weight: 600;
}

/* ── Stats player / miracoli ───────────────────────────────── */
html.theme-light .player-stats {
  background: var(--bg-3) !important;
  border: 1px solid var(--border-1) !important;
  padding: 16px;
  border-radius: 8px;
}
html.theme-light .miracle-stats {
  background: var(--bg-3) !important;
  border: 1px solid var(--border-1) !important;
  padding: 16px;
  border-radius: 8px;
}
html.theme-light .stat-value { 
  color: var(--text-0) !important;
  font-weight: 700;
  font-size: 1.2em;
}
html.theme-light .stat-label { 
  color: var(--text-3) !important;
  font-weight: 500;
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
html.theme-light .miracle-count {
  background: var(--bg-2) !important;
  color: var(--text-1) !important;
  border: 1px solid var(--border-1) !important;
  font-weight: 600;
}
html.theme-light .miracle-label { 
  color: var(--text-3) !important;
  font-weight: 500;
}

/* Icone stat colorate — versioni leggibili su carta */
html.theme-light .stat-item.total i    { color: var(--cyan) !important; }
html.theme-light .stat-item.army i     { color: var(--danger) !important; }
html.theme-light .stat-item.research i { color: var(--success) !important; }
html.theme-light .stat-item.building i { color: var(--warning) !important; }
html.theme-light .stat-item.gold i     { color: #9e6800 !important; }
html.theme-light .stat-item.cities i   { color: var(--magenta) !important; }

/* ── Table ─────────────────────────────────────────────────── */
html.theme-light .cyber-table {
  border-collapse: separate;
  border-spacing: 0;
}
html.theme-light tr:hover td { 
  background: var(--cyan-dim) !important;
  transition: background 0.15s ease;
}
html.theme-light .cyber-table thead th {
  background: var(--bg-3) !important;
  color: var(--text-1) !important;
  border-bottom: 2px solid var(--border-1) !important;
  font-weight: 700;
  padding: 12px;
}
html.theme-light .cyber-table td { 
  border-bottom: 1px solid var(--border-0) !important;
  padding: 10px 12px;
}
html.theme-light .cyber-table tbody tr:hover { 
  background: var(--cyan-dim) !important; 
}
html.theme-light .cyber-table th {
  background: var(--bg-3) !important;
  color: var(--cyan) !important;
  border-bottom: 2px solid var(--cyan) !important;
  font-weight: 700;
}
html.theme-light .table-container { 
  background: var(--bg-3) !important;
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
}

/* ── Status items ──────────────────────────────────────────── */
html.theme-light .status-item {
  background: var(--bg-3) !important;
  border: 1px solid var(--border-1) !important;
  padding: 8px 12px;
  border-radius: 6px;
}

/* ── Filter tabs ───────────────────────────────────────────── */
html.theme-light .filter-tab {
  border: 1px solid var(--border-1) !important;
  color: var(--text-2) !important;
  padding: 8px 16px;
  font-weight: 500;
  transition: all 0.2s ease;
  border-radius: 6px;
}
html.theme-light .filter-tab:hover {
  border-color: var(--cyan) !important;
  color: var(--cyan) !important;
  background: var(--cyan-dim) !important;
}
html.theme-light .filter-tab.active {
  background: var(--cyan) !important;
  border-color: var(--cyan) !important;
  color: #ffffff !important;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,77,148,0.2) !important;
}

/* ── Analyzer.css overrides ────────────────────────────────── */
html.theme-light .analyzer-card {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-1) !important;
  backdrop-filter: none !important;
  transition: all 0.2s ease;
}
html.theme-light .analyzer-card:hover {
  border-color: var(--cyan) !important;
  box-shadow: 0 6px 20px rgba(90,70,40,0.08) !important;
}
html.theme-light .card-header { 
  border-bottom: 2px solid var(--border-1) !important;
  padding-bottom: 12px;
  margin-bottom: 16px;
}
html.theme-light .code-input {
  background: var(--bg-2) !important;
  border: 1px solid var(--border-1) !important;
  color: var(--text-1) !important;
  font-family: 'Courier New', monospace;
  padding: 12px;
  border-radius: 6px;
}
html.theme-light .code-input:focus {
  background: var(--bg-1) !important;
  box-shadow: 0 0 0 3px var(--cyan-dim) !important;
  border-color: var(--cyan) !important;
  outline: none;
}
html.theme-light .char-count {
  background: var(--bg-3) !important;
  border: 1px solid var(--border-1) !important;
  color: var(--text-2) !important;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 4px;
}
html.theme-light .step {
  background: var(--bg-3) !important;
  padding: 12px;
  border-radius: 6px;
  transition: background 0.2s ease;
}
html.theme-light .step:hover { 
  background: var(--cyan-dim) !important; 
}
html.theme-light .step-text code {
  background: var(--bg-3) !important;
  color: var(--cyan) !important;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
}
html.theme-light .analyzer-loader {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-1) !important;
  padding: 24px;
  border-radius: 8px;
}
html.theme-light .island-stat {
  background: var(--bg-3) !important;
  border: 1px solid var(--border-1) !important;
  padding: 12px;
  border-radius: 6px;
  transition: all 0.2s ease;
}
html.theme-light .island-stat:hover {
  border-color: var(--cyan) !important;
  box-shadow: 0 4px 12px var(--cyan-dim) !important;
}
html.theme-light .results-card {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-1) !important;
  backdrop-filter: none !important;
  padding: 20px;
  border-radius: 10px;
}
html.theme-light .island-info-card {
  background: linear-gradient(135deg, var(--cyan-dim), rgba(106,22,150,0.06)) !important;
  border: 2px solid var(--cyan) !important;
  backdrop-filter: none !important;
  padding: 20px;
  border-radius: 10px;
}

/* ── Stat box (home / profilo) ─────────────────────────────── */
html.theme-light .stat-box {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-1) !important;
  padding: 16px;
  border-radius: 8px;
}
html.theme-light .stat-box strong { 
  color: var(--cyan) !important; 
  text-shadow: none !important;
  font-weight: 700;
  font-size: 1.1em;
}
html.theme-light .stat-box span { 
  color: var(--text-3) !important;
  font-weight: 500;
  font-size: 0.9em;
}

/* ── Bottoni generici ──────────────────────────────────────── */
html.theme-light .btn-ghost {
  border: 1px solid var(--border-1) !important;
  color: var(--text-2) !important;
  padding: 8px 16px;
  border-radius: 6px;
  transition: all 0.2s ease;
}
html.theme-light .btn-ghost:hover {
  background: var(--bg-3) !important;
  border-color: var(--text-2) !important;
}
html.theme-light .chart-btn,
html.theme-light .city-btn {
  background: var(--cyan-dim) !important;
  border: 1px solid var(--cyan) !important;
  color: var(--cyan) !important;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 6px;
  transition: all 0.2s ease;
}
html.theme-light .chart-btn:hover,
html.theme-light .city-btn:hover {
  background: var(--cyan) !important;
  color: #ffffff !important;
}

/* ── Neon override: classi con colori neon hardcoded ────────── */
/* Verde neon #00ff88 → verde scuro leggibile */
html.theme-light [style*="color:#00ff88"],
html.theme-light [style*="color: #00ff88"],
html.theme-light [style*="color:#00ff88 !important"],
html.theme-light [style*="color: #00ff88 !important"] { 
  color: var(--success) !important; 
}
html.theme-light [style*="color:#ff3366"],
html.theme-light [style*="color: #ff3366"] { 
  color: var(--danger) !important; 
}
html.theme-light [style*="color:#ffaa00"],
html.theme-light [style*="color: #ffaa00"] { 
  color: var(--warning) !important; 
}
html.theme-light [style*="color:#ff00ff"],
html.theme-light [style*="color: #ff00ff"] { 
  color: var(--magenta) !important; 
}
html.theme-light [style*="color:#0078d4"],
html.theme-light [style*="color: #0078d4"] { 
  color: var(--cyan) !important; 
}

/* ── Badge server / ally / status (profile, admin, player) ──── */
html.theme-light .badge-server,
html.theme-light .lp-gs-server-badge,
html.theme-light .wl-server-badge {
  background: var(--cyan-dim) !important;
  color: var(--cyan) !important;
  border: 1px solid var(--cyan-border) !important;
  text-shadow: none !important;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
}
html.theme-light .badge-ally {
  background: var(--magenta-dim) !important;
  color: var(--magenta) !important;
  border: 1px solid rgba(106,22,150,0.30) !important;
  text-shadow: none !important;
  font-weight: 600;
}
html.theme-light .badge-premium {
  background: var(--magenta-dim) !important;
  color: var(--magenta) !important;
  border: 1px solid rgba(106,22,150,0.30) !important;
  font-weight: 600;
}
html.theme-light .badge-free {
  background: var(--warning-dim) !important;
  color: var(--warning) !important;
  border: 1px solid rgba(138,88,0,0.30) !important;
  font-weight: 600;
}
html.theme-light .badge-status-active,
html.theme-light .badge-status.active {
  background: var(--success-dim) !important;
  color: var(--success) !important;
  border: 1px solid rgba(18,90,48,0.30) !important;
  text-shadow: none !important;
  box-shadow: none !important;
  font-weight: 600;
}
html.theme-light .badge-status-inactive,
html.theme-light .badge-status.inactive {
  background: var(--bg-3) !important;
  color: var(--text-3) !important;
  border: 1px solid var(--border-1) !important;
  text-shadow: none !important;
  box-shadow: none !important;
}

/* ── Link: no underline globale — solo testo scuro di default ── */
html.theme-light a {
  color: var(--text-2);
  text-decoration: none;
}
html.theme-light a:hover {
  color: var(--cyan);
  text-decoration: none;
}
/* Eccezione: link dentro testo/contenuto normale */
html.theme-light .content a,
html.theme-light p a,
html.theme-light .pcard a {
  color: var(--cyan);
  text-decoration: underline;
  text-underline-offset: 2px;
}

html.theme-light ::selection {
  background: var(--cyan-dim);
  color: var(--text-1);
}

html.theme-light :focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

/* Migliora contrasto per testo piccolo */
html.theme-light small,
html.theme-light .text-sm,
html.theme-light .text-xs {
  color: var(--text-2) !important;
  font-weight: 500;
}
/* ── 2. RESET MINIMO ────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
}
html { 
  scroll-behavior: smooth; 
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}
body {
  font-family: 'Exo 2', 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: var(--bg-0);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── 3. SFONDO APP ──────────────────────────────────────────── */
.cyber-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse 80% 50% at 20% 40%, rgba(0,229,255,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 20%, rgba(217,70,239,0.04) 0%, transparent 60%);
  pointer-events: none;
}

.grid-overlay, .scanline, .particle-field { display: none; }

@media (min-width: 992px) {
  .grid-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image:
      repeating-linear-gradient(0deg, transparent, transparent 39px, rgba(0,229,255,0.025) 40px),
      repeating-linear-gradient(90deg, transparent, transparent 39px, rgba(0,229,255,0.025) 40px);
    pointer-events: none;
  }
}

/* ── 4. TIPOGRAFIA ──────────────────────────────────────────── */
.font-orb { font-family: 'Orbitron', sans-serif; }

h1, h2, h3 { 
  color: var(--text-0); 
  font-weight: 700; 
  line-height: 1.25; 
}

/* AUMENTATE DIMENSIONI SU MOBILE */
h1 { font-size: clamp(1.3rem, 4vw, 1.8rem); }
h2 { font-size: clamp(1.1rem, 3vw, 1.4rem); }
h3 { font-size: clamp(0.95rem, 2.5vw, 1.1rem); }

.text-primary { color: var(--cyan); }
.text-muted    { color: var(--text-2); }
.text-dim      { color: var(--text-3); }
.text-success  { color: var(--success); }
.text-danger   { color: var(--danger); }
.text-warning  { color: var(--warning); }

/* ── 5. TOP NAVIGATION (OTTIMIZZATA MOBILE) ────────────────── */
.top-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--bg-nav);
  border-bottom: 1px solid var(--border-1);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 10px;
  z-index: 1000;
}

/* Brand */
.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-right: auto;
}

.glitch-text {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(0.9rem, 2.5vw, 1.1rem); /* Medialmente fluido */
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: 1.5px;
  text-shadow: 0 0 12px var(--cyan-glow);
  white-space: nowrap;
}

.brand-version {
  font-size: 0.65rem;
  color: var(--text-3);
  background: var(--border-0);
  padding: 2px 6px;
  border-radius: var(--r-full);
  display: none;
}

/* Selettore server - OTTIMIZZATO MOBILE */
.nav-server {
  flex-shrink: 0;
}

.nav-server select {
  background: var(--bg-2);
  color: var(--text-0);
  border: 1px solid var(--border-1);
  padding: 8px 32px 8px 12px; /* Spazio per freccia custom */
  border-radius: var(--r-md);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.75rem; /* AUMENTATO */
  font-weight: 600;
  outline: none;
  cursor: pointer;
  min-width: 130px; /* PIÙ LARGO */
  min-height: 44px; /* TOUCH TARGET */
  transition: border-color var(--t-fast);
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2300e5ff' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
}

.nav-server select:focus,
.nav-server select:hover {
  border-color: var(--border-2);
  box-shadow: 0 0 0 3px rgba(0,229,255,0.08);
}

/* Menu nav - OTTIMIZZATO MOBILE */
.nav-menu {
  display: none;
  align-items: center;
  gap: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--r-md);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-2);
  transition: all var(--t-fast);
  white-space: nowrap;
  min-height: 44px;
}

.nav-link:hover,
.nav-link.active {
  color: var(--cyan);
  background: var(--cyan-dim);
}

.nav-link.active {
  text-shadow: 0 0 8px var(--cyan-glow);
}

/* Hamburger - OTTIMIZZATO MOBILE */
.nav-hamburger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  color: var(--cyan);
  font-size: 1.2rem;
  flex-shrink: 0;
  transition: all var(--t-fast);
  cursor: pointer;
  background: transparent;
}

.nav-hamburger:active,
.nav-hamburger:hover {
  background: var(--cyan-dim);
  border-color: var(--border-2);
}

/* Menu mobile aperto */
.nav-menu.nav-open {
  display: flex !important;
  flex-direction: column;
  position: fixed;
  top: var(--nav-h);
  left: 0; right: 0;
  background: rgba(4,4,12,0.99);
  border-bottom: 1px solid var(--border-2);
  backdrop-filter: blur(20px);
  padding: 12px;
  gap: 4px;
  z-index: 999;
  max-height: calc(100vh - var(--nav-h));
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0,0,0,0.6);
  animation: slideDown var(--t-med) ease;
}

.nav-menu.nav-open .nav-link {
  padding: 14px 16px; /* TOUCH TARGET AMPIO */
  font-size: 0.85rem;
  border-radius: var(--r-md);
  justify-content: flex-start;
  border: 1px solid transparent;
  min-height: 50px;
}

.nav-menu.nav-open .nav-link:hover,
.nav-menu.nav-open .nav-link.active {
  border-color: var(--border-2);
  background: var(--cyan-dim);
}

/* Desktop */
@media (min-width: 992px) {
  .top-nav { padding: 0 24px; gap: 16px; }
  .nav-brand { margin-right: 0; }
  .brand-version { display: inline-block; }
  .nav-menu { display: flex; flex: 1; }
  .nav-hamburger { display: none; }
  .nav-server select { 
    min-width: 140px; 
    font-size: 0.75rem; 
    padding: 8px 32px 8px 14px;
  }
}

/* ── 6. BOTTOM NAV (OTTIMIZZATA MOBILE) ────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--botnav-h);
  background: var(--bg-nav);
  border-top: 1px solid var(--border-1);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: stretch;
  z-index: 1000;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-3);
  font-family: 'Orbitron', sans-serif;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  transition: all var(--t-fast);
  min-height: 50px; /* TOUCH TARGET */
  position: relative;
  text-decoration: none;
  padding: 6px 4px;
}

.bottom-nav-item i {
  font-size: 1.2rem;
  transition: color var(--t-fast);
}

.bottom-nav-item span {
  font-size: 0.65rem; /* LEGGIBILE */
  font-weight: 600;
}

.bottom-nav-item.active,
.bottom-nav-item:active {
  color: var(--cyan);
}

.bottom-nav-item.active::before {
  content: '';
  position: absolute;
  top: 0; left: 25%; right: 25%;
  height: 2px;
  background: var(--cyan);
  border-radius: 0 0 var(--r-sm) var(--r-sm);
  box-shadow: 0 0 8px var(--cyan-glow);
}

.bottom-nav-badge {
  position: absolute;
  top: 8px; right: calc(50% - 20px);
  min-width: 18px; height: 18px;
  background: var(--danger);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 800;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

@media (min-width: 768px) {
  .bottom-nav { display: none; }
}

/* ── 7. SIDEBAR (SOLO DESKTOP) ──────────────────────────────── */
.info-sidebar {
  display: none;
}

@media (min-width: 992px) {
  .info-sidebar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: fixed;
    top: var(--nav-h);
    left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: rgba(8,8,18,0.97);
    border-right: 1px solid var(--border-1);
    padding: 12px 10px;
    overflow: visible;
    z-index: 900;
  }
}

/* ── 8. MAIN LAYOUT ─────────────────────────────────────────── */
.main-content {
  margin-top: var(--nav-h);
  padding: 16px 14px;
  padding-bottom: calc(var(--botnav-h) + 20px + env(safe-area-inset-bottom, 0px));
  min-height: calc(100vh - var(--nav-h));
}

@media (min-width: 768px) {
  .main-content {
    padding: 24px 24px;
    padding-bottom: 32px;
  }
}

@media (min-width: 992px) {
  .main-content {
    margin-left: var(--sidebar-w);
    padding: 24px 32px;
    padding-bottom: 40px;
  }
}

.view-section { 
  display: none; 
  animation: fadeUp 0.3s ease; 
}

.view-section.active { 
  display: block; 
}

/* ── 9. SECTION HEADERS ─────────────────────────────────────── */
.section-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-1);
}

.section-header h1 {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(1rem, 3vw, 1.4rem);
  color: var(--cyan);
  display: flex;
  align-items: center;
  gap: 10px;
  text-shadow: 0 0 12px var(--cyan-glow);
  flex-wrap: wrap;
}

/* ── 10. BOTTONI (TOUCH OPTIMIZED) ──────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--r-full);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all var(--t-med);
  white-space: nowrap;
  min-height: 48px; /* TOUCH TARGET AMPIO */
  min-width: 48px;
  border: none;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

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

.btn-primary {
  background: linear-gradient(135deg, rgba(0,229,255,0.25), rgba(0,229,255,0.12));
  color: var(--cyan);
  border: 1px solid var(--border-2);
}

.btn-primary:hover, .btn-primary:active {
  background: linear-gradient(135deg, rgba(0,229,255,0.35), rgba(0,229,255,0.2));
  box-shadow: 0 4px 20px var(--cyan-glow);
}

.btn-solid {
  background: var(--cyan);
  color: var(--bg-0);
  font-weight: 800;
}

.btn-solid:hover, .btn-solid:active {
  box-shadow: 0 4px 20px var(--cyan-glow);
  opacity: 0.92;
}

.btn-danger {
  background: var(--danger-dim);
  color: var(--danger);
  border: 1px solid rgba(244,63,94,0.3);
}

.btn-danger:hover {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 4px 16px rgba(244,63,94,0.4);
}

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border-1);
}

.btn-ghost:hover {
  border-color: var(--border-2);
  color: var(--cyan);
}

.btn-back {
  background: var(--cyan-dim);
  color: var(--cyan);
  border: 1px solid var(--border-2);
  padding: 10px 18px;
  border-radius: var(--r-full);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all var(--t-fast);
  min-height: 48px;
}

.btn-back:hover {
  background: rgba(0,229,255,0.25);
  box-shadow: 0 0 16px var(--cyan-glow);
}

.btn-info {
  background: var(--cyan-dim);
  color: var(--cyan);
  border: 1px solid var(--border-2);
  padding: 8px 16px;
  border-radius: var(--r-sm);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.7rem;
  cursor: pointer;
  transition: all var(--t-fast);
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-info:hover {
  background: var(--cyan);
  color: var(--bg-0);
}

/* ── 11. INPUT & FORM (TOUCH OPTIMIZED) ────────────────────── */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
textarea,
select {
  width: 100%;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  padding: 12px 16px;
  color: var(--text-0);
  font-family: 'Exo 2', -apple-system, sans-serif;
  font-size: 0.95rem; /* LEGGIBILE */
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  min-height: 48px; /* TOUCH TARGET */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

textarea {
  min-height: 100px;
  resize: vertical;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--border-2);
  box-shadow: 0 0 0 3px rgba(0,229,255,0.1);
}

input::placeholder, textarea::placeholder {
  color: var(--text-3);
  opacity: 0.8;
}

label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-2);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}

label i { 
  color: var(--cyan); 
  margin-right: 6px; 
}

/* ── 12. FEED CONTROLS ──────────────────────────────────────── */
.feed-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
  padding: 14px;
  background: var(--bg-2);
  border-radius: var(--r-lg);
  border: 1px solid var(--border-1);
}

@media (min-width: 640px) {
  .feed-controls {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.filter-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-tab {
  padding: 10px 16px;
  border-radius: var(--r-full);
  border: 1px solid var(--border-1);
  background: transparent;
  color: var(--text-2);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all var(--t-fast);
  min-height: 40px;
  white-space: nowrap;
}

.filter-tab:active {
  transform: scale(0.95);
}

.filter-tab:hover {
  border-color: var(--border-2);
  color: var(--cyan);
}

.filter-tab.active {
  background: var(--cyan);
  border-color: var(--cyan);
  color: var(--bg-0);
  font-weight: 800;
  box-shadow: 0 0 12px var(--cyan-glow);
}

.feed-refresh {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.last-update {
  font-size: 0.7rem;
  color: var(--text-3);
  white-space: nowrap;
}

.refresh-btn {
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border-1);
  background: var(--bg-2);
  color: var(--cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all var(--t-med);
  cursor: pointer;
}

.refresh-btn:active {
  transform: rotate(180deg) scale(0.9);
}

.refresh-btn:hover {
  background: var(--cyan);
  color: var(--bg-0);
  box-shadow: 0 0 14px var(--cyan-glow);
}

/* ── 13. FEED CARDS ─────────────────────────────────────────── */
.feed-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.feed-card {
  background: var(--bg-card);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  padding: 14px;
  cursor: pointer;
  transition: all var(--t-med);
  animation: fadeUp 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}

.feed-card:active {
  transform: scale(0.98);
  border-color: var(--border-2);
  box-shadow: 0 0 20px rgba(0,229,255,0.1);
}

@media (min-width: 768px) {
  .feed-card { 
    padding: 16px 20px; 
  }
  
  .feed-card:hover { 
    transform: translateX(4px) translateY(-2px);
    border-color: var(--border-2);
    box-shadow: 0 0 20px rgba(0,229,255,0.1);
  }
}

/* Header card */
.feed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 10px;
  flex-wrap: wrap;
}

.event-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--r-full);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: rgba(0,0,0,0.4);
}

.event-badge.new {
  color: var(--cyan);
  border: 1px solid var(--border-2);
  text-shadow: 0 0 6px var(--cyan-glow);
}

.event-badge.lost {
  color: var(--danger);
  border: 1px solid rgba(244,63,94,0.3);
}

.feed-time {
  font-size: 0.7rem;
  color: var(--text-3);
  background: var(--bg-2);
  padding: 4px 10px;
  border-radius: var(--r-full);
  font-family: 'Orbitron', sans-serif;
  white-space: nowrap;
}

/* Body card */
.feed-body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 0.9rem;
}

/* Tag */
.tag-player, .player-name {
  color: var(--text-0);
  font-weight: 700;
  font-size: 0.92rem;
  background: linear-gradient(90deg, var(--cyan-dim), var(--magenta-dim));
  padding: 5px 12px;
  border-radius: var(--r-full);
  border: 1px solid var(--border-2);
}

.tag-city, .city-name {
  color: var(--cyan);
  font-weight: 600;
  background: var(--cyan-dim);
  padding: 4px 10px;
  border-radius: var(--r-full);
  border: 1px dashed var(--border-2);
  font-size: 0.82rem;
}

.tag-coords, .coords {
  font-family: 'Orbitron', monospace;
  color: var(--warning);
  background: var(--warning-dim);
  border: 1px solid rgba(245,158,11,0.25);
  padding: 4px 10px;
  border-radius: var(--r-full);
  font-size: 0.78rem;
  font-weight: 600;
}

.tag-ally, .ally-tag {
  color: var(--magenta);
  background: var(--magenta-dim);
  border: 1px solid rgba(217,70,239,0.25);
  padding: 4px 10px;
  border-radius: var(--r-full);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

/* Independent player (no alliance) */
.ally-tag--indep {
  color: var(--text-3);
  background: var(--border-0);
  border: 1px solid var(--border-1);
}

.action-text {
  color: var(--text-2);
  font-size: 0.85rem;
  font-style: italic;
}

/* Stats player */
.player-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 10px 12px;
  background: rgba(0,0,0,0.25);
  border-radius: var(--r-md);
  border: 1px solid var(--border-0);
  font-size: 0.75rem;
}

.stat-item { 
  display: flex; 
  align-items: center; 
  gap: 5px; 
}

.stat-item i { 
  font-size: 0.7rem; 
  opacity: 0.8; 
}

.stat-item.total i { color: var(--cyan); }
.stat-item.army i { color: var(--danger); }
.stat-item.research i { color: var(--success); }
.stat-item.building i { color: var(--warning); }
.stat-item.gold i { color: #fbbf24; }
.stat-item.cities i { color: var(--magenta); }

.stat-value { 
  font-weight: 700; 
  color: var(--text-0);
  font-size: 0.8rem;
}

.stat-label { 
  color: var(--text-3); 
  font-size: 0.65rem; 
}

/* Miracoli */
.miracle-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 8px 12px;
  background: rgba(0,0,0,0.25);
  border-radius: var(--r-md);
  border: 1px solid var(--border-0);
  font-size: 0.75rem;
  margin-top: 6px;
}

.miracle-item { 
  display: flex; 
  align-items: center; 
  gap: 5px; 
}

.miracle-item.efesto i   { color: var(--efesto); }
.miracle-item.poseidone i{ color: var(--poseidone); }
.miracle-item.colosso i  { color: var(--colosso); }

.miracle-count {
  font-weight: 700; 
  color: var(--text-0);
  background: var(--bg-2);
  padding: 2px 7px; 
  border-radius: var(--r-full);
  font-size: 0.7rem; 
  min-width: 22px; 
  text-align: center;
}

.miracle-label { 
  color: var(--text-3); 
  font-size: 0.62rem; 
  text-transform: uppercase; 
}

/* Footer card */
.feed-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-0);
  font-size: 0.65rem;
}

.event-id {
  font-family: 'Orbitron', monospace;
  color: var(--text-3);
  background: var(--bg-2);
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 0.62rem;
}

.server-tag {
  background: var(--cyan-dim);
  color: var(--cyan);
  border: 1px solid var(--border-2);
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-weight: 600;
  font-size: 0.65rem;
}

/* ── 14. PROFILO GIOCATORE ──────────────────────────────────── */
.profile-container { 
  animation: fadeUp 0.3s ease; 
}

.profile-card {
  background: var(--bg-card);
  border: 1px solid var(--border-1);
  border-top: 3px solid var(--cyan);
  border-radius: var(--r-lg);
  padding: 18px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

@media (min-width: 768px) {
  .profile-card { padding: 28px; }
}

.profile-header {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.profile-avatar {
  width: 60px; height: 60px;
  background: linear-gradient(135deg, var(--cyan), var(--magenta));
  border-radius: 50%;
  display: flex; 
  align-items: center; 
  justify-content: center;
  font-size: 1.6rem;
  color: var(--bg-0);
  border: 2px solid var(--border-2);
  box-shadow: 0 0 16px var(--cyan-glow);
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .profile-avatar { 
    width: 72px; 
    height: 72px; 
    font-size: 2rem; 
  }
}

.profile-title h2 {
  font-size: clamp(1.2rem, 3.5vw, 1.6rem);
  color: var(--cyan);
  margin-bottom: 6px;
  text-shadow: 0 0 8px var(--cyan-glow);
}

.profile-ally {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text-2);
}

.ally-badge {
  background: var(--magenta-dim);
  color: var(--magenta);
  border: 1px solid rgba(217,70,239,0.3);
  padding: 4px 12px;
  border-radius: var(--r-full);
  font-size: 0.78rem;
  font-weight: 700;
}

/* Grid stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 20px 0;
}

@media (min-width: 480px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
}

.stat-box {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  padding: 14px 10px;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: border-color var(--t-fast);
}

.stat-box:active { 
  border-color: var(--border-2); 
}

.stat-box span {
  display: block;
  font-size: 0.65rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}

.stat-box strong {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.2rem;
  color: var(--cyan);
  display: block;
  line-height: 1.2;
}

.stat-box .stat-icon {
  position: absolute;
  bottom: -4px; right: -2px;
  font-size: 2rem;
  opacity: 0.06;
  transform: rotate(-10deg);
}

.stats-grid.secondary { margin-top: 0; }

.profile-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}

@media (min-width: 480px) {
  .profile-actions {
    flex-direction: row;
    justify-content: center;
  }
}

/* ── 15. TABELLE (SCROLL ORIZZONTALE OTTIMIZZATO) ──────────── */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--r-md);
  border: 1px solid var(--border-1);
  margin: 16px 0;
  /* Indicatore di scroll */
  background: 
    linear-gradient(to right, var(--bg-2) 30%, transparent),
    linear-gradient(to left, var(--bg-2) 30%, transparent) 100% 0,
    radial-gradient(farthest-side at 0 50%, rgba(0,0,0,0.4), transparent),
    radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,0.4), transparent) 100% 0;
  background-repeat: no-repeat;
  background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
  background-attachment: local, local, scroll, scroll;
}

.details-table,
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  min-width: 500px;
}

th {
  background: var(--cyan-dim);
  color: var(--cyan);
  padding: 12px 14px;
  text-align: left;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border-bottom: 1px solid var(--border-2);
  white-space: nowrap;
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-0);
  vertical-align: middle;
  color: var(--text-1);
  font-size: 0.85rem;
}

tr:last-child td { border-bottom: none; }

tr:hover td { 
  background: rgba(255,255,255,0.02); 
}

tr:active td {
  background: rgba(0,229,255,0.05);
}

.city-level {
  font-size: 0.65rem;
  color: var(--text-3);
  background: var(--bg-2);
  padding: 3px 6px;
  border-radius: var(--r-sm);
  margin-left: 6px;
  white-space: nowrap;
}

.island-link {
  color: var(--cyan);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  padding: 4px 10px;
  background: var(--cyan-dim);
  border-radius: var(--r-full);
  transition: all var(--t-fast);
  border: 1px solid transparent;
  text-decoration: none;
}

.island-link:active { 
  border-color: var(--border-2); 
  transform: scale(0.97);
}

.coords-small {
  font-size: 0.65rem;
  color: var(--warning);
  font-family: 'Orbitron', monospace;
  background: var(--warning-dim);
  padding: 3px 6px;
  border-radius: var(--r-sm);
  margin-left: 5px;
}

/* ── RIMANENTI SEZIONI (16-29) ──────────────────────────────── */
/* Badges, pills e status ottimizzati per mobile */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: var(--r-full);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-active   { background: var(--success-dim); color: var(--success); border: 1px solid rgba(34,197,94,0.3); }
.badge-inactive { background: rgba(100,100,100,0.1); color: #aaa; border: 1px solid rgba(100,100,100,0.2); }
.badge-vacation { background: var(--warning-dim); color: var(--warning); border: 1px solid rgba(245,158,11,0.3); }
.badge-ghost    { background: rgba(100,100,100,0.08); color: var(--text-3); border: 1px solid var(--border-1); }
.badge.new      { background: var(--success-dim); color: var(--success); border: 1px solid rgba(34,197,94,0.3); }
.badge.lost     { background: var(--danger-dim); color: var(--danger); border: 1px solid rgba(244,63,94,0.3); }

.premium-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--r-full);
  background: linear-gradient(135deg, rgba(217,70,239,0.2), rgba(0,229,255,0.15));
  border: 1px solid rgba(217,70,239,0.35);
  color: var(--magenta);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.65rem;
  font-weight: 700;
}

/* Status bars */
.status-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.status-bar-premium {
  background: linear-gradient(135deg, rgba(217,70,239,0.15), rgba(0,229,255,0.12));
  border: 1px solid rgba(217,70,239,0.4);
  color: var(--magenta);
}

.status-bar-unlocked {
  background: var(--success-dim);
  border: 1px solid rgba(34,197,94,0.3);
  color: var(--success);
}

.status-bar-delayed {
  background: var(--danger-dim);
  border: 1px solid rgba(244,63,94,0.3);
  color: var(--danger);
}

.status-bar .status-text { 
  flex: 1; 
  font-size: 0.72rem; 
  color: var(--text-1); 
  font-family: 'Exo 2', sans-serif; 
  font-weight: 400; 
  min-width: 150px;
}

.status-bar .status-action { 
  margin-left: auto; 
  white-space: nowrap; 
}

/* Storico */
.history-section {
  margin-top: 24px;
  padding: 16px;
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
}

.history-section h3 {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.78rem;
  color: var(--cyan);
  margin-bottom: 14px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.history-container {
  max-height: 180px;
  overflow-y: auto;
  font-size: 0.8rem;
  -webkit-overflow-scrolling: touch;
}

.history-item {
  display: flex;
  justify-content: space-between;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border-0);
  gap: 10px;
}

.history-item.current {
  background: var(--cyan-dim);
  border-left: 2px solid var(--cyan);
}

.history-date { 
  color: var(--text-3); 
  font-family: monospace; 
  white-space: nowrap;
  font-size: 0.72rem;
}

.history-value { 
  color: var(--text-1); 
  font-weight: 600; 
}

.status-container { 
  display: flex; 
  flex-direction: column; 
  gap: 6px; 
}

.status-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 12px;
  background: rgba(0,0,0,0.2);
  border-radius: var(--r-sm);
  font-size: 0.8rem;
}

.status-badge { 
  padding: 3px 10px; 
  border-radius: var(--r-sm); 
  font-weight: 700; 
  font-size: 0.7rem;
}

.status-active  .status-badge { background: var(--success-dim); color: var(--success); }
.status-vacation.status-badge { background: var(--warning-dim); color: var(--warning); }
.status-inactive.status-badge { background: rgba(120,120,120,0.1); color: #aaa; }
.status-banned  .status-badge { background: var(--danger-dim); color: var(--danger); }

.status-dates { 
  color: var(--text-3); 
  font-size: 0.75rem; 
}

.movements-container { 
  max-height: 220px; 
  overflow-y: auto; 
  -webkit-overflow-scrolling: touch;
}

.movement-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-0);
  font-size: 0.8rem;
  flex-wrap: wrap;
}

.movement-date { 
  color: var(--text-3); 
  font-family: monospace; 
  min-width: 140px; 
  font-size: 0.72rem; 
}

.movement-icon { 
  min-width: 75px; 
}

.movement-icon .success { color: var(--success); }
.movement-icon .danger  { color: var(--danger); }

.movement-city   { 
  color: var(--cyan); 
  font-weight: 600; 
}

.movement-coords { 
  color: var(--text-3); 
  font-size: 0.72rem; 
}

/* Loading */
.loading {
  text-align: center;
  padding: 56px 24px;
  color: var(--cyan);
  font-family: 'Orbitron', sans-serif;
}

.loading i {
  font-size: 2.8rem;
  margin-bottom: 20px;
  display: block;
  opacity: 0.8;
  animation: spin 2s linear infinite;
}

.loading p {
  font-size: 0.8rem;
  color: var(--text-2);
  letter-spacing: 1px;
}

.loading-state {
  text-align: center;
  padding: 40px 24px;
  color: var(--text-2);
}

.loading-state i {
  font-size: 2rem;
  margin-bottom: 16px;
  display: block;
  color: var(--cyan);
}

/* Error */
.error-card {
  text-align: center;
  padding: 56px 28px;
  color: var(--danger);
  background: var(--danger-dim);
  border: 1px solid rgba(244,63,94,0.2);
  border-radius: var(--r-lg);
}

.error-card i {
  font-size: 2.8rem;
  margin-bottom: 20px;
  display: block;
}

.error-card h3 { 
  font-size: 1.3rem; 
  margin-bottom: 12px; 
  color: var(--danger); 
}

.error-card p { 
  color: var(--text-2); 
  margin-bottom: 24px; 
  font-size: 0.9rem;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  padding: 20px;
}

.modal-overlay.active,
.modal-overlay[style*="flex"] { 
  display: flex; 
}

.modal-content {
  background: var(--bg-1);
  border: 1px solid var(--border-2);
  border-radius: var(--r-lg);
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 0 40px rgba(0,229,255,0.12);
}

.modal-header {
  position: sticky;
  top: 0;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border-1);
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1;
}

.modal-title {
  font-family: 'Orbitron', sans-serif;
  color: var(--cyan);
  font-size: 0.95rem;
  font-weight: 700;
}

.modal-body { 
  padding: 24px; 
}

.close-modal {
  background: none;
  border: none;
  color: var(--text-2);
  font-size: 1.8rem;
  cursor: pointer;
  line-height: 1;
  padding: 8px;
  transition: color var(--t-fast);
  min-height: 44px;
  min-width: 44px;
}

.close-modal:active { 
  color: var(--danger); 
}

/* Cookie Banner */
.cookie-banner {
  position: fixed;
  bottom: calc(var(--botnav-h) + 12px);
  left: 14px;
  right: 14px;
  background: var(--bg-1);
  border: 1px solid var(--border-2);
  border-radius: var(--r-lg);
  padding: 18px;
  z-index: 9999;
  animation: slideUp var(--t-med) ease;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.4);
}

@media (min-width: 768px) {
  .cookie-banner {
    bottom: 20px;
    left: 24px;
    right: 24px;
    max-width: 700px;
  }
}

@media (min-width: 992px) {
  .cookie-banner {
    left: calc(var(--sidebar-w) + 24px);
  }
}

.cookie-content {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.cookie-content p {
  flex: 1;
  font-size: 0.8rem;
  color: var(--text-1);
  min-width: 220px;
  line-height: 1.5;
}

.cookie-btns {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.cookie-btn {
  background: var(--cyan);
  color: var(--bg-0);
  border: none;
  padding: 10px 20px;
  border-radius: var(--r-md);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--t-fast);
  min-height: 42px;
}

.cookie-btn:active {
  box-shadow: 0 0 14px var(--cyan-glow);
  opacity: 0.9;
}

.cookie-link {
  color: var(--text-3);
  font-size: 0.7rem;
  text-decoration: underline;
}

/* Notifiche */
.notification {
  position: fixed;
  top: calc(var(--nav-h) + 16px);
  right: 16px;
  left: 16px;
  background: var(--bg-2);
  border-left: 3px solid var(--cyan);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  color: var(--text-1);
  padding: 14px 20px;
  z-index: 4000;
  font-size: 0.85rem;
  transform: translateX(120%);
  transition: transform var(--t-med);
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}

.notification.show { 
  transform: translateX(0); 
}

.notification.notification-error { 
  border-left-color: var(--danger); 
  border-color: rgba(244,63,94,0.3); 
}

.notification.notification-success { 
  border-left-color: var(--success); 
  border-color: rgba(34,197,94,0.3); 
}

/* Pulse e live dot */
.live-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  animation: livePulse 2s infinite;
  display: inline-block;
  flex-shrink: 0;
}

.pulse-anim { 
  animation: pulse 2s infinite; 
}

.new-events-badge {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 20px; height: 20px;
  background: var(--danger);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 800;
  border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center;
  padding: 0 5px;
  box-shadow: 0 0 10px rgba(244,63,94,0.5);
  animation: pulse 2s infinite;
  z-index: 10;
}

.signal-strength { 
  display: flex; 
  gap: 3px; 
  align-items: flex-end; 
}

.signal-strength .bar {
  width: 3px;
  background: rgba(0,229,255,0.2);
  border-radius: 2px;
  transition: all 0.3s;
}

.signal-strength .bar:nth-child(1) { height: 8px; }
.signal-strength .bar:nth-child(2) { height: 14px; }
.signal-strength .bar:nth-child(3) { height: 20px; }

.signal-strength .bar.active {
  background: var(--cyan);
  box-shadow: 0 0 6px var(--cyan-glow);
}

/* System dossier */
.system-dossier {
  margin-top: 56px;
  padding: 24px;
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  font-size: 0.82rem;
  color: var(--text-2);
  line-height: 1.7;
}

.system-dossier h3 {
  font-family: 'Orbitron', sans-serif;
  color: var(--cyan);
  margin-bottom: 14px;
  font-size: 0.8rem;
}

.system-dossier p { 
  margin-bottom: 14px; 
}

/* Unlock modal */
.ika-unlock-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: none;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  z-index: 10001;
  padding: 16px;
}

.ika-modal-box {
  width: 100%;
  max-width: 760px;
  background: var(--bg-1);
  border: 1px solid var(--border-2);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: 0 0 50px rgba(0,229,255,0.12);
  display: flex;
  flex-direction: column;
  max-height: 94vh;
}

.ika-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-1);
  background: var(--cyan-dim);
  flex-shrink: 0;
}

.ika-modal-title {
  font-family: 'Orbitron', sans-serif;
  color: var(--cyan);
  font-weight: 700;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ika-modal-timer {
  font-family: 'Orbitron', sans-serif;
  color: var(--success);
  font-size: 1.5rem;
  font-weight: 900;
  min-width: 56px;
  text-align: right;
}

.ika-modal-video {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 300px;
  background: #000;
  overflow: hidden;
}

.ika-modal-video iframe {
  width: 100%; height: 100%;
  min-height: 300px;
  border: none;
  display: block;
}

.ika-modal-loading {
  position: absolute;
  inset: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  color: var(--text-2);
  font-size: 0.85rem;
}

.ika-modal-footer {
  padding: 10px 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 0.7rem;
  border-top: 1px solid var(--border-0);
  flex-shrink: 0;
}

/* ================================================================
   REDESIGN v3.1 — MODERN DARK
   Spostamento nav in sidebar + pulizia neon + fix responsive
   ================================================================ */

/* ── TOKEN AGGIORNATI: sfondo leggermente più caldo, meno puro nero ── */
:root {
  --bg-0: #09090f;
  --bg-1: #0f1018;
  --bg-2: #14151f;
  --bg-3: #191a27;
  --bg-card: rgba(20, 21, 31, 0.97);
  --bg-nav:  rgba(9, 9, 15, 0.98);
  --border-0: rgba(255,255,255,0.05);
  --border-1: rgba(255,255,255,0.09);
  --border-2: rgba(0,200,255,0.22);
  --cyan:      #00ccff;
  --cyan-dim:  rgba(0,204,255,0.1);
  --cyan-border: rgba(0,204,255,0.25);
  --cyan-glow: rgba(0,204,255,0.35);
  --text-0: #edf0ff;
  --text-1: #b8c8e8;
  --text-2: #7a8aaa;
  --text-3: #42526a;
  /* sidebar ridotta da 240px a 210px */
  --sidebar-w: 210px;
}

/* ── DESKTOP (992px+): nav in cima, server selector va nella sidebar ─ */
@media (min-width: 992px) {
  /* Hamburger nascosto su desktop */
  .nav-hamburger { display: none !important; }
  /* Server selector nascosto dalla top-bar (è nella sidebar) */
  .nav-server { display: none !important; }
  /* Brand compatto */
  .nav-brand { margin-right: 0 !important; }
  /* Top nav più pulita */
  .top-nav {
    padding: 0 16px !important;
    gap: 4px !important;
  }
  /* Sidebar */
  .info-sidebar {
    width: 210px !important;
  }
  /* Main content con margine sidebar */
  .main-content {
    margin-left: 210px !important;
    padding: 20px 28px !important;
    padding-bottom: 32px !important;
  }
}

/* ── SIDEBAR v3: card-style buttons ─────────────────────────────── */

/* Server select (in cima) */
.sb-server-wrap {
  margin-bottom: 10px;
}

/* Identità: username + badge */
.sb-identity {
  text-align: center;
  padding: 2px 0 8px;
}

.sb-username {
  font-family: 'Orbitron', -apple-system, sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  display: block;
  margin-bottom: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sb-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-family: 'Orbitron', -apple-system, sans-serif;
  font-size: 0.54rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border: 1px solid;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Card buttons container */
.sb-cards {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 8px;
}

/* Base card button */
.sb-card {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 11px;
  border-radius: 10px;
  text-decoration: none;
  font-family: 'Orbitron', -apple-system, sans-serif;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  border: 1px solid;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.sb-card-icon {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  flex-shrink: 0;
}

.sb-card-label {
  flex: 1;
  line-height: 1.2;
}

.sb-card-arrow {
  font-size: 0.65rem;
  opacity: 0.55;
  flex-shrink: 0;
}

/* MY PROFILE — blue/cyan */
.sb-card-profile {
  background: rgba(0, 100, 220, 0.14);
  border-color: rgba(40, 140, 255, 0.35);
  color: #5bbfff;
}
.sb-card-profile .sb-card-icon {
  background: rgba(40, 140, 255, 0.14);
  color: #5bbfff;
}
.sb-card-profile:hover {
  background: rgba(0, 100, 220, 0.26);
  border-color: rgba(40, 140, 255, 0.6);
  transform: translateX(2px);
}

/* ADMIN PANEL — red */
.sb-card-admin {
  background: rgba(220, 30, 60, 0.14);
  border-color: rgba(240, 60, 90, 0.4);
  color: #ff5577;
}
.sb-card-admin .sb-card-icon {
  background: rgba(220, 30, 60, 0.14);
  color: #ff5577;
}
.sb-card-admin:hover {
  background: rgba(220, 30, 60, 0.26);
  border-color: rgba(240, 60, 90, 0.7);
  transform: translateX(2px);
}

/* PREMIUM CTA — purple/magenta */
.sb-card-premium {
  background: rgba(180, 50, 255, 0.1);
  border-color: rgba(180, 50, 255, 0.3);
  color: #c060ff;
}
.sb-card-premium .sb-card-icon {
  background: rgba(180, 50, 255, 0.12);
  color: #c060ff;
}
.sb-card-premium:hover {
  background: rgba(180, 50, 255, 0.2);
  border-color: rgba(180, 50, 255, 0.55);
  transform: translateX(2px);
}

/* LOGOUT — gray subtle */
.sb-card-logout {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.1);
  color: #778899;
}
.sb-card-logout .sb-card-icon {
  background: rgba(255, 255, 255, 0.05);
  color: #778899;
}
.sb-card-logout:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateX(2px);
}

/* Legacy: sb-section-label usato altrove */
.sb-section-label {
  font-family: 'Exo 2', -apple-system, sans-serif;
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-3);
  margin: 10px 0 5px;
}
.sb-section-label i {
  font-size: 0.6rem;
  margin-right: 3px;
}

/* Server selector sidebar: stili inline nel componente PHP */

/* Divisore */
.sidebar-divider {
  height: 1px;
  background: var(--border-1);
  margin: 8px 0;
}

/* ── Language switcher ─────────────────────────────────────── */
.ika-lang-bar {
  display: flex;
  gap: 8px;
  align-items: center;
}
.ika-lang-bar--sidebar {
  justify-content: center;
  padding: 5px 0;
  border-top: 1px solid rgba(255,255,255,0.04);
  margin-top: 2px;
}
.ika-lang-link {
  color: #555;
  font-size: 0.65rem;
  font-family: 'Exo 2', sans-serif;
  text-decoration: none;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.2s;
  white-space: nowrap;
}
.ika-lang-link:hover { color: var(--cyan); }
.ika-lang-link--active {
  color: var(--cyan);
  font-weight: 700;
}
.ika-lang-sep {
  color: #2a2a2a;
  font-size: 0.6rem;
}

/* Light theme lang switcher */
html.theme-light .ika-lang-bar--sidebar {
  border-top-color: var(--border-0) !important;
}
html.theme-light .ika-lang-link {
  color: var(--text-3) !important;
  text-decoration: none !important;
}
html.theme-light .ika-lang-link:hover {
  color: var(--cyan) !important;
}
html.theme-light .ika-lang-link--active {
  color: var(--cyan) !important;
  font-weight: 700;
  background: var(--cyan-dim) !important;
  border-radius: 4px;
}
html.theme-light .ika-lang-sep {
  color: var(--border-1) !important;
}

/* Footer links visibili */
.ika-footer-link {
  color: #aaa;
  font-size: 0.68rem;
  text-decoration: none;
  font-family: 'Exo 2', sans-serif;
  transition: color var(--t-fast);
}

.ika-footer-link:hover {
  color: var(--cyan);
}

/* ── RIDUZIONE EFFETTI NEON ──────────────────────────────────────── */
/* Logo */
.glitch-text {
  text-shadow: none !important;
}
/* Titoli sezione */
.section-header h1 {
  text-shadow: none !important;
}
/* Bottoni */
.btn-primary:hover, .btn-primary:active {
  box-shadow: none !important;
}
.btn-solid:hover, .btn-solid:active {
  box-shadow: none !important;
}
/* Filter tab attivo */
.filter-tab.active {
  box-shadow: none !important;
}
/* Bottom nav indicator */
.bottom-nav-item.active::before {
  box-shadow: none !important;
}
/* Tag player */
.tag-player, .player-name {
  background: rgba(255,255,255,0.04) !important;
  border-color: var(--border-1) !important;
}
/* Stat box */
.stat-box strong {
  text-shadow: none !important;
}
/* Avatar sidebar */
.avatar {
  box-shadow: none !important;
}
/* Badge, pill neon */
.signal-strength .bar.active {
  box-shadow: none !important;
}
.new-events-badge {
  box-shadow: none !important;
}

/* ── FIX SIDEBAR USER BLOCK ──────────────────────────────────────── */
.user-status {
  border-radius: var(--r-md);
  padding: 10px;
  margin-bottom: 6px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-1);
}

/* ── MOBILE (< 768px): padding corretto con bottom nav ──────────── */
@media (max-width: 767px) {
  .main-content {
    padding: 12px !important;
    padding-bottom: calc(var(--botnav-h) + 16px + env(safe-area-inset-bottom,0px)) !important;
  }
  /* Evita scroll orizzontale su mobile */
  body { overflow-x: hidden; }
  /* Cards più compatte */
  .feed-card { padding: 12px !important; }
  /* Section header più compatto */
  .section-header { margin-bottom: 12px !important; padding-bottom: 10px !important; }
}

/* ── TABLET 768-991px: hamburger + main content full width ──────── */
@media (min-width: 768px) and (max-width: 991px) {
  .main-content {
    padding: 20px !important;
    padding-bottom: 28px !important;
  }
  /* Nav menu aperto in tablet: link più grandi */
  .nav-menu.nav-open .nav-link {
    font-size: 0.9rem !important;
    padding: 12px 16px !important;
  }
}

/* ── TOP NAV: header più pulito ─────────────────────────────────── */
.top-nav {
  border-bottom: 1px solid var(--border-1);
  box-shadow: none;
}

/* Server select: aspetto più moderno */
.nav-server select,
.ika-dd-trigger {
  background: rgba(255,255,255,0.04) !important;
  border: 1px solid var(--border-1) !important;
  transition: border-color var(--t-fast) !important;
}

.nav-server select:hover,
.ika-dd.open .ika-dd-trigger,
.ika-dd-trigger:hover {
  border-color: var(--border-2) !important;
  box-shadow: none !important;
}

/* ── CARDS: meno neon, più clean ────────────────────────────────── */
.feed-card:active,
.feed-card:hover {
  box-shadow: none !important;
}

/* Scroll orizzontale tabelle su mobile */
.table-wrap {
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--border-2) transparent;
}

/* ── HAMBURGER: bottone più visibile su mobile ───────────────────── */
.nav-hamburger {
  background: rgba(255,255,255,0.04) !important;
}

/* ── BOTTOM NAV: font più leggibile ──────────────────────────────── */
.bottom-nav-item {
  font-family: 'Exo 2', -apple-system, sans-serif !important;
  letter-spacing: 0.3px !important;
}

.bottom-nav-item span {
  font-size: 0.68rem !important;
  font-weight: 600 !important;
}

/* ── STATUS BANNERS (premium / ritardato / sbloccato): mobile stack ─ */
@media (max-width: 600px) {
  /* Le banner con flex orizzontale si impilano su mobile */
  [style*="font-family: 'Orbitron'"][style*="display: flex"],
  [style*="font-family:'Orbitron'"][style*="display:flex"] {
    flex-wrap: wrap !important;
    gap: 8px !important;
    font-size: 0.72rem !important;
  }
  /* I bottoni inside le banner full-width */
  [style*="font-family: 'Orbitron'"][style*="display: flex"] button,
  [style*="font-family:'Orbitron'"][style*="display:flex"] button {
    width: 100% !important;
  }
}

/* ── FEED CONTROLS: layout responsive ───────────────────────────── */
.feed-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

@media (max-width: 500px) {
  .filter-tabs {
    width: 100%;
  }
  .filter-tab {
    flex: 1;
    text-align: center;
  }
  .feed-refresh {
    width: 100%;
    justify-content: space-between;
  }
}

/* ── SECTION HEADER: più compatto e senza overflow ───────────────── */
.section-header h1,
.section-header h2 {
  font-size: clamp(0.9rem, 3vw, 1.1rem) !important;
  font-family: 'Exo 2', -apple-system, sans-serif !important;
  font-weight: 700 !important;
  letter-spacing: 0.3px !important;
}

/* Bottone INFO SISTEMA — più discreto */
.btn-info {
  font-family: 'Exo 2', -apple-system, sans-serif !important;
  font-size: 0.72rem !important;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── TOP NAV: altezza uniforme ───────────────────────────────────── */
.nav-brand a img {
  height: 34px !important;
}

/* Versione brand: nascondere su mobile piccolo */
@media (max-width: 380px) {
  .brand-version { display: none !important; }
}

/* ── SEARCH / STATUS BANNERS: wrap su mobile ─────────────────────── */
@media (max-width: 600px) {
  .search-status-banner,
  [class*="status-banner"] {
    flex-wrap: wrap !important;
    font-size: 0.72rem !important;
    padding: 8px 12px !important;
    gap: 8px !important;
  }
  .search-status-banner a,
  .search-status-banner button {
    width: 100% !important;
    text-align: center !important;
    justify-content: center !important;
  }
}

/* ── IKA-DD (server selector dropdown): aspetto uniforme ─────────── */
.ika-dd-trigger {
  min-width: 130px;
  max-width: 200px;
}

@media (max-width: 480px) {
  .ika-dd-trigger {
    min-width: 110px;
    font-size: 0.78rem !important;
    padding: 5px 8px !important;
  }
}

/* ── MAIN CONTENT: no margin su mobile (sidebar è nascosta) ────────── */
@media (max-width: 991px) {
  .main-content {
    margin-left: 0 !important;
  }
}

/* ── COOKIE BANNER: offset sidebar su desktop ───────────────────── */
@media (min-width: 992px) {
  .cookie-banner {
    left: calc(210px + 20px) !important;
  }
}

/* AD zones */
.ika-ad-zone {
  width: 100%;
  overflow: hidden;
  text-align: center;
  border-radius: var(--r-md);
  margin: 14px 0;
}

.ika-ad-zone iframe {
  display: block;
  width: 100%;
  border: none;
  overflow: hidden;
  transition: height 0.25s ease;
}

.ika-mobile-ad {
  display: none;
  width: 100%;
  text-align: center;
  margin: 12px 0;
}

@media (max-width: 768px) {
  .ika-mobile-ad { display: block; }
}

/* ════════════════════════════════════════════════════════════════
   MOBILE OVERRIDES GLOBALI — patch finale
   Risolve: min-width legacy, filter tabs, radar, cards, banners
   ════════════════════════════════════════════════════════════════ */

/* 1. Elimina il min-width 1200px di style.css — causa principale dello scroll */
body {
  min-width: 0 !important;
  overflow-x: hidden !important;
}
*, *::before, *::after {
  max-width: 100%;
}
/* Eccezioni: elementi che DEVONO poter scrollare orizzontalmente */
.table-wrap, pre, code { max-width: none; }

/* 2. FILTER TABS — scroll orizzontale invece di wrap su mobile */
@media (max-width: 767px) {
  .filter-tabs {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    gap: 8px !important;
    width: 100% !important;
    padding-bottom: 4px !important;
  }
  .filter-tabs::-webkit-scrollbar { display: none !important; }

  .filter-tab {
    flex-shrink: 0 !important;   /* non si comprime */
    padding: 10px 14px !important;
    font-size: 0.68rem !important;
    min-height: 44px !important;  /* touch target iOS */
    white-space: nowrap !important;
  }
}

/* 3. FEED CONTROLS — stacca radar sotto i tab su mobile */
@media (max-width: 767px) {
  .feed-controls {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    padding: 12px !important;
    margin-bottom: 12px !important;
  }
}

/* 4. RADAR SEARCH — full width, touch-friendly */
@media (max-width: 767px) {
  .radar-search {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    padding: 10px 12px !important;
    border-radius: 12px !important;
    box-sizing: border-box !important;
  }
  .radar-search input[type="number"] {
    width: 72px !important;
    min-height: 44px !important;
    font-size: 1rem !important;
    text-align: center !important;
    flex-shrink: 0 !important;
  }
  .radar-search select {
    flex: 1 !important;
    min-width: 100px !important;
    min-height: 44px !important;
    font-size: 0.82rem !important;
  }
  .radar-search .btn-scan,
  .radar-search .btn-back,
  .radar-search button {
    flex: 1 !important;
    min-height: 44px !important;
    font-size: 0.8rem !important;
  }
}

/* 5. DAYS-INACTIVE badge — wrap del testo su mobile */
@media (max-width: 767px) {
  .days-inactive {
    font-size: 0.7rem !important;
    white-space: normal !important;
    line-height: 1.3 !important;
    max-width: 100% !important;
    padding: 5px 10px !important;
  }
}

/* 6. FEED HEADER — stack verticale su schermi piccoli */
@media (max-width: 480px) {
  .feed-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 6px !important;
  }
  .feed-time {
    font-size: 0.68rem !important;
  }
}

/* 7. FEED BODY — player name, ally, score su colonna mobile */
@media (max-width: 480px) {
  .feed-body {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 5px !important;
  }
  .player-name { font-size: 1rem !important; }
}

/* 8. COORD BOX — box più grandi e touch-friendly */
@media (max-width: 767px) {
  .coord-box {
    padding: 6px 10px !important;
    font-size: 0.82rem !important;
    min-height: 36px !important;
    display: inline-flex !important;
    align-items: center !important;
  }
}

/* 9. PLAYER STATS (coords section) — padding ridotto mobile */
@media (max-width: 767px) {
  .player-stats {
    padding: 10px !important;
    margin-top: 10px !important;
  }
}

/* 10. STATUS BANNERS (vacanze/inattivi premium, limit, free) */
@media (max-width: 600px) {
  .vac-status-banner,
  [class*="status-banner"] {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
    padding: 12px !important;
    font-size: 0.75rem !important;
  }
  .vac-status-banner a,
  .vac-status-banner button,
  [class*="status-banner"] a,
  [class*="status-banner"] button {
    width: 100% !important;
    text-align: center !important;
    justify-content: center !important;
  }
}

/* 11. DUMP INFO header pill — wrap su mobile */
@media (max-width: 600px) {
  #dump-info {
    font-size: 0.68rem !important;
    padding: 4px 10px !important;
  }
  .section-header {
    gap: 8px !important;
  }
}

/* 12. CIMITERO SUB-TABS — scroll orizzontale */
@media (max-width: 767px) {
  #cem-subtabs .filter-tabs {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
  }
}

/* 13. TOP NAV: hamburger visibile, server select compatto */
@media (max-width: 480px) {
  .nav-server select {
    min-width: 105px !important;
    font-size: 0.7rem !important;
    padding: 8px 26px 8px 8px !important;
  }
}

/* 14. BOTTOM NAV: safe area iOS, testo leggibile */
.bottom-nav {
  padding-bottom: max(env(safe-area-inset-bottom, 0px), 4px);
}
@media (max-width: 380px) {
  .bottom-nav-item span {
    font-size: 0.58rem !important;
  }
  .bottom-nav-item i {
    font-size: 1.1rem !important;
  }
}

/* 15. MODAL PUB — full screen su mobile */
@media (max-width: 767px) {
  .ika-unlock-modal .ika-modal-content {
    width: 95vw !important;
    max-width: 95vw !important;
    padding: 20px 16px !important;
    margin: 10px !important;
  }
}

/* 16. LOADING spinner centrato */
.loading {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-2);
}

.ika-sidebar-ad { 
  width: 100%; 
  overflow: hidden; 
  border-radius: var(--r-md); 
  flex-shrink: 0; 
}

/* ── ANIMAZIONI ─────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

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

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-16px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.4); }
  50%       { box-shadow: 0 0 0 4px rgba(34,197,94,0); }
}

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

@keyframes scan {
  0%   { transform: translateY(-100%); }
  100% { transform: translateY(200%); }
}

@keyframes progress {
  0%   { width: 0%; }
  60%  { width: 80%; }
  100% { width: 100%; }
}

/* Rispetta preferenza utente per animazioni ridotte */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── UTILITY ────────────────────────────────────────────────── */
.hidden { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border-width: 0;
}

.truncate { 
  overflow: hidden; 
  text-overflow: ellipsis; 
  white-space: nowrap; 
}

.gap-sm { gap: 8px; }
.gap-md { gap: 14px; }
.mt-sm  { margin-top: 10px; }
.mt-md  { margin-top: 20px; }
.mt-lg  { margin-top: 28px; }

/* Scroll bar sottile */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-1); }
::-webkit-scrollbar-thumb { background: var(--border-1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-2); }

/* Miglioramenti accessibilità per touch */
@media (hover: none) and (pointer: coarse) {
  /* Dispositivi touch */
  .feed-card:hover,
  .nav-link:hover,
  .btn:hover {
    transform: none; /* Evita hover indesiderati su touch */
  }
  
  /* Migliora tap highlight */
  * {
    -webkit-tap-highlight-color: rgba(0, 229, 255, 0.1);
  }
}

/* Fix iOS input zoom */
@media screen and (-webkit-min-device-pixel-ratio: 0) { 
  select,
  textarea,
  input {
    font-size: 16px !important; /* Previene zoom automatico iOS */
  }
}

/* Migliora focus visibility per accessibilità */
:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

/* Migliora la leggibilità del testo su sfondo scuro */
@media (max-width: 480px) {
  body {
    line-height: 1.5;
  }
  
  p, li, td {
    font-size: 0.9rem;
    line-height: 1.6;
  }
}
/* ────────────────────────────────────────
   FIX RADAR LAYOUT - TUTTO IN UNA RIGA
   ──────────────────────────────────────── */

/* Container principale - FORZA RIGA */
.feed-body {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 6px !important;
  width: 100% !important;
}

/* OGNI elemento dentro feed-body DEVE stare in riga */
.feed-body > * {
  display: inline-flex !important;
  flex-shrink: 0;
  white-space: nowrap;
}

/* Se c'è uno span con testo "in", rendilo piccolo */
.feed-body .in-text {
  display: inline-flex !important;
  align-items: center;
  color: var(--text-3);
  font-size: 0.75rem;
  margin: 0 2px;
}

/* Forza player-name in riga */
.player-name,
.feed-body .player-name {
  display: inline-flex !important;
  white-space: nowrap !important;
  flex-shrink: 0;
}

/* Forza city-name in riga */
.city-name,
.feed-body .city-name {
  display: inline-flex !important;
  white-space: nowrap !important;
  flex-shrink: 0;
}

/* Forza coords in riga */
.coords,
.feed-body .coords {
  display: inline-flex !important;
  white-space: nowrap !important;
  flex-shrink: 0;
}

/* Forza ally-tag in riga */
.ally-tag,
.feed-body .ally-tag {
  display: inline-flex !important;
  white-space: nowrap !important;
  flex-shrink: 0;
}

/* Forza action-text in riga */
.action-text,
.feed-body .action-text {
  display: inline-flex !important;
  white-space: nowrap !important;
  flex-shrink: 0;
  font-size: 0.82rem;
}

/* Player stats - flex row con wrap */
.player-stats {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  gap: 10px 16px !important;
  align-items: center !important;
}

/* Miracle stats - flex row con wrap */
.miracle-stats {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  gap: 8px 14px !important;
  align-items: center !important;
}

/* Su mobile molto piccolo, riduci font e gap */
@media (max-width: 374px) {
  .feed-body {
    gap: 4px !important;
  }
  
  .player-name,
  .feed-body .player-name {
    font-size: 0.82rem !important;
    padding: 3px 8px !important;
  }
  
  .city-name,
  .feed-body .city-name {
    font-size: 0.78rem !important;
    padding: 2px 7px !important;
  }
  
  .coords,
  .feed-body .coords {
    font-size: 0.7rem !important;
    padding: 2px 6px !important;
  }
  
  .ally-tag,
  .feed-body .ally-tag {
    font-size: 0.7rem !important;
    padding: 2px 6px !important;
  }
  
  .action-text {
    font-size: 0.75rem !important;
  }
}

/* Legacy legal links */
.sb-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  padding: 8px 0;
  border-top: 1px solid var(--border-0);
  margin-top: 2px;
}

.sb-legal a {
  color: var(--text-3);
  font-size: 0.62rem;
  font-family: 'Exo 2', -apple-system, sans-serif;
  text-decoration: none;
  transition: color var(--t-fast);
}

.sb-legal a:hover {
  color: var(--text-2);
}

.sb-legal-sep {
  color: var(--text-3);
  opacity: 0.4;
  font-size: 0.62rem;
}

