/* ═══════════════════════════════════════════
   POLITALIA — Design System v2.0
   Font: Syne (headings) + Plus Jakarta Sans (body)
═══════════════════════════════════════════ */

:root {
  /* Backgrounds */
  --bg:       #04040a;
  --surface:  #0a0a14;
  --surface2: #10101e;
  --surface3: #16162a;
  --surface4: #1c1c34;

  /* Brand */
  --primary:       #2B6CE2;
  --primary-light: #63A3F0;
  --primary-glow:  rgba(43,108,226,0.35);
  --primary-soft:  rgba(43,108,226,0.12);

  /* Accents */
  --cyan:      #00d4ff;
  --cyan-soft: rgba(0,212,255,0.12);
  --cyan-glow: rgba(0,212,255,0.3);

  /* States */
  --yes:      #00e5a0;
  --yes-soft: rgba(0,229,160,0.12);
  --yes-glow: rgba(0,229,160,0.3);
  --no:       #ff4d6d;
  --no-soft:  rgba(255,77,109,0.12);
  --no-glow:  rgba(255,77,109,0.3);
  --gold:     #ffd166;

  /* Text */
  --text:  #eef2ff;
  --text2: #8b93b8;
  --text3: #565d7e;

  /* Borders */
  --border:  rgba(255,255,255,0.06);
  --border2: rgba(255,255,255,0.11);
  --border3: rgba(255,255,255,0.18);

  /* Misc */
  --radius:    18px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --shadow:    0 16px 48px rgba(0,0,0,0.5), 0 8px 32px rgba(43,108,226,0.08);
  --shadow-sm: 0 4px 16px rgba(0,0,0,0.35), 0 4px 16px rgba(43,108,226,0.06);
}

/* ── LIGHT MODE ── */
[data-theme="light"] {
  --bg:       #f4f6ff;
  --surface:  #ffffff;
  --surface2: #edf0fb;
  --surface3: #e3e7f8;
  --surface4: #d8dcf2;

  /* Brand — darkened for legibility on light bg */
  --primary-light: #1A55CC;
  --cyan:          #007fa3;
  --yes:           #008756;
  --no:            #c4294d;
  --gold:          #b07e00;

  --primary-glow:  rgba(43,108,226,0.18);
  --primary-soft:  rgba(43,108,226,0.09);
  --cyan-soft:     rgba(0,127,163,0.1);
  --cyan-glow:     rgba(0,127,163,0.22);
  --yes-soft:      rgba(0,135,86,0.1);
  --yes-glow:      rgba(0,135,86,0.2);
  --no-soft:       rgba(196,41,77,0.08);
  --no-glow:       rgba(196,41,77,0.18);

  --text:  #0d0f1c;
  --text2: #3a4070;
  --text3: #6b7299;

  --border:  rgba(0,0,0,0.07);
  --border2: rgba(0,0,0,0.12);
  --border3: rgba(0,0,0,0.18);

  --shadow:    0 16px 48px rgba(0,0,0,0.1), 0 8px 32px rgba(43,108,226,0.1);
  --shadow-sm: 0 4px 16px rgba(0,0,0,0.08), 0 4px 16px rgba(43,108,226,0.07);
}

/* ── LIGHT MODE — hardcoded color overrides ── */
[data-theme="light"] #cd-days  { color: #1A55CC !important; }
[data-theme="light"] #cd-hours { color: #007fa3 !important; }
[data-theme="light"] #cd-mins  { color: #008756 !important; }
[data-theme="light"] #cd-secs  { color: #c4294d !important; }

/* Hero secondary button: white-glass → light purple outline */
[data-theme="light"] .btn-hero-secondary {
  background: rgba(43,108,226,0.07) !important;
  border-color: rgba(43,108,226,0.25) !important;
  color: var(--primary) !important;
}

/* White/transparent glass surfaces → light tinted */
[data-theme="light"] .stat-card,
[data-theme="light"] .feature-card,
[data-theme="light"] .card {
  background: var(--surface);
  border-color: var(--border2);
}

