/* ============================================================
   ITALIACRIT — Design System
   Tabellone da cronometro × Copertina magazine ciclistico italiano
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Barlow+Condensed:wght@400;600;700&family=Barlow:wght@400;500&family=JetBrains+Mono:wght@400;700&display=swap');

/* ── TOKENS ─────────────────────────────────────────────────── */
:root {
  /* Base */
  --bg-primary:     #0a0a0a;
  --bg-secondary:   #111111;
  --bg-card:        #181818;
  --bg-elevated:    #222222;

  /* Accent primario — rosso corsa */
  --red-hot:        #e8001d;
  --red-deep:       #9b0013;
  --red-glow:       rgba(232, 0, 29, 0.15);

  /* Accent secondario — giallo numero */
  --yellow-race:    #f5c400;
  --yellow-dim:     #a88900;

  /* Testo */
  --text-primary:   #f0f0f0;
  --text-secondary: #888888;
  --text-muted:     #444444;

  /* Categorie badge */
  --cat-esordienti: #3b82f6;
  --cat-allievi:    #8b5cf6;
  --cat-juniores:   #10b981;
  --cat-u23:        #f59e0b;
  --cat-elite:      #e8001d;
  --cat-donne:      #ec4899;

  /* Podio */
  --gold:   #f5c400;
  --silver: #b0b0b0;
  --bronze: #cd7f32;

  /* Bordi */
  --border-subtle:  rgba(255,255,255,0.06);
  --border-active:  rgba(232, 0, 29, 0.5);

  /* Typography */
  --font-display: 'Bebas Neue', Impact, sans-serif;
  --font-heading: 'Barlow Condensed', sans-serif;
  --font-body:    'Barlow', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  /* Sizes */
  --size-hero:  clamp(3rem, 8vw, 7rem);
  --size-h1:    clamp(2rem, 4vw, 3.5rem);
  --size-h2:    clamp(1.4rem, 2.5vw, 2rem);
  --size-label: 0.7rem;
  --size-body:  0.95rem;
  --size-mono:  0.85rem;

  /* Gradienti */
  --gradient-hero: linear-gradient(160deg, rgba(10,10,10,0.97), rgba(232,0,29,0.06));
  --gradient-male: linear-gradient(135deg, #2a2a2a, #1a1a1a);
  --gradient-female: linear-gradient(135deg, #1e1e1e, #0a0a0a);
}

/* ── LIGHT MODE OVERRIDES (solo contenuto pagina, NON navbar) ─────── */
body.light-mode {
  --bg-primary:     #f8f9fa;
  --bg-secondary:   #ffffff;
  --bg-card:        #f1f3f5;
  --bg-elevated:    #e9ecef;
  --text-primary:   #111111;
  --text-secondary: #495057;
  --text-muted:     #868e96;
  --border-subtle:  rgba(0,0,0,0.08);
  --gradient-hero: linear-gradient(160deg, rgba(255,255,255,0.95), rgba(232,0,29,0.08));
  --gradient-male: linear-gradient(135deg, #f1f3f5, #e9ecef);
  --gradient-female: linear-gradient(135deg, #ffffff, #f8f9fa);
}

/* ── RESET ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--size-body);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
img { max-width: 100%; display: block; }

/* ── KEYFRAMES ───────────────────────────────────────────────── */
@keyframes flip-number {
  0%   { transform: rotateX(90deg); opacity: 0; }
  100% { transform: rotateX(0deg);  opacity: 1; }
}
@keyframes slide-in {
  from { transform: translateX(-20px); opacity: 0; }
  to   { transform: translateX(0);     opacity: 1; }
}
@keyframes slide-up {
  from { transform: translateY(12px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
@keyframes count-up {
  from { opacity: 0.3; transform: translateY(4px); }
  to   { opacity: 1;   transform: translateY(0); }
}
@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232,0,29,0.6); }
  50%       { box-shadow: 0 0 0 6px rgba(232,0,29,0); }
}
@keyframes blink-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.2; }
}
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes flame-flicker {
  0%,100% { transform: scaleY(1) translateY(0); opacity: 1; }
  50%      { transform: scaleY(1.15) translateY(-1px); opacity: 0.8; }
}

/* ── NAVBAR ──────────────────────────────────────────────────── */
#navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: #0a0a0a;
  border-bottom: 2px solid var(--red-hot);
  height: 82px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 0;
}
.nav-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  padding: 0;
  height: 100%;
}
.nav-logo-img {
  height: 80px;
  width: auto;
  object-fit: contain;
  display: block;
  transition: opacity 0.2s;
}
.nav-logo:hover .nav-logo-img { opacity: 0.8; }
.nav-sep {
  width: 1px;
  height: 28px;
  background: var(--red-hot);
  margin: 0 20px;
  opacity: 0.7;
  flex-shrink: 0;
}
.nav-links {
  display: flex;
  gap: 4px;
  align-items: center;
  flex: 1;
}
/* Nav links: colori SEMPRE basati su sfondo scuro */
.nav-link {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #888888;
  padding: 6px 14px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.nav-link:hover {
  color: #f0f0f0;
  background: rgba(255,255,255,0.08);
}
.nav-link.active { color: var(--red-hot); background: rgba(232,0,29,0.08); }
.nav-search-wrap {
  margin-left: auto;
  position: relative;
  flex-shrink: 0;
}
#nav-search {
  background: #1a1a1a;
  border: 1px solid rgba(255,255,255,0.1);
  color: #f0f0f0;
  font-family: var(--font-body);
  font-size: 0.85rem;
  padding: 6px 12px;
  border-radius: 4px;
  width: 180px;
  transition: border-color 0.15s, width 0.25s;
  outline: none;
}
#nav-search::placeholder { color: #555; }
#nav-search:focus {
  border-color: var(--red-hot);
  width: 240px;
}
.nav-search-icon { color: #555; }
.badge-live {
  display: none;
  margin-left: 14px;
  padding: 4px 10px;
  background: var(--red-deep);
  color: #fff;
  font-family: var(--font-heading);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-radius: 3px;
  flex-shrink: 0;
  animation: live-pulse 1.5s infinite;
}
.badge-live.visible { display: flex; align-items: center; gap: 5px; }
.badge-live .dot {
  width: 6px; height: 6px;
  background: #ff4444;
  border-radius: 50%;
  animation: blink-dot 1s infinite;
}
/* Selettore lingua (navbar) — solo bandiera, compatto */
.lang-select {
  margin-left: 14px;
  background: #1a1a1a;
  color: #f0f0f0;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  font-size: 1.05rem;
  line-height: 1;
  padding: 5px 6px;
  cursor: pointer;
  outline: none;
  flex-shrink: 0;
  text-align: center;
}
.lang-select:focus { border-color: var(--red-hot); }
.lang-select option { background: #1a1a1a; color: #f0f0f0; }
/* Selettore lingua (drawer mobile) */
.lang-select-m {
  width: 100%;
  background: var(--bg-elevated, #1a1a1a);
  color: var(--text-primary, #f0f0f0);
  border: 1px solid var(--border-subtle, rgba(255,255,255,0.1));
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 10px 12px;
  margin-top: 4px;
  cursor: pointer;
  outline: none;
}
/* Google Translate: nascondi widget e banner, evita lo shift del body */
#google_translate_element { display: none !important; }
.goog-te-banner-frame,
.goog-te-banner-frame.skiptranslate,
iframe.goog-te-banner-frame,
.goog-te-gadget,
.goog-te-gadget-icon,
.goog-te-balloon-frame,
#goog-gt-tt,
.VIpgJd-ZVi9od-aZ2wEe-wOHMyf,
.skiptranslate { display: none !important; }
.goog-tooltip, .goog-tooltip:hover { display: none !important; }
.goog-text-highlight { background: none !important; box-shadow: none !important; }
/* Google sposta il body di ~40px per il banner: forziamo lo stato originale */
body { top: 0 !important; position: static !important; }
/* Hamburger (mobile) */
#nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 6px;
  margin-left: auto;
}
#nav-hamburger span {
  width: 22px; height: 2px;
  background: #f0f0f0;
  border-radius: 1px;
  transition: all 0.2s;
}
/* Mobile drawer */
#nav-drawer {
  display: none;
  position: fixed;
  top: 82px; right: 0;
  bottom: 0; width: 260px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-subtle);
  z-index: 99;
  flex-direction: column;
  padding: 20px;
  gap: 8px;
  animation: slide-in 0.2s ease;
}
#nav-drawer.open { display: flex; }

