/* ═══════════════════════════════════════════════════════════════════════════
   shared_style_airbnb.css — PokemonKali iRacing 群赛站点 · Airbnb-style 主题

   Racing Red 版本。与旧 shared_style.css 双轨共存。
   结构：
     [A] 原版 :root + 基础规则 + 组件 + 媒体查询（保留 .ui-* 类语义与响应式）
     [B] Airbnb-style 覆盖段（token / header / 主色 / 圆角阶梯 / 阴影 / 排印）
     [C] Light & Dark Appearance 种子 token（Nudge 驱动）

   ⚠️ 修改此文件后需：
     1. 推送 GitHub (iracing-website-dev 自动完成)
     2. 部署到 hkserver (deploy_site.sh 自动同步)
   ═══════════════════════════════════════════════════════════════════════════ */


/* ╔═══════════════════════════════════════════════════════════════════════════╗
   ║ [A] 原版基础 — 保留所有 .ui-* / .mobile-* / .report-overview 语义        ║
   ╚═══════════════════════════════════════════════════════════════════════════╝ */

: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); }

.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);
}

.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;
}

/* 原版 Header 装饰：gradient + 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;
  }
}


/* ╔═══════════════════════════════════════════════════════════════════════════╗
   ║ [B] Airbnb-style Racing Red 覆盖段                                        ║
   ║     - 种子 token (--seed-*) + 派生 token 覆盖                            ║
   ║     - 白底 Header 重写（移除 gradient/checkerboard/rainbow）              ║
   ║     - Racing Red (#d70a1c) 替换原 #e8510a                                ║
   ║     - Airbnb 圆角阶梯 4/8/14/20/32 + 50%                                 ║
   ║     - 三层叠加阴影 (booking-panel 风格)                                  ║
   ╚═══════════════════════════════════════════════════════════════════════════╝ */

:root,
[data-appearance="light"] {
  /* Seed tokens (Light) */
  --seed-bg:      #ffffff;
  --seed-surface: #f7f7f7;
  --seed-fg:      #222222;
  --seed-muted:   #6a6a6a;
  --seed-border:  #dddddd;
  --seed-accent:  #d70a1c;   /* Racing Red */
  --seed-radius:  8px;

  /* 派生 token (覆盖 [A] 段同名) */
  --accent:        var(--seed-accent);
  --accent-hover:  color-mix(in srgb, var(--seed-accent) 88%, black);
  --accent-light:  color-mix(in srgb, var(--seed-accent) 10%, var(--seed-bg));
  --accent-dark:   color-mix(in srgb, var(--seed-accent) 78%, black);
  --accent-rgb:    215, 10, 28;

  --text:           var(--seed-fg);
  --text-secondary: var(--seed-muted);
  --text-muted:     color-mix(in srgb, var(--seed-fg) 42%, var(--seed-bg));
  --border:         var(--seed-border);
  --border-strong:  color-mix(in srgb, var(--seed-border) 60%, var(--seed-fg));
  --bg:             var(--seed-bg);
  --bg-alt:         var(--seed-surface);
  --card-bg:        var(--seed-bg);

  --header-bg:    var(--seed-bg);
  --header-text:  var(--seed-fg);

  --focus-ring: 0 0 0 2px var(--seed-fg);

  /* Airbnb 圆角阶梯 */
  --radius-1: 4px;
  --radius-2: var(--seed-radius);        /* 8px (默认) */
  --radius-3: 14px;
  --radius-4: 20px;
  --radius-5: 32px;
  --radius-sm: var(--radius-2);          /* 兼容旧类名 */
  --radius-md: var(--radius-2);
  --radius-lg: var(--radius-3);
  --radius-xl: var(--radius-4);

  /* Airbnb 三层叠加阴影 */
  --shadow-sm:
    rgba(0, 0, 0, 0.02) 0 0 0 1px,
    rgba(0, 0, 0, 0.04) 0 2px 6px 0,
    rgba(0, 0, 0, 0.10) 0 4px 8px 0;
  --shadow-md:
    rgba(0, 0, 0, 0.04) 0 0 0 1px,
    rgba(0, 0, 0, 0.08) 0 6px 20px 0;
  --shadow-lg:
    rgba(0, 0, 0, 0.08) 0 0 0 1px,
    rgba(0, 0, 0, 0.12) 0 12px 32px 0;

  --on-accent:  #ffffff;
}

/* Dark Appearance */
[data-appearance="dark"] {
  --seed-bg:      #1a1a1a;
  --seed-surface: #2b2b2b;
  --seed-fg:      #ededed;
  --seed-muted:   #a3a3a3;
  --seed-border:  #2f2f2f;
  --seed-accent:  #ef2d3e;   /* Racing Red 暗底亮一档 */
  --seed-radius:  8px;
}

