
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --red:    #e10600;
  --red2:   #ff2d1a;
  --gold:   #d4a017;
  --silver: #a8a9ad;
  --bronze: #cd7f32;
  --bg0:    #080808;
  --bg1:    #111111;
  --bg2:    #191919;
  --bg3:    #222222;
  --line:   rgba(255,255,255,0.07);
  --line2:  rgba(255,255,255,0.13);
  --w100:   rgba(255,255,255,1);
  --w70:    rgba(255,255,255,0.70);
  --w40:    rgba(255,255,255,0.40);
  --w20:    rgba(255,255,255,0.20);
  --w08:    rgba(255,255,255,0.08);
  --ff-title: 'Barlow Condensed', sans-serif;
  --ff-body:  'Barlow', sans-serif;
  --r4: 4px; --r8: 8px; --r12: 12px;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg0);
  color: var(--w100);
  font-family: var(--ff-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── LAYOUT WRAPPER ─────────────────────────────────────── */
.f1-app {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 16px 80px;
}

/* ── TOPBAR ─────────────────────────────────────────────── */
.f1-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 14px;
  border-bottom: 1px solid var(--line);
  gap: 12px;
  flex-wrap: wrap;
}

.f1-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.f1-badge {
  background: var(--red);
  font-family: var(--ff-title);
  font-size: 20px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 1px;
  padding: 4px 10px 3px;
  border-radius: var(--r4);
  line-height: 1;
}

.f1-brand-title {
  font-family: var(--ff-title);
  font-size: 22px;
  font-weight: 800;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1;
}

.f1-brand-sub {
  font-size: 11px;
  color: var(--w40);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
}

.f1-toolbar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: var(--r4);
  border: 1px solid var(--line2);
  background: var(--bg2);
  color: var(--w70);
  font-family: var(--ff-title);
  font-size: 13px;
  font-weight: 700;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn:hover { background: var(--bg3); color: var(--w100); border-color: var(--w20); }