/* ── THEME TOGGLE ────────────────────────────────────────────── */
.theme-toggle {
  margin-left: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all 0.2s;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.theme-toggle:hover {
  color: var(--text-primary);
  border-color: var(--border-active);
  background: var(--bg-elevated);
}
.theme-toggle svg { width: 18px; height: 18px; }
body.light-mode .theme-icon-sun { display: none; }
body:not(.light-mode) .theme-icon-moon { display: none; }

/* ── LAYOUT ──────────────────────────────────────────────────── */
#app {
  padding-top: 82px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.page { flex: 1; padding: 32px 24px; max-width: 1200px; margin: 0 auto; width: 100%; }
.page-enter { animation: slide-up 0.25s ease; }

/* ── SEARCH RESULTS DROPDOWN ─────────────────────────────────── */
#search-results-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  width: 320px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  margin-top: 4px;
  z-index: 200;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}
/* Barra di ricerca mobile (sotto l'header) — nascosta su desktop */
#mobile-search-bar { display: none; }
.search-result-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 0.1s;
  display: flex;
  align-items: center;
  gap: 10px;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg-elevated); }
.search-result-label { font-size: 0.7rem; color: var(--text-muted); font-family: var(--font-heading); text-transform: uppercase; letter-spacing: 0.1em; }
.search-result-name { font-family: var(--font-heading); font-weight: 700; color: var(--text-primary); }
.search-result-sub { font-size: 0.8rem; color: var(--text-secondary); }