/* 字体：Airbnb Cereal 体感替代品，500/600/700 三档 */
body {
  font-family: 'Inter', 'Söhne', -apple-system, BlinkMacSystemFont, 'Segoe UI',
               Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-weight: 500;
  background: var(--seed-bg);
  color: var(--seed-fg);
  letter-spacing: -0.01em;
  accent-color: var(--seed-accent);
}

::selection { color: var(--on-accent); background: var(--seed-accent); }

/* ── Header 白底重写 ───────────────────────────────────────────────────── */
.header-base,
.site-header.header-base {
  background: var(--seed-bg);
  color: var(--seed-fg);
  border-bottom: 1px solid var(--seed-border);
  position: relative;
  box-shadow: none;
}
.header-base::before,
.site-header.header-base::before {
  display: none;   /* 移除棋盘格 */
}
.header-base::after,
.site-header.header-base::after {
  content: "";
  position: absolute;
  bottom: -1px; left: 0; right: 0;
  height: 1px;
  background: var(--seed-border);   /* 覆盖 3px 彩虹为 1px 底分割 */
}

/* Header 内文字/链接/按钮全部切到近黑色 */
.site-header,
.site-header a,
.site-header button,
.site-header .site-header-row,
.site-header .site-logo,
.site-header .site-nav a {
  color: var(--seed-fg);
}
.site-header a:hover,
.site-header .site-nav a:hover {
  color: var(--seed-accent);
}
.site-header .site-nav a.active,
.site-header .site-nav a[aria-current="page"] {
  color: var(--seed-accent);
  border-bottom: 2px solid var(--seed-accent);
}

/* ── 按钮 / 输入 / 徽章 ───────────────────────────────────────────────── */
.ui-btn-primary {
  background: var(--seed-accent);
  border-color: var(--seed-accent);
  color: var(--on-accent);
  border-radius: var(--radius-2);
  transition: transform .18s var(--ease-out), background .18s;
}
.ui-btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--on-accent);
}
.ui-btn-primary:active { transform: scale(0.96); }

.ui-btn {
  border-radius: var(--radius-2);
  font-weight: 500;
}

.ui-field {
  border-radius: var(--radius-2);
  border-color: var(--seed-border);
}
.ui-field:focus {
  border-color: var(--seed-fg);
  box-shadow: 0 0 0 2px var(--seed-fg);
}

.ui-card {
  border-radius: var(--radius-3);
  box-shadow: var(--shadow-sm);
}

.ui-badge {
  background: color-mix(in srgb, var(--seed-accent) 8%, var(--seed-bg));
  color: color-mix(in srgb, var(--seed-accent) 78%, black);
  border-radius: 999px;
  font-weight: 600;
}

.report-overview a {
  background: color-mix(in srgb, var(--seed-accent) 8%, var(--seed-bg));
  color: color-mix(in srgb, var(--seed-accent) 78%, black);
  border-color: color-mix(in srgb, var(--seed-accent) 20%, var(--seed-border));
  border-radius: var(--radius-2);
}

/* Toast / Dialog 也跟着切到白底 */
.ui-toast {
  background: var(--seed-fg);
  color: var(--seed-bg);
  border-radius: var(--radius-2);
  border-left-color: var(--seed-accent);
}
.ui-dialog {
  background: var(--seed-surface);
  color: var(--seed-fg);
  border: 1px solid var(--seed-border);
  border-radius: var(--radius-4);
}
.ui-dialog h2 { color: var(--seed-fg); }
.ui-dialog p { color: var(--seed-muted); }

/* 移动端底部导航切到白底 */
@media (max-width: 640px) {
  .mobile-bottom-nav {
    background: var(--seed-bg);
    border-top: 1px solid var(--seed-border);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.06);
    backdrop-filter: none;
  }
  .mobile-bottom-nav button {
    color: var(--seed-muted);
  }
  .mobile-bottom-nav button.active {
    color: var(--seed-accent);
    background: color-mix(in srgb, var(--seed-accent) 8%, var(--seed-bg));
  }
}


/* ╔═══════════════════════════════════════════════════════════════════════════╗
   ║ [C] 额外语义（如有需要再页面模板使用）                                   ║
   ╚═══════════════════════════════════════════════════════════════════════════╝ */

/* 赛车风 Rausch 强调徽章：最快圈 / 心形 / #1 角标 */
.highlight-fastest-lap,
.fastest-lap,
.row-leader td:first-child {
  color: var(--seed-accent);
}
.row-leader td:first-child {
  box-shadow: inset 3px 0 0 var(--seed-accent);
}

/* Booking-panel 风格卡（sticky 报名面板） */
.booking-panel,
.sticky-panel {
  border-radius: var(--radius-3);
  box-shadow: var(--shadow-sm);
  border: 0;
}