/* Hardcoded light lavender (#A8C8F8, #63A3F0) — remap to dark purple */
[data-theme="light"] [style*="color:#A8C8F8"],
[data-theme="light"] [style*="color: #A8C8F8"] { color: #1A55CC !important; }
[data-theme="light"] [style*="color:#63A3F0"],
[data-theme="light"] [style*="color: #63A3F0"] { color: #1A55CC !important; }

/* Hardcoded rgba(255,255,255,...) borders/backgrounds → remap */
[data-theme="light"] [style*="border:1px solid rgba(255,255,255"],
[data-theme="light"] [style*="border: 1px solid rgba(255,255,255"] {
  border-color: var(--border2) !important;
}
[data-theme="light"] [style*="background:rgba(255,255,255,0.06)"],
[data-theme="light"] [style*="background: rgba(255,255,255,0.06)"] {
  background: rgba(43,108,226,0.06) !important;
}

/* ── NAVBAR LIGHT MODE ── */
[data-theme="light"] .navbar,
[data-theme="light"] #landing-nav {
  background: rgba(255,255,255,0.88) !important;
  border-bottom-color: rgba(0,0,0,0.1) !important;
}


/* ── STEP NUMBERS (01 02 03) — increase visibility in both modes ── */
.step-num { color: rgba(43,108,226,0.35) !important; }
[data-theme="light"] .step-num { color: rgba(26,85,204,0.22) !important; }

/* ── HERO BADGE LIGHT MODE ── */
[data-theme="light"] .hero-badge {
  color: #1A55CC !important;
  border-color: rgba(26,85,204,0.35) !important;
  background: rgba(26,85,204,0.08) !important;
}

/* ── LOGO SWAP (dark/light) ── */
.logo-dark  { display: block; }
.logo-light { display: none !important; }
[data-theme="light"] .logo-dark  { display: none !important; }
[data-theme="light"] .logo-light { display: block !important; }

/* ── NAV P ICON ── */
.nav-p-icon {
  height: 36px;
  width: auto;
  flex-shrink: 0;
}

/* ── BRAND LOGO TESTUALE ── */
.brand-logo {
  font-family: 'Syne', sans-serif;
  font-weight: 900;
  font-size: 1.45rem;
  letter-spacing: -0.5px;
  line-height: 1;
  display: inline-flex;
  align-items: baseline;
  text-decoration: none;
  user-select: none;
}
.brand-logo-lg {
  font-size: 2.8rem;
  letter-spacing: -1px;
  margin-bottom: 8px;
  display: inline-flex;
  align-items: baseline;
  font-family: 'Syne', sans-serif;
  font-weight: 900;
}
.brand-poll {
  color: #3a86ff;
  -webkit-text-fill-color: #3a86ff;
}
.brand-italia { display: inline-flex; align-items: baseline; }

/* Italia tricolor — lettera per lettera */
.it-v { color: #009246; -webkit-text-fill-color: #009246; }
.it-b { color: #ffffff; -webkit-text-fill-color: #ffffff; }
.it-r { color: #ce2b37; -webkit-text-fill-color: #ce2b37; }

/* Light mode: lettera bianca su sfondo chiaro — aggiungi outline sottile */
[data-theme="light"] .it-v { color: #007a3a; -webkit-text-fill-color: #007a3a; }
[data-theme="light"] .it-b { color: #ffffff; -webkit-text-fill-color: #ffffff; -webkit-text-stroke: 0.8px rgba(0,0,0,0.5); }
[data-theme="light"] .it-r { color: #b02030; -webkit-text-fill-color: #b02030; }

/* ── THEME TOGGLE BUTTON ── */
.btn-theme {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--border2);
  background: var(--surface3);
  color: var(--text2);
  cursor: pointer; font-size: 1.1rem; line-height: 1;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  flex-shrink: 0;
}
.btn-theme:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-light); }

/* ── RESET & BASE ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: 4px;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: none;
}

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  max-width: 100vw;
}

button, input, select, textarea {
  font-family: inherit;
}

h1, h2, h3, h4 {
  font-family: 'Syne', sans-serif;
  line-height: 1.2;
  text-wrap: balance;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface4); border-radius: 99px; }

/* ── NOISE TEXTURE overlay ── */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none; z-index: 0; opacity: 0.4;
}

/* ═══════════════════════════════════════════
   NAVBAR
═══════════════════════════════════════════ */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  display: flex; align-items: center; justify-content: space-between;
  padding: env(safe-area-inset-top) 28px 0; height: calc(68px + env(safe-area-inset-top));
  background: rgba(4,4,10,0.8);
  backdrop-filter: blur(24px) saturate(1.8);
  border-bottom: 1px solid var(--border);
}

.navbar::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--primary), var(--cyan), transparent);
  opacity: 0.4;
}

.nav-brand {
  display: flex; align-items: center; gap: 0;
  text-decoration: none; flex-shrink: 0;
}

.nav-links {
  display: flex; align-items: center; gap: 2px;
  position: absolute; left: 50%; transform: translateX(-50%);
}