/* ── HERO BANNER ─────────────────────────────────────────────── */
.hero-band {
  position: relative;
  overflow: hidden;
  background: var(--gradient-hero);
  border-bottom: 1px solid var(--border-subtle);
  padding: 40px 24px 32px;
  margin-bottom: 40px;
}
.hero-band::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 6px,
    rgba(255,255,255,0.012) 6px,
    rgba(255,255,255,0.012) 7px
  );
  pointer-events: none;
}
.hero-label {
  font-family: var(--font-heading);
  font-size: var(--size-label);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--red-hot);
  margin-bottom: 6px;
}
.hero-race-name {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.5rem);
  letter-spacing: 0.02em;
  line-height: 1;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.hero-race-meta {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 24px;
  color: var(--text-secondary);
  font-family: var(--font-heading);
  font-size: 0.9rem;
}
.hero-divider {
  height: 1px;
  background: var(--border-subtle);
  margin-bottom: 20px;
}
.hero-podio {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hero-podio-row {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  align-items: center;
  gap: 12px;
  animation: slide-in 0.35s ease both;
}
.hero-pos {
  font-family: var(--font-display);
  font-size: 3rem;
  line-height: 1;
  letter-spacing: -0.02em;
}
.hero-pos.p1 { color: var(--gold); }
.hero-pos.p2 { color: var(--silver); }
.hero-pos.p3 { color: var(--bronze); }
.hero-name {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-primary);
}
.hero-name a:hover { color: var(--red-hot); }
.hero-team {
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.hero-pts {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--yellow-race);
  white-space: nowrap;
}

/* ── HOME SECTION HEADER ─────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 20px;
}
.section-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  letter-spacing: 0.03em;
  color: var(--text-primary);
}
.section-subtitle {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.section-line {
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

/* ── CARD GRIGLIA TOP-3 HOME ─────────────────────────────────── */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 48px;
}
.cat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  overflow: hidden;
  transition: border-color 0.2s;
}
.cat-card:hover { border-color: var(--border-active); }
.cat-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
}
.cat-card-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.cat-card-body { padding: 8px 0; }
.cat-card-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.12s;
}
.cat-card-row:last-child { border-bottom: none; }
.cat-card-row:hover { background: var(--bg-elevated); }
.cat-pos {
  font-family: var(--font-display);
  font-size: 1.6rem;
  line-height: 1;
  color: var(--text-muted);
}
.cat-pos.p1 { color: var(--gold); }
.cat-pos.p2 { color: var(--silver); }
.cat-pos.p3 { color: var(--bronze); }
.cat-rider-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.9rem;
  text-transform: uppercase;
  color: var(--text-primary);
}
.cat-rider-name a:hover { color: var(--red-hot); }
.cat-rider-team { font-size: 0.75rem; color: var(--text-secondary); }
.cat-pts {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--yellow-race);
  animation: count-up 0.4s ease;
}

/* ── BADGE CATEGORIA ─────────────────────────────────────────── */
.badge-cat {
  font-family: var(--font-heading);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 2px;
  border: 1px solid currentColor;
  display: inline-block;
}
.badge-ES1, .badge-ES2 { color: var(--cat-esordienti); }
.badge-AL1, .badge-AL2 { color: var(--cat-allievi); }
.badge-JUN              { color: var(--cat-juniores); }
.badge-U23              { color: var(--cat-u23); }
.badge-ELI              { color: var(--cat-elite); }
.badge-genere-f         { background: rgba(236,72,153,0.15); color: var(--cat-donne); }
.badge-mult-x1          { color: var(--text-secondary); border-color: var(--text-muted); }
.badge-mult-x2          { background: rgba(245,196,0,0.15); color: var(--yellow-race); }
.badge-mult-x3          { background: rgba(232,0,29,0.15);  color: var(--red-hot); }

/* ── CLASSIFICA PAGE ─────────────────────────────────────────── */
.ranking-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 28px;
}
.tab-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.tab-btn {
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 24px;
  border-radius: 9999px;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  background: rgba(255,255,255,0.02);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}
.tab-btn:hover { color: var(--text-primary); border-color: rgba(255,255,255,0.2); background: rgba(255,255,255,0.05); }
.tab-btn.active-gender {
  background: var(--red-hot);
  border-color: var(--red-hot);
  color: #fff;
  box-shadow: 0 4px 12px rgba(232, 0, 29, 0.3);
}
.tab-btn.active-cat {
  background: var(--yellow-race);
  border-color: var(--yellow-race);
  color: #000;
  box-shadow: 0 4px 12px rgba(245, 196, 0, 0.3);
}
.ranking-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}
#ranking-search {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  padding: 7px 14px;
  border-radius: 4px;
  outline: none;
  width: 220px;
  transition: border-color 0.15s;
}
#ranking-search:focus { border-color: var(--border-active); }
.ranking-count { font-size: 0.8rem; color: var(--text-muted); margin-left: auto; }

