/* ═══════════════════════════════════════════════════════════════════════════
   shared_style.css — PokemonKali iRacing 群赛站点 共享主题样式

   此文件被 race_analyzer.py (报告生成) 和 server/rebuild_index.py (网站首页)
   同时引用。修改此文件即可统一更新报告和网站的视觉主题。

   ⚠️ 修改此文件后需：
   1. 推送 GitHub (iracing-website-dev 自动完成)
   2. 部署到 hkserver (deploy_site.sh 自动同步)
   3. 本地生成报告时自动读取最新版本 (同仓库，无需额外操作)
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --accent: #e8510a;
  --accent-hover: #d94706;
  --accent-light: #fff5f0;
  --accent-dark: #bf3a00;
  --accent-rgb: 232, 81, 10;
  --text: #1a1a2e;
  --text-secondary: #6b7280;
  --text-muted: #94a3b8;
  --border: #e5e7eb;
  --border-strong: #cbd5e1;
  --bg: #fafafa;
  --bg-alt: #f3f4f6;
  --card-bg: #ffffff;
  --green: #10b981;
  --red: #ef4444;
  --orange: #f59e0b;
  --purple: #7c3aed;
  --header-bg: #0f0f23;
  --header-text: #e2e8f0;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --radius-sm: 7px;
  --radius-md: 11px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 8px 28px rgba(15, 23, 42, 0.09);
  --shadow-lg: 0 18px 56px rgba(15, 23, 42, 0.18);
  --focus-ring: 0 0 0 3px rgba(var(--accent-rgb), 0.25);
  --content-width: 1200px;
  --touch-target: 44px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 150px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #fafafa 0%, #f0f0f5 100%);
  line-height: 1.5;
  max-width: var(--content-width);
  margin: 0 auto;
  min-height: 100vh;
  accent-color: var(--accent);
}

button, input, select, textarea { font: inherit; }
button, [role="button"], a { -webkit-tap-highlight-color: transparent; }
button:not(:disabled), [role="button"]:not([aria-disabled="true"]) { cursor: pointer; }
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  box-shadow: var(--focus-ring);
}
::selection { color: #fff; background: var(--accent); }

/* Shared primitives */
.ui-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.ui-btn {
  min-height: var(--touch-target);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card-bg);
  color: var(--text);
  font-weight: 700;
  transition: transform .18s var(--ease-out), border-color .18s, background .18s, color .18s;
}
.ui-btn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.ui-btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.ui-btn-primary:hover { background: var(--accent-hover); color: #fff; }
.ui-field {
  min-height: var(--touch-target);
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card-bg);
  color: var(--text);
  transition: border-color .18s, box-shadow .18s;
}
.ui-field:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
.ui-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg-alt);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
}
.ui-empty, .ui-loading {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-secondary);
}

/* Shared overlays, notices and mobile data cards */
.ui-overlay {
  position: fixed;
  inset: 0;
  z-index: 11000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 15, 35, .7);
  backdrop-filter: blur(7px);
}
.ui-dialog {
  width: min(440px, 100%);
  padding: 24px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius-xl);
  background: #17172c;
  color: #e2e8f0;
  box-shadow: var(--shadow-lg);
}
.ui-dialog h2 { margin-bottom: 8px; color: #fff; font-size: 20px; }
.ui-dialog p { color: #a8b3c7; line-height: 1.7; }
.ui-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.ui-toast-region {
  position: fixed;
  z-index: 12000;
  right: 20px;
  bottom: 20px;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}
.ui-toast {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: #172033;
  color: #fff;
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--accent);
  animation: uiToastIn .25s var(--ease-out);
}
.ui-toast.success { border-left-color: var(--green); }
.ui-toast.error { border-left-color: var(--red); }
.ui-toast.warning { border-left-color: var(--orange); }
@keyframes uiToastIn { from { opacity: 0; transform: translateY(8px); } }

.mobile-data-list { display: none; }
.mobile-data-card {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
}
.mobile-data-card + .mobile-data-card { margin-top: 10px; }
.mobile-data-card dl { display: grid; grid-template-columns: minmax(80px, auto) 1fr; gap: 7px 12px; }
.mobile-data-card dt { color: var(--text-muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.mobile-data-card dd { min-width: 0; color: var(--text); font-size: 13px; overflow-wrap: anywhere; }
.mobile-data-card dd a { color: var(--accent-dark); }
.mobile-data-more {
  min-height: 40px;
  width: 100%;
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-alt);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
}
.ui-data-dialog { max-height: min(720px, calc(100dvh - 40px)); overflow: auto; background: var(--card-bg); color: var(--text); }
.ui-data-dialog-head { position: sticky; z-index: 1; top: -24px; display: flex; align-items: center; gap: 12px; margin: -24px -24px 18px; padding: 18px 20px; border-bottom: 1px solid var(--border); background: var(--card-bg); }
.ui-data-dialog-head h2 { flex: 1; margin: 0; color: var(--text); }
.ui-data-close { width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--bg-alt); color: var(--text); font-size: 26px; line-height: 1; }
.ui-data-details { display: grid; grid-template-columns: minmax(90px, auto) 1fr; gap: 0; }
.ui-data-details dt, .ui-data-details dd { padding: 10px 0; border-bottom: 1px solid var(--border); }
.ui-data-details dt { padding-right: 14px; color: var(--text-muted); font-size: 11px; font-weight: 800; }
.ui-data-details dd { min-width: 0; overflow-wrap: anywhere; color: var(--text); font-size: 13px; }
.ui-scroll-hint { display: none; margin: 0 0 6px; color: var(--text-muted); font-size: 11px; text-align: right; transition: opacity .2s; }
.ui-scroll-hint.seen { opacity: 0; }
html.ui-dialog-open, html.ui-dialog-open body { overflow: hidden; }

.mobile-bottom-nav { display: none; }
.report-overview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
  padding: 18px 20px;
}
.report-overview h2 { margin: 7px 0 2px; font-size: 19px; }
.report-overview p { color: var(--text-secondary); font-size: 12px; }
.report-overview nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.report-overview a {
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px;
  color: var(--accent-dark); background: var(--accent-light); text-decoration: none;
  font-size: 12px; font-weight: 700;
}

/* ── Shared Header Pattern (gradient bg + checkerboard + rainbow strip) ── */
.header-base {
  background:
    linear-gradient(135deg, rgba(15,15,35,0.82) 0%, rgba(26,26,62,0.78) 30%, rgba(22,33,62,0.82) 100%),
    url('/bg/header_bg.png') center/cover no-repeat;
  color: var(--header-text);
  position: relative;
}
.header-base::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-conic-gradient(#ffffff08 0% 25%, transparent 0% 50%) 0 0 / 28px 28px;
  pointer-events: none;
}
.header-base::after {
  content: "";
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--orange), var(--purple), var(--green));
}