.nav-links a {
  padding: 8px 16px; border-radius: 50px;
  color: var(--text3); text-decoration: none;
  font-size: 0.875rem; font-weight: 600;
  transition: all 0.2s; letter-spacing: 0.01em;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.nav-links a:hover { color: var(--text); background: var(--surface3); }
.nav-links a.active {
  color: var(--text);
  background: var(--surface3);
  box-shadow: inset 0 0 0 1px var(--border2);
}

.nav-right { display: flex; align-items: center; gap: 10px; }

.coin-icon {
  display: inline-block; vertical-align: middle;
  width: 1.15em; height: 1.15em; object-fit: contain;
}
.stat-icon-bg .coin-icon {
  width: 3rem; height: 3rem; opacity: 1; filter: none;
}
.feature-icon .coin-icon { width: 2.2rem; height: 2.2rem; }

.points-badge {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: 50px;
  background: linear-gradient(135deg, rgba(43,108,226,0.15), rgba(0,212,255,0.1));
  border: 1px solid rgba(43,108,226,0.3);
  font-size: 0.85rem; font-weight: 700;
  color: var(--cyan); font-family: 'Syne', sans-serif;
  letter-spacing: 0.02em;
}

.nav-user {
  font-size: 0.83rem; color: var(--text2); font-weight: 600;
  max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.btn-logout {
  padding: 7px 14px; border-radius: 50px;
  border: 1px solid var(--border2);
  background: transparent; color: var(--text3);
  font-size: 0.8rem; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.btn-logout:hover { background: var(--no-soft); color: var(--no); border-color: var(--no); }

/* ═══════════════════════════════════════════
   MAIN LAYOUT
═══════════════════════════════════════════ */
.main { max-width: 1280px; margin: 0 auto; padding: 40px 28px; padding-top: calc(108px + env(safe-area-inset-top)); position: relative; z-index: 1; }

/* ═══════════════════════════════════════════
   PAGE HEADER
═══════════════════════════════════════════ */
.page-header {
  text-align: center; padding: 60px 0 44px;
  position: relative;
}

.page-header::before {
  content: '';
  position: absolute; top: -20px; left: 50%; transform: translateX(-50%);
  width: 700px; height: 400px;
  background: radial-gradient(ellipse, rgba(43,108,226,0.12) 0%, rgba(0,212,255,0.06) 40%, transparent 70%);
  pointer-events: none;
}

.page-header h1 {
  font-family: 'Syne', sans-serif;
  font-size: 3.2rem; font-weight: 800;
  color: var(--text);
  margin-bottom: 12px; letter-spacing: -1px;
  position: relative; display: inline-block;
}

.page-header h1::after {
  content: '';
  position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%);
  width: 48px; height: 2px;
  background: var(--primary);
  border-radius: 2px;
}

.page-header p { color: var(--text2); font-size: 1rem; max-width: 500px; margin: 0 auto; }

/* ═══════════════════════════════════════════
   STAT CARDS
═══════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px; margin-bottom: 36px;
}

@media (max-width: 600px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}
@media (max-width: 400px) {
  .stats-grid { grid-template-columns: 1fr; }
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px 22px;
  position: relative; overflow: hidden;
  transition: all 0.3s ease;
}

.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--primary-light), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.stat-card:hover { transform: translateY(-3px); border-color: var(--border2); }
.stat-card:hover::before { opacity: 1; }

.stat-icon-bg {
  position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  font-size: 3.2rem; opacity: 0.06; pointer-events: none; filter: blur(1px);
}

.stat-label {
  font-size: 0.75rem; font-weight: 600; color: var(--text3);
  text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 10px;
}

.stat-value {
  font-family: 'Syne', sans-serif;
  font-size: 2rem; font-weight: 800; line-height: 1;
  margin-bottom: 4px;
  animation: countUp 0.6s ease both;
}

.stat-sub { font-size: 0.72rem; color: var(--text3); font-weight: 500; }

.stat-value, .stat-bar-val, .podium-points, .points-badge {
  font-variant-numeric: tabular-nums;
}

/* ═══════════════════════════════════════════
   SEARCH + FILTERS
═══════════════════════════════════════════ */
.search-bar {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: var(--radius-sm); padding: 12px 18px; margin-bottom: 20px;
  transition: all 0.25s;
}
.search-bar:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.search-bar input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.9rem; font-weight: 500;
}
.search-bar input::placeholder { color: var(--text3); }
.search-bar span { color: var(--text3); font-size: 1rem; }

.filters {
  display: flex; gap: 8px; margin-bottom: 28px;
  overflow-x: auto; padding-bottom: 4px;
  scrollbar-width: none; -ms-overflow-style: none;
}
.filters::-webkit-scrollbar { display: none; }

.filter-btn {
  padding: 8px 18px; border-radius: 50px;
  border: 1px solid var(--border2);
  background: var(--surface2); color: var(--text2);
  font-size: 0.8rem; font-weight: 600; cursor: pointer;
  transition: all 0.2s; font-family: 'Plus Jakarta Sans', sans-serif;
  letter-spacing: 0.01em;
}
.filter-btn:hover { border-color: var(--primary); color: var(--text); }
.filter-btn:active { transform: scale(0.96); }
.filter-btn.active {
  background: linear-gradient(135deg, var(--primary), #63A3F0) !important;
  border-color: transparent !important; color: #fff !important;
  box-shadow: 0 4px 20px var(--primary-glow) !important;
}

/* ═══════════════════════════════════════════
   MARKETS GRID
═══════════════════════════════════════════ */
.markets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

/* ═══════════════════════════════════════════
   MARKET CARD
═══════════════════════════════════════════ */
.market-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  cursor: pointer; position: relative; overflow: hidden;
  transition: all 0.35s cubic-bezier(0.4,0,0.2,1);
}

.market-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--cyan));
  transform: scaleX(0); transform-origin: left;
  transition: transform 0.4s cubic-bezier(0.4,0,0.2,1);
  pointer-events: none;
}