/* Tabella classifica */
.ranking-table-wrap { overflow-x: auto; }
.ranking-table {
  width: 100%;
  border-collapse: collapse;
}
.ranking-table th {
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}
.ranking-table th.r { text-align: right; }
.ranking-row {
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.12s, border-left 0.12s;
  cursor: default;
  animation: slide-up 0.2s ease both;
}
.ranking-row:hover {
  background: var(--bg-elevated);
  border-left: 3px solid var(--red-hot);
}
.ranking-row td {
  padding: 10px 12px;
  vertical-align: middle;
}
.ranking-row td.r { text-align: right; }
.rank-num {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--text-muted);
  line-height: 1;
  animation: flip-number 0.3s ease-out;
  display: block;
  min-width: 44px;
}
.rank-num.p1 { color: var(--gold); }
.rank-num.p2 { color: var(--silver); }
.rank-num.p3 { color: var(--bronze); }

/* ── TREND INDICATORS ────────────────────────────────────────── */
.trend {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  white-space: nowrap;
}
.trend-up { color: var(--cat-juniores); }
.trend-down { color: var(--red-hot); }
.trend-stable { color: var(--text-muted); opacity: 0.5; }
.trend-new {
  font-size: 0.6rem;
  background: var(--cat-esordienti);
  color: #fff;
  padding: 1px 4px;
  border-radius: 2px;
  letter-spacing: 0.05em;
}

.rank-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  text-transform: uppercase;
  display: block;
}
.rank-name a:hover { color: var(--red-hot); text-decoration: underline; text-decoration-color: var(--red-hot); }
.rank-team a {
  font-size: 0.8rem;
  color: var(--text-secondary);
  transition: color 0.12s;
}
.rank-team a:hover { color: var(--text-primary); }
/* Progress bar */
.rank-progress-wrap { position: relative; display: flex; flex-direction: column; gap: 2px; }
.rank-progress-bar {
  height: 2px;
  border-radius: 1px;
  background: linear-gradient(90deg, var(--red-hot), var(--yellow-race));
  transition: width 0.6s ease;
  max-width: 200px;
}
.rank-pts {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--yellow-race);
  animation: count-up 0.4s ease;
}
/* Fiamma CSS-only per 3+ vittorie consecutive */
.flame-svg {
  display: inline-block;
  width: 14px; height: 18px;
  vertical-align: middle;
  margin-right: 4px;
  animation: flame-flicker 0.8s ease-in-out infinite;
}

/* ── ATLETA HEADER ───────────────────────────────────────────── */
.athlete-header {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 32px;
  padding: 32px;
}
.athlete-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 4px,
    rgba(255,255,255,0.02) 4px,
    rgba(255,255,255,0.02) 5px
  );
  pointer-events: none;
}
.athlete-header-top {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.athlete-header-name {
  position: relative;
}
.athlete-cognome {
  font-family: var(--font-display);
  font-size: var(--size-hero);
  line-height: 0.9;
  color: var(--text-primary);
  display: block;
}
.athlete-nome {
  font-family: var(--font-display);
  font-size: var(--size-h2);
  color: var(--text-secondary);
  display: block;
  margin-bottom: 12px;
}
.athlete-pts-display {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.athlete-pts-dot {
  width: 10px; height: 10px;
  background: var(--red-hot);
  border-radius: 50%;
  animation: blink-dot 1.2s infinite;
  flex-shrink: 0;
  margin-bottom: 4px;
}
.athlete-pts-value {
  font-family: var(--font-display);
  font-size: 3rem;
  color: var(--red-hot);
  line-height: 1;
}
.athlete-pts-label {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 4px;
}
.athlete-stats-bar {
  display: flex;
  gap: 0;
  background: var(--bg-secondary);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  margin-top: 20px;
  flex-wrap: wrap;
}
.athlete-stat {
  flex: 1;
  padding: 12px 20px;
  text-align: center;
  border-right: 1px solid var(--border-subtle);
  min-width: 80px;
}
.athlete-stat:last-child { border-right: none; }
.athlete-stat-val {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--text-primary);
  display: block;
}
.athlete-stat-label {
  font-family: var(--font-heading);
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  display: block;
}

/* ── SPARKLINE SVG ───────────────────────────────────────────── */
.sparkline-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 20px;
  margin-bottom: 28px;
}
.sparkline-title {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.sparkline-svg { width: 100%; height: 80px; overflow: visible; }
.sparkline-tooltip {
  position: absolute;
  background: var(--bg-elevated);
  border: 1px solid var(--border-active);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 3px;
  pointer-events: none;
  white-space: nowrap;
  z-index: 50;
  display: none;
}

/* ── TABELLA RISULTATI ───────────────────────────────────────── */
.results-table-wrap { overflow-x: auto; }
.results-table {
  width: 100%;
  border-collapse: collapse;
}
.results-table th {
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 10px 12px;
  text-align: left;
  border-bottom: 2px solid var(--border-subtle);
  white-space: nowrap;
}
.results-table tr:nth-child(even) { background: var(--bg-card); }
.results-table tr:nth-child(odd)  { background: var(--bg-secondary); }
.results-table tbody tr {
  border-bottom: 1px solid rgba(255,255,255,0.03);
  transition: background 0.12s, border-left 0.12s;
}
.results-table tbody tr:hover {
  background: var(--bg-elevated);
  border-left: 2px solid var(--red-hot);
}
.results-table td { padding: 9px 12px; vertical-align: middle; }
.td-pos { font-family: var(--font-display); font-size: 1.3rem; }
.td-pos.p1 { color: var(--gold); }
.td-pos.p2 { color: var(--silver); }
.td-pos.p3 { color: var(--bronze); }
.td-pos.win { color: var(--red-hot); }
.td-date { font-family: var(--font-mono); font-size: var(--size-mono); color: var(--text-secondary); }
.td-race a { color: var(--text-primary); transition: color 0.12s; }
.td-race a:hover { color: var(--red-hot); }
.td-pts { font-family: var(--font-mono); font-size: var(--size-mono); color: var(--yellow-race); font-weight: 700; }
.td-time { font-family: var(--font-mono); font-size: var(--size-mono); color: var(--text-secondary); }

/* ── TEAM HEADER ─────────────────────────────────────────────── */
.team-header {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 28px 32px;
  margin-bottom: 32px;
  display: flex;
  align-items: flex-start;
  gap: 32px;
  flex-wrap: wrap;
}
.team-name-display {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.5rem);
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 8px;
}
.team-stats-row {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
}
.team-stat { text-align: center; }
.team-stat-val {
  font-family: var(--font-display);
  font-size: 2.2rem;
  color: var(--yellow-race);
  display: block;
}
.team-stat-label {
  font-family: var(--font-heading);
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  display: block;
}

