:root {
  --red: #E10600;
  --red-dark: #B00500;
  --ink: #15151E;
  --ink-2: #3A3A44;
  --muted: #7A7A85;
  --line: #E6E6EB;
  --bg: #FFFFFF;
  --bg-soft: #F7F7F9;
  --bg-panel: #FBFBFC;
  --gold: #C9A227;
  --silver: #9BA0A6;
  --bronze: #A97142;
  --radius: 12px;
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, "Segoe UI", sans-serif;
  --mono: "SF Mono", Menlo, Consolas, monospace;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg-soft);
  color: var(--ink);
  line-height: 1.6;
  font-size: 15px;
}
a { color: inherit; text-decoration: none; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* ---------- 顶栏 ---------- */
.site-header {
  background: var(--ink);
  color: #fff;
  position: sticky; top: 0; z-index: 50;
  border-bottom: 3px solid var(--red);
}
.site-header .container {
  display: flex; align-items: center; gap: 28px;
  height: 56px;
}
.logo { font-weight: 800; font-size: 18px; letter-spacing: .5px; }
.logo em { color: var(--red); font-style: normal; }
.nav { display: flex; gap: 4px; }
.nav a {
  padding: 6px 14px; border-radius: 8px; font-size: 14px;
  color: #C9C9D2; white-space: nowrap; transition: .15s;
}
.nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav a.active { color: #fff; background: var(--red); }
.nav-dropdown { position: relative; }
.nav-dropbtn {
  padding: 6px 14px; border: none; border-radius: 8px; font-size: 14px;
  color: #C9C9D2; background: transparent; cursor: pointer; white-space: nowrap;
  font-family: inherit; transition: .15s;
}
.nav-dropbtn:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav-dropbtn.active { color: #fff; background: var(--red); }
.nav-dropmenu {
  display: none; position: absolute; top: calc(100% + 8px); left: 0; z-index: 60;
  background: var(--ink); border: 1px solid rgba(255,255,255,.15);
  border-radius: 10px; padding: 6px; min-width: 150px;
}
.nav-dropdown:hover .nav-dropmenu, .nav-dropdown.open .nav-dropmenu { display: block; }
.nav-dropmenu a { display: block; padding: 8px 12px; }

/* ---------- 通用 ---------- */
.page { padding: 28px 0 64px; }
.page-title { font-size: 26px; font-weight: 800; margin-bottom: 4px; }
.page-sub { color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.card {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; margin-bottom: 20px;
}
.card h2 { font-size: 16px; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.card h2::before { content: ""; width: 4px; height: 16px; background: var(--red); border-radius: 2px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 800px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- 首页 hero ---------- */
.hero {
  background: var(--ink); color: #fff;
  border-radius: var(--radius); padding: 34px 30px; margin-bottom: 20px;
  position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -60px; top: 0; bottom: 0; width: 45%;
  background: linear-gradient(105deg, transparent 0%, var(--red) 100%);
  opacity: .25; transform: skewX(-12deg);
}
.hero h1 { font-size: 30px; font-weight: 800; margin-bottom: 6px; }
.hero p { color: #B9B9C4; font-size: 14px; max-width: 560px; }
.hero .stat-row { display: flex; gap: 36px; margin-top: 22px; flex-wrap: wrap; position: relative; z-index: 1; }
.hero .stat b { display: block; font-size: 26px; font-weight: 800; font-family: var(--mono); }
.hero .stat span { font-size: 12px; color: #B9B9C4; }

/* ---------- 表格 ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--bg-panel); }
.table-wrap[style*="max-height"] th { position: sticky; top: 0; z-index: 2; }
tbody tr:hover { background: var(--bg-soft); }
td.num, th.num { text-align: right; font-family: var(--mono); }
.table-wrap { overflow-x: auto; }
.pos-badge {
  display: inline-block; min-width: 26px; text-align: center;
  font-family: var(--mono); font-weight: 700; border-radius: 6px; padding: 1px 5px;
  background: var(--bg-soft); border: 1px solid var(--line);
}
.pos-1 { background: var(--gold); color: #fff; border-color: var(--gold); }
.pos-2 { background: var(--silver); color: #fff; border-color: var(--silver); }
.pos-3 { background: var(--bronze); color: #fff; border-color: var(--bronze); }
a.link { color: var(--red); font-weight: 600; }
a.link:hover { text-decoration: underline; }
.tag { font-size: 11px; padding: 1px 7px; border-radius: 20px; background: #FDECEA; color: var(--red); font-weight: 600; }
.dnf { color: var(--muted); font-size: 12px; }

/* ---------- 车手详情 ---------- */
.profile-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.profile-head h1 { font-size: 28px; font-weight: 800; }
.profile-head .abbr {
  font-family: var(--mono); font-weight: 800; color: #fff; background: var(--ink);
  padding: 2px 10px; border-radius: 6px; font-size: 15px;
}
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; margin: 18px 0; }
.stat-box { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.stat-box b { display: block; font-size: 22px; font-weight: 800; font-family: var(--mono); }
.stat-box span { font-size: 12px; color: var(--muted); }
.stat-box.hl { background: #FDECEA; border-color: #F5C6C2; }
.stat-box.hl b { color: var(--red); }

/* ---------- 纪录榜 ---------- */
.record-list { list-style: none; }
.record-list li {
  display: grid; grid-template-columns: 24px minmax(0, 1fr) minmax(0, 150px) auto;
  align-items: center; gap: 10px; padding: 8px 0;
  border-bottom: 1px solid var(--line); font-size: 14px;
}
.record-list li.record-head {
  font-size: 12px; color: var(--muted); font-weight: 600;
  padding: 4px 0; border-bottom: 2px solid var(--line);
}
.record-list .rk { width: 24px; font-family: var(--mono); font-weight: 700; color: var(--muted); }
.record-list .nat { display: flex; align-items: center; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; }
.record-list .nat .flag-icon { margin-right: 6px; }
.record-list .val { margin-left: auto; font-family: var(--mono); font-weight: 800; color: var(--red); }
.record-list.mini li { grid-template-columns: 24px minmax(0, 1fr) auto; }
@media (max-width: 640px) {
  .record-list li { grid-template-columns: 20px minmax(0, 1fr) auto auto; gap: 8px; }
  .record-list .nat-name { display: none; }
  .record-list .nat .flag-icon { margin-right: 0; }
}

/* ---------- 对决 ---------- */
.vs-wrap { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: stretch; }
.vs-col select { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; background: #fff; }
.vs-mid { display: flex; align-items: center; font-weight: 800; font-size: 20px; color: var(--red); }
.vs-row { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: center; }
.vs-row .l { text-align: right; font-family: var(--mono); font-weight: 700; font-size: 16px; }
.vs-row .r { font-family: var(--mono); font-weight: 700; font-size: 16px; }
.vs-row .k { color: var(--muted); font-size: 13px; text-align: center; min-width: 130px; }
.win { color: var(--red); }

/* ---------- 搜索 / 工具行 ---------- */
.toolbar { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar input, .toolbar select {
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px;
  background: #fff; outline: none;
}
.toolbar input { flex: 1; min-width: 200px; }
.toolbar input:focus, .toolbar select:focus { border-color: var(--red); }

/* ---------- 弹窗（比赛详情） ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(21,21,30,.55);
  display: none; align-items: flex-start; justify-content: center; z-index: 100;
  padding: 40px 16px; overflow-y: auto;
}
.modal-mask.open { display: flex; }
.modal {
  background: #fff; border-radius: var(--radius); max-width: 760px; width: 100%;
  padding: 24px; position: relative;
}
.modal .close {
  position: absolute; right: 16px; top: 14px; border: none; background: var(--bg-soft);
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 15px; color: var(--muted);
}

.lang-sel {
  margin-left: auto; background: rgba(255,255,255,.1); color: #fff;
  border: 1px solid rgba(255,255,255,.25); border-radius: 8px;
  padding: 5px 8px; font-size: 13px; outline: none; cursor: pointer;
}
.lang-sel option { color: #15151E; }

/* ---------- 赛道 ---------- */
.circuit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.circuit-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; transition: .15s; display: block;
}
.circuit-card:hover { border-color: var(--red); transform: translateY(-2px); }
.circuit-thumb {
  height: 130px; display: flex; align-items: center; justify-content: center;
  background: var(--bg-panel); border-bottom: 1px solid var(--line); padding: 14px;
}
.circuit-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.circuit-info { padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.circuit-info b { font-size: 15px; }
.circuit-info span { font-size: 12px; color: var(--muted); }
.circuit-info .circuit-meta { color: var(--red); font-weight: 600; margin-top: 4px; }
.circuit-hero {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 24px; min-height: 320px; margin-bottom: 16px; overflow: hidden;
}
.circuit-flag {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: .10; pointer-events: none;
}
.circuit-layout-img { max-width: 100%; max-height: 400px; object-fit: contain; position: relative; z-index: 1; }
.circuit-overlay {
  position: absolute; left: 16px; top: 16px; z-index: 2;
  display: flex; flex-direction: column;
  padding: 16px 18px; min-width: 148px;
  max-width: 240px;
}
.ov-badge {
  align-self: flex-start; background: var(--ink); color: #fff;
  font-size: 11px; font-weight: 600; padding: 4px 10px;
  border-radius: 999px; margin-bottom: 12px; white-space: nowrap;
}
.ov-badge.current { background: var(--red); }
.ov-stat b { font-family: var(--mono); font-size: 22px; font-weight: 800; line-height: 1.1; color: var(--ink); }
.ov-stat b small { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 1px; }
.ov-stat span { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.ov-stat + .ov-stat { margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(0,0,0,.07); }
.ov-extra { margin-top: 12px; padding-top: 10px; border-top: 1px solid rgba(0,0,0,.07); font-size: 11px; color: var(--muted); line-height: 1.5; }
@media (max-width: 640px) {
  .circuit-overlay { position: static; width: 100%; max-width: none; margin-top: 16px; }
  .circuit-hero { flex-direction: column; }
}
.layout-row { display: flex; gap: 10px; flex-wrap: wrap; }
.layout-btn {
  border: 1px solid var(--line); background: #fff; border-radius: 8px;
  padding: 8px 14px; cursor: pointer; font-size: 13px; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.layout-btn span { font-size: 11px; color: var(--muted); font-weight: 400; }
.layout-btn.active { border-color: var(--red); background: #FDECEA; color: var(--red); }
.layout-btn.active span { color: var(--red); }

/* ---------- 首页 Banner 轮播 ---------- */
.banner {
  position: relative; background: var(--ink); color: #fff;
  border-radius: var(--radius); margin-bottom: 16px; overflow: hidden;
}
.banner::after {
  content: ""; position: absolute; right: -60px; top: 0; bottom: 0; width: 45%;
  background: linear-gradient(105deg, transparent 0%, var(--red) 100%);
  opacity: .25; transform: skewX(-12deg); pointer-events: none;
}
.banner-slide {
  display: none; padding: 40px 64px 46px; position: relative; z-index: 1;
  animation: bannerIn .4s ease;
}
.banner-slide.active { display: block; }
@keyframes bannerIn { from { opacity: 0; } to { opacity: 1; } }
.banner-kicker {
  display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: 1px;
  color: var(--red); background: #fff; border-radius: 4px; padding: 2px 10px; margin-bottom: 14px;
}
.banner-slide h1 { font-size: 30px; font-weight: 800; margin-bottom: 8px; }
.banner-slide p { color: #B9B9C4; font-size: 14px; }
.banner-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 34px; height: 34px; border: none; border-radius: 50%; cursor: pointer;
  background: rgba(255,255,255,.14); color: #fff; font-size: 20px; line-height: 1;
}
.banner-arrow:hover { background: var(--red); }
.banner-arrow.prev { left: 14px; }
.banner-arrow.next { right: 14px; }
.banner-dots { position: absolute; bottom: 16px; left: 0; right: 0; display: flex; justify-content: center; gap: 8px; z-index: 3; }
.banner-dots .dot {
  width: 8px; height: 8px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255,255,255,.35); padding: 0; transition: .15s;
}
.banner-dots .dot.active { background: var(--red); width: 22px; border-radius: 4px; }

/* ---------- 首页数据条 ---------- */
.stat-bar {
  display: flex; gap: 36px; flex-wrap: wrap; background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 24px; margin-bottom: 20px;
}
.stat-bar .stat b { display: block; font-size: 24px; font-weight: 800; font-family: var(--mono); }
.stat-bar .stat span { font-size: 12px; color: var(--muted); }

/* ---------- 首页中部 ---------- */
.home-mid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
@media (max-width: 800px) { .home-mid { grid-template-columns: 1fr; } }

.podium { display: grid; grid-template-columns: 1fr 1.2fr 1fr; gap: 10px; align-items: end; margin-top: 8px; }
.podium-slot {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  border-radius: 10px; padding: 14px 10px; background: var(--bg-soft);
  border: 1px solid var(--line); text-align: center; transition: .15s;
}
.podium-slot:hover { transform: translateY(-3px); }
.podium-slot b { font-size: 14px; }
.podium-pos { font-family: var(--mono); font-weight: 800; font-size: 22px; color: var(--muted); }
.podium-slot.p1 { background: #FBF3DC; border-color: #E5D193; padding: 24px 10px; }
.podium-slot.p1 .podium-pos { color: var(--gold); font-size: 30px; }
.podium-slot.p2 .podium-pos { color: var(--silver); }
.podium-slot.p3 .podium-pos { color: var(--bronze); }
.podium-team { font-size: 12px; color: var(--muted); }
.podium-time { font-size: 11px; color: var(--muted); font-family: var(--mono); }

.next-race-card .next-race-link { display: block; margin-bottom: 10px; }
.next-race-card .next-race-link b { display: block; font-size: 17px; }
.next-race-card .next-race-link span { font-size: 12px; color: var(--muted); }
.countdown {
  font-family: var(--mono); font-size: 26px; font-weight: 800; color: var(--red);
  padding: 14px 0; letter-spacing: 1px;
}
.next-circuit-link { font-size: 13px; }

.mini-records { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mini-records h3 { font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }

.driver-chips { display: flex; gap: 10px; flex-wrap: wrap; }
.chip {
  padding: 7px 16px; border-radius: 20px; background: var(--bg-soft);
  border: 1px solid var(--line); font-size: 13px; font-weight: 600; transition: .15s;
}
.chip:hover { background: var(--ink); color: #fff; border-color: var(--ink); }

.flag-icon {
  width: 18px; height: 18px; object-fit: cover; border-radius: 50%;
  vertical-align: -4px; margin-right: 6px; border: 1px solid var(--line);
  flex-shrink: 0; display: inline-block;
}

/* ---------- 首页积分榜 Tab ---------- */
.standings-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.standings-head h2 { margin: 0; }
.standings-tabs { display: flex; gap: 4px; background: var(--bg-panel); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.stand-tab {
  border: none; background: transparent; padding: 6px 18px; border-radius: 7px;
  font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; transition: .15s;
}
.stand-tab:hover { color: var(--ink); }
.stand-tab.active { background: var(--red); color: #fff; }
.nat-cell { white-space: nowrap; }

/* ---------- 页脚 ---------- */
.site-footer {
  border-top: 1px solid var(--line); padding: 24px 0 40px;
  color: var(--muted); font-size: 12px; background: #fff;
}
.loading { text-align: center; color: var(--muted); padding: 60px 0; }
.chart-box { position: relative; height: 220px; }
.season-timeline { display: grid; gap: 32px; }
.season-decade-title { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; font-family: var(--mono); font-size: 22px; font-weight: 800; }
.season-decade-title::before { content: ""; width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--red); }
.season-decade-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.season-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.season-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px; transition: .15s; display: block; }
.season-card:hover { border-color: var(--red); transform: translateY(-2px); }
.season-card .yr { font-size: 20px; font-weight: 800; font-family: var(--mono); }
.season-card .ch { font-size: 12px; color: var(--muted); margin-top: 4px; }
.season-card .ch b { color: var(--ink-2); font-weight: 600; }
