@import url('https://fonts.googleapis.com/css2?family=Big+Shoulders+Display:wght@500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  color-scheme: dark;
  /* --- paleta --- */
  --black-void: #07070a;
  --black-panel: #121016;
  --black-panel-2: #17151c;
  --gold-bright: #ecc873;
  --gold-core: #c9a24b;
  --gold-deep: #7c5f28;
  --text-primary: #f4efe4;
  --text-muted: #a79f92;
  --line: rgba(201, 162, 75, 0.22);
  --glass-fill: rgba(255, 255, 255, 0.045);
  --glass-fill-hover: rgba(255, 255, 255, 0.075);
  --danger: #d1495b;
  --ok: #6fae7c;

  /* --- tipografia --- */
  --f-display: 'Big Shoulders Display', sans-serif;
  --f-body: 'Inter', sans-serif;

  --radius: 18px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden; /* red de seguridad: nada debe poder abrir scroll horizontal de página */
  background:
    radial-gradient(1100px 700px at 12% -10%, rgba(201, 162, 75, 0.14), transparent 60%),
    radial-gradient(900px 600px at 100% 0%, rgba(201, 162, 75, 0.08), transparent 55%),
    var(--black-void);
  color: var(--text-primary);
  font-family: var(--f-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; }
button { font-family: inherit; }

/* ---------------- utilidades de layout ---------------- */
.wrap {
  width: min(1180px, 92vw);
  margin: 0 auto;
}

.stripe-divider {
  height: 46px;
  width: 100%;
  background:
    repeating-linear-gradient(
      120deg,
      transparent 0 24px,
      rgba(201, 162, 75, 0.10) 24px 26px,
      transparent 26px 62px
    );
  opacity: 0.6;
}

/* ---------------- LIQUID GLASS ---------------- */
.glass {
  position: relative;
  background: var(--glass-fill);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 20px 50px -20px rgba(0, 0, 0, 0.65);
}
.glass::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, rgba(236, 200, 115, 0.55), transparent 30%, transparent 70%, rgba(236, 200, 115, 0.25));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.glass-tight { border-radius: var(--radius-sm); }

/* ---------------- navegación ---------------- */
.nav-shell {
  position: sticky;
  top: 14px;
  z-index: 50;
  padding: 0 0 0 0;
}
.nav {
  margin: 10px auto 0;
  width: min(1180px, 92vw);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1.08rem;
  letter-spacing: 0.01em;
  text-decoration: none;
}
.brand .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--gold-bright);
  box-shadow: 0 0 12px 2px rgba(236, 200, 115, 0.75);
}
.brand small { color: var(--gold-core); font-family: var(--f-body); font-weight: 600; font-size: 0.7rem; }

.nav-links { display: flex; gap: 2px; align-items: center; }
.nav-links a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 999px;
  transition: color .15s ease, background .15s ease;
}
.nav-links a:hover, .nav-links a.active { color: var(--text-primary); background: rgba(255,255,255,0.06); }

.nav-user { display: flex; align-items: center; gap: 8px; }
.avatar-sm { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line); object-fit: cover; }