.market-card::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at top left, rgba(43,108,226,0.05), transparent 60%);
  opacity: 0; transition: opacity 0.3s;
  pointer-events: none;
}

.market-card:hover {
  transform: translateY(-6px);
  border-color: rgba(43,108,226,0.4);
  box-shadow: 0 24px 48px rgba(0,0,0,0.5), 0 0 0 1px rgba(43,108,226,0.15), 0 0 60px rgba(43,108,226,0.08);
}
.market-card:hover::before { transform: scaleX(1); }
.market-card:hover::after { opacity: 1; }
.market-card:active { transform: translateY(-2px) !important; }

.card-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 14px; gap: 8px; flex-wrap: wrap;
}

.category-tag {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; padding: 4px 10px; border-radius: 50px;
  border: 1px solid currentColor;
}
.cat-politica { background: rgba(43,108,226,0.15); color: #A8C8F8; }
.cat-sport    { background: rgba(0,229,160,0.12);  color: #6ee7b7; }
.cat-economia { background: rgba(251,191,36,0.12); color: #fcd34d; }
.cat-mondo    { background: rgba(0,212,255,0.12);  color: #67e8f9; }
.cat-tech     { background: rgba(59,130,246,0.12); color: #93c5fd; }
.cat-societa  { background: rgba(236,72,153,0.12); color: #f9a8d4; }
.cat-ambiente { background: rgba(34,197,94,0.12);  color: #86efac; }

.card-deadline {
  font-size: 0.7rem; color: var(--text3); font-weight: 600;
  white-space: nowrap;
}

.card-title {
  font-family: 'Syne', sans-serif;
  font-size: 1.02rem; font-weight: 700; line-height: 1.45;
  color: var(--text); margin-bottom: 20px;
}

/* ── PROBABILITY BAR ── */
.prob-bar-wrap { margin-bottom: 16px; }

.prob-labels {
  display: flex; justify-content: space-between;
  font-size: 0.75rem; font-weight: 700; margin-bottom: 8px;
}
.prob-yes { color: var(--yes) !important; font-weight: 800 !important; }
.prob-no  { color: var(--no)  !important; font-weight: 800 !important; }

.prob-bar {
  height: 8px !important; border-radius: 99px !important;
  background: rgba(255,77,109,0.2) !important;
  overflow: hidden; position: relative;
}

.prob-bar-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--yes), #00c896) !important;
  transition: width 1s cubic-bezier(0.4,0,0.2,1) !important;
  position: relative;
}
.prob-bar-fill::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  animation: shimmer 2.5s infinite;
}

/* ── BET BUTTONS ── */
.bet-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }

.btn-yes, .btn-no {
  padding: 11px 16px; border-radius: var(--radius-sm);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.9rem; font-weight: 700;
  cursor: pointer; transition: all 0.22s cubic-bezier(0.4,0,0.2,1);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  position: relative; overflow: hidden;
}

.btn-yes {
  background: var(--yes-soft) !important;
  border: 1.5px solid rgba(0,229,160,0.4) !important;
  color: var(--yes) !important;
}
.btn-yes span { font-size: 0.75rem; opacity: 0.8; }
.btn-yes:hover {
  background: rgba(0,229,160,0.2) !important;
  border-color: var(--yes) !important;
  box-shadow: 0 0 24px var(--yes-glow) !important;
  transform: translateY(-2px) !important;
}
.btn-yes:active { transform: scale(0.97) translateY(0) !important; box-shadow: none !important; }

.btn-no {
  background: var(--no-soft) !important;
  border: 1.5px solid rgba(255,77,109,0.4) !important;
  color: var(--no) !important;
}
.btn-no span { font-size: 0.75rem; opacity: 0.8; }
.btn-no:hover {
  background: rgba(255,77,109,0.2) !important;
  border-color: var(--no) !important;
  box-shadow: 0 0 24px var(--no-glow) !important;
  transform: translateY(-2px) !important;
}
.btn-no:active { transform: scale(0.97) translateY(0) !important; box-shadow: none !important; }

/* ── CARD EXTRAS ── */
.card-volume {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border);
  font-size: 0.73rem; color: var(--text3); font-weight: 500;
}

.card-footer {
  display: flex; justify-content: space-between;
  font-size: 0.73rem; color: var(--text3);
  margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--border);
}

.badge-hot {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff; font-size: 0.62rem; font-weight: 800;
  padding: 3px 8px; border-radius: 20px; letter-spacing: 0.4px;
  text-transform: uppercase; animation: pulse 2s infinite;
  box-shadow: 0 2px 10px rgba(239,68,68,0.4);
}

.badge-hot-scade {
  background: rgba(255,77,109,0.1); color: #fca5a5;
  border: 1px solid rgba(255,77,109,0.3);
  font-size: 0.62rem; font-weight: 700;
  padding: 3px 8px; border-radius: 20px;
}

/* ═══════════════════════════════════════════
   MODALS
═══════════════════════════════════════════ */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.75); backdrop-filter: blur(8px);
  z-index: 500; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.open { display: flex; animation: fadeIn 0.2s ease; }

