* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #050508;
  --bg-card: rgba(10,14,30,0.8);
  --bg-card-solid: #0a0e1e;
  --bg-hover: rgba(0,255,255,0.05);
  --bg-sidebar: #030306;
  --radius: 8px;
  --radius-sm: 4px;
  --font: 'Rajdhani', system-ui, sans-serif;
  --font-display: 'Orbitron', monospace;
  --bg-topbar: rgba(5,5,8,0.9);
  --border: rgba(0,255,255,0.15);
  --text: #e0e8f0;
  --text-dim: #7a8ca0;
  --text-muted: #8a9aac;
  --accent: #00f0ff;
  --accent-dim: #00b8cc;
  --accent-purple: #ff00aa;
  --pink: #ff00aa;
  --green: #00ff88;
  --gold: #ffcc00;
  --red: #ff3366;
  --shadow: 0 4px 24px rgba(0,240,255,0.08);
}

/* ══ THEME VARIATIONS ═══ */
/* Each theme sets its own variables. Default (no theme class) = Cyber Elven. */
html.theme-emerald {
  --bg: #060c08; --bg-card: rgba(8,20,12,0.85); --bg-card-solid: #08140c;
  --bg-sidebar: #040a06; --bg-topbar: rgba(6,12,8,0.9);
  --text: #d4e8d8; --text-dim: #749685; --text-muted: #6f9080;
  --accent: #00e878; --accent-dim: #00b85e; --accent-purple: #ff6bcb; --pink: #ff6bcb;
  --border: rgba(0,232,120,0.15); --green: #00ff88; --red: #ff4477; --gold: #f0c040;
  --shadow: 0 4px 24px rgba(0,232,120,0.08);
}
html.theme-royal {
  --bg: #0a0512; --bg-card: rgba(18,10,30,0.85); --bg-card-solid: #120a1e;
  --bg-sidebar: #08030e; --bg-topbar: rgba(10,5,18,0.9);
  --text: #e4daf0; --text-dim: #9080a8; --text-muted: #8878a0;
  --accent: #c084fc; --accent-dim: #a855f7; --accent-purple: #f472b6; --pink: #f472b6;
  --border: rgba(192,132,252,0.15); --green: #34d399; --red: #fb7185; --gold: #fbbf24;
  --shadow: 0 4px 24px rgba(192,132,252,0.08);
}
html.theme-ruby {
  --bg: #0c0606; --bg-card: rgba(20,10,10,0.85); --bg-card-solid: #140a0a;
  --bg-sidebar: #080404; --bg-topbar: rgba(12,6,6,0.9);
  --text: #f0e0dc; --text-dim: #a88880; --text-muted: #a08078;
  --accent: #ff5544; --accent-dim: #e04030; --accent-purple: #ff77aa; --pink: #ff77aa;
  --border: rgba(255,85,68,0.15); --green: #ff8800; --red: #ff2244; --gold: #ffaa00;
  --shadow: 0 4px 24px rgba(255,85,68,0.08);
}
html.theme-ocean {
  --bg: #060a10; --bg-card: rgba(8,14,24,0.85); --bg-card-solid: #080e18;
  --bg-sidebar: #040810; --bg-topbar: rgba(6,10,16,0.9);
  --text: #dce8f4; --text-dim: #7088a0; --text-muted: #6a8098;
  --accent: #38bdf8; --accent-dim: #0284c7; --accent-purple: #e879f9; --pink: #e879f9;
  --border: rgba(56,189,248,0.15); --green: #2dd4bf; --red: #f87171; --gold: #facc15;
  --shadow: 0 4px 24px rgba(56,189,248,0.08);
}

/* Light variants for themes (applied together with .theme-light) */