/* ---------------- botones ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--glass-fill);
  color: var(--text-primary);
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { background: var(--glass-fill-hover); border-color: rgba(236,200,115,0.5); transform: translateY(-1px); }
.btn-gold {
  background: linear-gradient(180deg, var(--gold-bright), var(--gold-core));
  color: #1a1305;
  border: none;
  font-weight: 700;
}
.btn-gold:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; gap: 6px; white-space: nowrap; }
.btn-danger { border-color: rgba(209,73,91,0.5); color: #f3b7bd; }

.btn-steam { border-color: rgba(120,150,200,0.4); }
.btn-discord { border-color: rgba(114,137,218,0.5); }

/* ---------------- hero ---------------- */
.hero {
  padding: 76px 0 40px;
  display: grid;
  grid-template-columns: 1.2fr 0.9fr;
  gap: 34px;
  align-items: stretch;
}
.eyebrow-free { color: var(--gold-core); font-weight: 600; font-size: 0.95rem; }
.hero h1 {
  font-family: var(--f-display);
  font-weight: 800;
  font-size: clamp(2.8rem, 6vw, 4.6rem);
  line-height: 0.96;
  margin: 10px 0 18px;
  letter-spacing: -0.01em;
}
.hero p.lead { color: var(--text-muted); font-size: 1.08rem; max-width: 46ch; margin-bottom: 26px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.next-race-card { padding: 26px; display: flex; flex-direction: column; justify-content: space-between; }
.next-race-card .label { color: var(--gold-core); font-size: 0.8rem; font-weight: 600; }
.next-race-card h3 { font-family: var(--f-display); font-size: 1.9rem; margin: 8px 0 4px; }
.countdown { display: flex; gap: 14px; margin-top: 18px; }
.countdown div { text-align: center; }
.countdown span { display: block; font-family: var(--f-display); font-size: 2rem; color: var(--gold-bright); }
.countdown small { color: var(--text-muted); font-size: 0.72rem; }

/* ---------------- secciones generales ---------------- */
section.page { padding: 54px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; margin-bottom: 28px; flex-wrap: wrap; }
.section-head h2 { font-family: var(--f-display); font-size: clamp(1.9rem, 3.4vw, 2.6rem); margin: 0; }
.section-head p { color: var(--text-muted); margin: 6px 0 0; max-width: 60ch; }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

.stat-card { padding: 22px; }
.stat-card .num { font-family: var(--f-display); font-size: 2.4rem; color: var(--gold-bright); }
.stat-card .lab { color: var(--text-muted); font-size: 0.85rem; }

/* ---------------- tablas (clasificación / parrilla) ---------------- */
.table-wrap { overflow-x: auto; max-width: 100%; }
table.gt3 { width: 100%; border-collapse: collapse; font-size: 0.94rem; }
table.gt3 thead th {
  text-align: left; padding: 12px 16px; color: var(--gold-core);
  font-weight: 600; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.gt3 tbody td { padding: 13px 16px; border-bottom: 1px solid rgba(255,255,255,0.05); white-space: nowrap; }
table.gt3 tbody tr:hover { background: rgba(255,255,255,0.03); }
.pos-1 { color: var(--gold-bright); font-weight: 700; }
.pos-2 { color: #d9d2c4; font-weight: 700; }
.pos-3 { color: #c98a52; font-weight: 700; }
.pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 600; border: 1px solid var(--line); color: var(--text-muted);
}
.pill.cat-Pro { color: #ecc873; border-color: rgba(236,200,115,0.4); }
.pill.cat-Silver { color: #cfd4da; border-color: rgba(207,212,218,0.35); }
.pill.cat-Am { color: #b8a08a; border-color: rgba(184,160,138,0.35); }

/* ---------------- calendario ---------------- */
.race-row {
  display: grid;
  grid-template-columns: 70px 1fr auto auto;
  gap: 18px;
  align-items: center;
  padding: 18px 22px;
  margin-bottom: 12px;
}
.race-round { font-family: var(--f-display); font-size: 1.6rem; color: var(--gold-core); text-align: center; }
.race-row h4 { margin: 0 0 4px; font-family: var(--f-display); font-size: 1.25rem; font-weight: 700; }
.race-row .meta { color: var(--text-muted); font-size: 0.85rem; }
.status-badge { padding: 5px 12px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.status-programada { color: #9db4d8; border: 1px solid rgba(157,180,216,0.35); }
.status-en_vivo { color: #f3b7bd; border: 1px solid rgba(209,73,91,0.4); }
.status-finalizada { color: #93c79b; border: 1px solid rgba(111,174,124,0.35); }
.status-cancelada { color: #8a8378; border: 1px solid var(--line); }

/* ---------------- formularios ---------------- */
.form-card { padding: 30px; max-width: 640px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 7px; font-weight: 500; }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: rgba(255,255,255,0.03); color: var(--text-primary);
  font-family: inherit; font-size: 0.95rem;
}
select {
  color-scheme: dark;
}
select option {
  background: var(--black-panel-2);
  color: var(--text-primary);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--gold-core); outline-offset: 1px;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.help { color: var(--text-muted); font-size: 0.8rem; margin-top: 6px; }
.notice { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 0.88rem; margin-bottom: 16px; }
.notice.ok { border: 1px solid rgba(111,174,124,0.4); color: #b6e0bd; background: rgba(111,174,124,0.08); }
.notice.err { border: 1px solid rgba(209,73,91,0.4); color: #f3b7bd; background: rgba(209,73,91,0.08); }

/* ---------------- perfil / vínculo de cuentas ---------------- */
.link-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; margin-bottom: 12px;
}
.link-row .who { display: flex; align-items: center; gap: 14px; }
.link-row .who img { width: 42px; height: 42px; border-radius: 50%; }
.link-row .who strong { display: block; }
.link-row .who span { color: var(--text-muted); font-size: 0.82rem; }

/* ---------------- admin ---------------- */
.admin-shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; align-items: start; }
.admin-nav { padding: 18px; position: sticky; top: 90px; }
.admin-nav h4 { font-family: var(--f-display); margin: 0 0 12px; color: var(--gold-core); font-size: 0.95rem; }
.admin-nav button {
  display: block; width: 100%; text-align: left; background: transparent; border: none;
  color: var(--text-muted); padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer; font-size: 0.9rem;
  margin-bottom: 2px;
}
.admin-nav button:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }
.admin-nav button.active { background: rgba(201,162,75,0.14); color: var(--gold-bright); }
.admin-panel { padding: 26px; min-height: 420px; min-width: 0; max-width: 100%; overflow-x: hidden; }
.admin-panel h3 { font-family: var(--f-display); margin-top: 0; }

.mini-table td, .mini-table th { padding: 10px 12px; font-size: 0.88rem; }
.tag-pendiente { color: #e0c273; }
.tag-aprobado { color: #93c79b; }
.tag-rechazado { color: #e08c8c; }
.tag-expulsado { color: #d1495b; font-weight: 700; }

.footer { padding: 40px 0 60px; color: var(--text-muted); font-size: 0.85rem; text-align: center; }
.footer a { color: var(--gold-core); text-decoration: none; }

.cookie-banner {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 997;
  max-width: 720px; margin: 0 auto;
  background: var(--black-panel-2); border: 1px solid rgba(201,162,75,0.35);
  border-radius: var(--radius-sm); padding: 16px 20px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  box-shadow: 0 20px 50px -18px rgba(0,0,0,0.75);
  font-size: 0.86rem; color: var(--text-muted);
}
.cookie-banner a { color: var(--gold-core); }
.cookie-banner button { flex-shrink: 0; margin-left: auto; }

/* ---------------- calendario estilo "calendario" ---------------- */
.cal-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; margin-bottom: 18px; flex-wrap: wrap;
}
.cal-toolbar .cal-nav { display: flex; align-items: center; gap: 10px; }
.cal-toolbar h3 { font-family: var(--f-display); font-size: 1.6rem; margin: 0; min-width: 220px; text-align: center; }
.cal-nav-btn {
  width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); background: var(--glass-fill); color: var(--text-primary); cursor: pointer; font-size: 1.1rem;
}
.cal-nav-btn:hover { background: var(--glass-fill-hover); border-color: rgba(236,200,115,0.5); }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  padding: 18px;
}
.cal-weekday {
  text-align: center; color: var(--gold-core); font-size: 0.78rem; font-weight: 700;
  letter-spacing: 0.04em; padding-bottom: 8px; text-transform: uppercase;
}
.cal-day {
  min-height: 96px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.02);
  padding: 8px;
  display: flex; flex-direction: column; gap: 4px;
}
.cal-day.cal-out { opacity: 0.28; }
.cal-day.cal-today { border-color: var(--gold-core); box-shadow: 0 0 0 1px rgba(201,162,75,0.35) inset; }
.cal-day .cal-daynum { font-family: var(--f-display); font-size: 0.95rem; color: var(--text-muted); }
.cal-day.cal-today .cal-daynum { color: var(--gold-bright); }
.cal-event {
  font-size: 0.7rem; line-height: 1.25; padding: 4px 6px; border-radius: 6px;
  background: rgba(201,162,75,0.14); color: var(--gold-bright); border: 1px solid rgba(201,162,75,0.3);
  cursor: pointer; white-space: normal;
}
.cal-event.cal-ev-en_vivo { background: rgba(209,73,91,0.16); color: #f3b7bd; border-color: rgba(209,73,91,0.4); }
.cal-event.cal-ev-finalizada { background: rgba(111,174,124,0.14); color: #93c79b; border-color: rgba(111,174,124,0.35); }
.cal-event.cal-ev-cancelada { background: rgba(138,131,120,0.12); color: #8a8378; border-color: var(--line); text-decoration: line-through; }
.cal-event:hover { filter: brightness(1.15); }

.cal-detail { padding: 22px; margin-top: 18px; }
.cal-detail h4 { font-family: var(--f-display); margin: 0 0 6px; font-size: 1.35rem; }
.cal-detail .sessions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.cal-session-chip {
  padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: rgba(255,255,255,0.03); font-size: 0.82rem;
}
.cal-session-chip strong { color: var(--gold-core); display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em; }

/* ---------------- tarjetas de pilotos (perfiles públicos) ---------------- */
.driver-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.driver-card { padding: 22px; display: flex; flex-direction: column; gap: 10px; }
.driver-card .dc-head { display: flex; align-items: center; gap: 12px; }
.driver-card .dc-num {
  font-family: var(--f-display); font-size: 1.6rem; color: var(--gold-bright);
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.driver-card .dc-name { font-family: var(--f-display); font-size: 1.15rem; margin: 0; }
.driver-card .dc-team { color: var(--text-muted); font-size: 0.82rem; display: flex; align-items: center; gap: 8px; }
.driver-card .dc-team img { width: 20px; height: 20px; border-radius: 4px; object-fit: cover; }
.dc-accounts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.acc-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px;
  font-size: 0.76rem; font-weight: 600; text-decoration: none; border: 1px solid var(--line); color: var(--text-muted);
}
.acc-badge.acc-linked.acc-steam { color: #9db4d8; border-color: rgba(157,180,216,0.4); }
.acc-badge.acc-linked.acc-discord { color: #b7bdf7; border-color: rgba(114,137,218,0.5); }

/* ---------------- subida de logo (URL o archivo) ---------------- */
.logo-option-row { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.logo-option-row .field { flex: 1; min-width: 200px; margin-bottom: 0; }
.logo-or { color: var(--text-muted); font-size: 0.8rem; padding-top: 34px; }
.logo-preview {
  width: 64px; height: 64px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  object-fit: cover; margin-top: 10px; display: none; background: rgba(255,255,255,0.03);
}

/* ---------------- configuración de dorsales / puntos (admin) ---------------- */
.points-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin: 14px 0 20px; }
.points-grid .pf { display: flex; flex-direction: column; gap: 4px; }
.points-grid .pf label { font-size: 0.72rem; color: var(--text-muted); }
.points-grid .pf input {
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: rgba(255,255,255,0.03); color: var(--text-primary); font-size: 0.88rem;
}

/* ---------------- pestañas de clasificación ---------------- */
.tabs-row { display: flex; gap: 8px; margin-bottom: 22px; }
.tab-btn {
  padding: 10px 20px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--glass-fill); color: var(--text-muted); font-weight: 600; font-size: 0.9rem; cursor: pointer;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { background: linear-gradient(180deg, var(--gold-bright), var(--gold-core)); color: #1a1305; border-color: transparent; }

/* ---------------- menú off-canvas (móvil/tablet) ---------------- */
.hamburger-btn {
  display: none;
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 10px; border: 1px solid var(--line); background: var(--glass-fill);
  align-items: center; justify-content: center; flex-direction: column; gap: 4px;
  cursor: pointer;
}
.hamburger-btn span { display: block; width: 18px; height: 2px; background: var(--text-primary); border-radius: 2px; transition: transform .2s ease, opacity .2s ease; }
.hamburger-btn.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.hamburger-btn.open span:nth-child(2) { opacity: 0; }
.hamburger-btn.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.offcanvas-backdrop {
  position: fixed; inset: 0; background: rgba(4,4,6,0.65); backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity .25s ease; z-index: 998;
}
.offcanvas-backdrop.open { opacity: 1; pointer-events: auto; }

.offcanvas-menu {
  position: fixed; top: 0; right: 0; height: 100vh; width: min(82vw, 320px);
  background: var(--black-panel); border-left: 1px solid var(--line);
  transform: translateX(100%); transition: transform .28s ease;
  z-index: 999; padding: 22px 18px; display: flex; flex-direction: column; gap: 4px;
  overflow-y: auto; box-shadow: -20px 0 50px -20px rgba(0,0,0,0.7);
}
.offcanvas-menu.open { transform: translateX(0); }
.offcanvas-menu .oc-close {
  align-self: flex-end; background: transparent; border: none; color: var(--text-muted);
  font-size: 1.5rem; line-height: 1; cursor: pointer; padding: 6px 10px; margin-bottom: 10px;
}
.offcanvas-menu a {
  color: var(--text-muted); text-decoration: none; padding: 13px 14px; border-radius: 10px;
  font-size: 1rem; font-weight: 600;
}
.offcanvas-menu a:hover, .offcanvas-menu a.active { color: var(--text-primary); background: rgba(255,255,255,0.06); }

/* Menú off-canvas también en tablets (pantallas más anchas que el resto de
   ajustes responsive, para que quepan bien los ~9 enlaces + usuario). */
@media (max-width: 1080px) {
  .nav-links { display: none; }
  .hamburger-btn { display: flex; }
}

/* ---------------- responsive ---------------- */
@media (max-width: 880px) {
  .hero { grid-template-columns: 1fr; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .admin-shell { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .race-row { grid-template-columns: 50px 1fr; grid-template-areas: "n t" "n a" "n b"; }
  .cal-grid { gap: 4px; padding: 10px; }
  .cal-day { min-height: 64px; padding: 5px; }
  .cal-weekday { font-size: 0.65rem; }
  .points-grid { grid-template-columns: repeat(3, 1fr); }
  .driver-grid { grid-template-columns: 1fr; }
  .logo-or { padding-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
