/* V2.0 visual system: spectator pages stay expressive, admin surfaces stay calm. */
:root {
  --bg: #080f18;
  --bg-deep: #050a11;
  --panel: #111c29;
  --panel-2: #172433;
  --panel-soft: rgba(20, 33, 47, .88);
  --line: rgba(185, 204, 223, .15);
  --line-strong: rgba(74, 211, 238, .38);
  --text: #f5f7fa;
  --muted: #b1bfce;
  --muted-2: #91a5b9;
  --cyan: #49d5ef;
  --orange: #ff742e;
  --orange-2: #ff9955;
  --green: #69dda4;
  --red: #fb777c;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 18px 42px rgba(0, 0, 0, .18);
}

html { scroll-behavior: smooth; }
body {
  background: radial-gradient(circle at 78% 2%, rgba(49, 89, 121, .13), transparent 34%),
    linear-gradient(180deg, #0a121d, #080f18 48%, #080f18);
  font-size: 14px;
}
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.app-shell { --sidebar-width: 244px; }
.sidebar { background: linear-gradient(180deg, #080e17, #0b1420); border-right-color: var(--line); }
.nav-label { color: #9aafc2; font-size: 11px; }
.nav-link { min-height: 46px; color: #b2c2d1; font-size: 13px; }
.nav-link.active { background: rgba(73, 213, 239, .1); border-color: rgba(73, 213, 239, .2); }
.topbar, .mobile-brand { background: rgba(8, 15, 24, .94); border-bottom-color: var(--line); }
.topbar-context strong { font-size: 13px; }
.topbar-context span { color: var(--muted-2); font-size: 11px; }
.page-container { padding-top: clamp(26px, 3vw, 42px); }
.kicker { color: var(--cyan); font-size: 11px; letter-spacing: 1.8px; }
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: clamp(28px, 2.7vw, 40px); letter-spacing: -.03em; }
.page-subtitle { color: var(--muted); font-size: 14px; }
.card, .soft-card {
  border-color: var(--line);
  background: linear-gradient(155deg, rgba(21, 34, 49, .96), rgba(14, 25, 37, .98));
  box-shadow: var(--shadow);
}
.card-header h2, .section-title { font-size: 19px; }
.card-header p, .section-note { color: var(--muted-2); font-size: 12px; }
.btn { min-height: 44px; border-radius: 10px; font-size: 13px; }
.btn-small { min-height: 36px; font-size: 12px; }
.btn-primary { color: #14100c; background: var(--orange); box-shadow: 0 10px 28px rgba(255, 116, 46, .17); }
.btn-secondary { color: #e4f7fb; background: #173043; border-color: rgba(73, 213, 239, .24); }
.btn-ghost { color: #d1dce8; background: rgba(12, 23, 35, .6); border-color: rgba(185, 204, 223, .23); }
.status-chip { min-height: 28px; font-size: 11px; }
.field-label { font-size: 13px; }
.field small, .switch-row small { color: var(--muted-2); font-size: 11px; }
.input, .select { min-height: 46px; }
.input, .select, .textarea { background: #0c1825; color: var(--text); }
.input::placeholder, .textarea::placeholder { color: #8297ab; }
.data-table th { color: #b4c3d2; font-size: 11px; }
.data-table td { font-size: 13px; }
.modal-section-title { font-size: 13px; }
.security-note, .admin-tip { color: #c5d0dc; font-size: 12px; }

/* The current issue is the first thing a player sees. */
.race-home .page-header { align-items: center; margin-bottom: 16px; }
.race-home .page-header h1 { margin-top: 4px; font-size: clamp(20px, 2vw, 26px); }
.race-home .page-subtitle { margin-top: 5px; font-size: 12px; }
.race-home .hero {
  min-height: 390px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  padding: clamp(28px, 4.5vw, 56px);
  border-color: rgba(255, 153, 85, .24);
  border-radius: 20px;
  background: linear-gradient(90deg, rgba(5, 11, 19, .97) 0%, rgba(5, 11, 19, .78) 43%, rgba(5, 11, 19, .13) 100%),
    url('/assets/racing-hero.png') center / cover no-repeat;
}
.race-home .hero::before { inset: auto 0 0; height: 4px; opacity: 1; background: linear-gradient(90deg, var(--orange), rgba(255, 116, 46, 0)); mask-image: none; }
.race-home .hero::after { display: none; }
.race-home .hero-content { max-width: min(630px, 70%); }
.race-home .hero-status { gap: 10px; color: #f4f7fa; font-size: 13px; }
.race-home .hero-status .live-dot { background: var(--cyan); box-shadow: 0 0 14px rgba(73, 213, 239, .58); }
.race-home .hero-season { margin-top: 22px; color: #b8cad8; font-size: 14px; }
.race-home .hero h2 { margin-top: 6px; font-size: clamp(40px, 5vw, 72px); line-height: 1.1; letter-spacing: -.04em; }
.race-home .hero-notice { max-width: 560px; color: #d1dbe4; font-size: 14px; line-height: 1.7; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.hero-actions .btn { min-height: 50px; padding-inline: 20px; }
.btn-hero-secondary { color: #f5f7fa; background: rgba(7, 18, 29, .55); border-color: rgba(245, 247, 250, .46); }
.race-home .hero-stats { display: flex; gap: 0; margin-top: 28px; border: 0; border-radius: 0; background: none; backdrop-filter: none; }
.race-home .hero-stat { min-width: 96px; padding: 0 18px; text-align: left; border-right-color: rgba(232, 241, 248, .26); }
.race-home .hero-stat:first-child { padding-left: 0; }
.race-home .hero-stat strong { color: #f8fafc; font-size: 22px; }
.race-home .hero-stat span { color: #b5c4d3; font-size: 11px; }
.race-home .schedule-grid { position: relative; gap: 0; }
.race-home .schedule-item { position: relative; min-height: 112px; padding: 22px 20px 14px; border: 0; border-top: 2px solid rgba(155, 179, 200, .3); border-radius: 0; background: none; }
.race-home .schedule-item::before { content: ''; position: absolute; top: -7px; left: 20px; width: 11px; height: 11px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 0 5px rgba(73, 213, 239, .13); }
.race-home .schedule-item h3 { margin: 8px 0 5px; font-size: 14px; }
.race-home .schedule-item p { color: var(--muted); font-size: 12px; }
.race-home .schedule-index { color: var(--cyan); font-size: 11px; }
.home-section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.home-section-heading h2 { margin: 3px 0 0; font-size: clamp(23px, 2vw, 30px); }
.home-section-heading p { margin: 0 0 2px; color: var(--muted-2); font-size: 12px; }
.race-home .module-grid { gap: 12px; }
.race-home .module-card { min-height: 132px; border-radius: 14px; background: #132132; box-shadow: none; }
.race-home .module-card::after { display: none; }
.race-home .module-card:hover { border-color: rgba(73, 213, 239, .5); box-shadow: 0 12px 28px rgba(0, 0, 0, .18); }
.race-home .module-card h3 { margin-top: 21px; font-size: 18px; }
.race-home .module-card p { color: #aebed0; font-size: 12px; }
.race-home .module-code { font-size: 10px; }
.race-home .quick-links { overflow: hidden; }
.race-home .quick-link { min-height: 86px; }
.race-home .quick-link h3 { font-size: 15px; }
.race-home .quick-link p, .race-home .notice-row p { font-size: 12px; }

/* Race result pages prioritize round, advancement, then scores. */
.race-competition .page-header { padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.race-competition .config-strip { box-shadow: none; background: rgba(20, 33, 47, .58); }
.race-competition .config-strip strong { font-size: 13px; }
.race-competition .config-strip span { font-size: 12px; }
.race-competition .round-tabs { position: sticky; top: 63px; z-index: 9; gap: 0; padding: 10px 0 14px; background: #142130; }
.race-competition .round-flow-connector { width: 28px; }
.race-competition .round-tab { min-width: 152px; min-height: 62px; border-radius: 10px; background: #0e1a28; }
.race-competition .round-tab.active { border-color: var(--cyan); background: #17364a; box-shadow: inset 0 3px 0 var(--orange); }
.race-competition .round-tab strong { font-size: 14px; }
.race-competition .round-tab span { font-size: 11px; }
.race-competition .group-card { border-radius: 13px; background: #0d1927; }
.race-competition .group-head { background: #17283a; }
.race-competition .group-head h3 { font-size: 16px; }
.race-competition .entrant-row { min-height: 64px; font-size: 12px; }
.race-competition .entrant-player strong { font-size: 13px; }
.race-competition .entrant-player span, .race-competition .score-cell label { color: var(--muted-2); font-size: 10px; }
.race-competition .entrant-total, .race-competition .entrant-place { font-size: 14px; }
.race-competition .score-box { font-size: 13px; }
.race-competition .final-rank-row { background: #101d2c; }

/* The admin console is a working surface, not an advertisement. */
.race-admin .page-header { padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.race-admin .card { box-shadow: none; background: #142131; }
.race-admin .card-header { margin-bottom: 18px; }
.race-admin .admin-grid { gap: 10px; }
.race-admin .admin-module { min-height: 114px; border-radius: 11px; background: #0e1b29; }
.race-admin .admin-module h3 { margin-top: 18px; font-size: 15px; }
.race-admin .admin-module p { color: var(--muted-2); font-size: 11px; }
.race-admin .manage-row { min-height: 66px; border-radius: 10px; background: #0e1b29; }
.race-admin .manage-row h4 { font-size: 14px; }
.race-admin .manage-row p { color: var(--muted-2); font-size: 11px; }
.admin-jump { position: sticky; top: 64px; z-index: 12; display: flex; gap: 6px; margin: -8px 0 20px; padding: 8px; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: rgba(11, 21, 32, .96); backdrop-filter: blur(12px); }
.admin-jump button { flex: none; min-height: 36px; padding: 0 14px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: #c5d3df; cursor: pointer; font-size: 12px; }
.admin-jump button:hover, .admin-jump button:focus-visible { color: var(--text); border-color: rgba(73, 213, 239, .3); background: rgba(73, 213, 239, .1); }
[data-admin-section] { scroll-margin-top: 132px; }

@media (max-width: 1180px) {
  .app-shell { --sidebar-width: 222px; }
  .race-home .hero-content { max-width: 75%; }
  .race-home .hero { min-height: 360px; }
}

@media (max-width: 820px) {
  .page-container { padding-top: 22px; }
  .mobile-brand-copy strong { font-size: 13px; }
  .mobile-brand-copy span { font-size: 11px; }
  .mobile-bottom-nav { height: calc(68px + env(safe-area-inset-bottom)); }
  .mobile-nav-link { font-size: 11px; }
  .race-home .hero { min-height: 360px; padding: 30px 26px; background-position: 56% center; }
  .race-home .hero-content { max-width: 72%; }
  .race-home .hero h2 { font-size: clamp(34px, 5vw, 48px); }
  .race-home .schedule-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .race-competition .round-tabs { top: 57px; }
  .race-competition .entrant-row { min-width: 0; display: flex; flex-wrap: wrap; gap: 10px 14px; padding: 12px; }
  .race-competition .entrant-player { flex: 1 0 100%; }
  .race-competition .score-cell { flex: 1 1 70px; text-align: left; }
  .race-competition .entrant-total, .race-competition .entrant-place { flex: 0 0 48px; text-align: left; }
  .race-competition .entrant-total::before { content: '总分'; display: block; color: var(--muted-2); font-size: 10px; font-weight: 500; }
  .race-competition .entrant-place::before { content: '名次'; display: block; color: var(--muted-2); font-size: 10px; font-weight: 500; }
  .race-competition .entrant-actions { align-self: end; margin-left: auto; }
  .race-admin .page-header { flex-wrap: wrap; }
  .admin-jump { top: 58px; }
  [data-admin-section] { scroll-margin-top: 126px; }
}

@media (max-width: 560px) {
  .race-home .page-header { gap: 12px; }
  .race-home .page-header h1 { font-size: 18px; }
  .race-home .page-header-actions .btn { padding-inline: 9px; }
  .race-home .hero { min-height: 450px; padding: 26px 20px; background-position: 61% center; background-image: linear-gradient(90deg, rgba(5, 11, 19, .98), rgba(5, 11, 19, .8) 65%, rgba(5, 11, 19, .38)), url('/assets/racing-hero.png'); }
  .race-home .hero-content { max-width: 100%; }
  .race-home .hero h2 { font-size: clamp(34px, 9vw, 46px); }
  .race-home .hero-notice { font-size: 13px; }
  .race-home .hero-actions { gap: 8px; }
  .race-home .hero-actions .btn { min-height: 46px; padding-inline: 13px; font-size: 12px; }
  .race-home .hero-stats { gap: 0; width: 100%; margin-top: 22px; }
  .race-home .hero-stat { flex: 1; min-width: 0; padding: 0 10px; }
  .race-home .hero-stat strong { font-size: 19px; }
  .race-home .hero-stat span { font-size: 10px; }
  .race-home .schedule-grid { grid-template-columns: 1fr; }
  .race-home .schedule-item { min-height: 0; padding: 14px 12px 18px 30px; border-top: 0; border-left: 2px solid rgba(155, 179, 200, .3); }
  .race-home .schedule-item::before { top: 18px; left: -7px; }
  .race-home .schedule-item h3 { margin-top: 4px; }
  .home-section-heading { align-items: start; flex-direction: column; gap: 3px; }
  .race-home .module-card { min-height: 118px; }
  .race-competition .config-strip { flex-wrap: wrap; }
  .race-competition .page-header, .race-admin .page-header { flex-wrap: wrap; }
  .race-competition .page-header-actions, .race-admin .page-header-actions { width: 100%; max-width: none; justify-content: flex-start; }
  .race-competition .round-flow-connector { width: 18px; }
  .race-competition .round-tab { min-width: 126px; }
  .race-admin .admin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .race-admin .manage-row { grid-template-columns: minmax(0, 1fr) auto; }
  .race-admin .manage-actions { grid-column: 1 / -1; }
}

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