/* ══ Hover improvements ══ */
.theme-light .btn-icon:hover { border-color: var(--accent-dim); color: var(--accent); }
.theme-light .sidebar-nav a:hover,
.theme-light .sidebar-nav a.active { color: var(--accent-dim); border-color: var(--border); }
.theme-light .p-link:hover { color: var(--accent-dim); }
.theme-light .search-result-item:hover { background: rgba(8,145,178,0.06); }
.theme-light .sortable:hover .sort-icon { color: var(--accent); }
.theme-light .pagination button:hover:not(:disabled) { border-color: var(--accent-dim); color: var(--accent); }
.theme-light .btn:hover { border-color: var(--border); color: var(--text); }
.theme-light .btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.theme-light .btn-primary:hover { background: var(--accent-dim); border-color: var(--accent-dim); color: #fff; }

/* ══ LIGHT THEME (live site colors) ══ */
.theme-light, .theme-light :root {
  --bg: #f0f4f8;
  --bg-card: rgba(255,255,255,0.85);
  --bg-card-solid: #fff;
  --bg-hover: rgba(0,180,255,0.05);
  --bg-sidebar: #fff;
  --bg-topbar: rgba(255,255,255,0.9);
  --border: rgba(0,0,0,0.12);
  --text: #1a1a2e;
  --text-dim: #475569;
  --text-muted: #586780;
  --accent: #0e7490;
  --accent-dim: #0284c7;
  --accent-purple: #e91e9d;
  --pink: #e91e9d;
  --green: #059669;
  --gold: #d97706;
  --red: #dc2626;
  --shadow: 0 4px 24px rgba(0,0,0,0.06);
}
.theme-light body { background: var(--bg); color: var(--text); background-image: none; }

/* Theme light variants — must come AFTER base .theme-light to override */
html.theme-light.theme-emerald {
  --bg: #f2f8f0; --bg-card: rgba(255,255,255,0.88); --bg-card-solid: #fff;
  --bg-sidebar: #fff; --bg-topbar: rgba(242,248,240,0.9);
  --text: #143028; --text-dim: #3d6b52; --text-muted: #5a8a6a;
  --accent: #059669; --accent-dim: #028754; --accent-purple: #d9467a; --pink: #d9467a;
  --border: rgba(0,0,0,0.10); --green: #059669; --red: #dc2626; --gold: #b87333;
  --shadow: 0 4px 24px rgba(0,0,0,0.06);
}
html.theme-light.theme-royal {
  --bg: #faf5ff; --bg-card: rgba(255,255,255,0.9); --bg-card-solid: #fff;
  --bg-sidebar: #fff; --bg-topbar: rgba(250,245,255,0.9);
  --text: #1a1028; --text-dim: #5a4a70; --text-muted: #7a6a90;
  --accent: #7c3aed; --accent-dim: #6d28d9; --accent-purple: #db2777; --pink: #db2777;
  --border: rgba(0,0,0,0.10); --green: #059669; --red: #dc2626; --gold: #d97706;
  --shadow: 0 4px 24px rgba(0,0,0,0.06);
}
html.theme-light.theme-ruby {
  --bg: #fef2f2; --bg-card: rgba(255,255,255,0.88); --bg-card-solid: #fff;
  --bg-sidebar: #fff; --bg-topbar: rgba(254,242,242,0.9);
  --text: #2c1010; --text-dim: #7a4a4a; --text-muted: #9a6a6a;
  --accent: #dc2626; --accent-dim: #b91c1c; --accent-purple: #e91e9d; --pink: #e91e9d;
  --border: rgba(0,0,0,0.10); --green: #059669; --red: #dc2626; --gold: #d97706;
  --shadow: 0 4px 24px rgba(0,0,0,0.06);
}
html.theme-light.theme-ocean {
  --bg: #f0f9ff; --bg-card: rgba(255,255,255,0.88); --bg-card-solid: #fff;
  --bg-sidebar: #fff; --bg-topbar: rgba(240,249,255,0.9);
  --text: #0c1a2c; --text-dim: #3d6b8a; --text-muted: #5a8aaa;
  --accent: #0284c7; --accent-dim: #0370a8; --accent-purple: #c026d3; --pink: #c026d3;
  --border: rgba(0,0,0,0.10); --green: #059669; --red: #dc2626; --gold: #d97706;
  --shadow: 0 4px 24px rgba(0,0,0,0.06);
}
.theme-light .app { background: var(--bg); }
.theme-light .sidebar { background: var(--bg-sidebar); }
.theme-light .sidebar { border-right-color: var(--border); }
.theme-light .sidebar-logo .logo-text { color: var(--text); }
.theme-light .sidebar-logo .logo-text .logo-a { color: var(--accent-purple); }
.theme-light .sidebar-nav a { color: var(--text-dim); border-color: transparent; }
.theme-light .sidebar-nav a:hover,
.theme-light .sidebar-nav a.active { color: var(--accent-purple); background: rgba(233,30,157,0.05); border-color: rgba(233,30,157,0.1); }
.theme-light .sidebar-nav a[data-role="admin"]:hover,
.theme-light .sidebar-nav a[data-role="admin"].active { color: var(--accent-purple); border-color: rgba(233,30,157,0.2); background: rgba(233,30,157,0.05); }
.theme-light .sidebar-footer { color: var(--text-muted); border-top-color: var(--border); }
.theme-light .topbar { background: var(--bg-topbar); border-bottom-color: var(--border); }
.theme-light .topbar-lang { background: var(--bg-card-solid); border-color: var(--border); color: var(--text-dim); }
.theme-light .btn-icon { background: var(--bg-card-solid); border-color: var(--border); color: var(--text-dim); }
.theme-light .btn-icon:hover { color: var(--text); border-color: var(--accent); }
.theme-light .search-box input { background: var(--bg-card-solid); border-color: var(--border); color: var(--text); }
.theme-light .search-box input::placeholder { color: var(--text-muted); }
.theme-light .hero-spread,
.theme-light .featured-stat,
.theme-light .info-card,
.theme-light .chart-card,
.theme-light .status-column { background: var(--bg-card); border-color: var(--border); }
.theme-light .hero-spread .player-name { color: var(--text); }
.theme-light .hero-spread .player-tagline { color: var(--text-dim); }
.theme-light .featured-stat .big-number { color: var(--gold); }
.theme-light .featured-stat .big-label { color: var(--text-dim); }
.theme-light .mini-stat { border-bottom-color: rgba(0,0,0,0.04); }
.theme-light .mini-stat .ms-label { color: var(--text-dim); }
.theme-light .mini-stat .ms-value { color: var(--text); }
.theme-light .mini-stat .ms-value.gold { color: var(--gold); }
.theme-light .mini-stat .ms-value.cyan { color: var(--accent); }
.theme-light .mini-stat .ms-value.pink { color: var(--accent-purple); }
.theme-light .mini-stat .ms-value.green { color: var(--green); }
.theme-light .badge-elf { color: var(--green); border-color: rgba(5,150,105,0.3); background: rgba(5,150,105,0.06); }
.theme-light .badge-human { color: #d97706; border-color: rgba(217,119,6,0.3); background: rgba(217,119,6,0.06); }
.theme-light .badge-active { color: var(--green); border-color: rgba(5,150,105,0.3); background: rgba(5,150,105,0.06); }
.theme-light .badge-inactive { color: var(--red); border-color: rgba(220,38,38,0.3); background: rgba(220,38,38,0.06); }
.theme-light .badge.role-archmage { color: #b8860b; border-color: rgba(184,134,11,0.3); background: rgba(184,134,11,0.06); }
.theme-light .badge.role-mage { color: #0088aa; border-color: rgba(0,136,170,0.2); background: rgba(0,136,170,0.04); }
.theme-light .badge.role-member { color: #888; border-color: rgba(0,0,0,0.06); background: rgba(0,0,0,0.02); }
.theme-light .server-badge { background: rgba(8,145,178,0.06); border-color: rgba(8,145,178,0.15); color: var(--text-dim); }
.theme-light .meta-item { background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.06); }
.theme-light .meta-item.gold { color: var(--gold); border-color: rgba(217,119,6,0.27); }
.theme-light .meta-item.cyan { color: var(--accent); border-color: rgba(8,145,178,0.27); }
.theme-light .meta-item.pink { color: var(--accent-purple); border-color: rgba(233,30,157,0.27); }
.theme-light .meta-item.green { color: var(--green); border-color: rgba(5,150,105,0.27); }
.theme-light .section-divider { border-color: var(--border); }
.theme-light .section-header .section-title { color: var(--text-dim); }
.theme-light .view-header h1 { color: var(--text); text-shadow: none; }
.theme-light .view-header p { color: var(--text-dim); }
.theme-light h1, .theme-light h2, .theme-light h3, .theme-light h4 { color: var(--text); }
.theme-light .tourney-table th { color: var(--text-muted); border-bottom-color: var(--border); }
.theme-light .tourney-table td { border-bottom-color: rgba(0,0,0,0.03); color: var(--text); }
.theme-light .tourney-table td.num { color: var(--text); }
.theme-light .p-link { color: var(--accent); }
.theme-light .p-link:hover { color: var(--accent-dim); }
.theme-light .status-stat-pill { background: rgba(0,0,0,0.02); border-color: var(--border); }
.theme-light .status-mini-header { color: var(--text-dim); }
.theme-light .status-mini-table th { color: var(--text-muted); }
.theme-light .status-count { color: var(--text); }
.theme-light .status-label { color: var(--text-dim); }
.theme-light .status-sub-label { color: var(--text-muted); }
.theme-light .stat-card { background: var(--bg-card); border-color: var(--border); }
.theme-light .stat-card .stat-label { color: var(--text-dim); }
.theme-light .stat-card .stat-value { color: var(--text); }
.theme-light .sc-footer { color: var(--text-muted); border-top-color: var(--border); }
.theme-light .view-header h1 i { color: var(--accent); }
/* Admin view headers in light theme: pink icons */
.theme-light .view-header[data-view-admin] h1 i { color: var(--accent-purple); }
.theme-light .badge-strip span { border-color: var(--border); background: var(--bg-card-solid); }
/* ══ Table light theme ══ */
.theme-light .table-wrap { background: var(--bg-card); border-color: var(--border); }
.theme-light .tourney-table tr:hover td { background: var(--bg-hover); }
.theme-light .tourney-table .boost-pct { color: var(--green); }
.theme-light .status-mini-table-wrap { border-color: var(--border); }
.theme-light .status-mini-table thead th { background: rgba(0,0,0,0.04); color: var(--text-muted); border-bottom-color: var(--border); }
.theme-light .status-mini-table td { color: var(--text); border-bottom-color: rgba(0,0,0,0.03); }
.theme-light .pagination button { background: var(--bg-card-solid); border-color: var(--border); color: var(--text-dim); }
.theme-light .pagination button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.theme-light .pagination span { color: var(--text-muted); }
.theme-light .controls select, .theme-light .controls input { background: var(--bg-card-solid); border-color: var(--border); color: var(--text); }
.theme-light #p-filter-name { background: var(--bg-card-solid); border-color: var(--border); color: var(--text); }
.theme-light .pagination button:disabled { opacity: 0.3; }

body {
  background: var(--bg);
  font-family: 'Rajdhani', sans-serif;
  color: var(--text);
  min-height: 100vh;
  display: flex;
}

/* ══ View Header Class ══ */
.vh { font-family:'Orbitron',sans-serif; font-size:24px; font-weight:900; letter-spacing:3px; text-transform:uppercase; color:var(--text); margin-bottom:4px; }
.subtitle { font-size:14px; color:var(--text-dim); margin-bottom:16px; }
.cyber-accent { color: var(--text); }

/* ═══ LAYOUT ═══ */
.app { display: flex; width: 100%; min-height: 100vh; background: var(--bg); }

/* ═══ SIDEBAR ═══ */
.sidebar {
  width: 210px;
  min-height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; z-index: 200;
  padding: 14px 8px;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}
.logo-text {
  font-family: 'Orbitron', sans-serif;
  font-size: 15px;
  font-weight: 900;
  color: #fff;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
}
.logo-a { color: #ff00aa; }
.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; border-radius: 6px;
  color: #888; text-decoration: none;
  font-size: 13px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.5px;
  transition: all .2s; cursor: pointer;
  border: 1px solid transparent;
}
.sidebar-nav a:hover { color: var(--accent-purple); background: rgba(255,0,170,0.05); border-color: rgba(255,0,170,0.1); }
.sidebar-nav a.active { color: var(--accent-purple); background: rgba(255,0,170,0.08); border-color: rgba(255,0,170,0.2); }
.sidebar-nav a i { width: 18px; text-align: center; font-size: 14px; }
.sidebar-nav a[data-role="admin"] { display: none; } /* hidden by default, shown by JS if auth'd */
.sidebar-nav a[data-role="admin"].auth-shown { display: flex; }
.sidebar-nav a[data-role="admin"]:hover { color: #ff00aa; background: rgba(255,0,170,0.05); border-color: rgba(255,0,170,0.1); }
.sidebar-nav a[data-role="admin"].active { color: #ff00aa; background: rgba(255,0,170,0.08); border-color: rgba(255,0,170,0.2); }
/* ── Sidebar Collapse ─────────────────────────────────── */
.sidebar-header { display:flex; align-items:center; gap:4px; padding:0 6px 20px; border-bottom:1px solid rgba(255,255,255,0.06); position:relative; }
.sidebar-logo { flex:1; }
.sidebar-collapse-btn { background:none; border:1px solid rgba(255,255,255,0.06); color:#888; width:20px; height:20px; border-radius:3px; cursor:pointer; display:flex; align-items:center; justify-content:center; font-size:8px; opacity:0.6; transition:all .2s; flex-shrink:0; }
.sidebar-collapse-btn:hover { opacity:1; color:var(--accent); border-color:var(--accent); }
.sidebar.collapsed { width:60px; }
.sidebar.collapsed .logo-text { display:none; }
.sidebar.collapsed .ea-logo { display:flex; align-items:center; justify-content:center; width:100%; }
.ea-logo { display:none; font-family:'Orbitron',sans-serif; font-size:22px; font-weight:900; color:var(--text); letter-spacing:0; line-height:1; }
.ea-logo .ea-pink { color:#ff00aa; }
.theme-light .ea-logo { color:var(--text); }
.theme-light .ea-logo .ea-pink { color:var(--accent-purple); }
.sidebar.collapsed .sidebar-header { justify-content:center; padding:8px 0 16px; gap:0; }
.sidebar.collapsed .sidebar-logo { flex:none; width:auto; display:flex; align-items:center; justify-content:center; }
.sidebar.collapsed .sidebar-nav a span { display:none; }
.sidebar.collapsed .sidebar-nav a { justify-content:center; padding:8px 0; }
.sidebar.collapsed .sidebar-nav a i { font-size:16px; width:auto; }
.sidebar.collapsed .sidebar-footer { display:none; }
.sidebar.collapsed ~ .topbar { left:60px; }
.sidebar.collapsed ~ .main-area { margin-left:60px; max-width:calc(100vw - 60px); }
.sidebar.collapsed ~ .sidebar-overlay { display:none !important; }

.sidebar-footer {
  padding: 12px 8px 0;
  border-top: 1px solid rgba(255,255,255,0.06);
  margin-top: auto;
  flex-shrink: 0;
  font-size: 11px; color: #555;
}
.version-badge {
  font-family: 'Orbitron', sans-serif;
  font-size: 10px;
  color: #666;
  letter-spacing: 0.5px;
  text-align: center;
  padding: 4px 0;
}
.version-badge::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #00ff88;
  margin-right: 5px;
  vertical-align: middle;
}
#sidebar-stats {
  text-align: center;
  font-size: 10px;
  color: #555;
  margin-top: 6px;
  font-family: 'Rajdhani', sans-serif;
  letter-spacing: 0.3px;
}
.sidebar-author {
  text-align: center;
  font-size: 9px;
  color: #444;
  margin-top: 2px;
  margin-bottom: 4px;
  font-style: italic;
}
.theme-light #sidebar-stats { color: var(--text-muted); }
.theme-light .sidebar-author { color: var(--text-muted); }

/* Sidebar donate */
.sidebar-donate { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 8px; }
.sidebar-donate a { transition: opacity 0.2s; opacity: 0.6; }
.sidebar-donate a:hover { opacity: 1; }
.sidebar.collapsed .sidebar-donate { display: none; }

/* Main area */
.main-area { flex: 1; margin-left: 210px; padding: 72px 28px 28px; max-width: calc(100vw - 210px); }
.main-area-inner { max-width: 1400px; width: 100%; }

/* ═══ MAGAZINE GRID ═══ */
.magazine { display: grid; grid-template-columns: 1fr 1.4fr; gap: 14px; align-items: start; }
.left-col { display: flex; flex-direction: column; gap: 10px; }
.right-col { display: flex; flex-direction: column; gap: 10px; }

/* ══ HERO BLOCK (redesigned player detail) ══ */
.hero-block {
  background: var(--bg-card-solid);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  padding: 20px 24px 16px;
  position: relative;
  overflow: hidden;
}
.hero-block::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0,240,255,0.05), transparent 60%);
  pointer-events: none;
}
.pd-hero-top {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.pd-hero-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.pd-hero-name {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: 32px;
  color: #fff;
  letter-spacing: 3px;
  text-transform: uppercase;
  line-height: 1;
}
.pd-hero-name i { color: var(--accent-purple); margin-right: 8px; font-size: 26px; }
.pd-hero-flag-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(0,240,255,0.06);
  border: 1px solid rgba(0,240,255,0.15);
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #c8c8d0;
  font-family: 'Orbitron', sans-serif;
  letter-spacing: 0.5px;
}
.pd-hero-meta-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.pd-hero-meta-row .meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
}
.pd-hero-meta-row .meta-item.gold { color: #ffcc00; border-color: #ffcc0044; }
.pd-hero-meta-row .meta-item.cyan { color: #00f0ff; border-color: #00f0ff44; }
.pd-hero-meta-row .meta-item.pink { color: #ff00aa; border-color: #ff00aa44; }
.pd-hero-meta-row .meta-item.green { color: #00ff88; border-color: #00ff8844; }
.pd-hero-quick-stats {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.stats-grid-sm {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  margin-bottom: 0;
}
.stats-grid-sm .stat-card {
  padding: 10px 12px;
  border-radius: 10px;
}
.stats-grid-sm .stat-card .stat-icon {
  font-size: 16px;
  margin-bottom: 2px;
}
.stats-grid-sm .stat-card .stat-value {
  font-size: 17px;
}
.stats-grid-sm .stat-card .stat-value.gold { color: #ffcc00; }
.stats-grid-sm .stat-card .stat-value.cyan { color: #00f0ff; }
.stats-grid-sm .stat-card .stat-value.pink { color: #ff00aa; }
.stats-grid-sm .stat-card .stat-value.green { color: #00ff88; }
.stats-grid-sm .stat-card .stat-label {
  font-size: 9px;
  margin-top: 1px;
}

/* ══ BADGE GRID (achievements — stacked style) ══ */
.pd-badge-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.pd-badge-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 20px 10px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--badge-color, #888) 6%, var(--bg-card-solid, #0d0d14));
  border: 2px solid color-mix(in srgb, var(--badge-color, #888) 30%, transparent);
  transition: all 0.3s ease;
  cursor: default;
  min-width: 80px;
  position: relative;
  overflow: visible;
}
.pd-badge-item::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--badge-color, #888), transparent);
  opacity: 0.6;
  transition: opacity 0.3s;
}
.pd-badge-item:hover::after { opacity: 1; }
.pd-badge-item i {
  font-size: 28px;
  color: var(--badge-color, #888);
  filter: drop-shadow(0 0 12px color-mix(in srgb, var(--badge-color, #888) 40%, transparent));
  transition: transform 0.3s;
}
.pd-badge-item:hover i { transform: scale(1.15); }
.pd-badge-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.3px;
  text-align: center;
  line-height: 1.2;
}
.pd-badge-item:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--badge-color, #888) 60%, transparent);
  box-shadow: 0 8px 28px rgba(0,0,0,0.4), 0 0 40px color-mix(in srgb, var(--badge-color, #888) 15%, transparent);
}
.pd-badge-item .pd-badge-tip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  font-size: 11px;
  color: var(--text-dim);
  background: var(--bg-card-solid, #0d0d14);
  border: 1px solid color-mix(in srgb, var(--badge-color, #888) 30%, transparent);
  padding: 8px 12px;
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
  z-index: 5;
  line-height: 1.4;
}
.pd-badge-item .pd-badge-tip strong { color: var(--badge-color, #888); font-size: 12px; }
.pd-badge-item:hover .pd-badge-tip {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}
.pd-badge-item.locked {
  filter: grayscale(1) opacity(0.5);
  pointer-events: none;
}
.theme-light .pd-badge-item {
  background: color-mix(in srgb, var(--badge-color, #888) 5%, var(--bg, #f0f4f8));
}
.theme-light .pd-badge-name { color: #475569; }
.theme-light .pd-badge-item .pd-badge-tip { background: var(--bg-card, #fff); }
.theme-light .hero-block { background: var(--bg-card); border-color: var(--border); }
.theme-light .pd-hero-name { color: var(--text); }
.theme-light .pd-hero-flag-badge { background: rgba(8,145,178,0.06); border-color: rgba(8,145,178,0.15); color: var(--text-dim); }
.theme-light .pd-hero-meta-row .meta-item { background: rgba(0,0,0,0.02); border-color: rgba(0,0,0,0.08); color: var(--text-dim); }
.theme-light .chart-empty-state { color: #607080; }

/* ══ Chart empty state ══ */
.chart-empty-state {
  width: 100%;
  color: #444;
  padding: 20px;
  text-align: center;
  font-size: 13px;
}

/* ══ HERO SPREAD ══ */
.hero-spread {
  background: var(--bg-card-solid);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  padding: 20px 24px;
  position: relative;
  overflow: hidden;
}
.hero-spread::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0,240,255,0.05), transparent 60%);
  pointer-events: none;
}
.hero-spread .player-name {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: 48px;
  color: #fff;
  letter-spacing: 4px;
  text-transform: uppercase;
  line-height: 1;
}
.hero-spread .player-name i { color: #00f0ff; margin-right: 8px; font-size: 36px; }
.hero-spread .player-tagline { font-size: 18px; color: #888; font-weight: 500; margin-top: 6px; letter-spacing: 1px; }
.hero-spread .player-meta { display: flex; gap: 16px; margin-top: 16px; flex-wrap: wrap; }
.hero-spread .meta-item {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 14px; border-radius: 20px;
  font-size: 13px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
}
.hero-spread .meta-item.gold { color: #ffcc00; border-color: #ffcc0044; }
.hero-spread .meta-item.cyan { color: #00f0ff; border-color: #00f0ff44; }
.hero-spread .meta-item.pink { color: #ff00aa; border-color: #ff00aa44; }
.hero-spread .meta-item.green { color: #00ff88; border-color: #00ff8844; }

/* ══ FEATURED STAT ══ */
.featured-stat {
  background: var(--bg-card-solid);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.featured-stat::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #ffcc00, transparent);
}
.featured-stat .big-number {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900; font-size: 54px;
  color: #ffcc00; line-height: 1;
  letter-spacing: 3px;
}
.featured-stat .big-label {
  font-size: 13px; text-transform: uppercase;
  letter-spacing: 3px; color: #666;
  margin-top: 6px; font-weight: 600;
}
.featured-stat .big-sub { font-size: 14px; color: #888; margin-top: 4px; }

/* ══ INFO CARD ══ */
.info-card {
  background: var(--bg-card-solid);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  padding: 20px;
}
.info-card h3 {
  font-family: 'Orbitron', sans-serif;
  font-size: 11px; letter-spacing: 2px;
  text-transform: uppercase; color: #555;
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.info-card h3 i { color: #00f0ff; }

/* ══ MINI STATS ══ */
.mini-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mini-stat { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.04); }
.mini-stat .ms-label { font-size: 13px; color: #888; }
.mini-stat .ms-value { font-family: 'Orbitron', sans-serif; font-weight: 600; font-size: 15px; color: #fff; }
.mini-stat .ms-value.gold { color: #ffcc00; }
.mini-stat .ms-value.cyan { color: #00f0ff; }
.mini-stat .ms-value.pink { color: #ff00aa; }
.mini-stat .ms-value.green { color: #00ff88; }

/* ══ BADGE STRIP ══ */
.badge-strip { display: flex; flex-wrap: wrap; gap: 6px; }
.badge-strip span {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  transition: all .2s;
}
.badge-strip span:hover { border-color: #00f0ff44; transform: scale(1.1); }
.badge-strip span.dim { opacity: 0.15; filter: grayscale(1); }

/* ══ CHART CARD ══ */
.chart-card {
  background: var(--bg-card-solid);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  padding: 18px;
  position: relative;
  overflow: hidden;
}
.chart-card h3 {
  font-family: 'Orbitron', sans-serif;
  font-size: 11px; letter-spacing: 2px;
  text-transform: uppercase; color: #555;
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.chart-card h3 i { color: #00f0ff; }

/* ══ CHART ROW (side-by-side cards) ══ */
.chart-row {
  display: flex;
  gap: 16px;
  margin-top: 16px;
}
.chart-half {
  flex: 1;
  min-width: 0;
}
@media (max-width: 900px) {
  .chart-row { flex-direction: column; }
  .chart-half { width: 100%; }
}

/* ══ CSS CHART ══ */
.css-chart { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 8px; }
.css-chart-wide { height: 200px; gap: 10px; padding-top: 24px; position: relative; overflow: visible; box-sizing: content-box; }
.css-bar {
  flex: 1; border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, var(--accent), var(--accent-dim));
  min-height: 4px; position: relative; transition: height 0.6s ease;
}
.css-bar::after {
  content: attr(data-label);
  position: absolute; top: -18px; left: 50%;
  transform: translateX(-50%);
  font-size: 9px; color: var(--text-muted);
  font-family: 'Orbitron', sans-serif;
  white-space: nowrap;
}
.css-bar .chart-tooltip,
.chart-col .css-bar .chart-tooltip {
  display: none; position: absolute; bottom: 100%; left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card-solid); color: var(--text); font-size: 11px;
  padding: 4px 8px; border-radius: 4px;
  white-space: nowrap; z-index: 2;
  font-family: 'Rajdhani', sans-serif;
  border: 1px solid var(--border);
  margin-bottom: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.css-bar:hover .chart-tooltip { display: block; }
.chart-inner {
  display: flex; align-items: flex-end; gap: 10px;
  flex: 1; height: 100%; position: relative; z-index: 1;
  margin-left: 52px; margin-top: 0;
}
.chart-scale {
  position: absolute; top: 24px; right: 0; bottom: 0; left: 0; z-index: 0;
  pointer-events: none; overflow: visible;
}
.chart-scale-line {
  position: absolute; left: 52px; right: 4px;
  border-top: 1px dashed var(--border);
}
.chart-scale-label {
  position: absolute; left: 0;
  font-size: 9px; color: var(--text-muted);
  font-family: 'Orbitron', sans-serif;
  transform: translateY(-50%);
  line-height: 1;
}
.chart-col {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end;
  height: 100%; position: relative;
}
.chart-col .css-bar {
  width: 100%; flex: none;
}
.chart-col .css-bar:hover { opacity: 0.85; box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 40%, transparent); }
.css-chart-wide .chart-inner { gap: 3px; }
.css-chart-wide .chart-col { min-width: 18px; }
.css-chart-wide .chart-col .css-bar { min-width: 12px; }
.bar-date {
  font-size: 8px; color: var(--text-muted); margin-top: 4px;
  font-family: 'Orbitron', sans-serif;
  white-space: nowrap; line-height: 1;
}
.chart-footer {
  margin-top: 8px; display: flex;
  justify-content: space-between;
  font-size: 10px; color: var(--text-muted);
  font-family: 'Orbitron', sans-serif; letter-spacing: 0.5px;
}
.chart-page-info {
  font-size: 10px; color: var(--text-muted);
  min-width: 60px; text-align: center;
}

/* ══ TOURNEY TABLE ══ */
.tourney-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tourney-table th {
  text-align: left; padding: 8px 10px;
  font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.5px; color: #666; font-weight: 600;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.tourney-table td { padding: 8px 10px; border-bottom: 1px solid rgba(255,255,255,0.03); color: #c8c8d0; }
.tourney-table td.num { font-family: 'Orbitron', sans-serif; font-weight: 600; font-size: 12px; color: #fff; padding: 6px 10px; }
.tourney-table tr:hover td { background: rgba(255,255,255,0.02); }
.tourney-table .boost-pct { color: #00ff88; font-weight: 700; }
.tourney-table td .server-badge { font-size: 11px; }

.relic-dot { width: 20px; height: 20px; border-radius: 4px; display: inline-block; vertical-align: middle; margin-right: 6px; }
.tourney-table .boosts-cell { text-align: center; vertical-align: middle; white-space: nowrap; }
.tourney-table .boosts-cell .relic-dot:last-child { margin-right: 0; }

/* ══ WONDER MINI (dashboard) ══ */
.wonder-mini { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; }
#dash-top-wonders { display: flex; flex-direction: column; gap: 6px; padding: 4px 0; }
#dash-top-wonders .ms-label { font-size:13px; }
.theme-light #dash-top-wonders .ms-label { color:var(--text); }
.wonder-mini-item { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.wonder-mini-item .w-icon { width: 24px; height: 24px; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 12px; background: rgba(0,240,255,0.06); color: #00f0ff; flex-shrink: 0; }
.wonder-mini-item .w-name { flex: 1; font-size: 13px; color: #c8c8d0; }
.wonder-mini-item .w-lvl { font-family: 'Orbitron', sans-serif; font-weight: 600; font-size: 13px; color: #ffcc00; }

/* ══ WONDERS: Commander's View (Layout 5) ══ */

/* Header */
.wonders-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; padding: 14px 18px;
  background: var(--bg-card); border: 1px solid rgba(0,240,255,0.08);
  border-radius: var(--radius);
  flex-wrap: wrap; gap: 12px;
  position: relative;
}
.wonders-header::before {
  content: ''; position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
}
.wonders-title {
  font-family: 'Orbitron', monospace; font-size: 12px; font-weight: 700;
  color: var(--accent); letter-spacing: 4px; text-transform: uppercase;
}
.wonders-title i { margin-right: 8px; }
.wonders-hs-group { display: flex; gap: 16px; }
.wonders-hs-cell { text-align: center; padding: 0 8px; position: relative; }
.wonders-hs-cell + .wonders-hs-cell::before {
  content: ''; position: absolute; left: -8px; top: 2px; bottom: 2px;
  width: 1px; background: rgba(255,255,255,0.04);
}
.wonders-hs-value {
  font-family: 'Orbitron', monospace; font-size: 16px; font-weight: 800;
  color: #fff; line-height: 1;
}
.wonders-hs-label {
  font-size: 8px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1px; margin-top: 2px;
}

/* Wonder rows */
.wonders-list { display: flex; flex-direction: column; gap: 4px; }
.wonder-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: var(--bg-card); border: 1px solid rgba(255,255,255,0.03);
  border-radius: var(--radius);
  transition: all 0.15s ease; position: relative;
}
.wonder-row:hover {
  background: rgba(0,240,255,0.02); border-color: rgba(0,240,255,0.08);
}
.wonder-row-rank {
  font-family: 'Orbitron', monospace; font-size: 10px;
  color: var(--text-muted); min-width: 20px; text-align: right;
  letter-spacing: 0.5px;
}
.wonder-icon-wrap {
  position: relative; flex-shrink: 0; display: flex;
}
.wonder-row-icon {
  width: 28px; height: 28px; object-fit: contain;
  border-radius: 4px; background: rgba(255,255,255,0.03);
  padding: 2px; cursor: pointer;
}
/* Hover preview: larger thumbnail above the icon */
.wonder-icon-preview {
  position: absolute; bottom: calc(100% + 8px); left: 50%;
  transform: translateX(-50%); display: none; z-index: 100;
  pointer-events: none;
}
.wonder-icon-wrap:hover .wonder-icon-preview { display: block; }
.wonder-icon-preview img {
  width: 96px; height: 96px; object-fit: contain;
  border-radius: 8px;
  background: var(--bg-card); border: 1px solid rgba(0,240,255,0.2);
  padding: 6px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.6), 0 0 30px rgba(0,240,255,0.05);
}
.wonder-icon-preview::after {
  content: ''; position: absolute; top: 100%; left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: var(--bg-card);
}
.theme-light .wonder-icon-preview img {
  background: var(--bg-card-solid);
  border-color: rgba(0,0,0,0.12);
  box-shadow: 0 4px 24px rgba(0,0,0,0.15);
}
.theme-light .wonder-icon-preview::after { border-top-color: var(--bg-card-solid); }
.wonder-row-name {
  flex: 1; font-size: 14px; font-weight: 600;
  color: #d0d8e0; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wonder-row-tier-badge {
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; padding: 2px 8px; border-radius: 3px;
  background: var(--tier-bg, rgba(255,255,255,0.04));
  color: var(--tier-color, #888);
  border: 1px solid var(--tier-border, rgba(255,255,255,0.06));
  flex-shrink: 0;
}
.wonder-row-level {
  font-family: 'Orbitron', monospace; font-size: 18px; font-weight: 800;
  color: var(--tier-color, #888);
  min-width: 32px; text-align: right; letter-spacing: 1px; flex-shrink: 0;
}
.wonder-row-pct {
  font-size: 10px; color: var(--text-muted);
  font-weight: 600; min-width: 30px; text-align: right; flex-shrink: 0;
}

/* Segmented bar (35 segments) */
.wonder-row-bar { display: flex; gap: 2px; flex-shrink: 0; }
.wonder-row-bar-seg {
  width: 6px; height: 14px; border-radius: 1px;
  background: rgba(255,255,255,0.06);
  transition: all 0.2s;
}
.wonder-row-bar-seg.filled { background: var(--tier-color, #666); box-shadow: 0 0 6px var(--tier-glow, transparent); }
.wonder-row-bar-seg.active { background: var(--tier-color, #666); box-shadow: 0 0 8px var(--tier-glow, transparent); }

/* Tier badges */
[data-tier="elite"]  { --tier-color: #ffd700; --tier-bg: rgba(255,215,0,0.08); --tier-border: rgba(255,215,0,0.15); --tier-glow: rgba(255,215,0,0.3); }
[data-tier="veteran"]{ --tier-color: #00ff88; --tier-bg: rgba(0,255,136,0.06); --tier-border: rgba(0,255,136,0.12); --tier-glow: rgba(0,255,136,0.2); }
[data-tier="adept"]  { --tier-color: #00aaff; --tier-bg: rgba(0,170,255,0.05); --tier-border: rgba(0,170,255,0.10); --tier-glow: rgba(0,170,255,0.15); }
[data-tier="novice"] { --tier-color: #8888ff; --tier-bg: rgba(136,136,255,0.04); --tier-border: rgba(136,136,255,0.08); --tier-glow: rgba(136,136,255,0.1); }
[data-tier="fledgling"]{--tier-color: #666;   --tier-bg: rgba(100,100,100,0.03); --tier-border: rgba(100,100,100,0.06); --tier-glow: transparent; }

/* Light theme */
.theme-light .wonders-header { background: var(--bg-card-solid); border-color: rgba(0,0,0,0.08); }
.theme-light .wonders-title { color: var(--accent); }
.theme-light .wonders-hs-value { color: var(--text); }
.theme-light .wonder-row { background: var(--bg-card-solid); }
.theme-light .wonder-row-name { color: var(--text); }
.theme-light .wonder-row:hover { background: rgba(0,0,0,0.02); }

/* Responsive */
@media (max-width: 820px) {
  .wonder-row-bar { gap: 1px; }
  .wonder-row-bar-seg { width: 4px; height: 12px; }
  .wonder-row-tier-badge { display: none; }
}
@media (max-width: 600px) {
  .wonder-row { padding: 8px 10px; gap: 8px; }
  .wonder-row-rank { display: none; }
  .wonder-row-bar-seg { width: 3px; height: 10px; }
  .wonder-row-pct { display: none; }
  .wonder-row-level { font-size: 15px; min-width: 24px; }
  .wonder-row-icon { width: 22px; height: 22px; }
  .wonders-header { padding: 12px 14px; }
}
@media (max-width: 420px) {
  .wonder-row-name { font-size: 12px; }
  .wonder-row-bar-seg { width: 3px; height: 8px; }
}

/* ══ SECTION HEADER (for full-width sections) ══ */
.section { margin-bottom: 24px; }
.section-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; flex-wrap: wrap; gap: 12px;
}
.section-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 16px; font-weight: 600; color: #fff;
  letter-spacing: 2px; text-transform: uppercase;
}
.section-title i { color: #00f0ff; margin-right: 8px; }
.total-count {
  font-size: 12px; color: #666;
  padding: 4px 12px;
  background: var(--bg-card-solid);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
}

/* ══ STATS GRID ══ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card-solid);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  padding: 18px 20px;
  transition: all .2s;
}
.stat-card:hover { border-color: rgba(0,240,255,0.15); }
.stat-card .stat-icon { font-size: 24px; margin-bottom: 6px; display: block; color: #00f0ff; }
.stat-card .stat-value { font-family: 'Orbitron', sans-serif; font-size: 24px; font-weight: 700; color: #fff; display: block; }
.stat-card .stat-label { font-size: 11px; color: #666; text-transform: uppercase; letter-spacing: 1px; margin-top: 2px; display: block; }

/* ══ FILTER BAR GLASS PANEL ══ */
#p-controls {
  background: var(--bg-card-solid);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 10px 14px;
  backdrop-filter: blur(4px);
}
#p-filter-name { width: 160px; }

/* ══ TABLE ══ */
.table-wrap { overflow-x: auto; background: var(--bg-card-solid); border: 1px solid var(--border); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; min-width: 500px; }
thead th {
  background: rgba(255,255,255,0.02);
  color: #00f0ff;
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1px;
  padding: 10px 12px; text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  white-space: nowrap; font-family: 'Orbitron', sans-serif;
}
td { padding: 8px 12px; font-size: 13px; border-bottom: 1px solid rgba(255,255,255,0.03); color: #c8c8d0; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(255,255,255,0.02); }
.p-link { color: #00ff88; text-decoration: none; font-weight: 600; cursor: pointer; }
.p-link:hover { color: #00f0ff; }
.sortable { cursor: pointer; }
.sortable:hover { color: #fff; }
.sort-icon { font-size: 8px; margin-left: 4px; color: #555; transition: color .2s; }
.sort-icon:not(:empty) { color: #00f0ff; }
.sortable:hover .sort-icon { color: #fff; }

/* ══ CONTROLS ══ */
.controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.controls select, .controls input {
  background: var(--bg-card-solid);
  color: #c8c8d0;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px; font-family: 'Rajdhani', sans-serif;
  outline: none; transition: all .2s;
}
.controls select:focus, .controls input:focus { border-color: #00f0ff44; }
.controls select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23888' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  padding-right: 30px; cursor: pointer;
}
#rank-filter, #global-filter, #gt-filter, #tourn-filter, #t-filter {
  background: var(--bg-card-solid); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 10px; font-size: 12px; font-family: 'Rajdhani', sans-serif;
  outline: none; transition: border-color .2s;
}
#tourn-filter:focus, #t-filter:focus { border-color: var(--accent); }
/* ══ CUSTOM SELECT (Tournament dropdown) ══ */
.sel-wrap { position: relative; width: 300px; }
.sel-btn {
  width: 100%; cursor: pointer; text-align: left;
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-card-solid); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px; font-family: 'Rajdhani', sans-serif;
  transition: border-color .2s;
}
.sel-btn:hover { border-color: rgba(0,240,255,0.3); }
.sel-btn #t-sel-relic {
  display: inline-flex; align-items: center; gap: 6px; flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sel-btn .fa-chevron-down { color: var(--text-muted); font-size: 10px; }
.sel-dd {
  display: none; position: absolute; top: 100%; left: 0; right: 0;
  background: var(--bg-card-solid); border: 1px solid var(--border);
  border-radius: 8px; max-height: 350px; overflow-y: auto;
  z-index: 100; margin-top: 4px;
}
.sel-item {
  padding: 7px 12px; cursor: pointer; display: flex; align-items: center;
  gap: 8px; font-size: 12px; color: var(--text);
  border-bottom: 1px solid var(--border); transition: background .15s;
}
.sel-item:hover { background: var(--bg-hover); }
.sel-item:last-child { border-bottom: none; }
.sel-item img { vertical-align: middle; border-radius: 3px; }
.sel-relic-placeholder {
  display: inline-block; width: 16px; height: 16px;
  border-radius: 3px; background: var(--text-muted); opacity: 0.15;
  vertical-align: middle;
}
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; background: var(--bg-card-solid);
  color: #c8c8d0; border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px; font-size: 13px; font-family: 'Rajdhani', sans-serif;
  cursor: pointer; transition: all .2s; white-space: nowrap;
}
.btn:hover { border-color: #00f0ff44; color: #00f0ff; }
.btn-primary { background: #00f0ff; color: #050508; border-color: #00f0ff; font-weight: 700; }
.btn-primary:hover { background: #00ccdd; color: #050508; }
.btn-sm { padding: 5px 10px; font-size: 11px; }
.btn:disabled { opacity: 0.3; cursor: not-allowed; pointer-events: none; }

/* ══ PAGINATION ══ */
.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; }
.pagination button {
  background: var(--bg-card-solid); color: #c8c8d0;
  border: 1px solid rgba(255,255,255,0.06); padding: 6px 14px;
  cursor: pointer; font-size: 12px; font-family: 'Rajdhani', sans-serif;
  transition: all .2s; border-radius: 8px; text-transform: uppercase; letter-spacing: 1px;
}
.pagination button:hover:not(:disabled) { border-color: #00f0ff44; color: #00f0ff; }
.pagination button:disabled { opacity: 0.3; cursor: default; }
.pagination span { color: #666; font-size: 12px; min-width: 80px; text-align: center; font-family: 'Orbitron', sans-serif; }

/* ══ TOPBAR EXTRAS ══ */
.topbar-divider { width:1px; height:24px; background:rgba(255,255,255,0.08); margin:0 4px; flex-shrink:0; }
.topbar-lang { background:rgba(255,255,255,0.03); border:1px solid rgba(255,255,255,0.06); color:#888; width:48px; height:36px; border-radius:8px; cursor:pointer; font-size:16px; text-align:center; padding:2px 4px; appearance:none; -webkit-appearance:none; }

/* ══ LIGHT THEME ══ */
/* ══ General Stats + Map light theme ══ */
.theme-light .gs-chart-wrap { background: var(--bg-card); border-color: var(--border); }
.theme-light .gs-chart-title { color: var(--text-dim); }
.theme-light .gs-panel { background: var(--bg-card); border-color: var(--border); }
.theme-light .gs-panel-title { color: var(--text-muted); }
.theme-light .gs-section-title { color: var(--text-dim); }
.theme-light .gs-big-number { color: var(--gold); }
.theme-light .map-server { background: var(--bg-card); border-color: var(--border); }
.theme-light .map-server h3 { color: var(--text); }
.theme-light .map-server .ms-players { color: var(--accent); }
.theme-light .map-server .ms-label { color: var(--text-muted); }
.theme-light .map-server .ms-id { color: var(--text-muted); }
.theme-light .gs-wonder-item { border-bottom-color: rgba(0,0,0,0.04); }
.theme-light .gs-wonder-level,
.theme-light .gs-city-value,
.theme-light .gs-growth-val { color: var(--gold); }
.theme-light .gs-growth-val.negative { color: var(--red); }
.theme-light .gs-old-item { border-bottom-color: rgba(0,0,0,0.04); }
.theme-light .gs-old-date { color: var(--text-muted); }
.theme-light .gs-city-item { border-bottom-color: rgba(0,0,0,0.04); }
.theme-light .gs-rank-row { border-bottom-color: rgba(0,0,0,0.04); }
.theme-light .daemon-card { background: var(--bg-card); border-color: var(--border); }
.theme-light .daemon-card .dc-label { color: var(--text-dim); }
.theme-light .daemon-card .dc-value { color: var(--text); }
.theme-light .cyber-accent { color: var(--text); opacity:0.4; }

/* ══ SEARCH ══ */
.search-box { position: relative; flex: 1; max-width: 360px; }
.search-box input {
  width: 100%; padding: 8px 12px 8px 32px;
  background: var(--bg-card-solid); border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px; color: #c8c8d0;
  font-size: 13px; font-family: 'Rajdhani', sans-serif;
  outline: none; transition: all .2s;
}
.search-box input:focus { border-color: #00f0ff44; }
.search-box input::placeholder { color: #555; }
.search-box i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #555; }
#search-results {
  display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--bg-card-solid); border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px; max-height: 360px; overflow-y: auto; z-index: 300;
}
.search-result-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; cursor: pointer; border-bottom: 1px solid rgba(255,255,255,0.04); }
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: rgba(0,240,255,0.03); }
.search-result-name { color: #00f0ff; font-weight: 600; }
.search-result-meta { color: #666; font-size: 12px; }

/* ══ TOPBAR ══ */
.topbar { height:52px; background:var(--bg-topbar); backdrop-filter:blur(16px); -webkit-backdrop-filter:blur(16px); border-bottom:1px solid var(--border); display:flex; align-items:center; gap:1rem; padding:0 1.5rem; position:fixed; top:0; left:210px; right:0; z-index:50; }
.sidebar-toggle { display:none; background:none; border:none; color:var(--text); font-size:1.4rem; cursor:pointer; padding:0.25rem; border-radius:4px; }
.sidebar-toggle:hover { background:rgba(255,255,255,0.05); }
.topbar-actions { display:flex; align-items:center; gap:0.5rem; margin-left:auto; }
.btn-icon { background:rgba(255,255,255,0.03); border:1px solid rgba(255,255,255,0.06); color:#888; width:36px; height:36px; border-radius:8px; cursor:pointer; display:flex; align-items:center; justify-content:center; font-size:1rem; transition:all .2s; }
.btn-icon:hover { background:rgba(255,255,255,0.06); color:var(--text); border-color:var(--accent); }
.sidebar-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.6); backdrop-filter:blur(4px); z-index:150; }

@media (max-width:768px) {
  .sidebar-toggle { display:block; }
  .sidebar-overlay.active { display:block; }
  .sidebar { transform:translateX(-100%); transition:transform .3s; -webkit-overflow-scrolling: touch; }
  .sidebar.open { transform:translateX(0); }
  .topbar { left:0; }
  .main-area { margin-left:0; max-width:100vw; padding:72px 16px 16px; -webkit-overflow-scrolling: touch; }
  .topbar-actions { gap:0.3rem; }
  #server-select { display: inline-flex; font-size: 11px; max-width: 90px; padding: 4px 6px; }
  .mini-stats { grid-template-columns: 1fr; }
  .wonder-mini { grid-template-columns: 1fr; }
  .hero-spread .player-name { font-size: 28px; }

  /* Scrollable tables on mobile */
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .chart-card { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Prevenir overflow horizontal da pagina (mobile): contentores encolhem, conteudo largo scrolla dentro */
  html, body { overflow-x: hidden; }
  .main-area-inner, .section, .magazine, .left-col, .right-col, .chart-card, .info-card { min-width: 0; max-width: 100%; }
  .css-chart, .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Adjust font sizes for mobile inputs/selects */
  .controls select, .controls input { font-size: 16px; }
  .input-ghost { font-size: 16px; }

  /* Grid helpers collapse on mobile */
  .grid-cards { grid-template-columns: 1fr 1fr; gap: 8px; }
  .grid-ways { grid-template-columns: 1fr; }
  .grid-stats-wide { grid-template-columns: 1fr 1fr; gap: 8px; }
  .grid-servers { grid-template-columns: 1fr 1fr; }

  /* Magazine already collapses via 1024px query; ensure no scroll issues */
  .compare-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stats-grid .stat-card { padding: 12px 14px; }
}

/* ══ BADGES ══ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap;
  border-radius: 4px;
}
.badge-elf { color: #00ff88; border: 1px solid rgba(0,255,136,0.3); background: rgba(0,255,136,0.06); }
.badge-human { color: #ff8800; border: 1px solid rgba(255,136,0,0.3); background: rgba(255,136,0,0.06); }
.badge-active { color: #00ff88; border: 1px solid rgba(0,255,136,0.3); background: rgba(0,255,136,0.06); }
.badge-inactive { color: #ff3366; border: 1px solid rgba(255,51,102,0.3); background: rgba(255,51,102,0.06); }

/* Role badges for fellowship */
.badge.role-archmage { color: var(--gold); border-color: rgba(255,204,0,0.3); background: rgba(255,204,0,0.08); font-weight:600; }
.badge.role-mage { color: var(--accent); border-color: rgba(0,240,255,0.2); background: rgba(0,240,255,0.06); }
.badge.role-member { color: var(--text-dim); border-color: rgba(255,255,255,0.06); background: rgba(255,255,255,0.02); }
.server-badge { display: inline-flex; align-items: center; gap: 4px; background: rgba(0,240,255,0.06); border: 1px solid rgba(0,240,255,0.15); padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; color: #c8c8d0; }

/* ══ ACTIVE VS INACTIVE ══ */
.status-compare { display: flex; gap: 16px; }
.status-column { flex: 1; background: var(--bg-card-solid); border: 1px solid rgba(255,255,255,0.06); border-radius: 16px; padding: 20px; position: relative; }
.status-column.active { border-color: rgba(0,255,136,0.15); }
.status-column.inactive { border-color: rgba(255,51,102,0.15); }
.status-column-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.pulse-green { background: #00ff88; }
.pulse-red { background: #ff3366; }
.status-count { font-family: 'Orbitron', sans-serif; font-size: 28px; font-weight: 700; }
.status-column.active .status-count { color: #00ff88; }
.status-column.inactive .status-count { color: #ff3366; }
.status-label { font-size: 14px; color: #c8c8d0; font-weight: 600; }
.status-sub-label { font-size: 11px; color: #666; }
.status-stats-row { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.status-stat-pill { flex: 1; min-width: 70px; background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.04); border-radius: 8px; padding: 8px; text-align: center; }
.ssp-label { display: block; font-size: 9px; color: #666; text-transform: uppercase; letter-spacing: 1px; }
.ssp-value { display: block; font-family: 'Orbitron', sans-serif; font-size: 14px; font-weight: 600; color: #fff; }
.status-mini-wrap { margin-top: 8px; }
.status-mini-header { font-size: 12px; color: #888; margin-bottom: 8px; }
.status-mini-table-wrap { border: 1px solid rgba(255,255,255,0.04); border-radius: 8px; overflow: hidden; }
.status-mini-table { width: 100%; border-collapse: collapse; }
.status-mini-table thead th { background: rgba(0,0,0,0.2); color: #666; font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; padding: 6px 8px; text-align: left; border-bottom: 1px solid rgba(255,255,255,0.04); }
.status-mini-table td { padding: 5px 8px; font-size: 11px; border-bottom: 1px solid rgba(255,255,255,0.02); color: #c8c8d0; }

/* ══ GS PANELS ══ */
.gs-chart-row { margin-bottom: 12px; }
.gs-chart-wrap { background: var(--bg-card-solid); border: 1px solid rgba(255,255,255,0.06); border-radius: 14px; padding: 16px 18px; }
.gs-chart-title { font-family: 'Orbitron', sans-serif; font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: #555; margin-bottom: 12px; }
.gs-panels-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.gs-panel { background: var(--bg-card-solid); border: 1px solid rgba(255,255,255,0.06); border-radius: 14px; padding: 14px; }
.gs-panel-title { font-family: 'Orbitron', sans-serif; font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: #555; margin-bottom: 8px; }
.gs-city-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.gs-player-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.gs-panel-wide { grid-column: span 2; }
.gs-big-number { font-family: 'Orbitron', sans-serif; font-size: 36px; font-weight: 900; color: #ffcc00; text-align: center; padding: 12px 0; }
.gs-subsection { margin-bottom: 20px; }
.gs-section-title { font-family: 'Orbitron', sans-serif; font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: #777; margin-bottom: 12px; }

/* ══ COMPARE — redesigned ══ */
.compare-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); gap: 14px; align-items: start; }
.compare-card {
  background: var(--bg-card-solid);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  padding: 0;
  position: relative;
  overflow: hidden;
  display: flex; flex-direction: column;
  max-height: 72vh; overflow-y: auto;
}
.compare-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-purple));
  opacity: 0.4; z-index: 1;
}

/* ── Identity Header ── */
.cmp-identity { padding: 18px 20px 14px; position: relative; z-index: 1; }
.cmp-name-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.cmp-name-row .cmp-active-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.cmp-active-dot.online { background: #00ff88; box-shadow: 0 0 8px rgba(0,255,136,0.5); }
.cmp-active-dot.offline { background: #ff3366; box-shadow: 0 0 8px rgba(255,51,102,0.3); }
.cmp-name {
  font-family: 'Orbitron', sans-serif; font-size: 17px; font-weight: 900;
  color: #fff; letter-spacing: 1px; line-height: 1; flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer;
}
.cmp-name:hover { color: var(--accent); }
.cmp-server-tag {
  font-size: 10px; font-weight: 600;
  background: rgba(0,240,255,0.06); border: 1px solid rgba(0,240,255,0.12);
  padding: 2px 8px; border-radius: 4px; color: var(--accent);
  font-family: 'Orbitron', sans-serif; letter-spacing: 0.5px;
  flex-shrink: 0;
}
.cmp-meta-row {
  display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px;
}
.cmp-rank-badge {
  font-family: 'Orbitron', sans-serif; font-size: 11px; font-weight: 700;
  padding: 2px 10px; border-radius: 12px;
  border: 1px solid rgba(255,204,0,0.3); color: var(--gold);
  background: rgba(255,204,0,0.06);
}
.cmp-fs-tag {
  font-size: 11px; color: var(--text-dim); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 150px;
}

/* ── Score Bar ── */
.cmp-score-section { padding: 0 20px 14px; position: relative; z-index: 1; }
.cmp-score-value {
  font-family: 'Orbitron', sans-serif; font-size: 26px; font-weight: 900;
  color: var(--accent); line-height: 1;
}
.cmp-score-bar {
  height: 8px; background: rgba(255,255,255,0.06); border-radius: 4px;
  overflow: hidden; margin: 8px 0;
}
.cmp-score-bar-fill {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-dim));
  transition: width 0.5s ease;
  position: relative;
}
.cmp-score-meta {
  display: flex; gap: 16px; font-size: 12px; margin-top: 6px;
}

/* ── Section Blocks ── */
.cmp-section {
  padding: 12px 20px; border-top: 1px solid rgba(255,255,255,0.04);
  position: relative; z-index: 1;
}
.cmp-section-header {
  font-family: 'Orbitron', sans-serif; font-size: 9px;
  text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--text-muted); margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.cmp-section-header i { color: var(--accent); font-size: 11px; }

/* ── Stat rows ── */
.cmp-stat-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 3px 0; font-size: 13px;
}
.cmp-stat-row + .cmp-stat-row { border-top: 1px solid rgba(255,255,255,0.02); }
.cmp-stat-label { color: var(--text-dim); min-width: 80px; }
.cmp-stat-value { font-weight: 600; text-align: right; font-family: 'Orbitron', sans-serif; }
.cmp-stat-value.best { color: var(--gold); }
.cmp-stat-value.worst { color: #555; }
.cmp-stat-value.best::after { content: ' \25B2'; font-size: 9px; }
.cmp-stat-value.worst::after { content: ' \25BC'; font-size: 9px; }

/* ── Boost icons row ── */
.cmp-boosts { display: flex; gap: 6px; align-items: center; padding-top: 6px; }
.cmp-boosts img { width: 20px; height: 20px; border-radius: 3px; }
.cmp-boosts-empty { font-size: 11px; color: var(--text-muted); font-style: italic; }

/* ── Wonder mini list ── */
.cmp-wonder-row {
  display: flex; align-items: center; gap: 8px;
  padding: 3px 0; font-size: 12px;
}
.cmp-wonder-rank { color: var(--text-muted); font-size: 10px; min-width: 16px; }
.cmp-wonder-name { flex: 1; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmp-wonder-lvl { font-family: 'Orbitron', sans-serif; font-weight: 700; color: var(--accent); min-width: 28px; text-align: right; }

/* ── Compare footer ── */
.cmp-footer { padding: 10px 20px; border-top: 1px solid rgba(255,255,255,0.04); text-align: center; position: relative; z-index: 1; }

/* ── Empty state ── */
.cmp-no-data { color: var(--text-muted); font-size: 12px; font-style: italic; padding: 4px 0; }

/* ── Search input ── */
#c-search { background: var(--bg-card-solid); border: 1px solid rgba(255,255,255,0.06); border-radius: 8px; padding: 8px 12px; color: var(--text); font-family: 'Rajdhani', sans-serif; font-size: 13px; outline: none; width: 260px; transition: all .2s; }
#c-search:focus { border-color: var(--accent); }
#c-ids { background: var(--bg-card-solid); border: 1px solid rgba(255,255,255,0.06); border-radius: 8px; padding: 8px 12px; color: var(--text); font-family: 'Rajdhani', sans-serif; font-size: 13px; outline: none; width: 160px; }
#c-ids:focus { border-color: var(--accent); }

/* ── Compare bar (bottom floating) ── */
#compare-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--bg-card-solid); border-top: 1px solid var(--accent);
  padding: 10px 24px; z-index: 999;
  display: flex; align-items: center; gap: 12px;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.cmp-bar-slot {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 6px; font-size: 12px; font-weight: 600;
}
.cmp-bar-slot.filled {
  background: rgba(0,240,255,0.08); border: 1px solid rgba(0,240,255,0.15);
  color: var(--accent);
}
.cmp-bar-slot.filled button {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 11px; padding: 0 2px;
}
.cmp-bar-slot.filled button:hover { color: var(--red); }
.cmp-bar-slot.empty {
  background: rgba(255,255,255,0.02); border: 1px dashed rgba(255,255,255,0.06);
  color: #555;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .compare-grid { grid-template-columns: 1fr; max-width: 100%; }
  .compare-card { max-height: none; overflow-y: visible; }
}
@media (max-width: 768px) {
  .compare-card { border-radius: 12px; }
  .cmp-identity { padding: 14px 16px 10px; }
  .cmp-score-section, .cmp-section { padding-left: 16px; padding-right: 16px; }
  .cmp-name { font-size: 15px; }
  .cmp-score-value { font-size: 22px; }
  #compare-bar { padding: 8px 12px; gap: 8px; flex-wrap: wrap; }
}

/* ── Light theme ── */
.theme-light .compare-card { background: var(--bg-card); border-color: var(--border); }
.theme-light .cmp-name { color: var(--text); }
.theme-light .cmp-name:hover { color: var(--accent); }
.theme-light .cmp-rank-badge { background: rgba(217,119,6,0.06); border-color: rgba(217,119,6,0.2); color: var(--gold); }
.theme-light .cmp-stat-label { color: #607080; }
.theme-light .cmp-stat-value { color: var(--text); }
.theme-light .cmp-stat-value.best { color: var(--gold); }
.theme-light .cmp-stat-value.worst { color: #999; }
.theme-light .cmp-section { border-top-color: rgba(0,0,0,0.05); }
.theme-light .cmp-section-header { color: #8a9ab0; }
.theme-light .cmp-wonder-name { color: #607080; }
.theme-light #compare-bar { background: var(--bg-card); border-top-color: var(--accent); }
.theme-light .cmp-fs-tag { color: #607080; }
.theme-light .cmp-no-data { color: #999; }
.theme-light #c-search, .theme-light #c-ids { background: #fff; border-color: rgba(0,0,0,0.12); color: var(--text); }
.theme-light .cmp-stat-row + .cmp-stat-row { border-top-color: rgba(0,0,0,0.03); }
.theme-light .cmp-score-bar { background: rgba(0,0,0,0.06); }

/* ══ MAP ══ */
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.map-server { background: var(--bg-card-solid); border: 1px solid rgba(255,255,255,0.06); border-radius: 16px; padding: 20px; }
.map-server h3 { font-family: 'Orbitron', sans-serif; font-size: 13px; color: #fff; letter-spacing: 1px; margin-bottom: 4px; }
.map-server .ms-players { font-size: 28px; font-weight: 700; color: #00f0ff; font-family: 'Orbitron', sans-serif; }
.map-server .ms-label { font-size: 11px; color: #666; text-transform: uppercase; letter-spacing: 1px; }
.map-server .ms-id { font-size: 10px; color: #555; margin-top: 4px; }

/* ══ DAEMON ══ */
.daemon-grid { display: block; }
.daemon-card { background: var(--bg-card-solid); border: 1px solid rgba(255,255,255,0.06); border-radius: 16px; padding: 20px; text-align: center; }
.daemon-card .dc-value { font-family: 'Orbitron', sans-serif; font-size: 32px; font-weight: 700; color: #00f0ff; }
.daemon-card .dc-label { font-size: 11px; color: #666; text-transform: uppercase; letter-spacing: 1px; margin-top: 4px; }

/* ══ PROFILE ══ */
.profile-form { max-width: 420px; }
.profile-form label { display: block; font-size: 12px; color: #888; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 1px; }
.profile-form input, .profile-form select { width: 100%; background: var(--bg-card-solid); border: 1px solid rgba(255,255,255,0.06); border-radius: 8px; padding: 8px 12px; color: #c8c8d0; font-size: 13px; font-family: 'Rajdhani', sans-serif; margin-bottom: 12px; outline: none; }
.profile-form input:focus { border-color: #00f0ff44; }

/* ══ LOADING / EMPTY ══ */
.loading-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px; color: #666; gap: 12px; }
#pd-loading, #pl-loading, #fd-loading, #dash-loading { display: flex; align-items: center; justify-content: center; min-height: 60vh; }
.spinner { width: 32px; height: 32px; border: 2px solid rgba(255,255,255,0.06); border-top-color: #00f0ff; border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { text-align: center; padding: 48px; color: #555; }
.empty-state p { font-size: 14px; }

/* ══ BACK BUTTON ══ */
.back-btn { display: inline-flex; align-items: center; gap: 6px; color: #888; background: var(--bg-card-solid); border: 1px solid rgba(255,255,255,0.06); border-radius: 8px; padding: 6px 14px; cursor: pointer; font-size: 13px; font-family: 'Rajdhani', sans-serif; transition: all .2s; margin-bottom: 16px; }
.back-btn:hover { color: #00f0ff; border-color: #00f0ff44; }

/* ══ SCROLLBAR ══ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #050508; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }

/* ══ VIEW SYSTEM ══ */
.view { display: none; }
.view.active { display: block !important; }

/* ══ RESPONSIVE ══ */
@media (max-width: 1024px) {
  .magazine { grid-template-columns: 1fr; }
  .hero-spread .player-name { font-size: 36px; }
  .featured-stat .big-number { font-size: 40px; }
  .status-compare { flex-direction: column; }
  .gs-panels-row { grid-template-columns: 1fr; }
  .gs-city-grid { grid-template-columns: 1fr; }
  .gs-player-grid { grid-template-columns: 1fr; }
}
@media (min-width: 769px) and (max-width: 1024px) {
  .sidebar { width: 180px; }
  .main-area { margin-left: 180px; padding: 24px; max-width: calc(100vw - 180px); }
}
/* ── Login Modal ───────────────────────────────────────── */
.modal-overlay{position:fixed;inset:0;background:rgba(0,0,0,0.75);z-index:99999;display:none;align-items:center;justify-content:center;backdrop-filter:blur(4px)}
.modal{background:var(--bg-card,#0d0d14);border:1px solid var(--border,rgba(255,255,255,0.06));border-radius:16px;width:100%;max-width:380px;box-shadow:0 8px 40px rgba(0,0,0,0.5)}
.modal-header{display:flex;align-items:center;justify-content:space-between;padding:1rem 1.25rem;border-bottom:1px solid var(--border,rgba(255,255,255,0.06))}
.modal-header h3{margin:0;font-family:'Orbitron',sans-serif;font-size:1rem;letter-spacing:0.08em;color:var(--accent,#00f0ff)}
.modal-close{background:none;border:none;color:#888;font-size:1.4rem;cursor:pointer;line-height:1;padding:0}
.modal-close:hover{color:#fff}
.modal-body{padding:1.25rem}
.cmp-input{width:100%;background:#07070e;color:#c8c8d0;border:1px solid rgba(255,255,255,0.06);border-radius:8px;padding:0.6rem;font-size:0.9rem;font-family:'Rajdhani',sans-serif;outline:none;box-sizing:border-box}
.cmp-input:focus{border-color:#00f0ff}

/* ══ Light theme final overrides (always win) ══ */
/* ══ Light theme: global overrides ══ */
.theme-light .btn { background: #fff; color: #1a1a2e; border-color: rgba(0,0,0,0.12); }
.theme-light .btn:hover { border-color: var(--accent-dim); color: var(--accent); }
.theme-light .btn:disabled { opacity: 0.3; }
.theme-light .back-btn { background: #fff; color: #607080; border-color: rgba(0,0,0,0.12); }
.theme-light .back-btn:hover { color: var(--accent); }
.theme-light .loading-state { color: #607080; }
.theme-light .empty-state { color: #607080; }
.theme-light .spinner { border-color: rgba(0,0,0,0.1); border-top-color: var(--accent); }
.theme-light .sidebar-collapse-btn { color: #607080; border-color: rgba(0,0,0,0.12); }
.theme-light #p-controls { background: rgba(255,255,255,0.85); border-color: rgba(0,0,0,0.08); }
.theme-light .total-count { background: #fff; color: #607080; border-color: rgba(0,0,0,0.12); }
.theme-light .sortable:hover { color: var(--accent); }
.theme-light tbody tr:hover td { background: rgba(0,0,0,0.02); }
.theme-light .topbar-divider { background: rgba(0,0,0,0.1); }
.theme-light .sidebar-toggle:hover { background: rgba(0,0,0,0.04); }
.theme-light #search-results { background: #fff; border-color: rgba(0,0,0,0.12); }
.theme-light .search-result-item { border-bottom-color: rgba(0,0,0,0.04); }
.theme-light .search-result-name { color: var(--accent); }
.theme-light .search-result-meta { color: #607080; }
.theme-light .search-box i { color: #607080; }
.theme-light .info-card h3 i { color: var(--accent-purple); }
.theme-light .chart-card h3 i { color: var(--accent-purple); }
/* Dark theme: view header icons → white, // → white, hover → pink */
.vh [style*="color:#00f0ff"],
h1 [style*="color:#00f0ff"] { color: #e0e8f0 !important; }
.vh:hover [style*="color:#00f0ff"],
h1:hover [style*="color:#00f0ff"] { color: var(--accent-purple) !important; transition: color .3s; }
/* Light theme: view header icons → pink, hover → darker pink */
.theme-light .vh [style*="color:#00f0ff"],
.theme-light h1 [style*="color:#00f0ff"] { color: #e91e9d !important; }
.theme-light .vh:hover [style*="color:#00f0ff"],
.theme-light h1:hover [style*="color:#00f0ff"] { color: #c2185b !important; }
.theme-light .cyber-accent { color: #1a1a2e; opacity: 0.3; }
.theme-light .wonder-mini-item .w-icon { background: rgba(8,145,178,0.06); color: var(--accent); }
.theme-light .wonder-mini-item .w-name { color: #1a1a2e; }
.theme-light .wonder-mini-item .w-lvl { color: var(--gold); }
.theme-light .profile-form label { color: #607080; }
.theme-light ::-webkit-scrollbar-track { background: #f0f4f8; }
.theme-light ::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); }
.theme-light .modal-close { color: #607080; }
.theme-light .modal-close:hover { color: #1a1a2e; }
.theme-light .cmp-input { background: #fff; color: #1a1a2e; border-color: rgba(0,0,0,0.12); }
.theme-light .dash-status-subtitle,
.theme-light #dash-status-subtitle { color: #607080; }
.theme-light .view-subtitle { color: #607080; }
.theme-light .chart-card h3 span { color: #607080; }
.theme-light .t-info,
.theme-light #t-info { color: #607080; }
.theme-light .daemon-card .dc-label { color: #607080; }
.theme-light .daemon-card .dc-value { color: #1a1a2e; }
/* Override hardcoded inline #888/#666/#444 in HTML/JS */
.theme-light [style*="color:#888"],
.theme-light [style*="color: #888"],
.theme-light [style*="color:#666"],
.theme-light [style*="color: #666"],
.theme-light [style*="color:#444"],
.theme-light [style*="color: #444"],
.theme-light [style*="color:#555"],
.theme-light [style*="color: #555"] { color: #475569 !important; }
/* Override hardcoded inline #fff title colors in light theme */
.theme-light [style*="color:#fff"],
.theme-light [style*="color: #fff"] { color: #1a1a2e !important; }

/* ══ DAEMON REDESIGN ══ */

/* ── Enrichment Log ── */
.log-widget {
  background: rgba(5,5,8,0.85);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  overflow: hidden;
}
.log-widget-body {
  font-family: 'Cascadia Code', 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 11px;
  line-height: 1.7;
  color: #607080;
  padding: 14px 16px;
  max-height: 260px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}
.log-widget-body .log-empty {
  color: #444;
  font-style: italic;
  font-family: 'Rajdhani', sans-serif;
  font-size: 13px;
}
.theme-light .log-widget {
  background: rgba(255,255,255,0.7);
  border-color: rgba(0,0,0,0.08);
}
.theme-light .log-widget-body {
  color: #607080;
}
.theme-light .log-widget-body .log-empty {
  color: #888;
}

/* ── Server table mini progress bar ── */
.pct-bar-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 80px;
}
.pct-bar-wrap span {
  font-family: 'Orbitron', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  min-width: 36px;
}
.pct-bar-fill {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  flex: 1;
  transition: width 0.4s ease;
  max-width: 100%;
}
.theme-light .pct-bar-fill {
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
}

/* ── Daemon filter input ── */
.daemon-filter-input {
  background: var(--bg-card-solid, #0d0d14);
  color: var(--text, #c8c8d0);
  border: 1px solid var(--border, rgba(255,255,255,0.06));
  border-radius: 8px;
  padding: 7px 12px 7px 32px;
  font-size: 13px;
  font-family: 'Rajdhani', sans-serif;
  outline: none;
  transition: all .2s;
  width: 180px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23666' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 10px center;
}
.daemon-filter-input:focus {
  border-color: var(--accent-dim, #00b8cc);
}
.daemon-filter-input::placeholder {
  color: var(--text-muted, #555);
}
.theme-light .daemon-filter-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23999' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E");
}

/* ── GameAPI Add Form ── */
.daemon-add-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-top: 1px solid var(--border, rgba(255,255,255,0.06));
}
.daemon-add-input {
  background: var(--bg-card-solid, #0d0d14);
  color: var(--text, #c8c8d0);
  border: 1px solid var(--border, rgba(255,255,255,0.06));
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
  font-family: 'Rajdhani', sans-serif;
  outline: none;
  transition: all .2s;
}
.daemon-add-input:focus {
  border-color: var(--accent-dim, #00b8cc);
}
.daemon-add-input::placeholder {
  color: var(--text-muted, #555);
}
.daemon-add-input[type="text"],
.daemon-add-input[type="password"] {
  min-width: 0;
}
.daemon-add-input#acc-server {
  width: 100px;
}
.daemon-add-input#acc-user,
.daemon-add-input#acc-pass {
  width: 150px;
}
.theme-light .daemon-add-form {
  border-top-color: rgba(0,0,0,0.06);
}

/* ── Server badge in table ── */
.tourney-table td .server-badge {
  font-size: 11px;
  padding: 2px 10px;
}

/* ══ UTILITY CLASSES (extracted from inline styles) ══ */

/* Grid helpers */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.grid-servers { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.grid-ways { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.grid-stats-wide { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }

/* Form helpers */
.label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 4px; }
.input-ghost {
  width: 100%; padding: 10px 12px;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px; color: #fff;
  font-size: 13px; box-sizing: border-box;
  font-family: inherit;
}

/* Card modifiers */
.card-link { text-decoration: none; color: inherit; }
.card-donate { padding: 16px; text-align: center; border-radius: 8px; transition: all 0.2s; cursor: pointer; }
.card-accent { border: 1px solid var(--accent); }
.card-pink { border: 1px solid var(--pink); }
.card-contribute { border: 1px solid var(--accent); border-radius: 8px; padding: 16px; }

/* Table helpers */
.tourney-table td.num.num-gold { color: var(--gold); font-weight: 600; }
.text-desc { color: var(--text-dim); line-height: 1.6; font-size: 14px; }

/* Ways to help panels */
.way-panel {
  padding: 10px; border-radius: 6px; border-left: 3px solid transparent;
}
.way-panel .way-title { font-weight: 600; font-size: 12px; margin-bottom: 4px; }
.way-panel .way-text { color: var(--text-dim); font-size: 11px; margin: 0; line-height: 1.5; }
.way-accent { background: rgba(0,240,255,0.05); border-left-color: var(--accent); }
.way-accent .way-title { color: var(--accent); }
.way-pink { background: rgba(255,0,170,0.05); border-left-color: var(--pink); }
.way-pink .way-title { color: var(--pink); }
.way-orange { background: rgba(255,171,64,0.05); border-left-color: #ffab40; }
.way-orange .way-title { color: #ffab40; }
.way-purple { background: rgba(156,39,176,0.05); border-left-color: #ce93d8; }
.way-purple .way-title { color: #ce93d8; }

/* ══ LIGHT THEME OVERRIDES for utility classes ══ */
.theme-light .input-ghost {
  background: #fff; color: var(--text); border-color: rgba(0,0,0,0.12);
}
.theme-light .label { color: #607080; }
.theme-light .way-accent { background: rgba(8,145,178,0.03); }
.theme-light .way-pink { background: rgba(233,30,157,0.03); }
.theme-light .way-orange { background: rgba(255,171,64,0.03); }
.theme-light .way-purple { background: rgba(156,39,176,0.03); }
.theme-light .way-panel .way-text { color: #475569; }

/* Stats mini card (about section) */
.chart-stat-mini { text-align: center; padding: 16px 8px; }
.text-desc-sm { color: var(--text-dim); font-size: 13px; line-height: 1.5; }
.theme-light .chart-stat-mini { background: var(--bg-card); }
.theme-light .text-desc-sm { color: #475569; }

/* ══ CITY BUILDINGS — Interactive Grid Map ══ */

/* Stats Row */
.city-stats-row {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px;
}
.city-stat-card {
  flex: 1; min-width: 100px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 14px;
  text-align: center; transition: all .2s;
}
.city-stat-card:hover { border-color: rgba(0,240,255,0.2); }
.city-stat-card .csc-value {
  font-family: 'Orbitron', monospace; font-size: 20px; font-weight: 800;
  color: var(--accent); line-height: 1; letter-spacing: 1px;
}
.city-stat-card .csc-value.gold  { color: var(--gold); }
.city-stat-card .csc-value.green { color: var(--green); }
.city-stat-card .csc-value.pink  { color: var(--accent-purple); }
.city-stat-card .csc-value.red   { color: var(--red); }
.city-stat-card .csc-label {
  font-size: 9px; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 1px; margin-top: 4px;
}

/* Summary Table (collapsible) */
.city-summary { margin-bottom: 14px; }
.city-summary-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px; cursor: pointer; list-style: none;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px; font-weight: 600; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 1px;
  font-family: 'Orbitron', monospace;
  transition: all .2s;
}
.city-summary-header:hover { color: var(--accent); border-color: rgba(0,240,255,0.15); }
.city-summary-header i { margin-right: 8px; color: var(--accent); font-size: 11px; }
.city-summary-chevron {
  font-size: 10px; color: var(--text-muted); transition: transform .2s; margin-right: 0 !important;
}
.city-summary[open] .city-summary-chevron { transform: rotate(180deg); }
.city-summary::-webkit-details-marker { display: none; }
.city-summary::marker { display: none; }

.city-summary-table-row { cursor: pointer; transition: all .15s; }
.city-summary-table-row:hover { background: var(--bg-hover) !important; }
.city-summary-table-row.active { background: rgba(0,240,255,0.06) !important; border-left: 2px solid var(--accent); }
.city-summary-table-row td { padding: 6px 10px; }
.city-type-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 2px;
  margin-right: 6px; vertical-align: middle;
}

/* Map Toolbar */
.city-map-toolbar {
  display: flex; align-items: center; gap: 6px; margin-bottom: 8px;
  padding: 6px 10px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.city-map-toolbar input[type="range"] {
  -webkit-appearance: none; appearance: none; height: 4px;
  background: rgba(255,255,255,0.08); border-radius: 2px; outline: none; cursor: pointer;
}
.city-map-toolbar input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); cursor: pointer; border: 2px solid var(--bg-card);
}
.city-map-toolbar input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); cursor: pointer; border: 2px solid var(--bg-card);
}

/* Map Card */
.city-map-card {
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}

/* Map Viewport */
.city-map-viewport {
  height: clamp(500px, 66vh, 840px); overflow: auto; position: relative;
  background: #030308;
  cursor: grab;
  scroll-behavior: smooth;
}
.city-map-viewport:active { cursor: grabbing; }
.city-map-viewport::-webkit-scrollbar { width: 6px; height: 6px; }
.city-map-viewport::-webkit-scrollbar-track { background: #050508; }
.city-map-viewport::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }
.city-map-viewport::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }

/* Fullscreen / maximizado do mapa (API nativa + fallback .city-map-max) */
.city-map-area:fullscreen {
  background: #05050a; padding: 10px;
  display: flex; flex-direction: column; overflow: hidden;
}
.city-map-area:fullscreen .city-map-card { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.city-map-area:fullscreen .city-map-viewport { height: auto; flex: 1; min-height: 0; }
.city-map-area.city-map-max {
  position: fixed; inset: 0; z-index: 6000;
  background: #05050a; padding: 10px;
  display: flex; flex-direction: column; overflow: hidden;
}
.city-map-area.city-map-max .city-map-card { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.city-map-area.city-map-max .city-map-viewport { height: auto; flex: 1; min-height: 0; }
.theme-light .city-map-area:fullscreen { background: #eef0f4; }
.theme-light .city-map-area.city-map-max { background: #eef0f4; }

/* Map Inner Grid */
.city-map-inner {
  position: relative;
  background-color: #050510;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  transform-origin: 0 0;
}
/* Individual Tile */
.city-tile {
  position: absolute; border-radius: 1px; box-sizing: border-box;
  cursor: pointer; border: 1px solid rgba(0,0,0,0.25);
  z-index: 1; will-change: left, top, width, height;
  transition: box-shadow .12s, z-index 0s;
}
.city-tile:hover {
  z-index: 10 !important;
  box-shadow: 0 0 0 2px rgba(0,240,255,0.7), inset 0 0 0 1px rgba(255,255,255,0.3);
}
/* Streets are subtle — thin, muted, low opacity */
.city-tile-street {
  border-color: transparent !important;
  opacity: 0.55;
}
.city-tile-street:hover {
  opacity: 0.8;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.2);
}
.city-tile.dimmed { opacity: 0.06; pointer-events: none; }
.city-tile.dimmed.city-tile-street { opacity: 0.04; }
.city-tile.selected {
  z-index: 20 !important; animation: city-pulse 1.2s ease-in-out infinite;
  box-shadow: 0 0 0 2px var(--gold), 0 0 18px rgba(255,204,0,0.5);
  border-color: var(--gold) !important;
}
.city-tile.filter-highlight { opacity: 1; }
.city-tile.search-highlight {
  z-index: 15 !important;
  box-shadow: 0 0 0 2px var(--accent-purple), 0 0 20px rgba(255,0,170,0.5) !important;
  animation: city-search-pulse 0.8s ease-in-out infinite;
}
@keyframes city-search-pulse {
  0%, 100% { box-shadow: 0 0 0 2px var(--accent-purple), 0 0 20px rgba(255,0,170,0.5); }
  50% { box-shadow: 0 0 0 3px var(--accent-purple), 0 0 32px rgba(255,0,170,0.8); }
}

@keyframes city-pulse {
  0%, 100% { box-shadow: 0 0 16px rgba(255,204,0,0.5); }
  50% { box-shadow: 0 0 28px rgba(255,204,0,0.8); }
}

/* Always-visible tile label (nivel + chapter) */
.city-tile-label {
  position: absolute; inset: 0; display: none;
  flex-direction: column; align-items: center; justify-content: center;
  pointer-events: none; overflow: hidden; line-height: 1; text-align: center;
  color: #fff; font-family: 'Rajdhani', sans-serif; font-weight: 700;
  text-shadow: 0 1px 2px rgba(0,0,0,0.95), 0 0 3px rgba(0,0,0,0.85);
}
.city-tile-label .ctl-ch { font-size: 0.66em; font-weight: 600; opacity: 0.92; margin-top: 1px; letter-spacing: 0.3px; }
.city-tile.dimmed .city-tile-label { display: none !important; }

/* Tooltip */
.city-tooltip {
  position: fixed; z-index: 9999; pointer-events: none;
  background: var(--bg-card-solid); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  white-space: nowrap; max-width: 300px;
  font-family: 'Rajdhani', sans-serif; font-size: 12px; color: var(--text-dim);
  transition: opacity .08s;
}
.city-tooltip .ct-name {
  font-weight: 700; font-size: 14px; color: var(--text);
  display: block; margin-bottom: 2px; line-height: 1.2;
}
.city-tooltip .ct-type {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--accent); font-family: 'Orbitron', monospace;
}
.city-tooltip .ct-meta {
  font-size: 10px; color: var(--text-muted); margin-top: 2px;
}
.city-tooltip .ct-connected {
  font-size: 10px; margin-top: 3px; font-weight: 600;
}
.city-tooltip .ct-type, .city-tooltip .ct-meta, .city-tooltip .ct-connected { display: block; }

/* Axis Labels (inside viewport, sticky to bottom/left) */
.city-axis {
  position: sticky; z-index: 5; pointer-events: none;
  font-family: 'Orbitron', monospace; font-size: 8px; color: rgba(255,255,255,0.12);
  letter-spacing: 0.5px; white-space: nowrap;
}
.city-axis-x {
  bottom: 0; left: 0; height: 14px; display: flex; align-items: center;
  padding-left: 40px; border-top: 1px solid rgba(255,255,255,0.04);
  background: linear-gradient(0deg, rgba(5,5,8,0.7), transparent);
}
.city-axis-y {
  left: 0; top: 0; width: 36px; display: flex; flex-direction: column;
  justify-content: space-between; padding: 4px 6px;
  text-align: right; border-right: 1px solid rgba(255,255,255,0.04);
}
.city-axis-y span { line-height: 1; }

/* Legend */
.city-legend {
  display: flex; flex-wrap: wrap; gap: 4px 12px;
  padding: 8px 14px; border-top: 1px solid rgba(255,255,255,0.04);
  background: rgba(5,5,8,0.6);
}
.city-legend-item {
  display: flex; align-items: center; gap: 4px;
  font-size: 9px; color: var(--text-muted); cursor: pointer;
  padding: 2px 6px; border-radius: 3px; transition: all .15s;
  text-transform: uppercase; letter-spacing: 0.3px; font-weight: 500;
}
.city-legend-item:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.city-legend-item.active { color: var(--accent); background: rgba(0,240,255,0.06); }
.city-legend-swatch {
  width: 8px; height: 8px; border-radius: 1px; flex-shrink: 0;
}

/* Detail Panel */
.city-detail {
  margin-top: 12px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px;
  position: relative; overflow: hidden;
  animation: city-detail-in .25s ease-out;
}
.city-detail::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
}
@keyframes city-detail-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.city-detail-close {
  position: absolute; top: 12px; right: 14px;
  width: 26px; height: 26px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-muted); border-radius: 4px;
  font-size: 13px; transition: all .15s;
}
.city-detail-close:hover { color: var(--red); background: rgba(255,51,102,0.08); }
.city-detail-content { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.city-detail-icon {
  width: 56px; height: 56px; border-radius: 10px; display: flex;
  align-items: center; justify-content: center; font-size: 28px;
  flex-shrink: 0; border: 1px solid rgba(255,255,255,0.08);
}
.city-detail-info { flex: 1; min-width: 200px; }
.city-detail-name {
  font-family: 'Orbitron', monospace; font-size: 18px; font-weight: 800;
  color: var(--text); letter-spacing: 1px; margin-bottom: 2px;
}
.city-detail-type-badge {
  display: inline-block; font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; padding: 3px 10px; border-radius: 12px; margin-bottom: 10px;
  font-family: 'Orbitron', monospace;
}
.city-detail-specs { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.city-detail-spec {
  font-size: 12px; color: var(--text-dim);
  display: flex; align-items: center; gap: 4px;
}
.city-detail-spec strong { color: var(--text); font-family: 'Orbitron', monospace; font-size: 11px; }
.city-detail-spec .cd-connected { color: var(--green); }
.city-detail-spec .cd-disconnected { color: var(--red); }
.city-detail-id {
  font-size: 9px; color: var(--text-muted); margin-top: 8px;
  font-family: 'Cascadia Code', 'JetBrains Mono', monospace;
  opacity: 0.6;
}

/* ══ LIGHT THEME overrides for city map ══ */
.theme-light .city-stats-row .city-stat-card { background: var(--bg-card); border-color: var(--border); }
.theme-light .city-stats-row .csc-value { color: var(--accent); }
.theme-light .city-stats-row .csc-label { color: var(--text-muted); }
.theme-light .city-summary-header { background: var(--bg-card); border-color: var(--border); color: var(--text-dim); }
.theme-light .city-summary-header:hover { color: var(--accent); }
.theme-light .city-map-card { background: var(--bg-card-solid); border-color: var(--border); }
.theme-light .city-map-viewport { background: #f0f0f4; }
.theme-light .city-map-inner { background-color: #e8e8f0; background-image: linear-gradient(rgba(0,0,0,0.06) 1px, transparent 1px), linear-gradient(90deg, rgba(0,0,0,0.06) 1px, transparent 1px); }
.theme-light .city-map-toolbar { background: var(--bg-card); border-color: var(--border); }
.theme-light .city-map-viewport::-webkit-scrollbar-track { background: #f0f0f4; }
.theme-light .city-map-viewport::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); }
.theme-light .city-legend { background: rgba(255,255,255,0.6); border-top-color: var(--border); }
.theme-light .city-legend-item { color: var(--text-muted); }
.theme-light .city-legend-item:hover { color: var(--text); background: rgba(0,0,0,0.04); }
.theme-light .city-detail { background: var(--bg-card); border-color: var(--border); }
.theme-light .city-detail-icon { border-color: var(--border); }
.theme-light .city-detail-name { color: var(--text); }
.theme-light .city-tooltip { background: var(--bg-card-solid); border-color: var(--border); }
.theme-light .city-tooltip .ct-name { color: var(--text); }
.theme-light .city-map-viewport::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.2); }
.theme-light .city-tile-street { opacity: 0.2; }
.theme-light .city-axis { color: rgba(0,0,0,0.12); }
.theme-light .city-axis-x { border-top-color: rgba(0,0,0,0.06); background: linear-gradient(0deg, rgba(255,255,255,0.7), transparent); }
.theme-light .city-axis-y { border-right-color: rgba(0,0,0,0.06); }

/* ══ RESPONSIVE for city map ══ */
@media (max-width: 768px) {
  .city-map-viewport { height: 340px; }
  .city-stats-row { gap: 4px; }
  .city-stat-card { padding: 8px 10px; }
  .city-stat-card .csc-value { font-size: 16px; }
  .city-detail-content { flex-direction: column; gap: 12px; }
  .city-detail-icon { width: 40px; height: 40px; font-size: 20px; }
  .city-detail-name { font-size: 15px; }
  .city-legend { gap: 2px 8px; padding: 6px 10px; }
  .city-legend-item { font-size: 8px; }
}

/* Esconder separadores por role até a auth resolver (evita flash no load) */
.sidebar-nav a[data-role]:not(.auth-shown){display:none!important}