.modal {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 28px; width: 100%; max-width: 460px;
  box-shadow: var(--shadow), 0 0 0 1px rgba(43,108,226,0.1);
  animation: slideUp 0.3s cubic-bezier(0.4,0,0.2,1);
  position: relative;
}

.modal::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--primary), var(--cyan), transparent);
}

.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 18px;
}
.modal-title {
  font-family: 'Syne', sans-serif;
  font-size: 1.1rem; font-weight: 700;
}
.modal-close {
  background: var(--surface3); border: 1px solid var(--border);
  width: 32px; height: 32px; border-radius: 50%;
  color: var(--text2); cursor: pointer; font-size: 0.9rem;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.modal-close:hover { background: var(--no-soft); color: var(--no); border-color: var(--no); }

.bet-choice-display {
  padding: 12px 16px; border-radius: var(--radius-sm);
  font-weight: 700; font-size: 0.95rem; margin-bottom: 18px;
  text-align: center; font-family: 'Syne', sans-serif;
}
.bet-choice-display.yes {
  background: var(--yes-soft); color: var(--yes); border: 1px solid rgba(0,229,160,0.3);
}
.bet-choice-display.no {
  background: var(--no-soft); color: var(--no); border: 1px solid rgba(255,77,109,0.3);
}

.bet-info {
  background: var(--surface3); border-radius: var(--radius-sm);
  padding: 14px 16px; margin: 16px 0;
  border: 1px solid var(--border);
}
.bet-info-row {
  display: flex; justify-content: space-between;
  font-size: 0.85rem; color: var(--text2); padding: 4px 0;
}
.bet-info-row strong { color: var(--text); }

.quick-amounts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.quick-amt {
  padding: 5px 12px; border-radius: 50px;
  background: var(--surface3); border: 1px solid var(--border2);
  color: var(--text2); font-size: 0.78rem; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.quick-amt:hover {
  background: var(--primary-soft); border-color: var(--primary); color: var(--primary-light);
}

/* ═══════════════════════════════════════════
   FORMS
═══════════════════════════════════════════ */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 0.78rem; font-weight: 700;
  color: var(--text3); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.06em;
}
.form-input {
  width: 100%; padding: 12px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border2); background: var(--surface3);
  color: var(--text); font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.9rem; font-weight: 500; outline: none;
  transition: all 0.25s;
}
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
  background: var(--surface4);
}
.form-input::placeholder { color: var(--text3); }

.btn-primary {
  width: 100%; padding: 13px;
  background: linear-gradient(135deg, var(--primary), #63A3F0);
  border: none; border-radius: var(--radius-sm);
  color: #fff; font-family: 'Syne', sans-serif;
  font-size: 0.95rem; font-weight: 700;
  cursor: pointer; transition: all 0.25s;
  letter-spacing: 0.02em;
  position: relative; overflow: hidden;
}
.btn-primary::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  opacity: 0; transition: opacity 0.2s;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px var(--primary-glow);
}
.btn-primary:hover::before { opacity: 1; }
.btn-primary:active { transform: scale(0.99) translateY(0) !important; box-shadow: none !important; }
.btn-primary:disabled {
  opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none;
}

/* ═══════════════════════════════════════════
   LOGIN PAGE
═══════════════════════════════════════════ */
.login-page {
  min-height: 100dvh; display: flex; align-items: center;
  justify-content: center; position: relative;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 24px; padding: 36px;
  width: 100%; max-width: 440px;
  box-shadow: var(--shadow), 0 0 80px rgba(43,108,226,0.08);
  position: relative; z-index: 1;
  animation: slideUp 0.5s cubic-bezier(0.4,0,0.2,1);
}

.login-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--primary), var(--cyan), transparent);
}

.login-logo {
  text-align: center; margin-bottom: 28px;
}
.login-logo p {
  color: var(--text3); font-size: 0.85rem; font-weight: 500; margin-top: 4px;
}