.btn-red { background: var(--red); border-color: var(--red); color: #fff; }
.btn-red:hover { background: var(--red2); border-color: var(--red2); color: #fff; }
.btn svg { width: 13px; height: 13px; }

/* ── PROGRESS BAR ───────────────────────────────────────── */
.f1-progress-wrap {
  padding: 10px 0 0;
  display: flex;
  align-items: center;
  gap: 12px;
}
.f1-progress-bar {
  flex: 1;
  height: 3px;
  background: var(--line2);
  border-radius: 2px;
  overflow: hidden;
}
.f1-progress-fill {
  height: 100%;
  background: var(--red);
  border-radius: 2px;
  transition: width 0.4s ease;
  width: 0%;
}
.f1-progress-label {
  font-family: var(--ff-title);
  font-size: 12px;
  font-weight: 700;
  color: var(--w40);
  text-transform: uppercase;
  letter-spacing: 1px;
  white-space: nowrap;
}

/* ── CHAMPION BANNER ────────────────────────────────────── */
.f1-champ-banner {
  display: none;
  margin: 16px 0 0;
  border-radius: var(--r8);
  overflow: hidden;
  position: relative;
}
.f1-champ-banner.visible { display: block; }
.f1-champ-inner {
  background: linear-gradient(105deg, rgba(225,6,0,0.18) 0%, rgba(212,160,23,0.10) 100%);
  border: 1px solid rgba(225,6,0,0.35);
  border-radius: var(--r8);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.f1-champ-trophy {
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
}
.f1-champ-label {
  font-family: var(--ff-title);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--red);
  margin-bottom: 2px;
}
.f1-champ-name {
  font-family: var(--ff-title);
  font-size: 22px;
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  line-height: 1;
}
.f1-champ-detail {
  font-size: 12px;
  color: var(--w40);
  margin-top: 2px;
}

/* ── MAIN GRID ──────────────────────────────────────────── */
.f1-main {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  margin-top: 16px;
  align-items: start;
}

/* ── RACE CARDS ─────────────────────────────────────────── */
.f1-races { display: flex; flex-direction: column; gap: 10px; }

.race-card {
  background: var(--bg1);
  border: 1px solid var(--line);
  border-radius: var(--r8);
  overflow: hidden;
  transition: border-color 0.2s;
}
.race-card.completed { border-color: rgba(255,255,255,0.12); }
.race-card.completed .race-card-head { background: var(--bg2); }

.race-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 9px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  user-select: none;
  gap: 10px;
}
.race-card-head:hover { background: var(--bg2); }

.race-round {
  font-family: var(--ff-title);
  font-size: 10px;
  font-weight: 800;
  color: var(--red);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}
.race-name {
  font-family: var(--ff-title);
  font-size: 17px;
  font-weight: 800;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  line-height: 1;
  margin-top: 1px;
}
.race-tags { display: flex; gap: 6px; align-items: center; }
.tag {
  font-family: var(--ff-title);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 2px 7px;
  border-radius: 3px;
}
.tag-sprint { background: rgba(100,196,255,0.15); color: #64C4FF; border: 1px solid rgba(100,196,255,0.25); }
.tag-done   { background: rgba(39,212,137,0.12); color: #27d489; border: 1px solid rgba(39,212,137,0.2); }
.tag-real   { background: rgba(212,160,23,0.15); color: var(--gold); border: 1px solid rgba(212,160,23,0.3); }

.race-card-body { padding: 12px 14px 14px; }

.race-selectors {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 10px;
}

.sel-group { display: flex; flex-direction: column; gap: 5px; }
.sel-label {
  font-family: var(--ff-title);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.sel-label .pos-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}

.sel-group select {
  width: 100%;
  background: var(--bg0);
  color: var(--w100);
  border: 1px solid var(--line2);
  padding: 7px 10px;
  border-radius: var(--r4);
  font-family: var(--ff-body);
  font-size: 13px;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='rgba(255,255,255,0.3)' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  transition: border-color 0.15s;
}
.sel-group select:focus { border-color: var(--red); }
.sel-group select option { background: #111; }

/* Sprint selects en carrera con sprint */
.sprint-row {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 10px;
}
.sprint-header {
  font-family: var(--ff-title);
  font-size: 10px;
  font-weight: 800;
  color: #64C4FF;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 8px;
  grid-column: 1 / -1;
}

/* ── SIDEBAR ─────────────────────────────────────────────── */
.f1-sidebar { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 16px; }

.sidebar-card {
  background: var(--bg1);
  border: 1px solid var(--line);
  border-radius: var(--r8);
  overflow: hidden;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
}
.sidebar-title {
  font-family: var(--ff-title);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--w70);
}

/* ── STANDINGS TABLE ─────────────────────────────────────── */
.standings-list { padding: 6px; }
.driver-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border-radius: var(--r4);
  transition: background 0.12s;
}
.driver-row:hover { background: var(--w08); }
.driver-row.pos-1 { background: rgba(212,160,23,0.08); }
.driver-row.pos-2 { background: rgba(168,169,173,0.06); }
.driver-row.pos-3 { background: rgba(205,127,50,0.06); }

.driver-pos {
  width: 18px;
  text-align: center;
  font-family: var(--ff-title);
  font-size: 13px;
  font-weight: 800;
  color: var(--w40);
  flex-shrink: 0;
}
.pos-1 .driver-pos { color: var(--gold); }
.pos-2 .driver-pos { color: var(--silver); }
.pos-3 .driver-pos { color: var(--bronze); }

.driver-stripe {
  width: 3px;
  height: 28px;
  border-radius: 2px;
  flex-shrink: 0;
}
.driver-info { flex: 1; min-width: 0; }
.driver-name {
  font-family: var(--ff-title);
  font-size: 14px;
  font-weight: 800;
  font-style: italic;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.1;
}
.driver-team {
  font-size: 10px;
  color: var(--w40);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.driver-pts {
  font-family: var(--ff-title);
  font-size: 19px;
  font-weight: 900;
  min-width: 36px;
  text-align: right;
  line-height: 1;
}
.driver-gap {
  font-size: 10px;
  color: var(--w40);
  min-width: 30px;
  text-align: right;
}

/* ── STATS CARD ─────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
}
.stat-cell {
  background: var(--bg1);
  padding: 11px 13px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat-label { font-size: 10px; color: var(--w40); text-transform: uppercase; letter-spacing: 0.8px; }
.stat-value {
  font-family: var(--ff-title);
  font-size: 17px;
  font-weight: 900;
  font-style: italic;
  line-height: 1;
}
.stat-sub { font-size: 10px; color: var(--w40); }

/* ── CONSTRUCTORS CARD ───────────────────────────────────── */
.constructor-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 14px;
  border-bottom: 1px solid var(--line);
}
.constructor-row:last-child { border-bottom: none; }
.con-pos { width: 14px; font-family: var(--ff-title); font-size: 12px; font-weight: 800; color: var(--w40); }
.con-stripe { width: 3px; height: 22px; border-radius: 2px; flex-shrink: 0; }
.con-name { flex: 1; font-family: var(--ff-title); font-size: 13px; font-weight: 700; font-style: italic; text-transform: uppercase; }
.con-pts { font-family: var(--ff-title); font-size: 16px; font-weight: 900; }

/* ── POINTS SYSTEM REFERENCE ─────────────────────────────── */
.pts-table {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1px;
  background: var(--line);
  font-family: var(--ff-title);
  font-size: 12px;
}
.pts-cell {
  background: var(--bg1);
  padding: 6px 4px;
  text-align: center;
}
.pts-cell.header { color: var(--w40); font-size: 10px; letter-spacing: 0.5px; }
.pts-cell.pts { font-weight: 800; color: var(--red); }

/* ── ARTICLE SECTION ─────────────────────────────────────── */
.f1-article {
  margin-top: 60px;
  max-width: 820px;
}
.article-label {
  font-family: var(--ff-title);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--red);
  margin-bottom: 10px;
}
.article-title {
  font-family: var(--ff-title);
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  line-height: 1;
  margin-bottom: 20px;
}
.article-lead {
  font-size: 16px;
  color: var(--w70);
  line-height: 1.7;
  margin-bottom: 28px;
  border-left: 3px solid var(--red);
  padding-left: 16px;
}
.article-body { font-size: 14px; color: var(--w70); line-height: 1.8; }
.article-body h2 {
  font-family: var(--ff-title);
  font-size: 20px;
  font-weight: 800;
  font-style: italic;
  text-transform: uppercase;
  color: var(--w100);
  margin: 32px 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line2);
}
.article-body h3 {
  font-family: var(--ff-title);
  font-size: 16px;
  font-weight: 700;
  font-style: italic;
  text-transform: uppercase;
  color: var(--w100);
  margin: 20px 0 6px;
}
.article-body p { margin-bottom: 14px; }
.article-body ul { padding-left: 20px; margin-bottom: 14px; }
.article-body li { margin-bottom: 6px; }
.article-body strong { color: var(--w100); font-weight: 600; }