/* ── GARA HEADER ─────────────────────────────────────────────── */
.race-header {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 28px 32px;
  margin-bottom: 32px;
}
.race-name-display {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 12px;
}
.race-meta-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: center;
  font-family: var(--font-heading);
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.race-meta-sep { color: var(--red-hot); }

/* ── CALENDARIO PAGE ─────────────────────────────────────────── */
.calendar-controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  align-items: center;
}
.cal-filter-select {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  padding: 6px 12px;
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}
.cal-filter-select:focus { border-color: var(--border-active); }
.calendar-list { display: flex; flex-direction: column; gap: 8px; }
.cal-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 0;
  transition: border-color 0.15s, background 0.15s;
  animation: slide-up 0.2s ease both;
}
.cal-item-header {
  display: flex;
  align-items: center;
  gap: 16px;
}
.cal-item:hover { border-color: var(--border-active); background: var(--bg-elevated); }
.cal-date-block { text-align: center; }
.cal-day { font-family: var(--font-display); font-size: 2rem; color: var(--text-primary); line-height: 1; }
.cal-month { font-family: var(--font-heading); font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em; }
.cal-name { font-family: var(--font-heading); font-weight: 700; font-size: 1rem; text-transform: uppercase; color: var(--text-primary); }
.cal-name a:hover { color: var(--red-hot); }
.cal-cat { font-size: 0.8rem; color: var(--text-secondary); margin-top: 2px; }
.cal-badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.cal-item-past {
  opacity: 0.8;
  background: rgba(255,255,255,0.01);
  border-style: dashed;
}
.cal-item-past:hover {
  opacity: 1;
}

/* ── NOT FOUND ───────────────────────────────────────────────── */
.not-found {
  text-align: center;
  padding: 80px 20px;
}
.not-found h2 {
  font-family: var(--font-display);
  font-size: 5rem;
  color: var(--red-hot);
  margin-bottom: 12px;
}
.not-found p {
  color: var(--text-secondary);
  font-family: var(--font-heading);
  font-size: 1.2rem;
}

/* ── EMPTY STATE ─────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-size: 1rem;
  letter-spacing: 0.08em;
}

/* ── LOADING ─────────────────────────────────────────────────── */
.loading-bar {
  height: 2px;
  background: linear-gradient(90deg, var(--red-hot), var(--yellow-race), var(--red-hot));
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
  margin-bottom: 32px;
  border-radius: 1px;
}
@keyframes shimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* ── FOOTER ──────────────────────────────────────────────────── */
footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  padding: 20px 24px;
  text-align: center;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.82rem;
}
footer strong { color: var(--text-secondary); font-family: var(--font-display); letter-spacing: 0.05em; }
footer .footer-sep { color: var(--red-hot); margin: 0 8px; }

/* ── COMPONENTI AGGIUNTIVI (CAROSELLO / PODIO PREMIUM) ───────── */
.carousel-wrap {
  position: relative;
  width: 100%;
  overflow: hidden;
  margin-bottom: 40px;
}
.carousel-inner {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 12px;
  /* hide scrollbar */
  scrollbar-width: thin;
  scrollbar-color: var(--border-active) var(--bg-card);
}
.carousel-inner::-webkit-scrollbar { height: 6px; }
.carousel-inner::-webkit-scrollbar-thumb { background: var(--border-active); border-radius: 3px; }
.carousel-card {
  flex: 0 0 320px;
  scroll-snap-align: start;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 16px;
  transition: border-color 0.2s;
  display: flex;
  flex-direction: column;
}
.carousel-card:hover {
  border-color: var(--border-active);
}
.ranking-count {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Category Grouping Styles */
.category-divider {
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: 0.1em;
  color: var(--red-hot);
  margin: 40px 0 16px 0;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border-subtle);
  text-transform: uppercase;
}