.tab-switch {
  display: flex; background: var(--surface2);
  border-radius: 50px; padding: 4px; margin-bottom: 24px;
  border: 1px solid var(--border);
}
.tab-btn {
  flex: 1; padding: 9px; border: none; background: none;
  color: var(--text3); font-family: 'Syne', sans-serif;
  font-size: 0.88rem; font-weight: 700; cursor: pointer;
  border-radius: 50px; transition: all 0.25s; letter-spacing: 0.02em;
}
.tab-btn.active {
  background: var(--primary); color: #fff;
  box-shadow: 0 4px 16px var(--primary-glow);
}

.login-bonus {
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(135deg, rgba(251,191,36,0.08), rgba(251,191,36,0.04));
  border: 1px solid rgba(251,191,36,0.2);
  border-radius: var(--radius-sm); padding: 12px 16px;
  margin-top: 16px; font-size: 0.83rem; color: var(--text2);
}
.bonus-icon { font-size: 1.2rem; }
.login-bonus strong { color: var(--gold); }

/* ── PARTICLES ── */
.particles { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.particle {
  position: absolute; border-radius: 50%;
  background: radial-gradient(circle, var(--primary), var(--cyan));
  animation: float linear infinite;
}

/* ═══════════════════════════════════════════
   LEADERBOARD
═══════════════════════════════════════════ */

/* Podio top 3 */
.podium {
  display: flex; align-items: flex-end; justify-content: center;
  gap: 16px; margin-bottom: 40px;
}

.podium-item {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  animation: fadeInUp 0.6s ease both;
}

.podium-avatar {
  width: 60px; height: 60px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif; font-size: 1.4rem; font-weight: 800;
  position: relative;
}
.podium-item:nth-child(1) .podium-avatar {
  width: 72px; height: 72px; font-size: 1.6rem;
}

.podium-crown {
  position: absolute; top: -16px; font-size: 1.3rem;
  animation: bounce 2s ease infinite;
}

.podium-block {
  width: 100%; border-radius: 12px 12px 0 0;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif; font-size: 1.5rem; font-weight: 800;
}

.podium-name {
  font-weight: 700; font-size: 0.85rem; color: var(--text);
  text-align: center; max-width: 100px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.podium-points {
  font-family: 'Syne', sans-serif; font-size: 0.9rem; font-weight: 700; color: var(--cyan);
}

/* Leaderboard table */
.leaderboard-table {
  width: 100%; border-collapse: collapse;
  background: var(--surface); border-radius: var(--radius);
  overflow: hidden; border: 1px solid var(--border);
}
.leaderboard-table thead th {
  padding: 14px 20px; text-align: left;
  font-size: 0.7rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--text3);
  background: var(--surface2); border-bottom: 1px solid var(--border);
}
.leaderboard-row td {
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  font-size: 0.875rem; vertical-align: middle;
}
.leaderboard-row:last-child td { border-bottom: none; }
.leaderboard-row {
  transition: all 0.2s;
}
.leaderboard-row:hover { background: var(--surface2); }
.lb-row-me {
  background: rgba(43,108,226,0.08) !important;
  outline: 1.5px solid rgba(43,108,226,0.35);
  outline-offset: -1px;
}

/* ═══════════════════════════════════════════
   PROFILE
═══════════════════════════════════════════ */
.profile-header {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 32px;
  margin-bottom: 24px; position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 24px;
}

.profile-header::before {
  content: '';
  position: absolute; top: 0; right: 0; width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(43,108,226,0.08), transparent 70%);
  pointer-events: none;
}

.profile-avatar {
  width: 80px; height: 80px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif; font-size: 1.8rem; font-weight: 800; color: #fff;
  box-shadow: 0 0 0 4px rgba(43,108,226,0.2), 0 0 30px rgba(43,108,226,0.3);
}

.profile-info h2 {
  font-size: 1.5rem; font-weight: 800; margin-bottom: 4px;
}
.profile-info p { color: var(--text2); font-size: 0.875rem; }

/* Bet history items */
.bet-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 16px 20px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; transition: all 0.2s;
  position: relative;
}
.bet-item:hover { border-color: var(--border2); background: var(--surface2); }
.bet-item::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; border-radius: 3px 0 0 3px;
}
.bet-item.won::before  { background: var(--yes); }
.bet-item.lost::before { background: var(--no); }
.bet-item.open::before { background: var(--gold); }

.bet-status {
  padding: 5px 12px; border-radius: 50px;
  font-size: 0.72rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.06em; white-space: nowrap;
}
.bet-status.won  { background: var(--yes-soft); color: var(--yes); }
.bet-status.lost { background: var(--no-soft);  color: var(--no);  }
.bet-status.open { background: rgba(251,191,36,0.12); color: var(--gold); }