/* Points reference table in article */
.pts-ref-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 24px;
  font-size: 13px;
}
.pts-ref-table th {
  background: var(--bg2);
  padding: 8px 12px;
  text-align: left;
  font-family: var(--ff-title);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--w40);
  border-bottom: 1px solid var(--line2);
}
.pts-ref-table td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--w70);
}
.pts-ref-table tr:last-child td { border-bottom: none; }
.pts-ref-table td:first-child { font-family: var(--ff-title); font-weight: 800; font-style: italic; color: var(--w100); }
.pts-ref-table td.pts-val { color: var(--red); font-weight: 700; }

/* ── GUIDE SECTION ───────────────────────────────────────── */
.guide-steps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin: 16px 0 28px;
}
.guide-step {
  background: var(--bg2);
  border: 1px solid var(--line2);
  border-radius: var(--r8);
  padding: 14px;
}
.step-num {
  font-family: var(--ff-title);
  font-size: 28px;
  font-weight: 900;
  font-style: italic;
  color: var(--red);
  line-height: 1;
  margin-bottom: 6px;
}
.step-title {
  font-family: var(--ff-title);
  font-size: 14px;
  font-weight: 800;
  font-style: italic;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.step-desc { font-size: 12px; color: var(--w40); line-height: 1.5; }

/* ── FAQ ────────────────────────────────────────────────── */
.faq-item {
  border-top: 1px solid var(--line);
  padding: 14px 0;
}
.faq-q {
  font-family: var(--ff-title);
  font-size: 15px;
  font-weight: 700;
  font-style: italic;
  text-transform: uppercase;
  color: var(--w100);
  margin-bottom: 6px;
}
.faq-a { font-size: 13px; color: var(--w40); line-height: 1.6; }

/* ── EXPORT OFFSCREEN ────────────────────────────────────── */
#export-offscreen {
  position: fixed;
  top: -9999px; left: -9999px;
  width: 900px;
  background: #080808;
  color: white;
  font-family: 'Barlow Condensed', sans-serif;
  padding: 40px;
  z-index: -1;
}

/* ── TOAST ──────────────────────────────────────────────── */
.f1-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg3);
  border: 1px solid var(--line2);
  color: var(--w100);
  padding: 10px 16px;
  border-radius: var(--r8);
  font-size: 13px;
  font-family: var(--ff-title);
  font-style: italic;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  z-index: 9999;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.2s;
  pointer-events: none;
}
.f1-toast.show { opacity: 1; transform: translateY(0); }

/* ── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 960px) {
  .f1-main { grid-template-columns: 1fr; }
  .f1-sidebar { position: static; }
}
@media (max-width: 600px) {
  .f1-toolbar { gap: 4px; }
  .btn { padding: 6px 9px; font-size: 11px; }
  .race-selectors { grid-template-columns: 1fr 1fr; }
}