@media (max-width: 640px) {
  html { scroll-padding-top: 112px; }
  body { overflow-wrap: anywhere; }
  body.has-mobile-nav { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  input, select, textarea { font-size: 16px !important; }
  button, [role="button"], summary { touch-action: manipulation; }
  .ui-overlay {
    align-items: flex-end;
    padding: max(12px, env(safe-area-inset-top)) 0 0;
  }
  .ui-dialog {
    width: 100%;
    max-height: calc(100dvh - max(12px, env(safe-area-inset-top)));
    padding: 22px 16px calc(18px + env(safe-area-inset-bottom));
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    overflow: auto;
  }
  .ui-data-dialog-head { top: -22px; margin: -22px -16px 16px; padding: 12px 16px; }
  .ui-data-details { grid-template-columns: minmax(76px, auto) 1fr; }
  .ui-scroll-hint { display: block; }
  .mobile-bottom-nav {
    position: fixed;
    z-index: 9000;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(62px, 1fr);
    width: min(100%, var(--content-width));
    padding: 6px max(8px, env(safe-area-inset-left)) calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255,255,255,.1);
    background: rgba(15, 15, 35, .96);
    box-shadow: 0 -8px 24px rgba(15,23,42,.2);
    backdrop-filter: blur(14px);
  }
  .mobile-bottom-nav button {
    min-height: 52px;
    padding: 5px 4px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #94a3b8;
    font-size: 10px;
    font-weight: 700;
  }
  .mobile-bottom-nav button.active { color: #fff; background: rgba(var(--accent-rgb), .22); }
  .mobile-bottom-nav .tab-icon { display: block; width: 17px; height: 17px; margin: 0 auto 3px; background: currentColor; }
  .mobile-data-list { display: block; }
  table[data-mobile-cards="true"] { display: none; }
  .mobile-data-card { padding: 13px; }
  .ui-dialog-actions { flex-direction: column-reverse; }
  .ui-dialog-actions .ui-btn { width: 100%; }
  .ui-toast-region { right: 16px; bottom: 84px; }
  .report-overview { align-items: stretch; flex-direction: column; padding: 15px; }
  .report-overview nav { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

  .site-shell {
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 8px 22px rgba(15,23,42,0.12);
  }
  .site-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
  }
  .site-eyebrow {
    margin-bottom: 3px;
    color: var(--accent);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    position: relative;
    z-index: 1;
  }
  .site-header { padding: 20px 36px 16px; }
  .site-header h1 {
    font-size: 22px;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 6px;
    position: relative;
    z-index: 1;
    letter-spacing: -0.3px;
    line-height: 1.4;
  }
  .site-header h1 .brand { color: var(--accent); }
  .site-header .subtitle {
    font-size: 14px;
    color: #94a3b8;
    position: relative;
    z-index: 1;
    line-height: 1.6;
  }

  /* ===== L1: Game Navigation (top-level iRacing / LMU capsule toggle) ===== */
  .game-nav {
    display: flex;
    justify-content: center;
    padding: 0 24px 12px;
    position: relative;
    z-index: 1;
    background: #0f1b30;
  }
  .game-nav-inner {
    display: inline-flex;
    gap: 3px;
    padding: 3px;
    background: rgba(255,255,255,0.08);
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.06);
  }
  .game-btn {
    padding: 7px 28px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: rgba(255,255,255,0.45);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    font-family: inherit;
    letter-spacing: 0.8px;
    text-transform: uppercase;
  }
  .game-btn:hover { color: rgba(255,255,255,0.7); background: rgba(255,255,255,0.05); }
  .game-btn.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 2px 12px rgba(232,81,10,0.4), inset 0 1px 0 rgba(255,255,255,0.15);
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
  }
  .game-group { display: none; }
  .game-group.active { display: block; }

  /* ===== L2: Sub Tab Navigation (light background, content-level) ===== */
  .tab-nav {
    display: flex;
    gap: 0;
    padding: 0 24px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tab-nav::-webkit-scrollbar { display: none; }

  .tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 20px;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-family: inherit;
    position: relative;
  }
  .tab-btn:hover { color: var(--text); background: var(--bg-alt); }
  .tab-btn.active {
    color: var(--accent);
    font-weight: 700;
    background: transparent;
  }
  .tab-btn.active::after {
    content: "";
    position: absolute;
    bottom: 0; left: 12px; right: 12px;
    height: 3px;
    background: var(--accent);
    border-radius: 3px 3px 0 0;
  }
  .tab-btn .tab-icon {
    display: inline-block; width: 16px; height: 16px; vertical-align: middle;
    background: currentColor;
    -webkit-mask-size: contain; mask-size: contain;
    -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
    -webkit-mask-position: center; mask-position: center;
  }
  .icon-flag { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z'/%3E%3Cline x1='4' y1='22' x2='4' y2='15'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z'/%3E%3Cline x1='4' y1='22' x2='4' y2='15'/%3E%3C/svg%3E"); }
  .icon-driver { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E"); }
  .icon-calendar { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E"); }
  .icon-team { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M23 21v-2a4 4 0 0 0-3-3.87'/%3E%3Cpath d='M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M23 21v-2a4 4 0 0 0-3-3.87'/%3E%3Cpath d='M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E"); }
  .icon-stopwatch { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpolyline points='12 6 12 12 16 14'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpolyline points='12 6 12 12 16 14'/%3E%3C/svg%3E"); }

  .tab-panel { display: none; animation: tabFadeIn 0.35s cubic-bezier(0.4, 0, 0.2, 1); }
  .tab-panel.active { display: block; }

  .content-wrapper { padding: 28px 24px; }

  /* ===== Stats Bar (reports tab) ===== */
  .stats-bar {
    display: flex;
    gap: 14px;
    margin-bottom: 28px;
    flex-wrap: wrap;
  }
  .stat-card {
    flex: 1;
    min-width: 120px;
    background: var(--card-bg);
    border-radius: 16px;
    padding: 24px 20px 20px;
    border: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    text-align: center;
    border-top: 4px solid var(--accent);
    transition: transform 0.2s, box-shadow 0.2s;
  }
  .stat-card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,0.1); }
  .stat-card .stat-value {
    font-size: 38px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
  }
  .stat-card .stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 6px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
  }

  .race-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  .race-card {
    background: var(--card-bg);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
    border: 1px solid var(--border);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    display: flex;
    flex-direction: row;
  }
  .race-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 28px rgba(0,0,0,0.10);
    border-color: var(--accent);
  }

  .race-card-accent {
    width: 4px;
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--accent), var(--orange));
  }

  .race-card-body {
    flex: 1;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
  }

  .race-card-info { flex: 1; min-width: 0; }

  .race-card-date {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.5px;
    margin-bottom: 5px;
    opacity: 0.85;
  }

  .race-card-track {
    font-size: 19px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 8px;
    letter-spacing: -0.3px;
    line-height: 1.3;
  }

  .race-card-meta {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--text-secondary);
  }
  .race-card-meta span { display: flex; align-items: center; gap: 4px; }

  .race-card-action { flex-shrink: 0; }

  .btn-view {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff;
    text-decoration: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    transition: all 0.2s ease;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(232,81,10,0.25);
  }
  .btn-view:hover { transform: scale(1.05); box-shadow: 0 4px 14px rgba(232,81,10,0.35); }
  .btn-view .arrow { font-size: 16px; transition: transform 0.2s; }
  .btn-view:hover .arrow { transform: translateX(3px); }

  .empty-state {
    text-align: center;
    padding: 80px 24px;
    color: var(--text-secondary);
  }
  .empty-state .empty-icon { font-size: 64px; margin-bottom: 16px; opacity: 0.6; }
  .empty-state h3 {
    font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 8px;
    border: none; padding: 0; justify-content: center;
  }
  .empty-state p { font-size: 14px; max-width: 400px; margin: 0 auto; }

  /* ===== Endurance Schedule ===== */
  .schedule-intro {
    text-align: center;
    margin-bottom: 24px;
    color: var(--text-secondary);
    font-size: 14px;
  }

  .schedule-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
  }

  .series-card {
    background: var(--card-bg);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
  }
  .series-card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,0.08); }

  .series-card-header {
    padding: 16px 20px 8px;
    cursor: pointer;
  }
  .series-card-body { display: none; }
  .series-card.sc-open .series-card-body { display: block; animation: tabFadeIn 0.25s ease; }
  .sc-toggle-hint { font-size: 11px; color: var(--text-secondary); white-space: nowrap; }
  .sc-toggle-hint::after { content: "\25BC"; margin-left: 4px; font-size: 8px; display: inline-block; transition: transform 0.3s; }
  .series-card.sc-open .sc-toggle-hint::after { transform: rotate(180deg); }
  .series-card-header::after {
    content: "";
    display: block;
    height: 3px;
    margin-top: 10px;
    border-radius: 2px;
  }
  .series-get  .series-card-header::after { background: var(--accent); }
  .series-ces  .series-card-header::after { background: var(--purple); }
  .series-nec  .series-card-header::after { background: #059669; }
  .series-gtes .series-card-header::after { background: var(--orange); }
  .series-ies  .series-card-header::after { background: #2563eb; }
  .series-pec  .series-card-header::after { background: var(--green); }
  .series-se   .series-card-header::after { background: linear-gradient(90deg, var(--accent), var(--orange), var(--purple), var(--green)); }

  .series-abbr {
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.3px;
  }
  .series-name {
    font-size: 13px;
    color: var(--text-secondary);
    margin-left: 8px;
    font-weight: 400;
  }

  .series-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding: 0 20px 12px;
  }
  .series-tag.license-b { background: #d1fae5; color: #065f46; }
  .series-tag.license-c { background: #fef9c3; color: #854d0e; }
  .series-tag.license-d { background: #ffedd5; color: #9a3412; }
  .series-tag {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 6px;
    background: #f1f5f9;
    color: #475569;
    white-space: nowrap;
  }
  .series-tag.series-tag-time {
    background: color-mix(in srgb, var(--accent) 15%, transparent);
    color: var(--accent);
    font-weight: 700;
  }

  .series-schedule {
    width: 100%;
    border-collapse: collapse;
  }
  .series-schedule th {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 7px 14px;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    text-align: left;
  }
  .series-schedule td {
    font-size: 13px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
  }
  .series-schedule td.week-num { font-weight: 700; color: var(--text-secondary); width: 36px; }
  .series-schedule td.track-name { font-weight: 700; color: var(--accent); }
  .series-schedule tr { transition: background 0.15s; }
  .series-schedule tr:hover td { background: var(--accent-light); }
  .series-schedule tr:last-child td { border-bottom: none; }
  .series-schedule .no-races, .no-races {
    text-align: center;
    padding: 18px 14px;
    color: #cbd5e1;
    font-size: 13px;
  }

  /* ===== Season Switcher ===== */
  .season-nav {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
  }
  .season-btn {
    padding: 6px 18px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
  }
  .season-btn:hover { border-color: var(--accent); color: var(--text); }
  .season-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
  }
  .season-subtitle {
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 20px;
  }
  .season-group { display: none; }
  .season-group.active { display: block; animation: tabFadeIn 0.3s ease; }

  /* Section dividers */
  .schedule-section-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 28px 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
  }
  .schedule-section-label:first-child { margin-top: 0; }

  /* All-series expand/collapse */
  .all-series-toggle-btn {
    display: block;
    margin: 24px auto 0;
    padding: 8px 24px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
  }
  .all-series-toggle-btn:hover { border-color: var(--accent); color: var(--text); }
  .all-series-section { display: none; }
  .all-series-section.expanded { display: block; animation: tabFadeIn 0.3s ease; }

  .category-group { margin-bottom: 20px; }
  .category-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
    padding-left: 4px;
  }
  .category-label::before { content: "🏁 "; }

  /* Compact card variant for non-group-focus series */
  .series-card.series-card-compact .series-card-header { padding: 12px 16px 6px; }
  .series-card.series-card-compact .series-abbr { font-size: 16px; }
  .series-card.series-card-compact .series-name { font-size: 12px; }
  .series-card.series-card-compact .series-tags { padding: 0 16px 8px; }

  /* ===== Sub-Tabs (组队/全部) ===== */
  .schedule-sub-tabs {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 16px;
  }
  .schedule-sub-btn {
    padding: 6px 16px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
  }
  .schedule-sub-btn:hover { border-color: var(--accent); color: var(--text); }
  .schedule-sub-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
  }
  .schedule-sub-panel { display: none; }
  .schedule-sub-panel.active { display: block; animation: tabFadeIn 0.25s ease; }

  /* ===== Filter Controls ===== */
  .schedule-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    padding: 12px 16px;
    margin-bottom: 16px;
    background: var(--bg-alt);
    border-radius: 12px;
    border: 1px solid var(--border);
  }
  .filter-group {
    display: flex;
    align-items: center;
    gap: 4px;
  }
  .filter-label {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
  }
  .filter-input {
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    background: var(--card-bg);
    color: var(--text);
    width: 140px;
    transition: border-color 0.2s;
  }
  .filter-input:focus { outline: none; border-color: var(--accent); }
  .filter-select {
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    background: var(--card-bg);
    color: var(--text);
    cursor: pointer;
  }
  .filter-select:focus { outline: none; border-color: var(--accent); }
  .filter-btn {
    padding: 5px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
  }
  .filter-btn:hover { border-color: var(--accent); color: var(--accent); }
  .filter-btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
  .filter-count {
    font-size: 12px;
    color: var(--text-secondary);
    margin-left: auto;
  }
  @media (max-width: 768px) {
    .schedule-filters { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 12px; }
    .filter-group { width: 100%; }
    .filter-input { width: 100%; flex: 1; }
    .filter-select { flex: 1; }
    .filter-count { margin-left: 0; text-align: right; }
  }
  @media (max-width: 640px) {
    .schedule-filters { gap: 6px; padding: 8px 10px; }
    .filter-input, .filter-select { font-size: 14px; padding: 8px 10px; }
    .filter-btn { width: 100%; padding: 8px 14px; }
  }

  /* ===== Date Picker ===== */
  .date-picker-wrap { position: relative; display: inline-block; }
  .date-picker-input {
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    background: var(--card-bg);
    color: var(--text);
    width: 140px;
    cursor: pointer;
  }
  .date-picker-input:focus { outline: none; border-color: var(--accent); }
  .date-picker-popup {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    padding: 12px;
    min-width: 280px;
    margin-top: 4px;
  }
  .date-picker-popup.open { display: block; }
  .dp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
  }
  .dp-header button {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: 4px;
  }
  .dp-header button:hover { background: var(--bg-alt); }
  .dp-title { font-weight: 700; font-size: 14px; }
  .dp-grid { width: 100%; border-collapse: collapse; }
  .dp-grid th {
    font-size: 11px;
    color: var(--text-secondary);
    padding: 4px 0;
    text-align: center;
    font-weight: 600;
  }
  .dp-grid td {
    text-align: center;
    padding: 4px 0;
    font-size: 13px;
    cursor: default;
    border-radius: 6px;
    transition: background 0.15s;
  }
  .dp-grid td[data-date] { cursor: pointer; }
  .dp-grid td[data-date]:hover { background: var(--bg-alt); }
  .dp-grid td.dp-today { font-weight: 800; color: var(--accent); }
  .dp-grid td.dp-selected { background: var(--accent); color: #fff; border-radius: 6px; }
  .dp-grid td.dp-has-race { position: relative; }
  .dp-grid td.dp-has-race::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 5px;
    height: 5px;
    background: var(--accent);
    border-radius: 50%;
  }
  .dp-grid td.dp-selected.dp-has-race::after { background: #fff; }
  .dp-grid td.dp-other-month { color: var(--border); }

  /* ===== Series Table (全部赛事) ===== */
  .series-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
  }
  .series-table thead th {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 12px;
    background: var(--bg-alt);
    border-bottom: 2px solid var(--border);
    text-align: left;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    position: sticky;
    top: 0;
  }
  .series-table thead th:hover { color: var(--accent); }
  .series-table thead th .sort-arrow { font-size: 10px; margin-left: 2px; }
  .series-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
    cursor: pointer;
  }
  .series-table tbody tr:hover { background: var(--accent-light); }
  .series-table tbody td {
    padding: 8px 12px;
    color: var(--text);
    vertical-align: middle;
  }
  .series-table td.st-name { font-weight: 700; color: var(--text); }
  .series-table td.st-name .st-key {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 400;
    margin-left: 6px;
  }
  .series-table .st-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    text-transform: uppercase;
  }
  .st-badge.cat-sports_car { background: #dbeafe; color: #1e40af; }
  .st-badge.cat-oval { background: #fef3c7; color: #92400e; }
  .st-badge.cat-formula_car { background: #ede9fe; color: #5b21b6; }
  .st-badge.cat-dirt_oval, .st-badge.cat-dirt_road, .st-badge.cat-dirt { background: #fce7f3; color: #9d174d; }
  .series-table .st-license {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
  }
  .st-license.license-r { background: #f1f5f9; color: #475569; }
  .st-license.license-d { background: #ffedd5; color: #9a3412; }
  .st-license.license-c { background: #fef9c3; color: #854d0e; }
  .st-license.license-b { background: #d1fae5; color: #065f46; }
  .st-license.license-a { background: #dbeafe; color: #1e40af; }
  .series-table .st-cars {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    color: var(--text-secondary);
  }
  .series-table .st-count {
    font-weight: 700;
    color: var(--accent);
    text-align: center;
  }
  .series-table .expand-arrow {
    display: inline-block;
    font-size: 10px;
    color: var(--text-secondary);
    transition: transform 0.2s;
    margin-right: 4px;
  }
  .series-table tr.expanded .expand-arrow { transform: rotate(90deg); }
  .series-table .expanded-detail { display: none; }
  .series-table tr.expanded + .expanded-detail { display: table-row; }
  .expanded-detail td {
    padding: 0 12px 12px;
    background: var(--bg-alt);
  }
  .expanded-detail .detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
  }
  .expanded-detail .detail-table th {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    padding: 6px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border);
  }
  .expanded-detail .detail-table td {
    padding: 5px 10px;
    border-bottom: 1px solid var(--border);
    background: transparent;
  }
  .expanded-detail .detail-table td.dt-track { font-weight: 700; color: var(--accent); }
  .expanded-detail .detail-table td.dt-week { font-weight: 700; color: var(--text-secondary); width: 30px; }

  /* ===== Race Results View (flat search results) ===== */
  .race-results-view { display: none; }
  .race-results-view.active { display: block; }
  .race-results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
  }
  .race-results-table thead th {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 12px;
    background: var(--bg-alt);
    border-bottom: 2px solid var(--border);
    text-align: left;
    position: sticky;
    top: 0;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
  }
  .race-results-table thead th:hover { color: var(--accent); }
  .race-results-table thead th .sort-arrow { font-size: 10px; margin-left: 2px; }
  .race-results-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
  }
  .race-results-table tbody tr:hover { background: var(--accent-light); }
  .race-results-table tbody td {
    padding: 7px 12px;
    color: var(--text);
    vertical-align: middle;
  }
  .race-results-table .rr-series {
    font-weight: 700;
    white-space: nowrap;
  }
  .race-results-table .rr-series .st-key {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 400;
    margin-left: 4px;
  }
  .race-results-table .rr-week {
    font-weight: 700;
    color: var(--text-secondary);
    white-space: nowrap;
    width: 36px;
  }
  .race-results-table .rr-date {
    white-space: nowrap;
    color: var(--text-secondary);
  }
  .race-results-table .rr-track {
    font-weight: 700;
    color: var(--accent);
  }
  .race-results-table .rr-config {
    font-size: 12px;
    color: var(--text-secondary);
  }
  .race-results-table .rr-dur {
    white-space: nowrap;
    font-weight: 600;
  }
  .race-results-table .rr-dow {
    white-space: nowrap;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
  }
  .race-results-table .rr-dow.rr-weekend {
    color: var(--accent);
    font-weight: 700;
  }
  .series-schedule td.weekend,
  .expanded-detail .detail-table td.weekend {
    color: var(--accent);
    font-weight: 700;
  }
  .race-results-count {
    text-align: center;
    padding: 12px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
  }
  @media (max-width: 768px) {
    .series-table thead th, .series-table tbody td { padding: 6px 8px; font-size: 12px; }
    .series-table thead th:nth-child(5), .series-table tbody > tr > td:nth-child(5) { display: none; }
    .series-table .st-cars { max-width: 120px; }
    .expanded-detail .detail-table th, .expanded-detail .detail-table td { padding: 4px 6px; font-size: 11px; }
    .race-results-table thead th, .race-results-table tbody td { padding: 5px 8px; font-size: 12px; }
  }
  @media (max-width: 640px) {
    .series-table thead th:nth-child(4), .series-table tbody > tr > td:nth-child(4) { display: none; }
    .series-table .st-name { font-size: 12px; }
    .series-table .st-key { display: none; }
  }

  /* ===== Teammate Matching Placeholder ===== */
  .matching-placeholder {
    text-align: center;
    padding: 60px 24px;
  }
  .matching-placeholder .matching-icon { font-size: 72px; margin-bottom: 20px; opacity: 0.7; }
  .matching-placeholder h3 {
    font-size: 20px; font-weight: 800; color: var(--text); margin-bottom: 10px;
    border: none; padding: 0; justify-content: center;
  }
  .matching-placeholder .matching-desc {
    font-size: 14px; color: var(--text-secondary); max-width: 460px;
    margin: 0 auto 28px; line-height: 1.7;
  }
  .matching-features {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
  }
  .matching-feature {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 18px;
    width: 175px;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  }
  .matching-feature:hover { transform: translateY(-3px); box-shadow: 0 6px 18px rgba(0,0,0,0.08); border-color: var(--accent); }
  .matching-feature .feat-icon { font-size: 28px; margin-bottom: 8px; }
  .matching-feature .feat-title { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
  .matching-feature .feat-desc { font-size: 12px; color: var(--text-secondary); }

  /* ===== Nordschleife Leaderboard ===== */
  .ns-container {
    text-align: center;
    padding: 48px 24px 60px;
  }
  .ns-header h2 {
    font-size: 24px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 16px;
    letter-spacing: -0.3px;
  }
  .ns-intro {
    font-size: 15px;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 40px;
    line-height: 1.9;
  }
  .ns-classes {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 40px;
  }
  .ns-class-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px 22px 20px;
    width: 150px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  }
  .ns-class-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.10);
    border-color: var(--accent);
  }
  .ns-class-abbr {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 6px;
  }
  .ns-class-name {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
  }
  .ns-footer-note {
    font-size: 13px;
    color: #94a3b8;
    font-weight: 600;
    padding: 12px 24px;
    display: inline-block;
    border: 1px dashed var(--border);
    border-radius: 8px;
    background: var(--bg-alt);
  }

  /* ===== Nordschleife Leaderboard ===== */
  .ns-leaderboard { max-width: 900px; margin: 0 auto; }
  .ns-tab-nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-bottom: 20px;
    padding-bottom: 4px;
  }
  .ns-tab-nav::-webkit-scrollbar { display: none; }
  .ns-tab-btn {
    padding: 6px 14px;
    border: none;
    border-radius: 6px;
    background: rgba(0,0,0,0.05);
    background: color-mix(in srgb, var(--ns-color, var(--accent)) 10%, transparent);
    color: var(--ns-color, var(--accent));
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    font-family: inherit;
  }
  .ns-tab-btn:hover {
    background: rgba(0,0,0,0.08);
    background: color-mix(in srgb, var(--ns-color, var(--accent)) 18%, transparent);
  }
  .ns-tab-btn.active {
    background: var(--ns-color, var(--accent));
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    box-shadow: 0 2px 8px color-mix(in srgb, var(--ns-color, var(--accent)) 30%, transparent);
  }
  .ns-tab-btn.has-data::after {
    content: "";
    display: inline-block;
    width: 6px; height: 6px;
    background: var(--ns-color, var(--accent));
    border-radius: 50%;
    margin-left: 4px;
    vertical-align: middle;
  }
  .ns-tab-btn.active.has-data::after {
    background: #fff;
  }
  .ns-tab-panel { display: none; animation: tabFadeIn 0.25s ease; }
  .ns-tab-panel.active { display: block; }
  .ns-no-data-panel {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-secondary);
    font-size: 15px;
  }
  .ns-table { width: 100%; border-collapse: collapse; }
  .ns-table th {
    background: linear-gradient(180deg, #f8f9fb, #eef0f4);
    padding: 8px 12px;
    font-size: 12px;
    text-align: left;
    font-weight: 700;
    color: var(--text);
    border-bottom: 2px solid #d1d5db;
  }
  .ns-table td { padding: 10px 12px; font-size: 14px; border-bottom: 1px solid var(--border); }
  .ns-table tbody tr:nth-child(even) { background: var(--bg-alt); }
  .ns-table tbody tr:hover { background: var(--accent-light); }
  .ns-tier { display: inline-flex; align-items: center; gap: 6px; }
  .ns-tier img { width: 24px; height: 24px; border-radius: 4px; }
  .ns-tier-label { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 4px; white-space: nowrap; }
  .ns-tier-hang { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #92400e; }
  .ns-tier-dingji { background: #dbeafe; color: #1e40af; }
  .ns-tier-renshangren { background: #d1fae5; color: #065f46; }
  .ns-tier-npc { background: var(--bg-alt); color: var(--text-secondary); }
  .ns-tier-lawanle { background: #fef2f2; color: #dc2626; }
  .ns-best-lap { font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace; font-weight: 700; font-size: 15px; }
  .ns-rank-1 .ns-best-lap { color: #d97706; }
  .ns-rank-2 .ns-best-lap { color: #6366f1; }
  .ns-rank-3 .ns-best-lap { color: #10b981; }
  .ns-rank-1 td, .ns-rank-2 td, .ns-rank-3 td, .ns-rank-last td { padding-top: 14px; padding-bottom: 14px; }
  .ns-rank-1 .ns-tier img, .ns-rank-2 .ns-tier img, .ns-rank-3 .ns-tier img, .ns-rank-last .ns-tier img { width: 36px; height: 36px; }
  .ns-rank-1 .ns-tier-label, .ns-rank-2 .ns-tier-label, .ns-rank-3 .ns-tier-label, .ns-rank-last .ns-tier-label { font-size: 14px; padding: 3px 10px; }
  .ns-rank-1 strong, .ns-rank-2 strong, .ns-rank-3 strong, .ns-rank-last strong { font-size: 16px; }
  .ns-rank-1 .ns-best-lap, .ns-rank-2 .ns-best-lap, .ns-rank-3 .ns-best-lap { font-size: 17px; }
  .ns-ref-row { background: linear-gradient(90deg, rgba(255,215,0,0.06), transparent) !important; border-bottom: 1px dashed var(--border); }
  .ns-ref-row td { color: var(--text-secondary); font-style: italic; font-size: 13px; padding-top: 8px; padding-bottom: 8px; }
  .ns-ref-row:hover { background: rgba(255,215,0,0.1) !important; }
  .ns-ref-badge { font-size: 10px; padding: 2px 6px; border-radius: 3px; background: #fff3e0; color: #e65100; font-weight: 700; white-space: nowrap; }
  .ns-rank-last .ns-best-lap { color: #dc2626; font-size: 17px; }
  @media (max-width: 768px) {
    .ns-container { padding: 32px 16px 40px; }
    .ns-header h2 { font-size: 20px; }
    .ns-table th, .ns-table td { padding: 8px 8px; font-size: 12px; }
    .ns-best-lap { font-size: 13px; }
    .ns-tier img { width: 20px; height: 20px; }
    .ns-col-date { display: none; }
    .ns-tab-btn { padding: 5px 12px; font-size: 12px; }
    .ns-car-grid { grid-template-columns: 1fr; }
    .ns-wr-table th, .ns-wr-table td { padding: 6px 6px; font-size: 12px; }
    .ns-wr-table .ns-col-wr-date { display: none; }
    .ns-wr-table .ns-col-wr-src { display: none; }
    .ns-wr-table .ns-col-wr-link { display: none; }
    .ns-wr-header { padding: 18px 16px; }
    .ns-wr-header h3 { font-size: 16px; }
  }
  @media (max-width: 640px) {
    .ns-col-car { display: none; }
    .ns-tier-label { font-size: 11px; padding: 2px 6px; }
    .ns-tab-btn { padding: 4px 10px; font-size: 11px; }
    .ns-layout-btn { padding: 4px 10px; font-size: 11px; }
    .ns-car-toggle { font-size: 12px; padding: 8px 12px; }
    .ns-car-panel-body { padding: 10px 12px; }
    .ns-car-item { padding: 6px 10px; font-size: 12px; }
    .ns-wr-table .ns-col-wr-source { display: none; }
    .ns-wr-filters { padding: 12px; }
    .ns-wr-pill { padding: 3px 8px; font-size: 11px; }
  }

  /* ===== Nordschleife Layout Pills ===== */
  .ns-layout-nav {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
  }
  .ns-layout-btn {
    padding: 5px 16px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    position: relative;
  }
  .ns-layout-btn:hover { border-color: var(--accent); color: var(--text); }
  .ns-layout-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
  }
  .ns-layout-btn.has-data:not(.active)::after {
    content: "";
    display: inline-block;
    width: 5px; height: 5px;
    background: var(--accent);
    border-radius: 50%;
    margin-left: 4px;
    vertical-align: middle;
  }
  .ns-layout-btn.ns-layout-btn-wr {
    border-color: #1a5c2e;
    color: #fff;
    background: linear-gradient(rgba(20,83,45,0.55), rgba(20,83,45,0.55)), url('/bg/wr_green_hell_btn.png');
    background-size: cover;
    background-position: center;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
  }
  .ns-layout-btn.ns-layout-btn-wr:hover {
    border-color: #14532d;
    color: #fff;
    background: linear-gradient(rgba(20,83,45,0.7), rgba(20,83,45,0.7)), url('/bg/wr_green_hell_btn.png');
    background-size: cover;
    background-position: center;
    box-shadow: 0 0 8px rgba(26, 92, 46, 0.3);
  }
  .ns-layout-btn.ns-layout-btn-wr.active {
    background-color: #14532d;
    background-image: url('/bg/wr_green_hell_btn.png');
    background-blend-mode: overlay;
    color: #fff;
    border-color: #14532d;
    box-shadow: 0 2px 8px rgba(20, 83, 45, 0.4);
  }
  .ns-layout-btn.ns-layout-btn-wr.has-data:not(.active)::after {
    background: #fff;
  }
  .ns-layout-group { display: none; }
  .ns-layout-group.active { display: block; }
  .ns-layout-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-weight: 500;
  }

  /* ===== Nordschleife Car Info Panel ===== */
  .ns-car-panel {
    margin: 12px 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card-bg);
    overflow: hidden;
  }
  .ns-car-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 16px;
    border: none;
    background: var(--bg-alt);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
  }
  .ns-car-toggle:hover { background: var(--accent-light); color: var(--text); }
  .ns-car-toggle .ns-icon { margin-right: 6px; vertical-align: -2px; }
  .ns-panel-arrow { font-size: 10px; transition: transform 0.3s; }
  .ns-panel-open .ns-panel-arrow { transform: rotate(180deg); }
  .ns-car-panel-body {
    display: none;
    padding: 14px 16px;
    animation: tabFadeIn 0.25s ease;
  }
  .ns-panel-open .ns-car-panel-body { display: block; }
  .ns-car-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
  }
  .ns-car-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-alt);
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 13px;
    transition: border-color 0.2s;
  }
  .ns-car-item:hover { border-color: var(--accent); }
  .ns-car-name { font-weight: 600; color: var(--text); }
  .ns-car-status {
    font-size: 11px; font-weight: 700; padding: 2px 8px;
    border-radius: 4px; white-space: nowrap; flex-shrink: 0; margin-left: 8px;
  }
  .ns-car-active { background: #d1fae5; color: #065f46; }
  .ns-car-legacy { background: #f1f5f9; color: #64748b; }
  .ns-car-empty { text-align: center; padding: 24px; color: var(--text-secondary); font-size: 13px; }

  /* ===== Nordschleife World Records Section ===== */
  .ns-wr-section {
    margin-top: 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: var(--card-bg);
  }
  .ns-wr-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #e2e8f0;
    padding: 24px;
    text-align: center;
    position: relative;
  }
  .ns-wr-header::after {
    content: "";
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--orange), var(--purple), var(--green));
  }
  .ns-wr-header-icon { margin-bottom: 4px; }
  .ns-wr-header-icon svg { width: 28px; height: 28px; }
  .ns-wr-header h3 { font-size: 18px; font-weight: 800; margin: 0 0 4px; }
  .ns-wr-header p { font-size: 13px; color: #94a3b8; margin: 0; }
  .ns-wr-filters { padding: 16px; border-bottom: 1px solid var(--border); }
  .ns-wr-search {
    width: 100%; padding: 8px 12px;
    border: 1px solid var(--border); border-radius: 8px;
    background: var(--bg-alt); color: var(--text);
    font-size: 13px; outline: none; box-sizing: border-box;
    margin-bottom: 12px;
  }
  .ns-wr-search:focus { border-color: var(--accent); }
  .report-search {
    width: 100%; padding: 8px 12px;
    border: 1px solid var(--border); border-radius: 8px;
    background: var(--bg-alt); color: var(--text);
    font-size: 13px; outline: none; box-sizing: border-box;
  }
  .report-search:focus { border-color: var(--accent); }
  .report-toolbar {
    display: flex; align-items: center; gap: 12px;
    margin: 0 0 16px; padding: 14px 16px;
    background: var(--card-bg); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  }
  .report-toolbar .report-search { flex: 1; min-height: 42px; background: var(--card-bg); }
  .report-result-count {
    flex-shrink: 0; color: var(--text-secondary);
    font-size: 12px; font-weight: 700;
  }
  .ns-wr-filter-row { display: flex; flex-direction: column; gap: 10px; }
  .ns-wr-filter-group {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  }
  .ns-wr-filter-label {
    font-size: 12px; font-weight: 700; color: var(--text-secondary);
    min-width: 36px;
  }
  .ns-wr-pill {
    padding: 4px 12px; border-radius: 14px;
    border: 1px solid var(--border); background: transparent;
    color: var(--text-secondary); font-size: 12px; font-weight: 600;
    cursor: pointer; transition: all 0.15s; font-family: inherit;
  }
  .ns-wr-pill[style*="--ns-color"] { border-color: var(--ns-color); color: var(--ns-color); font-weight: 700; }
  .ns-wr-pill:hover { border-color: var(--ns-color, var(--accent)); color: var(--ns-color, var(--accent)); }
  .ns-wr-pill.active {
    background: var(--ns-color, var(--accent));
    color: #fff; border-color: var(--ns-color, var(--accent));
  }
  .ns-wr-pills-extra { display: inline; }
  .ns-wr-pills-toggle { border-style: dashed; color: var(--accent); font-weight: 700; }
  .ns-wr-session-badge { font-size: 11px; padding: 2px 6px; border-radius: 3px; font-weight: 600; }
  .ns-session-qual { background: #e3f2fd; color: #1565c0; }
  .ns-session-race { background: #fce4ec; color: #c62828; }
  .ns-wr-tabs {
    display: flex; border-bottom: 1px solid var(--border);
  }
  .ns-wr-tab {
    flex: 1; padding: 10px 16px; border: none; background: transparent;
    color: var(--text-secondary); font-size: 13px; font-weight: 700;
    cursor: pointer; font-family: inherit; transition: all 0.2s;
    border-bottom: 3px solid transparent;
    display: flex; align-items: center; justify-content: center; gap: 6px;
  }
  .ns-wr-tab .ns-icon { vertical-align: -2px; }
  .ns-wr-tab:hover { color: var(--text); background: var(--bg-alt); }
  .ns-wr-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
  .ns-wr-tab-count {
    font-size: 10px; font-weight: 600; padding: 1px 6px;
    border-radius: 10px; background: var(--bg-alt); color: var(--text-secondary);
    min-width: 20px; text-align: center;
  }
  .ns-wr-tab.active .ns-wr-tab-count { background: var(--accent); color: #fff; }
  .ns-wr-video-link {
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; border-radius: 50%;
    background: #dc2626; color: #fff; transition: all 0.2s;
  }
  .ns-wr-video-link:hover { background: #b91c1c; transform: scale(1.1); }
  .ns-col-wr-src { width: 28px; text-align: center; }
  .ns-col-wr-src a { color: var(--text-secondary); transition: color 0.2s; }
  .ns-col-wr-src a:hover { color: var(--accent); }
  .ns-col-wr-link { width: 40px; text-align: center; }
  .ns-wr-content { padding: 0; }
  .ns-wr-lazy {
    display: grid; place-items: center; min-height: 240px; padding: 32px;
    border: 1px solid var(--border); border-radius: 12px; background: var(--card-bg);
    color: var(--text-secondary); text-align: center;
  }
  .ns-wr-lazy button {
    min-height: 44px; margin-top: 14px; padding: 9px 18px; border: 0; border-radius: 9px;
    background: var(--accent); color: #fff; font-weight: 800;
  }
  .ns-wr-table { width: 100%; border-collapse: collapse; }
  .ns-wr-table th {
    background: linear-gradient(180deg, #f8f9fb, #eef0f4);
    padding: 8px 10px; font-size: 11px; text-align: left;
    font-weight: 700; color: var(--text); border-bottom: 2px solid #d1d5db;
  }
  .ns-wr-table td {
    padding: 8px 10px; font-size: 13px; border-bottom: 1px solid var(--border);
  }
  .ns-wr-table tbody tr:hover { background: var(--accent-light); }
  .ns-wr-table tr.ns-wr-hidden { display: none; }
  .ns-wr-tips {
    margin-top: 8px; font-size: 12px; color: var(--text-secondary);
  }
  .ns-wr-tips summary {
    cursor: pointer; font-weight: 600; color: var(--accent);
    list-style: none; display: inline-flex; align-items: center; gap: 4px;
  }
  .ns-wr-tips summary::before { content: "💡 "; }
  .ns-wr-tips summary::marker { display: none; }
  .ns-wr-tips-body {
    margin-top: 8px; padding: 12px 16px;
    background: var(--bg-alt); border-radius: 8px; border: 1px solid var(--border);
    display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
    text-align: left;
  }
  .ns-wr-tips-body strong { display: block; margin-bottom: 4px; color: var(--text); font-size: 12px; text-align: left; }
  .ns-wr-tips-body ul { margin: 0; padding-left: 16px; }
  .ns-wr-tips-body li { margin-bottom: 3px; line-height: 1.5; font-size: 12px; text-align: left; }
  .ns-wr-tips-body b { color: var(--text); }
  .ns-wr-subtitle { font-size: 13px; }
  .ns-wr-subtitle a { color: var(--accent); text-decoration: none; }
  .ns-wr-subtitle a:hover { text-decoration: underline; }
  .ns-wr-footer {
    padding: 12px 16px; font-size: 12px; color: var(--text-secondary);
    text-align: center; border-top: 1px solid var(--border);
  }
  .ns-wr-footer a { color: var(--accent); text-decoration: none; }
  .ns-wr-footer a:hover { text-decoration: underline; }
  @media (max-width: 768px) {
    .ns-wr-tips-body { grid-template-columns: 1fr; }
  }
  .ns-wr-layout-badge {
    font-size: 11px; font-weight: 700; padding: 2px 8px;
    border-radius: 4px; background: var(--bg-alt); color: var(--text-secondary);
  }
  .ns-wr-class-badge {
    font-size: 11px; font-weight: 700; padding: 2px 8px;
    border-radius: 4px;
    background: rgba(0,0,0,0.05);
    background: color-mix(in srgb, var(--ns-color, var(--accent)) 12%, transparent);
    color: var(--ns-color, var(--accent));
  }
  .ns-wr-empty { text-align: center; padding: 40px 24px; color: var(--text-secondary); font-size: 13px; }
  .ns-rec-source {
    font-size: 11px; padding: 2px 6px; background: var(--bg-alt);
    border-radius: 4px; color: var(--text-secondary); white-space: nowrap;
  }

  /* ===== Nordschleife Footer ===== */
  .ns-footer {
    text-align: center; font-size: 13px; color: var(--text-secondary);
    margin-top: 32px; padding-top: 16px;
    border-top: 1px dashed var(--border);
    line-height: 1.8;
  }

  /* ===== Footer ===== */
  .footer {
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 48px;
    padding: 20px 0 8px;
    border-top: 1px solid var(--border);
  }
  .footer a { color: var(--accent); text-decoration: none; }

  @keyframes tabFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
  }

  @media (max-width: 1024px) {
    .schedule-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
    .tm-container { padding: 20px 16px; }
  }
  @media (max-width: 768px) {
    .site-header h1 { font-size: 19px; }
    .game-nav { padding: 0 16px 10px; }
    .game-btn { padding: 6px 20px; font-size: 13px; }
    .tab-btn { padding: 10px 14px; font-size: 13px; }
    .content-wrapper { padding: 22px 16px; }
    .stat-card .stat-value { font-size: 26px; }
    .race-card-track { font-size: 17px; }
    .schedule-grid { grid-template-columns: 1fr; }
    .tm-race-card { padding: 18px; }
    .tm-matrix thead th { padding: 6px 4px; max-width: 100px; min-width: 60px; }
    .tm-matrix td { padding: 3px 4px; }
  }
  @media (max-width: 640px) {
    .site-shell { position: relative; box-shadow: none; }
    .site-header { padding: 18px 16px 14px; }
    .site-header h1 { font-size: 17px; }
    .site-header .subtitle { font-size: 12px; line-height: 1.5; }
    .game-nav { padding: 0 12px 8px; }
    .game-btn { padding: 5px 16px; font-size: 12px; letter-spacing: 0.5px; }
    .game-nav-inner { padding: 2px; }
    .game-group > .tab-nav { display: none; }
    .tab-nav { padding: 0 12px; }
    .tab-btn { font-size: 12px; padding: 9px 10px; gap: 4px; }
    .tab-btn .tab-icon { font-size: 14px; }
    .content-wrapper { padding: 20px 14px; }
    .stats-bar { gap: 8px; }
    .stat-card { padding: 14px 12px; border-radius: 12px; }
    .stat-card .stat-value { font-size: 24px; }
    .race-card-body { flex-direction: column; align-items: stretch; padding: 16px 18px; gap: 14px; }
    .race-card-track { font-size: 17px; }
    .btn-view { width: 100%; justify-content: center; padding: 12px 20px; }
    .schedule-grid { grid-template-columns: 1fr; }
    .matching-features { flex-direction: column; align-items: center; }
    .matching-feature { width: 100%; max-width: 260px; }
    .report-toolbar { align-items: stretch; flex-direction: column; padding: 12px; }
    .report-result-count { padding-left: 2px; }
    .site-header .subtitle { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
    .pk-auth-modal { padding: 24px 20px; border-radius: 14px; }
    .pk-auth-modal h3 { font-size: 18px; }
    .pk-auth-modal input[type="email"],
    .pk-auth-modal input[type="text"],
    .pk-auth-modal input[type="password"] { font-size: 16px; padding: 12px 14px; margin-bottom: 12px; }
    .pk-user-widget { gap: 6px; }
    .pk-user-btn { padding: 5px 10px; font-size: 12px; }
    .pk-user-avatar { width: 24px; height: 24px; font-size: 11px; }
    .back-to-top { bottom: 80px; right: 16px; width: 40px; height: 40px; font-size: 18px; }
    .date-picker-popup { min-width: 0; width: calc(100vw - 32px); max-width: 300px; }
    .ns-classes { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; justify-content: flex-start; padding-bottom: 8px; gap: 10px; }
    .ns-classes::-webkit-scrollbar { display: none; }
    .ns-class-card { width: 120px; min-width: 120px; padding: 16px 14px 14px; }
    .ns-class-abbr { font-size: 20px; }
    .ns-class-name { font-size: 11px; }
    .ns-wr-filters { padding: 10px 12px; }
    .ns-wr-filter-group { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; gap: 4px; padding-bottom: 2px; }
    .ns-wr-filter-group::-webkit-scrollbar { display: none; }
    .ns-wr-pill { padding: 4px 10px; font-size: 11px; white-space: nowrap; flex-shrink: 0; }
    .ns-wr-filter-label { flex-shrink: 0; }
  }

  /* ===== Auth (from pk_client.js) ===== */
  .pk-auth-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6);
    z-index: 9999; align-items: center; justify-content: center;
  }
  .pk-auth-overlay.active { display: flex; }
  .pk-auth-modal {
    background: #1a1a2e; border-radius: 16px; padding: 32px 28px;
    width: 380px; max-width: 90vw; color: #e2e8f0;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5); position: relative;
  }
  .pk-auth-modal h3 { margin: 0 0 6px; font-size: 20px; color: #fff; }
  .pk-auth-modal .pk-subtitle { font-size: 13px; color: #94a3b8; margin-bottom: 20px; }
  .pk-auth-modal .pk-close {
    position: absolute; top: 14px; right: 18px; background: none; border: none;
    color: #64748b; font-size: 22px; cursor: pointer;
  }
  .pk-auth-modal .pk-close:hover { color: #e2e8f0; }
  .pk-auth-modal label { display: block; font-size: 12px; color: #94a3b8; margin-bottom: 4px; font-weight: 600; }
  .pk-auth-modal input[type="email"],
  .pk-auth-modal input[type="text"],
  .pk-auth-modal input[type="password"] {
    width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid #334155;
    background: #0f172a; color: #e2e8f0; font-size: 14px; margin-bottom: 14px;
    outline: none; box-sizing: border-box;
  }
  .pk-auth-modal input:focus { border-color: #e8510a; }
  .pk-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 20px; border-radius: 10px; border: none; font-size: 14px;
    font-weight: 700; cursor: pointer; transition: all 0.2s;
  }
  .pk-btn-primary { background: #e8510a; color: #fff; width: 100%; }
  .pk-btn-primary:hover { background: #bf3a00; }
  .pk-btn-ghost {
    background: transparent; color: #94a3b8; font-size: 12px; padding: 6px 0;
    text-decoration: underline; cursor: pointer;
  }
  .pk-btn-ghost:hover { color: #e2e8f0; }
  .pk-auth-error { color: #ef4444; font-size: 12px; margin-bottom: 12px; display: none; }
  .pk-auth-success { color: #10b981; font-size: 12px; margin-bottom: 12px; display: none; }
  .pk-auth-links { text-align: center; margin-top: 12px; font-size: 13px; color: #64748b; }
  .pk-auth-links a { color: #e8510a; cursor: pointer; text-decoration: none; font-weight: 600; }
  .pk-auth-links a:hover { text-decoration: underline; }
  .pk-user-widget { display: flex; align-items: center; gap: 8px; }
  .pk-user-btn {
    background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15);
    color: #cbd5e1; padding: 6px 14px; border-radius: 8px; font-size: 13px;
    font-weight: 600; cursor: pointer; transition: all 0.2s; font-family: inherit;
  }
  .pk-user-btn:hover { background: rgba(255,255,255,0.14); color: #fff; }
  .pk-user-avatar {
    width: 28px; height: 28px; border-radius: 50%; background: #e8510a;
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
  }
  .pk-user-menu {
    position: absolute; top: 100%; right: 0; margin-top: 6px;
    background: #1a1a2e; border-radius: 10px; border: 1px solid #334155;
    box-shadow: 0 8px 30px rgba(0,0,0,0.4); min-width: 140px; display: none;
    z-index: 100; overflow: hidden;
  }
  .pk-user-menu.active { display: block; }
  .pk-user-menu-item {
    display: block; width: 100%; padding: 9px 16px; background: none; border: none;
    color: #cbd5e1; font-size: 13px; cursor: pointer; text-align: left; font-family: inherit;
  }
  .pk-user-menu-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
  .pk-loading { text-align: center; color: #64748b; font-size: 13px; padding: 16px; }

  /* ===== Team Matching (from team_matching.js) ===== */
  .tm-container { padding: 24px 28px; max-width: 960px; margin: 0 auto; }
  .tm-header { margin-bottom: 24px; }
  .tm-header h2 { font-size: 22px; font-weight: 800; color: var(--text); margin-bottom: 6px; }
  .tm-header p { font-size: 14px; color: var(--text-secondary); }
  .tm-race-card {
    background: var(--card-bg); border: 1px solid var(--border);
    border-radius: 14px; padding: 24px; margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04); transition: box-shadow 0.2s;
  }
  .tm-race-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
  .tm-race-card-header { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
  .tm-race-name { font-size: 18px; font-weight: 700; color: var(--text); }
  .tm-race-meta { font-size: 13px; color: var(--text-secondary); line-height: 1.8; }
  .tm-race-meta span { margin-right: 16px; white-space: nowrap; }
  .tm-race-classes { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
  .tm-class-tag {
    display: inline-block; padding: 3px 10px; border-radius: 6px;
    font-size: 11px; font-weight: 700;
    background: rgba(232,81,10,0.1); color: var(--accent); border: 1px solid rgba(232,81,10,0.25);
  }
  .tm-race-status {
    display: inline-block; padding: 3px 10px; border-radius: 6px;
    font-size: 11px; font-weight: 700;
  }
  .tm-status-open { background: rgba(16,185,129,0.1); color: #10b981; border: 1px solid rgba(16,185,129,0.25); }
  .tm-status-closed { background: rgba(239,68,68,0.1); color: #ef4444; border: 1px solid rgba(239,68,68,0.25); }
  .tm-reg-section { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
  .tm-reg-count { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 10px; }
  .tm-reg-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 14px;
    border-radius: 10px; background: rgba(0,0,0,0.02); margin-bottom: 6px; flex-wrap: wrap;
  }
  .tm-reg-user { font-size: 14px; font-weight: 600; color: var(--text); min-width: 100px; }
  .tm-license-badge {
    display: inline-block; padding: 2px 8px; border-radius: 4px;
    font-size: 11px; font-weight: 700; color: #fff; min-width: 28px; text-align: center;
  }
  .tm-reg-class { font-size: 12px; color: var(--accent); font-weight: 600; }
  .tm-reg-cars { font-size: 12px; color: var(--text-secondary); }
  .tm-reg-slots-bar {
    flex: 1; min-width: 120px; height: 8px; border-radius: 4px;
    background: #e5e7eb; overflow: hidden; display: flex;
  }
  .tm-reg-slots-fill { height: 100%; background: var(--accent); border-radius: 4px; }
  .tm-matrix-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 8px 0; }
  .tm-mobile-reg-list { display: none; }
  .tm-mobile-reg-card {
    padding: 12px; border: 1px solid var(--border); border-radius: 10px;
    background: var(--card-bg); color: var(--text-secondary); font-size: 12px;
  }
  .tm-mobile-reg-head { display: flex; justify-content: space-between; margin-bottom: 6px; color: var(--text); }
  .tm-mobile-reg-slots { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
  .tm-mobile-reg-slots span { padding: 3px 6px; border-radius: 5px; background: var(--accent-light); color: var(--accent-dark); font-size: 10px; font-weight: 700; }
  .tm-matrix { border-collapse: collapse; font-size: 12px; min-width: 100%; }
  .tm-matrix thead th {
    position: sticky; top: 0; z-index: 2;
    background: #1a1a2e; color: #e2e8f0; padding: 8px 6px;
    border-bottom: 2px solid #334155; white-space: normal; text-align: center;
    max-width: 130px; min-width: 80px;
  }
  .tm-matrix th.tm-mx-time {
    position: sticky; left: 0; z-index: 3;
    background: #1a1a2e; min-width: 100px; text-align: left;
  }
  .tm-matrix td {
    padding: 4px 6px; text-align: center; border-bottom: 1px solid #1e293b;
    white-space: nowrap; color: #64748b;
  }
  .tm-matrix td.tm-mx-time {
    position: sticky; left: 0; background: #1a1a2e;
    color: #94a3b8; font-size: 11px; text-align: left; font-weight: 600;
  }
  .tm-matrix td.tm-mx-avail { background: linear-gradient(135deg, rgba(232,81,10,0.2), rgba(232,81,10,0.12)); color: var(--accent); font-weight: 700; font-size: 14px; }
  .tm-matrix td { transition: background 0.15s; }
  .tm-matrix tbody tr:hover td { background: rgba(255,255,255,0.04); }
  .tm-matrix tbody tr:hover td.tm-mx-avail { background: rgba(232,81,10,0.28); }
  .tm-matrix .tm-mx-player-name { font-weight: 600; color: #e2e8f0; font-size: 13px; }
  .tm-matrix .tm-mx-player-info { font-size: 10px; color: #94a3b8; }
  .tm-matrix .tm-mx-player-cars { font-size: 9px; color: var(--accent); white-space: normal; overflow-wrap: break-word; word-break: normal; line-height: 1.3; }
  .tm-matrix .tm-mx-player-cars-label { font-size: 9px; color: #64748b; }

  /* Info rows (license, class, owned/preferred cars) */
  .tm-info-row td { font-size: 12px; padding: 6px 8px; border-bottom: 1px solid #1e293b; color: #e2e8f0; text-align: center; white-space: normal; word-break: break-word; }
  .tm-info-row .tm-mx-time { font-weight: 700; color: #94a3b8; text-align: left; white-space: nowrap; }
  .tm-info-cell { min-width: 80px; }
  .tm-info-cell.tm-rt-class { color: var(--accent); font-weight: 600; }

  /* Separator between info rows and time slots */
  .tm-sep-row td { padding: 0; height: 3px; background: #334155; border: none; }
  .tm-sep-row .tm-mx-time { background: #1a1a2e; }

  .tm-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
  .tm-btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 8px 18px; border-radius: 8px; border: none;
    font-size: 13px; font-weight: 700; cursor: pointer; transition: all 0.2s;
    font-family: inherit;
  }
  .tm-btn-primary { background: var(--accent); color: #fff; }
  .tm-btn-primary:hover { background: var(--accent-dark); }
  .tm-btn-outline {
    background: transparent; color: var(--accent);
    border: 1.5px solid var(--accent);
  }
  .tm-btn-outline:hover { background: rgba(232,81,10,0.06); }
  .tm-btn-ghost {
    background: transparent; color: var(--text-secondary);
    border: 1px solid var(--border);
  }
  .tm-btn-ghost:hover { color: #ef4444; border-color: #ef4444; }
  .tm-empty { text-align: center; padding: 40px 20px; color: var(--text-secondary); }
  .tm-empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
  .tm-empty p { font-size: 14px; }
  .tm-form { max-height: 70vh; overflow-y: auto; padding-right: 4px; }
  .tm-form-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-bottom: 18px; }
  .tm-form-steps span { padding: 7px 5px; border-radius: 8px; background: rgba(255,255,255,.05); color: #94a3b8; text-align: center; font-size: 11px; font-weight: 700; }
  .tm-form-steps b { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; margin-right: 3px; border-radius: 50%; background: var(--accent); color: #fff; }
  .tm-form-section { margin-bottom: 18px; }
  .tm-form-section label {
    display: block; font-size: 12px; font-weight: 700; color: #94a3b8;
    margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px;
  }
  .tm-form-section select {
    width: 100%; padding: 9px 12px; border-radius: 8px;
    border: 1px solid #334155; background: #0f172a; color: #e2e8f0;
    font-size: 14px; outline: none; font-family: inherit;
  }
  .tm-form-section select:focus { border-color: #e8510a; }
  .tm-car-group { margin-bottom: 12px; }
  .tm-car-group-title { font-size: 12px; font-weight: 700; color: #64748b; margin-bottom: 5px; }
  .tm-car-checks { display: flex; flex-wrap: wrap; gap: 6px; }
  .tm-car-check {
    display: flex; align-items: center; gap: 5px;
    padding: 5px 10px; border-radius: 6px; border: 1px solid #334155;
    font-size: 12px; color: #cbd5e1; cursor: pointer; transition: all 0.15s; user-select: none;
  }
  .tm-car-check:hover { border-color: #e8510a; }
  .tm-car-check.checked { background: rgba(232,81,10,0.15); border-color: #e8510a; color: #e8510a; }
  .tm-car-check input { display: none; }
  .tm-slot-date-label { font-size: 12px; font-weight: 700; color: #94a3b8; margin: 8px 0 4px; }
  .tm-slot-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
  .tm-slot {
    padding: 6px 4px; text-align: center; border-radius: 5px;
    border: 1px solid #334155; font-size: 11px; color: #94a3b8;
    cursor: pointer; transition: all 0.12s; user-select: none;
  }
  .tm-slot:hover { border-color: #e8510a; color: #e2e8f0; }
  .tm-slot.selected { background: rgba(232,81,10,0.2); border-color: #e8510a; color: #e8510a; font-weight: 700; }
  .tm-slot.out-of-range { opacity: 0.3; pointer-events: none; }
  .tm-warn-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6);
    z-index: 10001; align-items: center; justify-content: center;
  }
  .tm-warn-overlay.active { display: flex; }
  .tm-warn-box {
    background: #1a1a2e; border-radius: 14px; padding: 28px 24px;
    width: 360px; max-width: 90vw; color: #e2e8f0;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5); text-align: center;
  }
  .tm-warn-box h4 { font-size: 16px; margin-bottom: 10px; color: #f59e0b; }
  .tm-warn-box p { font-size: 13px; color: #94a3b8; margin-bottom: 20px; line-height: 1.6; }
  .tm-warn-actions { display: flex; gap: 10px; justify-content: center; }
  @media (max-width: 520px) {
    .tm-container { padding: 16px 12px; }
    .tm-race-card { padding: 16px; }
    .tm-slot-grid { grid-template-columns: repeat(2, 1fr); }
    .tm-reg-item { flex-direction: column; align-items: flex-start; gap: 6px; }
    .tm-matrix-wrap { display: none; }
    .tm-mobile-reg-list { display: grid; gap: 8px; }
    .tm-btn { min-height: 44px; }
    .tm-warn-overlay { align-items: flex-end; }
    .tm-warn-box {
      width: 100%; max-width: none; max-height: calc(100dvh - env(safe-area-inset-top));
      overflow-y: auto; border-radius: 16px 16px 0 0;
      padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }
    .tm-warn-actions { flex-direction: column-reverse; }
    .tm-warn-actions .tm-btn { width: 100%; }
  }

  /* ===== Skeleton Loading ===== */
  .skeleton {
    background: linear-gradient(90deg, #f0f0f5 25%, #e5e7eb 50%, #f0f0f5 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 10px;
  }
  @keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
  }

  /* ===== Back to Top ===== */
  .back-to-top {
    position: fixed; bottom: 28px; right: 28px; z-index: 99;
    width: 44px; height: 44px; border-radius: 12px;
    background: var(--accent); color: #fff;
    border: none; cursor: pointer; font-size: 20px;
    box-shadow: 0 4px 14px rgba(232,81,10,0.3);
    opacity: 0; transform: translateY(10px); pointer-events: none;
    transition: opacity 0.3s, transform 0.3s, background 0.2s;
    display: flex; align-items: center; justify-content: center;
  }
  .back-to-top.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
  .back-to-top:hover { background: var(--accent-dark); transform: translateY(-2px); }