/* ═══════════════════════════════════════════
   CHART CONTAINER
═══════════════════════════════════════════ */
.chart-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
}
.chart-card h3 {
  font-size: 0.8rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text3); margin-bottom: 16px;
}
.chart-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
  margin-bottom: 28px;
}

/* ═══════════════════════════════════════════
   LOADER
═══════════════════════════════════════════ */
/* ── Skeleton loader ── */
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position: 600px 0; }
}
.skeleton-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
}
.skel {
  border-radius: 6px;
  background: linear-gradient(90deg, var(--surface2) 25%, var(--surface3) 50%, var(--surface2) 75%);
  background-size: 600px 100%;
  animation: shimmer 1.4s infinite linear;
}
.skel-tag   { height: 22px; width: 90px; margin-bottom: 16px; }
.skel-title { height: 18px; width: 100%; margin-bottom: 8px; }
.skel-title2{ height: 18px; width: 70%; margin-bottom: 20px; }
.skel-bar   { height: 8px; width: 100%; border-radius: 4px; margin-bottom: 20px; }
.skel-vol   { height: 14px; width: 55%; margin-bottom: 16px; }
.skel-btns  { display: flex; gap: 10px; }
.skel-btn   { height: 40px; flex: 1; border-radius: 50px; }

.loader {
  display: flex; justify-content: center; padding: 60px 0;
}
.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--border2);
  border-top-color: var(--primary);
  animation: spin 0.7s linear infinite;
}

/* ═══════════════════════════════════════════
   EMPTY STATE
═══════════════════════════════════════════ */
.empty-state {
  text-align: center; padding: 80px 24px;
}
.empty-icon { font-size: 3.5rem; margin-bottom: 16px; }
.empty-state h3 {
  font-size: 1.2rem; font-weight: 700; margin-bottom: 8px;
  color: var(--text2);
}
.empty-state p { color: var(--text3); font-size: 0.9rem; }

/* ═══════════════════════════════════════════
   TOAST
═══════════════════════════════════════════ */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 10px; z-index: 9999;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-radius: var(--radius-sm);
  font-size: 0.875rem; font-weight: 600;
  background: var(--surface3); border: 1px solid var(--border2);
  box-shadow: var(--shadow); max-width: 320px;
  animation: slideInRight 0.3s ease, fadeOut 0.3s ease 2.8s forwards;
}
.toast.success { border-color: rgba(0,229,160,0.4); color: var(--yes); }
.toast.error   { border-color: rgba(255,77,109,0.4); color: var(--no); }
.toast.info    { border-color: rgba(43,108,226,0.4); color: var(--primary-light); }

/* ═══════════════════════════════════════════
   SECTION HEADER
═══════════════════════════════════════════ */
.section-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.section-title {
  font-family: 'Syne', sans-serif;
  font-size: 1.1rem; font-weight: 800;
}

/* ═══════════════════════════════════════════
   CONFETTI
═══════════════════════════════════════════ */
.confetti-piece {
  position: fixed; border-radius: 2px;
  animation: confettiFall 2.5s ease-in forwards;
  z-index: 9998; pointer-events: none;
}

/* ═══════════════════════════════════════════
   ANIMATIONS
═══════════════════════════════════════════ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(32px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes fadeOut {
  to { opacity: 0; transform: translateX(40px); }
}
@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(200%); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes float {
  0%   { transform: translateY(100vh) scale(0); opacity: 0; }
  10%  { opacity: 0.5; }
  90%  { opacity: 0.3; }
  100% { transform: translateY(-10vh) scale(1); opacity: 0; }
}
@keyframes confettiFall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}
@keyframes countUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes glow {
  0%, 100% { box-shadow: 0 0 20px var(--primary-glow); }
  50%       { box-shadow: 0 0 40px var(--primary-glow), 0 0 80px rgba(43,108,226,0.1); }
}

/* ── PAGE TRANSITIONS ── */
/* Solo opacity — nessun transform: evita stacking context su position:fixed (Safari + Chrome) */
.page-enter { animation: pageEnter 0.35s ease both; }
@keyframes pageEnter {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── SCROLL REVEAL ── */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.5s cubic-bezier(0.4,0,0.2,1),
              transform 0.5s cubic-bezier(0.4,0,0.2,1);
}
.reveal.visible { opacity: 1; transform: translateY(0); }
.reveal-d1 { transition-delay: 0.08s; }
.reveal-d2 { transition-delay: 0.16s; }
.reveal-d3 { transition-delay: 0.21s; }

/* ── MISC ── */
.rank-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface3); border: 1px solid var(--border2);
  font-size: 0.75rem; font-weight: 700; color: var(--text3);
}

.winrate-high { color: var(--yes) !important; }
.winrate-mid  { color: var(--gold) !important; }
.winrate-low  { color: var(--no)  !important; }