/* Parallel Rankings Styles */
.hero-label {
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
}
.carousel-date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.carousel-name {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-primary);
  margin-bottom: auto; /* spinge footer giu */
}
.carousel-footer {
  margin-top: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.btn-action {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 6px 14px;
  border-radius: 4px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
  /* centrare / stretch */
  display: inline-block;
  text-align: center;
}
.btn-action:hover {
  background: var(--red-hot);
  border-color: var(--red-hot);
  color: #fff;
}
.btn-action.full { width: 100%; margin-top: 8px; }

/* Posizioni Spaccate Table Columns */
.td-p-wrap {
  display: flex;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-align: center;
}
.td-p { flex: 1; min-width:30px; }
.td-p.p1 { color: var(--gold); }
.td-p.p2 { color: var(--silver); }
.td-p.p3 { color: var(--bronze); }
.td-p.pout { color: var(--text-muted); }

/* Classifica Post Gara Badge */
.rank-badge {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border-subtle);
  padding: 3px 8px;
  border-radius: 4px;
  font-family: var(--font-heading);
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
}
.rank-badge .b-num {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--text-primary);
  line-height:1;margin-left:4px;
  vertical-align: middle;
}

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 640px) {
  .page { padding: 20px 16px; }
  .nav-links { display: none; }
  #nav-hamburger { display: flex; }
  /* Navbar mobile: riga singola — logo | (spazio) | search | tema | hamburger */
  #navbar { height: 60px; padding: 0 12px; flex-wrap: nowrap; }
  .nav-logo-img { height: 48px; }
  /* Chip occupa lo spazio tra logo e search */
  #ctx-chip {
    flex-grow: 1;
    order: 2;
    margin: 0 6px;
    min-width: 0;
    justify-content: center;
  }
  #ctx-chip .ctx-chip-lbl { max-width: none; }
  /* La ricerca esce dalla navbar e va sotto l'header (#mobile-search-bar) */
  .nav-search-wrap { display: none; }
  /* Selettore lingua (bandiera) visibile anche su mobile, compatto */
  .lang-select { margin-left: 6px; order: 3; padding: 4px 4px; font-size: 1rem; }
  .theme-toggle { order: 4; margin-left: auto; flex-shrink: 0; }
  #nav-hamburger { order: 5; margin-left: 6px; flex-shrink: 0; }
  /* Barra ricerca mobile: fissa sotto l'header, prima del contenuto */
  #mobile-search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    position: fixed;
    top: var(--nav-h, 56px); left: 0; right: 0;
    z-index: 95;
    height: 52px;
    padding: 0 12px;
    background: #0a0a0a;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }
  #mobile-search-bar .m-search-icon { color: #777; flex-shrink: 0; }
  #m-search {
    flex: 1;
    min-width: 0;
    background: #1a1a1a;
    border: 1px solid rgba(255,255,255,0.1);
    color: #f0f0f0;
    font-family: var(--font-body);
    font-size: 0.9rem;
    padding: 8px 12px;
    border-radius: 6px;
    outline: none;
  }
  #m-search::placeholder { color: #555; }
  #m-search:focus { border-color: var(--red-hot); }
  #m-search-dropdown {
    position: absolute;
    top: 100%;
    left: 12px; right: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    margin-top: 4px;
    max-height: 70vh;
    overflow-y: auto;
    z-index: 200;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  }
  /* Dropdown navbar (drawer) allineato a destra per non uscire dallo schermo */
  #search-results-dropdown { right: 0; left: auto; width: 260px; }
  /* Offset contenuto: header (60) + barra ricerca (52) */
  #app { padding-top: 112px; }
  #nav-drawer { top: 60px; }
  /* Separatore rimosso su mobile */
  .nav-sep { display: none; }
  .cat-grid { grid-template-columns: 1fr; }
  .athlete-header { padding: 20px; }
  .team-header { padding: 20px; }
  .race-header { padding: 20px; }
  .athlete-stats-bar { flex-direction: row; overflow-x: auto; }
  .ranking-table th.hide-mobile,
  .ranking-table td.hide-mobile { display: none; }
  .results-table th.hide-mobile,
  .results-table td.hide-mobile { display: none; }
  .tab-group { gap: 4px; }
  .tab-btn { padding: 5px 12px; font-size: 0.78rem; }
  .cal-badges { display: none; }
  .hero-band { padding: 24px 16px 20px; }
  .hero-pos { font-size: 2.2rem; }
}
@media (min-width: 641px) and (max-width: 1024px) {
  #navbar { height: 70px; }
  .nav-logo-img { height: 64px; }
  #app { padding-top: 70px; }
  #nav-drawer { top: 70px; }
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1025px) {
  .cat-grid { grid-template-columns: repeat(3, 1fr); }
}