/* ═══════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════ */
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .chart-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .navbar { padding: env(safe-area-inset-top) 16px 0; }
  .nav-links { display: none; }
  .nav-user { display: none; }
  .nav-p-icon { height: 24px; }
  .brand-logo { display: inline-flex; font-size: 1.1rem; }
  .nav-brand { gap: 0; }
  .main { padding: calc(88px + env(safe-area-inset-top)) 16px 100px; }
  .markets-grid { grid-template-columns: 1fr; }
  .page-header h1 { font-size: 2rem; }
  .page-header { padding: 40px 0 28px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .podium { gap: 8px; }
  .login-card { padding: 28px 20px; }
  .bottom-nav { display: flex !important; }
  /* Disabilita aurora su mobile — riduce jank scroll */
  .aurora-band { animation: none; will-change: auto; }
  .hero-bg { animation: none; will-change: auto; }
  /* Rimuove noise texture fixed su mobile — causa scroll jamming su iOS Chrome */
  body::before { display: none; }
}

@media (min-width: 769px) {
  .bottom-nav { display: none !important; }
}

/* ── BOTTOM NAVIGATION BAR ── */
/* Sempre fixed e hidden di default, visibile solo su mobile via JS/media */
.bottom-nav {
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 9999 !important;
  display: none;
  background: rgba(4,4,10,0.98);
  border-top: 1px solid var(--border2);
  padding: 10px 0;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  justify-content: space-around;
  align-items: center;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.5);
}

.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  text-decoration: none; padding: 4px 8px; border-radius: 12px;
  transition: all 0.2s; flex: 1; min-width: 0;
  color: var(--text3); font-size: 0.58rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav .bn-icon {
  font-size: 1.4rem; line-height: 1;
  transition: transform 0.2s;
  display: block;
}

.bottom-nav a.active { color: var(--primary-light); }
.bottom-nav a.active .bn-icon { transform: translateY(-3px); }
.bottom-nav a:active .bn-icon { transform: scale(0.9); }

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-value { font-size: 1.5rem; }
}

/* ── LANDSCAPE MOBILE ── */
@media (orientation: landscape) and (max-height: 600px) {
  /* Navbar compatta, solo logo + nav-right (no nav-links) */
  .navbar {
    height: 52px;
    padding-left:  max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
  .nav-brand img { height: 34px; }
  /* Nascondi link centrali e username come in portrait mobile */
  .navbar .nav-links { display: none; }
  .navbar .nav-user  { display: none; }

  /* Mostra bottom nav anche in landscape mobile */
  .bottom-nav {
    display: flex !important;
    padding-left:  max(8px, env(safe-area-inset-left));
    padding-right: max(8px, env(safe-area-inset-right));
    padding-bottom: max(4px, env(safe-area-inset-bottom));
    height: 52px !important;
  }

  /* Contenuto principale */
  .main {
    padding-top: 68px;
    padding-left:  max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    padding-bottom: 68px;
  }

  /* Header di pagina più compatto */
  .page-header { padding: 16px 0 12px; }
  .page-header h1 { font-size: 1.4rem; }

  /* Griglia mercati a 2 colonne in landscape */
  .markets-grid { grid-template-columns: 1fr 1fr; }
}

/* ── AURORA HERO ── */
.aurora-band {
  position: absolute;
  width: 200%; height: 300px;
  border-radius: 50%;
  filter: blur(80px);
  animation: auroraFlow var(--d, 8s) ease-in-out infinite alternate;
  pointer-events: none;
  will-change: transform;
}
.ab1 {
  background: rgba(43,108,226,0.45);
  top: -80px; left: -20%; --d: 7s;
}
.ab2 {
  background: rgba(0,212,255,0.25);
  top: 40px; left: 10%; --d: 9s;
  animation-delay: -3s;
}
.ab3 {
  background: rgba(255,77,109,0.15);
  top: 120px; left: 30%; --d: 11s;
  animation-delay: -5s;
}
@keyframes auroraFlow {
  from { transform: scaleX(0.85) scaleY(1) translateX(-4%); }
  to   { transform: scaleX(1.1) scaleY(1.25) translateX(4%); }
}

/* Parallax scroll sull'aurora (Chrome/Edge 115+) */
@supports (animation-timeline: scroll()) {
  .hero-bg {
    animation: heroParallax linear both;
    animation-timeline: scroll(root);
    animation-range: 0% 50%;
  }
  @keyframes heroParallax {
    from { transform: translateY(0); }
    to   { transform: translateY(60px); }
  }
}

/* ── REDUCED MOTION ── */
@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal-d1, .reveal-d2, .reveal-d3 {
    transition: none; opacity: 1; transform: none;
  }
  .page-enter { animation: none; }
  .aurora-band { animation: none; }
  .hero-bg { animation: none; }
}