/* --- Trend Indicators --- */
.trend-indicator {
    font-size: 0.75rem;
    font-weight: 800;
    margin-left: 6px;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    vertical-align: middle;
}
.trend-up { color: #10b981; } /* Emerald */
.trend-down { color: #ef4444; } /* Red */
.trend-stable { color: var(--text-dim); font-size: 0.6rem; opacity: 0.5; }
.trend-new {
    background: var(--accent);
    color: white;
    font-size: 0.6rem;
    padding: 1px 4px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.2;
}



/* --- SHARE SYSTEM --- */
.btn-share {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-heading); font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase; padding: 6px 14px;
  border-radius: 4px; border: 1px solid var(--border-subtle);
  color: var(--text-secondary); background: var(--bg-card);
  cursor: pointer; transition: all 0.18s ease;
}
.btn-share:hover { color: var(--text-primary); border-color: var(--red-hot); background: rgba(232,0,29,0.07); }
.btn-share svg { width: 13px; height: 13px; flex-shrink: 0; }
.share-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.85); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px; backdrop-filter: blur(6px); animation: fade-in 0.2s ease; }
.share-modal { background: #141414; border: 1px solid rgba(255,255,255,0.1); border-radius: 12px; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; box-shadow: 0 24px 64px rgba(0,0,0,0.8); animation: slide-up 0.25s ease; }
.share-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 16px; border-bottom: 1px solid rgba(255,255,255,0.06); }
.share-modal-title { font-family: var(--font-heading); font-weight: 700; font-size: 1.1rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-primary); }
.share-modal-close { width: 32px; height: 32px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.1); color: var(--text-secondary); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.15s; font-size: 1.1rem; flex-shrink: 0; background: none; }
.share-modal-close:hover { border-color: var(--red-hot); color: var(--red-hot); }
.share-format-selector { display: flex; gap: 8px; padding: 16px 24px; border-bottom: 1px solid rgba(255,255,255,0.06); }
.share-format-btn { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.08); background: rgba(255,255,255,0.02); cursor: pointer; transition: all 0.2s; color: var(--text-secondary); }
.share-format-btn:hover { border-color: rgba(255,255,255,0.2); color: var(--text-primary); }
.share-format-btn.active { border-color: var(--yellow-race); background: rgba(245,196,0,0.08); color: var(--yellow-race); }
.share-format-icon { border: 2px solid currentColor; border-radius: 3px; opacity: 0.8; }
.share-format-icon.square   { width: 28px; height: 28px; }
.share-format-icon.vertical { width: 18px; height: 32px; }
.share-format-icon.horiz    { width: 36px; height: 20px; }
.share-format-label { font-family: var(--font-heading); font-size: 0.65rem; letter-spacing: 0.08em; text-transform: uppercase; text-align: center; }
.share-preview-wrap { padding: 20px 24px; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.3); border-bottom: 1px solid rgba(255,255,255,0.06); min-height: 200px; }
#share-canvas-preview { border-radius: 6px; box-shadow: 0 8px 32px rgba(0,0,0,0.6); max-width: 100%; max-height: 380px; object-fit: contain; }
.share-actions { display: flex; gap: 10px; padding: 16px 24px 20px; flex-wrap: wrap; }
.share-action-btn { flex: 1; min-width: 120px; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 20px; border-radius: 8px; font-family: var(--font-heading); font-weight: 700; font-size: 0.85rem; letter-spacing: 0.05em; text-transform: uppercase; cursor: pointer; transition: all 0.2s; border: none; }
.share-action-download { background: var(--red-hot); color: white; }
.share-action-download:hover { background: #c0001a; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(232,0,29,0.4); }
.share-action-native { background: rgba(255,255,255,0.06); color: var(--text-primary); border: 1px solid rgba(255,255,255,0.1) !important; }
.share-action-native:hover { background: rgba(255,255,255,0.1); }
.share-action-native.hidden { display: none; }
.share-generating { display: flex; align-items: center; gap: 10px; padding: 24px; color: var(--text-secondary); font-family: var(--font-heading); font-size: 0.9rem; }
.share-spinner { width: 20px; height: 20px; border: 2px solid rgba(255,255,255,0.1); border-top-color: var(--red-hot); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
/* ── Social platform buttons ─────────────────────────────────── */
.share-platforms {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.share-plat-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 12px 6px 10px;
  border-radius: 10px;
  border: 1.5px solid rgba(255,255,255,0.07);
  background: rgba(255,255,255,0.02);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
  color: var(--text-muted);
  min-width: 0;
  width: 100%;
}
.share-plat-btn:hover {
  transform: translateY(-3px);
  color: var(--text-primary);
}
.share-plat-btn.active {
  border-color: currentColor;
  background: rgba(255,255,255,0.05);
  color: inherit;
}
.share-plat-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.05);
  transition: background 0.18s ease, box-shadow 0.18s ease;
  flex-shrink: 0;
}
.share-plat-btn.active .share-plat-icon,
.share-plat-btn:hover .share-plat-icon {
  background: rgba(255,255,255,0.1);
}
.share-plat-icon svg {
  width: 22px;
  height: 22px;
  display: block;
}
.share-plat-label {
  font-family: var(--font-heading);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.3;
  white-space: pre-line;
  color: inherit;
  opacity: 0.85;
}
/* Colori piattaforme */
.plat-instagram { color: #E1306C; }
.plat-instagram .share-plat-icon { background: rgba(225,48,108,0.12); }
.plat-instagram:hover .share-plat-icon,
.plat-instagram.active .share-plat-icon { background: rgba(225,48,108,0.22); box-shadow: 0 0 14px rgba(225,48,108,0.35); }
.plat-story { color: #C13584; }
.plat-story .share-plat-icon { background: rgba(193,53,132,0.12); }
.plat-story:hover .share-plat-icon,
.plat-story.active .share-plat-icon { background: rgba(193,53,132,0.22); box-shadow: 0 0 14px rgba(193,53,132,0.35); }
.plat-facebook { color: #1877F2; }
.plat-facebook .share-plat-icon { background: rgba(24,119,242,0.12); }
.plat-facebook:hover .share-plat-icon,
.plat-facebook.active .share-plat-icon { background: rgba(24,119,242,0.22); box-shadow: 0 0 14px rgba(24,119,242,0.35); }
.plat-twitter { color: #e0e0e0; }
.plat-twitter .share-plat-icon { background: rgba(255,255,255,0.07); }
.plat-twitter:hover .share-plat-icon,
.plat-twitter.active .share-plat-icon { background: rgba(255,255,255,0.14); box-shadow: 0 0 14px rgba(255,255,255,0.15); }
.plat-whatsapp { color: #25D366; }
.plat-whatsapp .share-plat-icon { background: rgba(37,211,102,0.12); }
.plat-whatsapp:hover .share-plat-icon,
.plat-whatsapp.active .share-plat-icon { background: rgba(37,211,102,0.22); box-shadow: 0 0 14px rgba(37,211,102,0.35); }
/* Size label sotto la griglia */
.share-size-label {
  text-align: center;
  padding: 6px 20px 10px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

/* ── AUTH PAGES ─────────────────────────────────────────────── */
.auth-wrap {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 16px 80px;
  min-height: 60vh;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 440px;
}

.auth-title {
  font-family: var(--font-display);
  font-size: 2.4rem;
  letter-spacing: 0.06em;
  color: var(--red-hot);
  margin: 0 0 4px;
}

.auth-sub {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin: 0 0 28px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 0;
}

.auth-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.auth-input {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: var(--font-body);
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.15s;
}

.auth-input:focus {
  outline: none;
  border-color: var(--red-hot);
}

.auth-btn {
  background: var(--red-hot);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 12px 24px;
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  display: inline-block;
}

.auth-btn:hover   { background: var(--red-deep); }
.auth-btn:disabled { opacity: 0.55; cursor: not-allowed; }

.auth-btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.auth-btn-outline:hover { border-color: var(--red-hot); color: var(--red-hot); background: transparent; }

.auth-error {
  background: rgba(232,0,29,0.12);
  border: 1px solid rgba(232,0,29,0.4);
  border-radius: 6px;
  padding: 10px 14px;
  color: var(--red-hot);
  font-size: 0.88rem;
  margin-bottom: 8px;
}

.auth-switch {
  text-align: center;
  margin-top: 20px;
  font-size: 0.88rem;
  color: var(--text-secondary);
}
.auth-switch a { color: var(--red-hot); }

.auth-section {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  margin-top: 20px;
}

.auth-section-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: 0.06em;
  margin: 0 0 14px;
  color: var(--text-primary);
}

.profile-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 0.9rem;
}
.profile-info-row span:first-child { color: var(--text-muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; }

.link-result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-elevated);
  border-radius: 4px;
  cursor: pointer;
  margin-bottom: 4px;
  font-size: 0.88rem;
  transition: background 0.12s;
}
.link-result-row:hover { background: var(--bg-secondary); }

/* Light mode overrides for auth */
body.light-mode .auth-card  { background: #fff; border-color: #ddd; }
body.light-mode .auth-input { background: #f5f5f5; border-color: #ddd; color: #111; }
body.light-mode .auth-input:focus { border-color: var(--red-hot); }
body.light-mode .link-result-row { background: #f0f0f0; }
body.light-mode .link-result-row:hover { background: #e5e5e5; }

/* Calendar home rows */
a.hcal-row:hover { border-color: var(--red-hot) !important; }

/* ── PHOTO AREA ──────────────────────────────────────────────── */
.photo-area { position: relative; flex-shrink: 0; }

.photo-cam-btn {
  position: absolute;
  bottom: 3px;
  right: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--red-hot);
  border: 2px solid var(--bg-card);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  padding: 0;
  transition: background .15s, transform .15s;
}
.photo-cam-btn:hover { background: var(--red-deep); transform: scale(1.1); }

.upload-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--red-hot);
  color: #fff;
  padding: 10px 24px;
  border-radius: 6px;
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: .06em;
  z-index: 9999;
  pointer-events: none;
  animation: toastIn .2s ease;
}
@keyframes toastIn { from { opacity:0; transform: translateX(-50%) translateY(8px); } to { opacity:1; transform: translateX(-50%) translateY(0); } }

/* Admin edit button */
.admin-edit-btn {
  background: transparent;
  border: 1px solid var(--yellow-race);
  color: var(--yellow-race);
  border-radius: 4px;
  padding: 5px 12px;
  font-family: var(--font-display);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.admin-edit-btn:hover { background: var(--yellow-race); color: #000; }
