/* ── 커스텀 스크롤바 ────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(168,168,163,0.25);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(168,168,163,0.48); }
* { scrollbar-width: thin; scrollbar-color: rgba(168,168,163,0.25) transparent; }

:root {
  --bg: #0E0E10;
  --panel: #1A1A1D;
  --track: #242427;
  --panel-border: #2E2E33;
  --panel-2: #161618;
  --accent: #FFD400;
  --accent-ink: #2E2800;
  --accent-dim: #C9A800;
  --danger: #FF453A;
  --text-main: #F5F5F4;
  --text-muted: #A8A8A3;
  --text-hint: #6E6E69;
  --rank-1: #FFD400;
  --rank-2: #C9CDD4;
  --rank-3: #D98A4E;

  /* backward-compat aliases */
  --color-goal: #FFD400;
  --color-record: #A8A8A3;
  --color-season: #A8A8A3;
  --color-success: #A8A8A3;
  --color-danger: #FF453A;
  --accent-2: #6E6E69;

  /* legacy aliases */
  --bg-main: #0E0E10;
  --panel-bg: #1A1A1D;
  --panel-border: #2E2E33;
}

html, body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
}

.mono {
  font-family: 'Courier New', monospace;
  font-variant-numeric: tabular-nums;
}

.ui-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--color-goal);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ui-section-title {
  color: var(--text-main);
  font-size: clamp(1.25rem, 2vw, 1.8rem);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.1;
}

.ui-highlight-goal {
  color: var(--color-goal);
  font-weight: 900;
}

.ui-highlight-record {
  color: var(--color-record);
  font-weight: 900;
}

.ui-highlight-season {
  color: var(--color-season);
  font-weight: 900;
}

.ui-highlight-success {
  color: var(--color-success);
  font-weight: 900;
}

.ui-highlight-danger {
  color: var(--color-danger);
  font-weight: 900;
}

.ui-badge-important {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  color: #2E2800;
  background: #FFD400;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.ui-panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.ui-card {
  background: rgba(26,26,29,0.88);
  border: 1px solid rgba(62,62,67,0.72);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.36);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.ui-muted {
  color: var(--text-muted);
  opacity: 0.82;
}

.ui-stat {
  display: grid;
  gap: 4px;
}

.ui-stat-label {
  color: #A8A8A3;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.ui-stat-value {
  color: #F5F5F4;
  font-size: 1.15rem;
  font-weight: 900;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #0E0E10;
  color: #fff;
}

#three-canvas, #hud-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: none;
}
#three-canvas { z-index: 4; }
#hud-canvas   { z-index: 5; pointer-events: none; }

/* ── screens ── */
.screen {
  display: none !important;
  position: fixed; inset: 0;
  z-index: 10;
  background: #0E0E10;
  flex-direction: column;
  align-items: stretch;
}
.screen.active,
.screen.is-active { display: flex !important; overflow-y: auto; }

/* Waves background layering for screens that mount <Waves /> */
#screen-trackselect > .waves,
#screen-lobby > .waves,
#leaderboard-overlay > .waves { z-index: -1; pointer-events: none; }
/* Fixed-viewport waves so scrolling content doesn't push the canvas off-screen */
#screen-trackselect > .waves,
#screen-lobby > .waves { position: fixed !important; inset: 0; }
.modal { display: none !important; }
.modal.is-open { display: flex !important; }
[hidden] { display: none !important; }

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.screen-header { text-align: center; padding: 32px 0 16px; }
.screen-header h1 {
  font-size: 2.4rem; font-weight: 900;
  letter-spacing: 4px;
  color: #F5F5F4;
}
.screen-header .subtitle { color: #A8A8A3; margin-top: 6px; font-size: 1rem; }

.main-menu {
  width: 100%;
  height: 100%;
  overflow: hidden;
  padding: 0;
  flex: 1;
}
.main-hero {
  min-height: 100vh;
  display: block;
  position: relative;
  overflow: hidden;
}
.main-kicker {
  color: #A8A8A3;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.main-hero h1 {
  font-size: clamp(2.5rem, 7vw, 5.6rem);
  line-height: 0.95;
  letter-spacing: 0;
}
.main-copy {
  max-width: 650px;
  color: #A8A8A3;
  font-size: 1.08rem;
  line-height: 1.55;
}
.main-controls,
.main-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.main-controls span {
  border: 1px solid #2E2E33;
  border-radius: 8px;
  background: #1A1A1D;
  color: #A8A8A3;
  padding: 8px 10px;
  font-size: 0.84rem;
  font-weight: 800;
}
.main-play {
  min-width: 180px;
  min-height: 52px;
}

#screen-main {
  background: #0E0E10;
  pointer-events: none;
}
#screen-main button,
#screen-main a,
#screen-main input,
#screen-main select,
#screen-main .lobby-car-card,
#screen-main .main-board-tab {
  pointer-events: auto;
}

.lobby-hub {
  width: 100%;
  max-width: none;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(270px, 340px) 1fr minmax(260px, 340px);
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  padding: 22px;
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 122, 31, 0.04), transparent 30%),
    linear-gradient(90deg, rgba(14, 14, 16, 0.62), rgba(14, 14, 16, 0.05) 42%, rgba(14, 14, 16, 0.7));
}
#screen-main #hero-bg-video,
#screen-main .hero-bg-fallback {
  display: none;
}
#screen-main .hero-overlay {
  background: transparent;
}
/* [3] 헤더: 우측 중복 요소 숨김. 프로필 위젯이 이미 로그인·이름을 제공 */
#lobby-current-car,
#btn-main-login { display: none; }

.lobby-topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  /* padding-right: profile-widget(fixed, ~176px + right:16px) 공간 확보 */
  padding: 10px 210px 10px 20px;
  border: 1px solid rgba(255,212,0,0.15);
  border-radius: 16px;
  background: linear-gradient(90deg, rgba(26,26,29,0.96) 55%, rgba(20,20,22,0.82));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  min-width: 0;
}
.lobby-topbar > div:first-child {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}
/* [4] 타이틀 디자인 */
.main-kicker {
  color: rgba(201,168,0,0.82);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-bottom: 2px;
}
.lobby-topbar h1 {
  font-family: 'Orbitron', 'Chakra Petch', sans-serif;
  font-size: clamp(1.15rem, 2.8vw, 2.2rem);
  font-weight: 900;
  font-style: italic;
  letter-spacing: 0.02em;
  line-height: 1;
  background: linear-gradient(95deg, #FFD400 20%, #FF8C00 80%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}
.lobby-top-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
  font-weight: 800;
  flex-shrink: 0;
  flex-wrap: nowrap;
}
.lobby-car-panel {
  grid-column: 1;
  align-self: start;
  pointer-events: auto;
  /* topbar(~80px) + padding(22*2) + HUD(~90px) + gap(18) ≈ 232px */
  max-height: calc(100vh - 232px);
  display: flex;
  flex-direction: column;
  overflow: hidden; /* 패널 전체는 overflow 없음 */
}
.lobby-mode-panel {
  grid-column: 3;
  align-self: start;
  display: grid;
  gap: 12px;
  pointer-events: auto;
  grid-template-columns: 1fr 1fr;
}
.lobby-mode-panel .ui-kicker,
.lobby-mode-card.primary,
.lobby-mode-card.accent {
  grid-column: 1 / -1;
}
.lobby-mode-card {
  min-height: 74px;
  border: 1px solid #2E2E33;
  border-radius: 12px;
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
  background: #1A1A1D;
  color: var(--text-main);
  padding: 14px;
  text-align: left;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease;
}
.lobby-mode-card b,
.lobby-mode-card span { display: block; }
.lobby-mode-card span {
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 0.86rem;
  line-height: 1.35;
}
.lobby-mode-card.primary {
  background: #FFD400;
  color: #2E2800;
  border-color: #FFD400;
}
.lobby-mode-card.primary span {
  color: #5A4800;
}
.lobby-mode-card.accent {
  border-color: #FF453A;
  background: #1A1A1D;
}
.lobby-mode-card:hover {
  transform: translateY(-2px) scale(1.01);
  border-color: #A8A8A3;
  box-shadow: 0 8px 24px rgba(0,0,0,0.28);
}
.lobby-mode-card:active { transform: scale(0.98); }
.lobby-car-stats {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}
.lobby-stat-row {
  display: grid;
  grid-template-columns: 96px 1fr 42px;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 900;
}
.lobby-stat-row i {
  height: 10px;
  border-radius: 999px;
  background: #141519;
  border: 1px solid #2E2E33;
  overflow: visible;
}
.lobby-stat-row em {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #19f0d6, #2ee6ff 50%, #b14bff);
  box-shadow: 0 0 8px rgba(46,230,255,0.8), 0 0 16px rgba(177,75,255,0.5);
  transition: width 0.28s ease;
}
.lobby-car-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.lobby-car-strip {
  display: grid;
  gap: 8px;
  flex: 1;        /* 남은 패널 공간을 전부 차지 */
  min-height: 0;  /* flex overflow 필수 */
  overflow-y: auto;
  overflow-x: hidden;
}
.lobby-car-card {
  display: grid;
  gap: 3px;
  width: 100%;
  border: 1px solid #2E2E33;
  border-radius: 12px;
  background: rgba(26,26,29,0.72);
  color: var(--text-main);
  padding: 10px;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
}
.lobby-car-card:hover {
  background: rgba(36,36,39,0.9);
  border-color: #6E6E69;
  transform: translateX(2px);
}
.lobby-car-card.selected {
  border-color: #FFD400;
  background: rgba(255,212,0,0.07);
  box-shadow: inset 3px 0 0 #FFD400, 0 0 12px rgba(255,212,0,0.12);
}
.lobby-car-card.locked {
  opacity: 0.42;
  cursor: not-allowed;
}

/* [5] 레어도 색상 */
.lobby-car-card small { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; }
.lobby-car-card small.rarity-common    { color: #A8A8A3; }
.lobby-car-card small.rarity-rare      { color: #4DA6FF; }
.lobby-car-card small.rarity-epic      { color: #B87FFF; }
.lobby-car-card small.rarity-transcend { color: #FFD400; }
.lobby-car-card small.rarity-selected  { color: #FFD400; }
.lobby-car-card small {
  color: var(--text-muted);
  font-weight: 800;
}
/* 중앙 리더보드 패널: 3D 뷰 가리므로 숨김. 전체랭킹 버튼으로 접근 */
.lobby-compact-board {
  display: none !important;
}
.lobby-mini-panel { display: none; }
.lobby-control-hint {
  grid-column: 1 / -1;
  justify-self: center;
  padding: 10px 14px;
  border-radius: 999px;
  background: #1A1A1D;
  color: #A8A8A3;
  font-size: 0.82rem;
  font-weight: 800;
  pointer-events: none;
}
.lobby-car-toast {
  position: fixed;
  left: 50%;
  top: 22%;
  transform: translate(-50%, -10px);
  z-index: 18;
  opacity: 0;
  pointer-events: none;
  padding: 12px 18px;
  border-radius: 999px;
  background: #1A1A1D;
  color: #F5F5F4;
  font-weight: 900;
  letter-spacing: 0.04em;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.lobby-car-toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
.lobby-ad-hidden { display: none !important; }
/* 로비에서 하단 배너 광고 숨김 - ad-lobby-side가 이미 모드 패널에 있음 */
.hero-content.lobby-hub > #ad-main-menu-banner { display: none !important; }
/* 랭킹 버튼 단독 배치 시 full-width */
#btn-main-leaderboard { grid-column: 1 / -1; }
/* compact board 내부 모든 요소 pointer-events 명시 */
.lobby-compact-board,
.lobby-compact-board .main-board-head,
.lobby-compact-board .main-board-tabs,
.lobby-compact-board .main-board-tab,
.lobby-compact-board button {
  pointer-events: auto;
}
.main-board-tab:hover:not(.active) {
  background: rgba(255, 212, 0, 0.12);
  border-color: rgba(255, 212, 0, 0.32);
  color: #F5F5F4;
}
/* 로비 중앙 컬럼 리더보드 - width 재정의 */
.lobby-compact-board.main-leaderboard-preview {
  width: 100%;
  max-width: 100%;
  margin-top: 0;
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.lobby-compact-board > .global-leaderboard-list {
  flex: 1;
  overflow-y: auto;
  max-height: none;
  padding-right: 2px;
}
/* 광고 슬롯 가시성 개선 */
#ad-lobby-side {
  border: 1px solid #2E2E33;
  border-style: solid;
  background: #1A1A1D;
  color: #A8A8A3;
  height: 64px;
  min-height: 64px;
}
#ad-lobby-side span {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: #A8A8A3;
}
#ad-lobby-side small {
  color: #6E6E69;
  font-size: 0.64rem;
}
.lobby-hub.panels-collapsed .lobby-car-panel,
.lobby-hub.panels-collapsed .lobby-mode-panel,
.lobby-hub.panels-collapsed .lobby-compact-board {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

/* Practice lobby must never be covered by the old static hero layer. */
#screen-main.screen.is-active {
  background: transparent !important;
  align-items: stretch;
}
#screen-main.screen.is-active .hero-bg-fallback,
#screen-main.screen.is-active #hero-bg-video {
  display: none !important;
}
#screen-main.screen.is-active .hero-overlay {
  background: transparent !important;
}
.main-info {
  display: none;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 20px;
}
.main-info article {
  border-top: 1px solid #2E2E33;
  padding-top: 14px;
}
.main-info h2 {
  font-size: 0.95rem;
  margin-bottom: 6px;
}
.main-info p {
  color: #A8A8A3;
  font-size: 0.82rem;
  line-height: 1.5;
}
.main-info-link,
.main-footer-links a,
.policy-back {
  color: #A8A8A3;
  font-weight: 800;
  text-decoration: none;
}
.main-info-link:hover,
.main-footer-links a:hover,
.policy-back:hover {
  text-decoration: underline;
}
.main-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  border-top: 1px solid #2E2E33;
  padding: 18px 0 0;
  width: min(1120px, calc(100vw - 32px));
  margin: 8px auto 28px;
  justify-content: center;
}
.help-screen-panel {
  width: min(980px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  margin: auto;
  padding: 24px;
}
.help-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 16px 0 20px;
}
.help-card-grid article,
.result-panel {
  border: 1px solid var(--panel-border);
  background: var(--panel);
  border-radius: 10px;
  padding: 16px;
}
.help-card-grid h2 {
  margin-bottom: 8px;
  color: var(--text-main);
}
.help-card-grid p {
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: 8px;
}
.ad-placeholder {
  width: 100%;
  max-width: 728px;
  height: 90px;
  min-height: 90px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  border: 1px dashed #6E6E69;
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
  color: #A8A8A3;
  margin-top: 8px;
  flex-shrink: 0;
}
.ad-placeholder span {
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.ad-placeholder small {
  color: #6E6E69;
}
#ad-main-menu-banner,
#ad-game-over-banner {
  max-width: 728px;
  height: 90px;
}
#ad-main-menu-banner {
  grid-column: 1 / -1;
  justify-self: center;
  width: 100%;
  max-width: 980px;
  margin-top: 0;
}
.ad-lobby-side {
  grid-column: 1 / -1;
  width: 100%;
  max-width: 100%;
  height: 70px;
  min-height: 70px;
  margin-top: 8px;
  border-radius: 10px;
}
#help-overlay.is-active {
  display: flex !important;
  align-items: center;
  justify-content: center;
}
.profile-widget { position: fixed; top: 16px; right: 16px; z-index: 55; }
.profile-chip {
  min-width: 176px; height: 42px;
  display: grid; grid-template-columns: 14px 1fr auto;
  align-items: center; gap: 9px;
  border: 1px solid #2E2E33;
  border-radius: 999px; background: #1A1A1D;
  color: #fff; padding: 0 14px; cursor: pointer; font-weight: 800;
}
.profile-dot { width: 12px; height: 12px; border-radius: 50%; background: #A8A8A3; }
.profile-chip b { color: #A8A8A3; font-size: 0.8rem; }
.profile-panel {
  position: absolute; top: 50px; right: 0; width: 318px;
  border: 1px solid #2E2E33; border-radius: 12px;
  background: #1A1A1D; padding: 16px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.45);
}
.profile-panel-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.profile-auth-box, .profile-field { display: grid; gap: 7px; margin-bottom: 12px; }
.profile-auth-box input, .profile-field input {
  height: 36px; border-radius: 8px; border: 1px solid #2E2E33;
  background: #0E0E10; color: #fff; padding: 0 11px;
}
.profile-field span, .profile-auth-box span, .profile-note {
  color: #A8A8A3; font-size: 0.76rem;
}
.profile-wallet {
  height: 42px; display: flex; align-items: center; justify-content: space-between;
  border-radius: 8px; background: #0E0E10; padding: 0 12px; margin-bottom: 12px;
}
.profile-wallet b { color: #F5F5F4; }
.profile-note { margin-top: 10px; line-height: 1.4; }

/* ── car select ── */
.category-tabs {
  display: flex; gap: 8px; margin-bottom: 20px;
  flex-wrap: wrap; justify-content: center;
  padding: 0 16px;
}
.cat-tab {
  padding: 8px 22px; border-radius: 20px; border: none; cursor: pointer;
  font-size: 0.85rem; font-weight: 600; transition: all .15s;
  background: #242427; color: #A8A8A3;
}
.cat-tab.active { background: #2E2E33; color: #F5F5F4; }

.home-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 22px;
  width: min(1320px, calc(100vw - 32px));
  min-height: 0;
}
.home-layout.car-select-focused {
  grid-template-columns: minmax(0, 1fr);
  max-width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
}
.home-layout.car-select-focused .home-leaderboard {
  display: none !important;
}
.car-grid {
  display: flex; gap: 20px; flex-wrap: nowrap;
  justify-content: center; padding: 0 4px 8px;
  overflow-x: auto; overflow-y: hidden; max-height: 46vh;
}

.car-card {
  width: 218px; border-radius: 12px; padding: 14px;
  background: #1A1A1D;
  border: 2px solid #2E2E33;
  cursor: pointer; transition: all .18s; text-align: center;
  flex-shrink: 0;
}
.car-card:hover  { border-color: #555; transform: translateY(-3px); }
.car-card.selected { border-color: #FFD400; background: #242427; }

.car-preview {
  width: 100%; height: 118px;
  border-radius: 16px; margin-bottom: 12px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,0.1);
  background: #0E0E10;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06), 0 18px 34px rgba(0,0,0,0.28);
  overflow: hidden;
}
.car-preview canvas { width: 100%; height: 100%; }

.car-cinematic-preview {
  display: grid;
  grid-template-columns: minmax(260px, 1.1fr) minmax(240px, 0.9fr);
  gap: 18px;
  margin: 14px 0 18px;
}

.car-cinematic-preview canvas {
  width: 100%;
  max-height: 240px;
  border-radius: 18px;
  background: #0E0E10;
}

.car-cinematic-info {
  display: grid;
  gap: 10px;
  align-content: center;
}

.car-power {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--color-record);
  font-weight: 900;
}

.car-power b {
  color: var(--color-goal);
  font-size: 1.25rem;
}

.car-stat-list {
  display: grid;
  gap: 8px;
}

.car-stat-row {
  display: grid;
  grid-template-columns: 112px 78px 1fr;
  align-items: center;
  gap: 10px;
  color: var(--text-main);
  font-size: 0.86rem;
  font-weight: 800;
}

.car-stat-row > b {
  color: var(--color-record);
  text-align: right;
}

.car-stat-row > i {
  height: 10px;
  overflow: visible;
  border-radius: 999px;
  background: #141519;
  border: 1px solid #2E2E33;
}

.car-stat-row > i > em {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #19f0d6, #2ee6ff 50%, #b14bff);
  box-shadow: 0 0 8px rgba(46,230,255,0.8), 0 0 16px rgba(177,75,255,0.5);
  transition: width 0.28s ease;
}

.car-stat-row.transcend-stat > b,
.transcend-badge {
  color: var(--color-season);
}

.car-stat-row.transcend-stat > i > em {
  background: linear-gradient(90deg, #ffd400, #ff8a00);
  box-shadow: 0 0 8px rgba(255,212,0,0.85), 0 0 16px rgba(255,138,0,0.5);
}
/* SUPERSONIC DRIFT — title + accent glow */
.lobby-topbar h1 {
  font-family: 'Orbitron', 'Chakra Petch', sans-serif !important;
  text-shadow: 0 0 12px rgba(46,230,255,0.55), 0 0 26px rgba(177,75,255,0.4);
  letter-spacing: 0.04em;
}
.main-kicker { text-shadow: 0 0 10px rgba(46,230,255,0.4); }

.car-name  { font-size: 0.95rem; font-weight: 700; margin-bottom: 4px; }
.car-badge {
  display: inline-block; padding: 2px 10px; border-radius: 10px;
  font-size: 0.72rem; font-weight: 600; color: #0E0E10;
  background: #A8A8A3; margin-bottom: 8px;
}
.car-spec  { font-size: 0.75rem; color: #A8A8A3; line-height: 1.7; text-align: left; }
.car-tags {
  display: flex; justify-content: center; gap: 6px;
  margin: 2px 0 10px;
}
.car-tags span {
  background: #0E0E10;
  border: 1px solid #2E2E33;
  border-radius: 6px;
  color: #A8A8A3;
  font-size: 0.68rem;
  padding: 2px 7px;
}
.stat-row {
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  gap: 8px;
  margin: 7px 0;
}
.stat-row b {
  height: 7px;
  background: #0E0E10;
  border-radius: 8px;
  overflow: hidden;
}
.stat-row i {
  display: block;
  height: 100%;
  background: #2E2E33;
}
.stat-row.over b {
  box-shadow: 0 0 0 1px #A8A8A3;
}
.stat-row.over i {
  background: linear-gradient(90deg, #A8A8A3, #FF453A);
}

.screen-footer {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; max-width: 960px; padding: 16px 24px 28px;
  margin-top: auto; margin-left: auto; margin-right: auto;
  align-self: center;
}
.car-desc { color: #A8A8A3; font-size: 0.9rem; flex: 1; padding-right: 20px; }
.menu-credits {
  color: #6E6E69;
  font-size: 0.76rem;
  padding: 0 16px 14px;
  text-align: center;
}

/* ── track select ── */
.track-grid {
  display: flex; gap: 18px; justify-content: center;
  padding: 8px 24px; overflow-y: auto;
  flex-wrap: wrap; max-width: 1400px;
  max-height: 60vh;
}
.track-card {
  width: 316px; border-radius: 10px; overflow: hidden;
  background: #1A1A1D; border: 2px solid #2E2E33;
  cursor: pointer; transition: all .18s;
  flex-shrink: 0;
}
.track-card:hover   { border-color: #555; transform: translateY(-3px); }
.track-card.selected { border-color: #A8A8A3; background: #242427; }
.track-map { width: 100%; height: 160px; display: block; }
.track-info { padding: 10px 14px 12px; }
.track-info h3   { font-size: 0.95rem; margin-bottom: 4px; }
.track-info span { font-size: 0.72rem; color: #A8A8A3; margin-right: 10px; }
.track-info .track-gp {
  display: block;
  color: #A8A8A3;
  font-weight: 800;
  margin: 0 0 6px;
}
.track-info .desc {
  display: block; font-size: 0.7rem; color: #6b7280;
  margin-top: 4px; line-height: 1.3;
}
.track-info .track-character {
  color: #A8A8A3;
  font-weight: 700;
}
.track-selected-badge {
  display: block; text-align: center;
  color: #A8A8A3; font-size: 0.8rem; font-weight: 700;
  padding-bottom: 10px;
}

/* ── skin / mode select ── */
.skin-grid,
.mode-grid {
  display: flex;
  gap: 18px;
  justify-content: center;
  align-content: flex-start;
  flex-wrap: wrap;
  width: min(1120px, calc(100vw - 32px));
  max-height: 62vh;
  overflow-y: auto;
  padding: 8px 12px;
}
.skin-card,
.mode-card {
  width: 250px;
  min-height: 190px;
  border-radius: 10px;
  border: 2px solid #2E2E33;
  background: #1A1A1D;
  color: #fff;
  cursor: pointer;
  text-align: left;
  padding: 16px;
  transition: transform .18s, border-color .18s, background .18s;
}
.skin-card:hover,
.mode-card:hover {
  transform: translateY(-3px);
  border-color: #555;
}
.skin-card.selected,
.mode-card:hover {
  border-color: #A8A8A3;
  background: #242427;
}
.skin-card.locked {
  opacity: 0.55;
  filter: saturate(0.55);
}
.skin-swatch {
  display: block;
  height: 58px;
  border-radius: 8px;
  margin-bottom: 12px;
  border: 1px solid rgba(255,255,255,0.16);
  background:
    linear-gradient(135deg, var(--skin-color), var(--skin-color) 48%, var(--skin-accent) 50%, var(--skin-accent)),
    #0E0E10;
  box-shadow: inset 0 0 24px rgba(255,255,255,0.08);
}
.skin-card b,
.mode-card b {
  display: block;
  font-size: 1rem;
  margin-bottom: 4px;
}
.mode-card b {
  font-size: 1.4rem;
  letter-spacing: 2px;
}
.skin-card small {
  display: inline-block;
  color: #0E0E10;
  background: var(--skin-accent);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 0.68rem;
  font-weight: 900;
  margin-bottom: 10px;
}
.skin-card em,
.skin-card span:not(.skin-swatch),
.mode-card span {
  display: block;
  color: #A8A8A3;
  font-size: 0.78rem;
  line-height: 1.45;
  font-style: normal;
}
.skin-card em {
  color: var(--skin-accent);
  font-weight: 800;
  margin-bottom: 5px;
}
.game-mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: min(1080px, calc(100vw - 32px));
}
.game-mode-card {
  min-height: 230px;
}
.game-mode-card em {
  display: inline-block;
  margin-top: 14px;
  color: #A8A8A3;
  font-size: 0.76rem;
  font-style: normal;
  font-weight: 900;
  text-transform: uppercase;
}
.ghost-option {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid #2E2E33;
  border-radius: 8px;
  background: #1A1A1D;
  color: #A8A8A3;
  font-size: 0.86rem;
  font-weight: 800;
  margin-bottom: 8px;
}
.ghost-option input {
  width: 16px;
  height: 16px;
  accent-color: #FFD400;
}

/* ── multiplayer lobby ── */
.lobby-layout {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px 24px;
  display: grid;
  grid-template-columns: minmax(320px, 380px) 1fr;
  gap: 22px;
  align-items: start;
}
.lobby-mode-pane,
.lobby-room-pane {
  background: #1A1A1D;
  border: 1px solid #2E2E33;
  border-radius: 14px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.lobby-room-pane { min-height: 460px; padding: 22px; }
.lobby-room-pane.hidden,
.lobby-pane.hidden,
.lobby-room-controls.hidden { display: none; }
.lobby-mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.lobby-tab {
  background: #0E0E10;
  border: 1px solid #2E2E33;
  color: #A8A8A3;
  padding: 9px 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}
.lobby-tab.active {
  background: #2E2E33;
  color: #F5F5F4;
  border-color: #A8A8A3;
}
.lobby-pane {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lobby-pane-hint {
  color: #A8A8A3;
  font-size: 0.82rem;
  line-height: 1.5;
}
.lobby-field {
  display: grid;
  gap: 6px;
}
.lobby-field > span {
  font-size: 0.78rem;
  color: #A8A8A3;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.lobby-field input,
.lobby-field select {
  background: #0E0E10;
  color: #F5F5F4;
  border: 1px solid #2E2E33;
  border-radius: 7px;
  padding: 8px 10px;
  font-size: 0.92rem;
}
.lobby-field input:focus,
.lobby-field select:focus {
  outline: none;
  border-color: #A8A8A3;
}
.lobby-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.74rem;
  color: #6E6E69;
  margin: 4px 0;
}
.lobby-divider::before,
.lobby-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #2E2E33;
}
.lobby-queue-status {
  background: #0E0E10;
  padding: 12px;
  border-radius: 8px;
  color: #A8A8A3;
  font-weight: 800;
  text-align: center;
  font-size: 0.92rem;
  border: 1px dashed #2E2E33;
}
.lobby-conn-state {
  font-size: 0.74rem;
  color: #6E6E69;
  text-align: center;
}
.lobby-conn-state.online { color: #A8A8A3; }
.lobby-conn-state.disconnected { color: #FF453A; }
.lobby-room-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid #2E2E33;
}
.lobby-room-label {
  font-size: 0.74rem;
  color: #A8A8A3;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.lobby-room-head h2 {
  font-family: 'Courier New', monospace;
  font-variant-numeric: tabular-nums;
  font-size: 2.2rem;
  letter-spacing: 0.18em;
  color: #F5F5F4;
  margin: 4px 0 0;
}
.lobby-room-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: right;
}
.lobby-room-meta span {
  font-size: 0.82rem;
  color: #A8A8A3;
}
.lobby-room-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.lobby-map-preview {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
  align-items: stretch;
  background: #1A1A1D;
  border: 1px solid #2E2E33;
  border-radius: 10px;
  padding: 12px;
}
.lobby-map-art {
  min-height: 132px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255,255,255,0.04) 1px, transparent 1px),
    #0E0E10;
  background-size: 18px 18px;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.lobby-map-art svg { width: 100%; height: 100%; }
.lobby-map-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.lobby-map-info span,
.lobby-room-status {
  color: #A8A8A3;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.lobby-map-info h3 {
  color: #F5F5F4;
  margin: 0;
  font-size: 1.18rem;
}
.lobby-map-info p {
  color: #A8A8A3;
  margin: 0;
  line-height: 1.45;
  font-size: 0.86rem;
}
.lobby-map-info div {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: auto;
}
.lobby-map-info b {
  color: #F5F5F4;
  background: #2E2E33;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.72rem;
}
.lobby-room-status {
  background: rgba(255, 212, 0, 0.06);
  border: 1px solid rgba(255, 212, 0, 0.18);
  border-radius: 8px;
  padding: 9px 11px;
}
.lobby-player-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lobby-player-row {
  display: grid;
  grid-template-columns: 32px 1fr auto auto;
  gap: 10px;
  align-items: center;
  background: #0E0E10;
  border: 1px solid #2E2E33;
  padding: 9px 12px;
  border-radius: 8px;
}
.lobby-player-row.is-me { border-color: #A8A8A3; }
.lobby-player-row.is-host { border-color: #2E2E33; }
.lobby-player-dot { width: 14px; height: 14px; border-radius: 50%; }
.lobby-player-name { font-weight: 800; color: #F5F5F4; }
.lobby-player-car { font-size: 0.78rem; color: #A8A8A3; }
.lobby-profile-card {
  display: grid;
  grid-template-columns: 54px 1fr auto;
  gap: 12px;
  align-items: center;
  background: var(--bg);
  border: 1px solid #2E2E33;
  border-radius: 8px;
  padding: 11px 12px;
}
.lobby-profile-card.is-me { border-color: #A8A8A3; }
.lobby-profile-card.is-host { border-color: #2E2E33; }
.lobby-profile-card.frame-neon { }
.lobby-profile-card.frame-carbon { background: repeating-linear-gradient(135deg, #0E0E10 0 8px, #1A1A1D 8px 16px); }
.lobby-profile-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--avatar-color, #3b82f6);
  color: white;
  font-weight: 900;
  border: 2px solid rgba(255,255,255,0.22);
}
.lobby-profile-main { min-width: 0; }
.lobby-profile-name {
  color: #F5F5F4;
  font-weight: 900;
  display: flex;
  align-items: center;
  gap: 8px;
}
.lobby-profile-name small {
  color: #A8A8A3;
  background: #2E2E33;
  border-radius: 999px;
  padding: 2px 6px;
  font-size: 0.62rem;
}
.lobby-profile-title { color: #A8A8A3; font-size: 0.78rem; margin-top: 2px; }
.lobby-profile-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  color: #A8A8A3;
  font-size: 0.75rem;
  margin-top: 5px;
}
.lobby-profile-tags {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  color: #A8A8A3;
  font-size: 0.72rem;
}
.lobby-profile-tags span,
.lobby-profile-tags b,
.lobby-player-empty {
  border-radius: 999px;
  background: #2E2E33;
  padding: 4px 8px;
}
.lobby-profile-tags b.ready { background: #242427; color: #A8A8A3; }
.lobby-player-empty {
  border: 1px dashed #2E2E33;
  color: #A8A8A3;
  border-radius: 8px;
  text-align: center;
}
.lobby-player-flag {
  font-size: 0.72rem;
  padding: 3px 7px;
  border-radius: 999px;
  background: #2E2E33;
  color: #A8A8A3;
  letter-spacing: 0.05em;
}
.lobby-player-flag.ready { background: #242427; color: #A8A8A3; }
.lobby-player-flag.host { background: #2E2E33; color: #A8A8A3; }
.lobby-room-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-top: auto;
}
.lobby-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #1A1A1D;
  border: 1px solid #2E2E33;
  color: #F5F5F4;
  padding: 12px 18px;
  border-radius: 10px;
  z-index: 80;
  font-size: 0.9rem;
}
.lobby-toast.hidden { display: none; }

.profile-editor-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(0,0,0,0.58);
  display: grid;
  place-items: center;
  padding: 18px;
}
.profile-editor-overlay.hidden { display: none; }
.profile-editor-modal {
  width: min(560px, 100%);
  background: #0E0E10;
  border: 1px solid #2E2E33;
  border-radius: 12px;
  padding: 18px;
  color: #F5F5F4;
}
.profile-editor-modal header,
.profile-editor-modal footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.profile-editor-modal h2 { margin: 0; }
.profile-editor-modal p { margin: 4px 0 0; color: #A8A8A3; }
.profile-editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 16px 0;
}
.profile-editor-field {
  display: grid;
  gap: 6px;
  color: #A8A8A3;
  font-size: 0.78rem;
}
.profile-editor-field select {
  background: #1A1A1D;
  border: 1px solid #2E2E33;
  color: #F5F5F4;
  border-radius: 7px;
  padding: 9px 10px;
}
.profile-editor-preview { margin-bottom: 16px; }

#mp-standings {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 50;
  background: #1A1A1D;
  border: 1px solid #2E2E33;
  border-radius: 12px;
  padding: 10px 14px;
  font-family: monospace;
  font-size: 0.84rem;
  color: #F5F5F4;
  pointer-events: none;
  min-width: 180px;
}
#mp-standings.hidden { display: none; }
#mp-standings h4 {
  margin: 0 0 8px;
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  color: #A8A8A3;
  text-transform: uppercase;
}
.mp-standings-row {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 6px;
  align-items: center;
  padding: 3px 0;
}
.mp-standings-row.mine { color: #FFD400; }
.mp-standings-row.finished { color: #A8A8A3; }
.mp-standings-dot { width: 10px; height: 10px; border-radius: 50%; }

.mpresults-box {
  width: min(640px, 92vw);
  background: #1A1A1D;
  border: 1px solid #2E2E33;
  border-radius: 14px;
  padding: 28px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  margin: auto;
}
.mpresults-box h2 {
  margin: 0 0 18px;
  font-size: 1.8rem;
  text-align: center;
}
.mpresults-list {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mpresults-row {
  display: grid;
  grid-template-columns: 36px 1fr auto auto;
  gap: 12px;
  align-items: center;
  background: #0E0E10;
  border: 1px solid #2E2E33;
  padding: 10px 14px;
  border-radius: 8px;
}
.mpresults-row.mine { border-color: #FFD400; }
.mpresults-row.first { border-color: #FFD400; background: rgba(255, 212, 0, 0.06); }
.mpresults-row.dnf { opacity: 0.66; }
.mpresults-rank {
  font-family: 'Courier New', monospace;
  font-variant-numeric: tabular-nums;
  font-size: 1.1rem;
  font-weight: 800;
  color: #A8A8A3;
}
.mpresults-name { font-weight: 800; }
.mpresults-car { font-size: 0.78rem; color: #A8A8A3; }
.mpresults-time {
  font-family: 'Courier New', monospace;
  font-variant-numeric: tabular-nums;
  color: #A8A8A3;
}
.mpresults-best {
  font-family: 'Courier New', monospace;
  font-variant-numeric: tabular-nums;
  font-size: 0.84rem;
  color: #A8A8A3;
}
.mpresults-actions { display: flex; gap: 10px; justify-content: center; }

/* ── buttons ── */
.btn-primary, .btn-secondary {
  padding: 12px 36px; border-radius: 12px; border: none;
  cursor: pointer; font-size: 1rem; font-weight: 700;
  transition: background 0.14s ease, border-color 0.14s ease, transform 0.1s ease;
}
.btn-primary, .btn-secondary {
  cursor: pointer;
}
.btn-primary {
  background: #FFD400;
  color: #2E2800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: none;
}
.btn-primary:hover   { background: #C9A800; }
.btn-primary:active  { transform: scale(0.97); }
.btn-secondary {
  background: #1A1A1D;
  color: #F5F5F4;
  border: 1px solid #2E2E33;
}
.btn-secondary:hover { background: #242427; border-color: #A8A8A3; }
.btn-secondary:active { transform: scale(0.97); }

/* ── results ── */
.results-box {
  background: #1A1A1D;
  border: 1px solid #2E2E33;
  border-radius: 20px;
  padding: 32px 36px;
  text-align: center;
  margin: auto;
  width: min(620px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow-y: auto;
}
/* 결과화면 광고 슬롯: 실제 광고 없을 때 숨김 */
.result-ad-slot { display: none; }
.result-ad-slot:not(:empty) { display: block; margin-top: 12px; }
.results-title { font-size: 1.8rem; font-weight: 800; margin-bottom: 16px; }
.results-title.new { color: #A8A8A3; }
.results-time  {
  font-size: 3.2rem;
  font-weight: 900;
  font-family: 'Courier New', monospace;
  font-variant-numeric: tabular-nums;
  margin-bottom: 24px;
}
.results-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 0 0 18px;
}
#mp-minimap {
  position: fixed;
  top: 70px;
  right: 16px;
  z-index: 50;
  width: 190px;
  height: 132px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 10px;
  overflow: hidden;
  background: #1A1A1D;
  pointer-events: none;
}
#mp-minimap.hidden { display: none; }
#mp-minimap-canvas { display: block; width: 100%; height: 100%; }
.mp-rematch-status {
  margin: 14px 0;
  padding: 12px;
  border: 1px solid #2E2E33;
  border-radius: 10px;
  background: #1A1A1D;
}
.mp-rematch-status strong {
  display: block;
  margin-bottom: 8px;
  color: #A8A8A3;
}
.mp-rematch-status div {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.mp-rematch-status span {
  padding: 5px 9px;
  border-radius: 999px;
  background: #2E2E33;
  color: #A8A8A3;
  font-size: 0.78rem;
}
.mp-rematch-status span.ready {
  background: #242427;
  color: #A8A8A3;
}
.results-summary div {
  background: #0E0E10;
  border: 1px solid #2E2E33;
  border-radius: 8px;
  padding: 10px;
}
.results-summary,
.result-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}
.results-summary span {
  display: block;
  color: #A8A8A3;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 5px;
}
.results-summary b {
  font-family: 'Courier New', monospace;
  font-variant-numeric: tabular-nums;
  font-size: 1rem;
  color: #F5F5F4;
}
.results-sectors { display: flex; flex-direction: column; gap: 10px; margin-bottom: 22px; }
.sector-row {
  display: grid; grid-template-columns: 90px 1fr 120px; align-items: center;
  gap: 12px;
  background: #0E0E10; border-radius: 8px; padding: 8px 18px;
}
.sector-label { color: #A8A8A3; font-size: 0.9rem; }
.sector-time  {
  font-family: 'Courier New', monospace;
  font-variant-numeric: tabular-nums;
  font-size: 1rem;
  font-weight: 600;
}
.sector-time.best { color: #A8A8A3; }
.sector-best {
  color: #6E6E69;
  font-family: 'Courier New', monospace;
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
  text-align: right;
}
.results-actions,
.results-extra-actions,
.result-actions-primary,
.result-actions-secondary {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.results-extra-actions,
.result-actions-secondary {
  margin-top: 12px;
}
.result-actions-primary { gap: 10px; margin-top: 18px; }
.result-actions-secondary { margin-top: 8px; gap: 8px; }
.result-actions-secondary .btn-secondary { font-size: 0.84rem; min-height: 38px; padding: 8px 18px; }
.result-actions-primary .btn-primary,
.result-actions-primary .btn-secondary {
  min-height: 48px;
  min-width: 150px;
}
.result-actions-secondary .btn-secondary {
  min-height: 44px;
}
.rewarded-ad-button {
  margin-top: 12px;
  width: min(320px, 100%);
}
#ad-game-over-banner {
  margin: 18px auto 0;
}

.policy-page {
  min-height: 100%;
  overflow-y: auto;
  background: #0E0E10;
}
.policy-document {
  width: min(760px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 64px 0;
}
.policy-document h1 {
  font-size: clamp(2.2rem, 6vw, 4rem);
  margin: 18px 0 24px;
  letter-spacing: 0;
}
.policy-document p {
  color: #A8A8A3;
  font-size: 1rem;
  line-height: 1.75;
  margin: 0 0 18px;
}
.policy-document .policy-updated {
  color: #A8A8A3;
  font-weight: 800;
  margin-top: 28px;
}

/* ── online leaderboard ── */
.leaderboard-panel {
  text-align: left;
  border-top: 1px solid #2E2E33;
  border-bottom: 1px solid #2E2E33;
  padding: 18px 0 16px;
  margin-bottom: 24px;
}
.leaderboard-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 18px; margin-bottom: 12px;
}
.leaderboard-title { font-size: 1rem; font-weight: 800; }
.leaderboard-subtitle { color: #A8A8A3; font-size: 0.78rem; margin-top: 3px; }
.btn-small {
  height: 34px;
  padding: 0 14px;
  font-size: 0.82rem;
}
.hidden { display: none !important; }

/* ── global lap completion toast ── */
.global-toast-container {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: min(540px, calc(100vw - 32px));
}
.global-toast {
  background: #1A1A1D;
  border: 1px solid #2E2E33;
  border-radius: 10px;
  padding: 10px 16px;
  color: #fff;
  font-size: 0.92rem;
  font-weight: 700;
  text-align: center;
  opacity: 0;
  transform: translateY(-12px);
  transition: opacity 0.32s, transform 0.32s;
}
.global-toast.show {
  opacity: 1;
  transform: translateY(0);
}
.global-toast b {
  color: #A8A8A3;
}
.global-toast time {
  font-family: 'Courier New', monospace;
  font-variant-numeric: tabular-nums;
  color: #A8A8A3;
  margin-left: 4px;
}

/* ── auth screen ── */
#screen-auth {
  justify-content: center;
  align-items: center;
  padding: 24px;
}
.auth-card {
  width: min(420px, 100%);
  padding: 32px 28px;
  border-radius: 16px;
  background: #1A1A1D;
  border: 1px solid #2E2E33;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.auth-title {
  font-size: 1.9rem;
  font-weight: 900;
  letter-spacing: 3px;
  text-align: center;
  color: #F5F5F4;
}
.auth-subtitle {
  text-align: center;
  color: #A8A8A3;
  font-size: 0.92rem;
  margin-top: -8px;
}
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-field span { color: #A8A8A3; font-size: 0.78rem; }
.auth-field input {
  height: 40px;
  border-radius: 8px;
  border: 1px solid #2E2E33;
  background: #0E0E10;
  color: #fff;
  padding: 0 12px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s;
}
.auth-field input:focus { border-color: #A8A8A3; }
.auth-error {
  min-height: 1.1em;
  color: #FF453A;
  font-size: 0.82rem;
  text-align: center;
}
.auth-submit {
  width: 100%;
  height: 44px;
  font-size: 0.95rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 700;
}
.auth-switch {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  color: #A8A8A3;
  font-size: 0.85rem;
}
.btn-link {
  background: none;
  border: none;
  color: #A8A8A3;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.88rem;
  padding: 0;
}
.btn-link:hover { color: #C9A800; text-decoration: underline; }
.car-card.locked {
  opacity: 0.62;
  filter: saturate(0.55);
}
.car-lock {
  margin: 8px 12px 12px;
  padding: 8px 10px;
  text-align: center;
  border-radius: 8px;
  background: rgba(0,0,0,0.42);
  color: #A8A8A3;
  font-size: 0.78rem;
  font-weight: 800;
}
.car-lock b,
.car-lock span {
  display: block;
}
.car-lock span {
  margin-top: 3px;
  color: #A8A8A3;
  font-size: 0.72rem;
  font-weight: 700;
}
.home-leaderboard {
  align-self: stretch; background: #1A1A1D; border: 1px solid #2E2E33;
  border-radius: 12px; padding: 16px; min-height: 360px;
}
.home-board-head { display: grid; gap: 10px; margin-bottom: 12px; }
.home-board-head strong { display: block; font-size: 1rem; }
.home-board-head span { color: #A8A8A3; font-size: 0.78rem; }
#home-leaderboard-track {
  height: 36px; border-radius: 8px; border: 1px solid #2E2E33;
  background: #0E0E10; color: #fff; padding: 0 10px; font-weight: 700;
}
.global-leaderboard-list.compact .global-leaderboard-row {
  grid-template-columns: 36px 1fr auto; min-height: 38px;
}
.global-leaderboard-list.compact .global-leaderboard-meta { display: none; }
.leaderboard-list {
  list-style: none;
  display: flex; flex-direction: column; gap: 6px;
  margin: 0 0 10px;
}
.leaderboard-row {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  min-height: 34px;
  background: #0E0E10;
  border: 1px solid #2E2E33;
  border-radius: 8px;
  padding: 0 12px;
  border-left: 2px solid #2E2E33;
}
.leaderboard-row.mine {
  border: 1px solid #FFD400;
  background: rgba(255, 212, 0, 0.06);
}
.leaderboard-rank {
  color: #2ee6ff;
  font-weight: 900;
  font-size: 0.95rem;
  text-shadow: 0 0 8px rgba(46,230,255,0.55);
}
.leaderboard-row:first-child .leaderboard-rank,
.global-leaderboard-row:first-child .leaderboard-rank {
  color: #FFD400;
  text-shadow: 0 0 10px rgba(255,212,0,0.75);
}
.leaderboard-row:first-child {
  border-left-color: #FFD400;
  box-shadow: 0 0 14px rgba(255,212,0,0.22);
}
.leaderboard-driver {
  min-width: 0;
  color: #ECECEA;
  font-size: 0.9rem;
  font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.leaderboard-time {
  color: #F5F5F4;
  font-family: 'Courier New', monospace;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: 0.95rem;
}
.leaderboard-empty {
  color: #A8A8A3;
  text-align: center;
  background: #0E0E10;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.86rem;
}
.leaderboard-status {
  min-height: 18px;
  color: #A8A8A3;
  font-size: 0.78rem;
  text-align: center;
}

#screen-main {
  background: #0E0E10;
  align-items: stretch;
}
.main-menu {
  width: 100%;
  padding: 0;
}
#hero-screen {
  position: relative;
  min-height: 100svh;
  width: 100%;
  overflow: hidden;
  display: block;
}
#hero-bg-video,
.hero-bg-fallback,
.hero-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
#hero-bg-video {
  object-fit: cover;
  z-index: 1;
  opacity: 0.62;
}
#hero-bg-video:not([src]) {
  display: none;
}
.hero-bg-fallback {
  z-index: 0;
  background:
    radial-gradient(circle at 62% 24%, rgba(255,212,0,0.06), transparent 26%),
    linear-gradient(115deg, transparent 0 42%, rgba(255,255,255,0.06) 43% 44%, transparent 45%),
    linear-gradient(90deg, rgba(46,46,51,0.32) 0 2px, transparent 2px 48px),
    linear-gradient(180deg, #0E0E10 0%, #161618 48%, #0E0E10 100%);
  background-size: auto, 360px 100%, 96px 100%, auto;
  animation: heroRoadMove 1.35s linear infinite;
}
.hero-bg-fallback::before,
.hero-bg-fallback::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -12%;
  width: 44vw;
  height: 92%;
  border-left: 2px solid rgba(255,255,255,0.28);
  border-right: 2px solid rgba(255,255,255,0.16);
  transform: translateX(-50%) perspective(420px) rotateX(58deg);
}
.hero-bg-fallback::after {
  width: 12vw;
  border-color: rgba(255,212,0,0.78);
  border-style: dashed;
  opacity: 0.65;
}
.hero-overlay {
  z-index: 2;
  background:
    linear-gradient(90deg, rgba(14,14,16,0.92), rgba(14,14,16,0.55) 48%, rgba(14,14,16,0.84)),
    linear-gradient(180deg, rgba(14,14,16,0.2), rgba(14,14,16,0.9));
}
.hero-content {
  position: relative;
  z-index: 3;
  width: min(1120px, calc(100vw - 32px));
  min-height: 100svh;
  display: grid;
  align-content: center;
  gap: 16px;
  padding: 76px 0 34px;
  margin: 0 auto;
}
.hero-content.lobby-hub {
  width: 100%;
  min-height: 100vh;
  align-content: stretch;
  padding: 22px;
  margin: 0;
}
.main-short-note {
  max-width: 680px;
  color: #A8A8A3;
  font-size: 0.94rem;
  line-height: 1.55;
}
.main-leaderboard-preview {
  width: min(620px, 100%);
  border: 1px solid #2E2E33;
  border-radius: 12px;
  background: #1A1A1D;
  padding: 14px;
  margin-top: 4px;
}
.main-board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.main-board-head h2 {
  font-size: 1rem;
  margin-bottom: 3px;
}
.main-board-head span {
  color: #A8A8A3;
  font-size: 0.78rem;
}
.main-board-tabs {
  display: flex;
  gap: 6px;
}
.main-board-tab {
  min-height: 34px;
  border: 1px solid #2E2E33;
  border-radius: 8px;
  background: #1A1A1D;
  color: #A8A8A3;
  padding: 0 12px;
  cursor: pointer;
  font-weight: 900;
}
.main-board-tab.active {
  background: #2E2E33;
  border-color: #A8A8A3;
  color: #F5F5F4;
}
.main-leaderboard-preview .global-leaderboard-list {
  max-height: 212px;
  overflow-y: auto;
  padding-right: 2px;
}
.main-leaderboard-preview .btn-small {
  width: 100%;
}
.season-panel,
.mission-panel,
.garage-panel {
  margin-top: 14px;
  border: 1px solid #2E2E33;
  background: #1A1A1D;
  border-radius: 10px;
  padding: 12px;
}
.season-panel-inner span,
.mission-panel-head span {
  color: #A8A8A3;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.season-panel-inner h2,
.mission-panel h2,
.garage-panel h2 {
  margin: 3px 0;
  color: #fff;
  font-size: 1rem;
}
.season-panel-inner p { margin: 0 0 8px; color: #A8A8A3; }
.season-panel-inner div,
.mission-panel-head,
.garage-unlocks,
.mission-list {
  display: grid;
  gap: 8px;
}
.season-panel-inner b,
.rating-badge {
  display: inline-block;
  width: max-content;
  color: #fff;
  background: #2E2E33;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.72rem;
}
.mission-panel-head {
  grid-template-columns: 1fr auto;
  align-items: center;
}
.mission-row {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  min-height: 48px;
  border: 1px solid #2E2E33;
  background: #0E0E10;
  color: #F5F5F4;
  border-radius: 8px;
  padding: 8px;
  text-align: left;
}
.mission-row small { display: block; color: #A8A8A3; }
.mission-row i {
  position: absolute;
  left: 0;
  bottom: 0;
  width: var(--mission-progress, 0%);
  height: 3px;
  background: #A8A8A3;
}
.mission-row.complete { border-color: var(--color-success); }

.mission-difficulty {
  justify-self: end;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.mission-difficulty-easy { color: var(--color-success); }
.mission-difficulty-normal { color: var(--color-record); }
.mission-difficulty-hard { color: var(--color-goal); }
.mission-difficulty-transcend {
  color: var(--color-season);
}
.garage-unlocks {
  grid-template-columns: 1fr 1fr;
}
.garage-unlock {
  display: block;
  border: 1px solid #2E2E33;
  background: #0E0E10;
  color: #F5F5F4;
  border-radius: 8px;
  padding: 8px;
  text-align: left;
}
.garage-unlock span { display: block; color: #A8A8A3; font-size: 0.72rem; }
.garage-unlock.locked { opacity: 0.54; }
.share-card-preview {
  border: 1px solid #2E2E33;
  background: #1A1A1D;
  border-radius: 10px;
  padding: 12px;
  margin: 12px 0;
  color: #F5F5F4;
}
.share-card-preview span { color: #A8A8A3; font-size: 0.78rem; }
.share-card-preview h3 { margin: 4px 0; }
.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 180;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0.62);
  padding: 16px;
}
.onboarding-card {
  width: min(520px, 100%);
  border: 1px solid #2E2E33;
  border-radius: 12px;
  background: #0E0E10;
  color: #F5F5F4;
  padding: 18px;
}
.onboarding-card li {
  margin: 10px 0;
  color: #A8A8A3;
}
.onboarding-card li b { color: #A8A8A3; margin-right: 8px; }
.onboarding-card div { display: flex; gap: 10px; flex-wrap: wrap; }
.race-minimap,
.spectator-hud {
  position: fixed;
  right: 16px;
  top: 70px;
  z-index: 52;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 10px;
  overflow: hidden;
  background: #1A1A1D;
}
.race-minimap canvas { display: block; width: 190px; height: 132px; }
.spectator-hud {
  top: 214px;
  color: #F5F5F4;
  padding: 8px;
}
.spectator-hud button { margin-left: 6px; min-height: 34px; }
.lobby-emote-feed {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.lobby-emote-feed button,
.lobby-emote-feed span {
  min-width: 36px;
  min-height: 36px;
  border-radius: 999px;
  border: 1px solid #2E2E33;
  background: #0E0E10;
  color: #F5F5F4;
  display: grid;
  place-items: center;
}
.control-list {
  margin-top: 8px;
  padding-left: 18px;
  color: #A8A8A3;
  font-size: 0.8rem;
  line-height: 1.55;
}
.control-list b {
  color: #A8A8A3;
}

.mobile-controls {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 65;
  display: none;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  padding: 0 max(18px, env(safe-area-inset-left)) calc(18px + env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  pointer-events: none;
  touch-action: none;
}
.mobile-controls.visible {
  display: flex;
}
.mobile-joystick,
.mobile-control-btn {
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.mobile-joystick {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(26,26,29,0.72);
  position: relative;
}
.mobile-joystick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255,255,255,0.9);
  box-shadow: 0 8px 20px rgba(0,0,0,0.4);
}
.mobile-action-stack {
  display: grid;
  gap: 10px;
  justify-items: end;
}
.mobile-control-btn {
  min-width: 98px;
  min-height: 52px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 12px;
  background: rgba(26,26,29,0.62);
  color: #fff;
  font-weight: 950;
  letter-spacing: 0.02em;
}
.mobile-control-btn.drift {
  min-width: 124px;
}
.mobile-control-btn.active {
  background: rgba(255,212,0,0.88);
  color: #2E2800;
}
.mobile-control-btn.cooldown {
  opacity: 0.48;
}

@keyframes heroRoadMove {
  from { background-position: 0 0, 0 0, 0 0, 0 0; }
  to { background-position: 0 0, 360px 0, 96px 0, 0 0; }
}

@media (max-width: 620px) {
  .main-menu {
    width: 100%;
    padding-top: 0;
  }
  .main-hero {
    min-height: 100svh;
    padding-bottom: 0;
  }
  .hero-content {
    width: calc(100vw - 24px);
    min-height: 100svh;
    padding: 74px 0 24px;
  }
  .hero-content.lobby-hub {
    width: 100%;
    padding: 12px;
  }
  .main-hero h1 {
    font-size: clamp(2.4rem, 13vw, 4.1rem);
  }
  .main-board-head {
    align-items: stretch;
    flex-direction: column;
  }
  .main-board-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .main-board-tab {
    width: 100%;
  }
  .main-actions .btn-primary,
  .main-actions .btn-secondary {
    width: 100%;
    min-height: 48px;
  }
  .main-info {
    grid-template-columns: 1fr;
    width: calc(100vw - 24px);
    margin: 0 auto;
  }
  .game-mode-grid {
    grid-template-columns: 1fr;
  }
  .ad-placeholder {
    max-width: 320px;
    height: 50px;
    min-height: 50px;
  }
  #ad-main-menu-banner,
  #ad-game-over-banner {
    max-width: 320px;
    height: 50px;
  }
  .results-box {
    padding: 28px 22px;
  }
  .results-time {
    font-size: 2.45rem;
  }
  .leaderboard-head {
    flex-direction: column;
    align-items: stretch;
  }
  .results-summary {
    grid-template-columns: 1fr;
  }
  .results-actions,
  .results-extra-actions {
    flex-direction: column;
  }
  .results-actions .btn-primary,
  .results-actions .btn-secondary,
  .results-extra-actions .btn-secondary {
    width: 100%;
  }
  .leaderboard-submit {
    grid-template-columns: 1fr;
  }
  .leaderboard-submit .btn-secondary {
    width: 100%;
  }
  .home-layout {
    grid-template-columns: 1fr;
    overflow-y: auto;
    width: calc(100vw - 24px);
  }
  .profile-panel {
    width: min(318px, calc(100vw - 32px));
  }
  .global-leaderboard-row {
    grid-template-columns: 32px 1fr auto;
  }
  .global-leaderboard-meta {
    grid-column: 2 / 4;
  }
  .mobile-controls.visible {
    display: flex;
  }
  .mobile-joystick {
    width: 112px;
    height: 112px;
  }
  .mobile-joystick-knob {
    width: 52px;
    height: 52px;
  }
  .mobile-control-btn {
    min-height: 50px;
    min-width: 94px;
    font-size: 0.76rem;
  }
}

/* ── controls hint ── */
#controls-hint {
  position: fixed; bottom: 98px; left: 50%; transform: translateX(-50%);
  z-index: 5; display: flex; gap: 12px;
  background: rgba(0,0,0,0.55); border-radius: 20px;
  padding: 6px 18px; pointer-events: none;
  animation: fadeout 4s forwards;
  animation-delay: 3s;
  max-width: 90vw; flex-wrap: wrap; justify-content: center;
}
#controls-hint span {
  font-size: 0.72rem; color: rgba(255,255,255,0.7);
  white-space: nowrap;
}
@keyframes fadeout { to { opacity: 0; } }

/* ── help button + overlay ── */
#btn-help {
  position: fixed; top: 16px; left: 16px; z-index: 50;
  width: 38px; height: 38px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.4);
  background: rgba(0,0,0,0.6);
  color: #fff; font-size: 1.15rem; font-weight: 800;
  cursor: pointer;
  transition: all .15s;
}
#btn-help:hover { background: #242427; border-color: #fff; }

#help-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0,0,0,0.78);
  display: flex; align-items: center; justify-content: center;
  padding: 32px;
}
#help-overlay.hidden { display: none; }
#leaderboard-overlay {
  position: fixed; inset: 0; z-index: 58;
  background: radial-gradient(ellipse at center, rgba(8,8,16,0.72) 0%, rgba(0,0,0,0.92) 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 28px;
  overflow: hidden;
}
#leaderboard-overlay.hidden { display: none; }
#leaderboard-overlay.screen,
#help-overlay.screen {
  display: none;
}
#leaderboard-overlay.screen.is-active,
#help-overlay.screen.is-active {
  display: flex !important;
}
.leaderboard-modal {
  width: min(720px, 100%);
  max-height: 86vh;
  overflow-y: auto;
  background: #1A1A1D;
  border: 2px solid #2E2E33;
  border-radius: 14px;
  padding: 24px;
}
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.leaderboard-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.leaderboard-tab {
  border: 1px solid #2E2E33;
  background: #0E0E10;
  color: #A8A8A3;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 900;
}
.leaderboard-tab.active {
  background: #2E2E33;
  color: #F5F5F4;
  border-color: #A8A8A3;
}
.leaderboard-submit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-bottom: 14px;
}
.leaderboard-submit input {
  min-width: 0;
  height: 34px;
  border-radius: 8px;
  border: 1px solid #2E2E33;
  background: #0E0E10;
  color: #fff;
  padding: 0 10px;
}
.monetization-leaderboard-row {
  display: grid;
  grid-template-columns: 42px 1fr auto auto;
  gap: 10px;
  align-items: center;
  min-height: 38px;
  background: #0E0E10;
  border: 1px solid #2E2E33;
  border-radius: 8px;
  padding: 0 12px;
}
.modal-head h2 {
  font-size: 1.45rem;
  margin-bottom: 4px;
}
.modal-head p {
  color: #A8A8A3;
  font-size: 0.82rem;
}
#leaderboard-track-filter {
  min-width: 210px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid #2E2E33;
  background: #0E0E10;
  color: #fff;
  padding: 0 10px;
  font-weight: 700;
}
.btn-icon {
  width: 34px; height: 34px;
  border-radius: 8px;
  border: 1px solid #2E2E33;
  background: #0E0E10;
  color: #fff;
  cursor: pointer;
  font-size: 1.3rem;
  line-height: 1;
}
.global-leaderboard-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 16px;
}
.global-leaderboard-row {
  display: grid;
  grid-template-columns: 40px minmax(110px, 1fr) minmax(150px, 1.25fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  background: #0E0E10;
  border: 1px solid #2E2E33;
  border-radius: 8px;
  padding: 0 12px;
  border-left: 2px solid #2E2E33;
}
.global-leaderboard-row:first-child {
  border-left-color: #FFD400;
}
.global-leaderboard-row.mine {
  border: 1px solid #FFD400;
  background: rgba(255, 212, 0, 0.06);
}
.global-leaderboard-main,
.global-leaderboard-meta {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.global-leaderboard-main {
  color: #F5F5F4;
  font-weight: 800;
  font-size: 0.9rem;
}
.global-leaderboard-meta {
  color: #A8A8A3;
  font-size: 0.78rem;
}
.global-leaderboard-row .leaderboard-time {
  color: #F5F5F4;
  font-family: 'Courier New', monospace;
  font-variant-numeric: tabular-nums;
}
.help-box {
  max-width: 860px; width: min(100%, 860px);
  background: #0E0E10; border: 1px solid #2E2E33;
  border-radius: 20px; padding: 28px 32px;
  color: #A8A8A3; align-self: center; margin: auto;
  max-height: 92vh; overflow-y: auto;
}
.help-title {
  font-size: 1.5rem; margin-bottom: 20px; text-align: center;
  color: #F5F5F4;
  font-weight: 900; letter-spacing: 0.06em;
}
.help-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
.help-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid #2E2E33;
  border-radius: 14px;
  padding: 16px;
  display: flex; flex-direction: column; gap: 6px;
}
.help-card-icon { font-size: 1.8rem; line-height: 1; }
.help-card-label {
  font-weight: 900; font-size: 0.9rem;
  color: #A8A8A3; letter-spacing: 0.06em; text-transform: uppercase;
  margin-bottom: 4px;
}
.help-key-row {
  font-size: 0.82rem; color: #A8A8A3;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.help-key-tip {
  font-size: 0.74rem; color: #A8A8A3; margin-top: 4px;
}
.help-mobile-hint {
  background: rgba(255,255,255,0.03);
  border-radius: 10px; padding: 12px 16px;
  font-size: 0.82rem; color: #A8A8A3;
  margin-bottom: 18px;
}
.help-mobile-hint span { color: #A8A8A3; font-weight: 900; margin-right: 8px; }
.help-table {
  width: 100%; border-collapse: collapse;
  font-size: 0.86rem;
}
.help-table td {
  padding: 6px 4px; border-bottom: 1px solid #2E2E33;
}
.help-table td:first-child {
  width: 38%; color: #A8A8A3;
}
.help-table kbd {
  display: inline-block;
  padding: 2px 8px; margin: 0 2px;
  background: #2E2E33; color: #fff;
  border: 1px solid #444;
  border-radius: 4px;
  font-family: monospace; font-size: 0.78rem;
}
.help-list {
  font-size: 0.82rem; line-height: 1.6;
  color: #A8A8A3; padding-left: 18px;
}
.help-list b { color: #A8A8A3; }
.tech-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 10px;
}
.tech-card {
  min-width: 0;
  border: 1px solid #2E2E33;
  border-radius: 10px;
  background: #1A1A1D;
  padding: 10px;
}
.tech-title {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  color: #F5F5F4;
  font-size: 0.78rem;
  font-weight: 800;
}
.tech-svg {
  display: block;
  width: 100%;
  aspect-ratio: 8 / 3;
  margin-top: 8px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255,255,255,0.035) 1px, transparent 1px),
    radial-gradient(circle at 20% 20%, rgba(255,212,0,0.06), transparent 42%),
    #0E0E10;
  background-size: 18px 18px, 18px 18px, auto, auto;
  overflow: hidden;
}
.tech-desc {
  min-height: 36px;
  margin: 8px 0 0;
  color: #A8A8A3;
  font-size: 0.76rem;
  line-height: 1.45;
}
#btn-help-close {
  margin-top: 18px; width: 100%;
}

@media (max-width: 720px) {
  .lobby-hub {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr auto auto;
    padding: 12px;
    gap: 10px;
    background: linear-gradient(180deg, rgba(14,14,16,0.94), rgba(14,14,16,0.5) 38%, rgba(14,14,16,0.94));
  }
  .lobby-topbar,
  .lobby-car-panel,
  .lobby-mode-panel,
  .lobby-compact-board,
  .lobby-control-hint {
    grid-column: 1;
  }
  .lobby-topbar {
    align-items: center;
    flex-wrap: nowrap;
    padding: 8px 8px 8px 12px; /* 모바일: profile-widget은 scroll 뒤로 빠지므로 padding-right 줄임 */
  }
  .lobby-topbar h1 {
    font-size: clamp(1rem, 5vw, 1.5rem);
    letter-spacing: 0.04em;
  }
  #lobby-current-car { display: none; }
  .lobby-top-meta { gap: 6px; }
  .lobby-car-panel {
    align-self: end;
    padding: 12px;
    max-height: 45vh; /* 모바일: 화면의 절반 이하로 제한 */
  }
  .lobby-car-strip {
    grid-auto-flow: column;
    grid-auto-columns: minmax(140px, 1fr);
    overflow-x: auto;
    overflow-y: hidden;
    max-height: none;
    flex: none; /* 모바일 가로 스크롤이므로 flex 해제 */
  }
  .lobby-mode-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 12px;
  }
  .lobby-mode-panel .ui-kicker {
    grid-column: 1 / -1;
  }
  .lobby-mode-card {
    min-height: 54px;
    padding: 10px;
    font-size: 0.84rem;
  }
  .lobby-mode-card.primary,
  .lobby-mode-card.accent {
    grid-column: auto;
  }
  .lobby-compact-board {
    display: none;
  }
  .lobby-control-hint {
    font-size: 0.72rem;
    border-radius: 12px;
    text-align: center;
  }
  .main-menu {
    width: 100%;
    padding: 0;
  }
  .main-hero {
    min-height: auto;
    align-content: start;
    padding-top: 36px;
  }
  .main-actions,
  .result-actions-primary,
  .result-actions-secondary {
    flex-direction: column;
  }
  .main-actions > button,
  .result-actions-primary > button,
  .result-actions-secondary > button {
    width: 100%;
    min-height: 44px;
  }
  .season-panel,
  .mission-panel,
  .main-leaderboard-preview {
    max-height: 240px;
    overflow: auto;
  }
  .help-card-grid,
  .results-summary,
  .result-summary-grid {
    grid-template-columns: 1fr;
  }
  .car-cinematic-preview {
    grid-template-columns: 1fr;
    padding: 14px;
  }
  .car-stat-row {
    grid-template-columns: 1fr 72px;
  }
  .car-stat-row > i {
    grid-column: 1 / -1;
  }
  .help-screen-panel {
    padding: 16px;
  }
  .lobby-map-preview,
  .lobby-profile-card,
  .profile-editor-grid {
    grid-template-columns: 1fr;
  }
  .lobby-map-art { min-height: 118px; }
  .lobby-profile-tags {
    align-items: flex-start;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .help-box {
    padding: 22px 18px;
  }
  .tech-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tech-svg animateMotion {
    animation: none;
  }
}

/* ─────────────────────────────────────────────────────────────
   SUPERSONIC DRIFT — Stage 1: 배경 + ASCII 타이틀 + 토픽바
   ───────────────────────────────────────────────────────────── */
@keyframes sd-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

#sd-root {
  position: fixed; inset: 0;
  background: #05060a;
  overflow: hidden;
  font-family: 'Chakra Petch', sans-serif;
  color: #f5f7fb;
  z-index: 1;
}
#sd-root .sd-hyperspeed {
  position: absolute; inset: 0; z-index: 0;
}
#sd-root .sd-vignette {
  position: absolute; inset: 0; z-index: 1;
  pointer-events: none;
  background: radial-gradient(120% 75% at 50% 6%,
    transparent 28%, rgba(5,6,10,.5) 68%, rgba(5,6,10,.92) 100%);
}
#sd-root .sd-screen-menu {
  position: absolute; inset: 0; z-index: 3;
}

#sd-root .sd-topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 24px 34px;
  pointer-events: none;
}
#sd-root .sd-topbar > div { pointer-events: auto; }
#sd-root .sd-logo {
  font: 700 15px 'IBM Plex Mono', monospace;
  letter-spacing: .34em;
  color: #28e0ff;
  text-shadow: 0 0 12px rgba(40,224,255,.55);
}
#sd-root .sd-subline {
  display: flex; align-items: center; gap: 8px; margin-top: 8px;
  font: 500 12px 'IBM Plex Mono', monospace;
  letter-spacing: .16em;
  color: #7a8398;
}
#sd-root .sd-dot-online {
  width: 7px; height: 7px; border-radius: 50%;
  background: #2bd47a; box-shadow: 0 0 8px #2bd47a;
  animation: sd-pulse 1.6s infinite;
}
#sd-root #sd-online-count {
  color: #d6dde9;
  font-variant-numeric: tabular-nums;
  transition: color .25s ease, text-shadow .25s ease;
}
#sd-root #sd-online-count.sd-online-up   { color: #6cffb0; text-shadow: 0 0 8px rgba(43,212,122,.55); }
#sd-root #sd-online-count.sd-online-down { color: #ff8aa0; text-shadow: 0 0 8px rgba(255,92,128,.45); }
#sd-root .sd-acct-cluster {
  display: flex; align-items: center; gap: 9px;
}
#sd-root .sd-pill {
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.04);
  color: #c3cad9;
  border-radius: 9px;
  padding: 8px 16px;
  font: 600 12px 'IBM Plex Mono', monospace;
  letter-spacing: .12em;
  cursor: pointer;
  transition: all .15s;
}
#sd-root .sd-pill:hover { border-color: rgba(40,224,255,.5); color: #fff; }
#sd-root .sd-pill-cyan {
  border-color: rgba(40,224,255,.45);
  color: #28e0ff;
}
#sd-root .sd-acct-chip {
  display: flex; align-items: center; gap: 9px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(12,15,26,.85);
  border-radius: 999px;
  padding: 7px 8px 7px 13px;
  cursor: pointer;
  backdrop-filter: blur(8px);
}
#sd-root .sd-acct-dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: #9aa3b8;
  box-shadow: 0 0 8px rgba(154,163,184,.6);
}
#sd-root .sd-acct-chip b {
  font: 700 14px 'Chakra Petch'; color: #f5f7fb;
}
#sd-root .sd-coin {
  font: 600 12px 'IBM Plex Mono', monospace;
  color: #ffd400;
  background: rgba(255,212,0,.12);
  border-radius: 999px;
  padding: 4px 10px;
}

#sd-root .sd-title-band {
  position: absolute; top: 100px; left: 0; right: 0; height: 60vh; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  pointer-events: none;
}
#sd-root .ascii-text-container {
  position: relative;
  width: min(1500px, 95vw);
  height: 100%;
}

#sd-root .sd-content-placeholder {
  /* Stage 2/3 자리 — 카드/리더보드/광고 */
  position: absolute;
  top: calc(60vh + 80px); left: 0; right: 0; bottom: 0;
  z-index: 3;
}

/* 기존 .main-menu hide (SD 메뉴 활성 시) */
#screen-main:has(#sd-root) .main-menu { display: none !important; }
/* SD 메뉴에서는 홈 화면 자체 스크롤 제거 */
#screen-main:has(#sd-root).is-active,
#screen-main:has(#sd-root).active { overflow: hidden !important; }

/* ─────────────────────────────────────────────────────────────
   MATCHMAKING OVERLAY (MagicRings 배경)
   ───────────────────────────────────────────────────────────── */
#sd-matchmaking {
  position: fixed; inset: 0; z-index: 9999;
  background: #05060a;
  font-family: 'Chakra Petch', sans-serif;
  color: #f5f7fb;
  overflow: hidden;
  animation: sd-mm-fade-in .35s ease;
}
@keyframes sd-mm-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
#sd-matchmaking .sd-mm-bg {
  position: absolute; inset: 0; z-index: 0;
  width: 100%; height: 100%;
}
#sd-matchmaking .sd-mm-content {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 18px;
  pointer-events: none;
  text-align: center;
  padding: 24px;
}
#sd-matchmaking .sd-mm-pulse {
  display: flex; align-items: center; gap: 10px;
  pointer-events: auto;
}
#sd-matchmaking .sd-mm-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: #ee2a0d;
  box-shadow: 0 0 12px #ee2a0d;
  animation: sd-pulse 1.4s infinite;
}
#sd-matchmaking .sd-mm-kicker {
  font: 600 13px 'IBM Plex Mono', monospace;
  letter-spacing: .42em;
  color: #f1e4df;
  text-shadow: 0 0 16px rgba(238,42,13,.45);
}
#sd-matchmaking .sd-mm-title {
  font: 700 64px 'Chakra Petch';
  letter-spacing: .04em;
  margin: 0;
  text-shadow: 0 0 30px rgba(238,42,13,.55);
  pointer-events: auto;
}
#sd-matchmaking .sd-mm-sub {
  font: 500 16px 'IBM Plex Mono', monospace;
  letter-spacing: .12em;
  color: #c3cad9;
  pointer-events: auto;
  margin-top: 4px;
}
#sd-matchmaking .sd-mm-cancel {
  margin-top: 32px;
  pointer-events: auto;
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(12,15,26,.7);
  color: #f5f7fb;
  border-radius: 10px;
  padding: 11px 28px;
  font: 600 13px 'IBM Plex Mono', monospace;
  letter-spacing: .2em;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: all .15s;
}
#sd-matchmaking .sd-mm-cancel:hover {
  border-color: rgba(238,42,13,.65);
  color: #ee2a0d;
}
@media (max-width: 720px) {
  #sd-matchmaking .sd-mm-title { font-size: 40px; }
  #sd-matchmaking .sd-mm-sub   { font-size: 13px; }
}

/* SUPERSONIC — Stage 2: 모드 카드 + 콘텐츠 */
#sd-root .sd-content {
  position: absolute;
  top: calc(60vh + 80px); left: 0; right: 0; bottom: 24px;
  z-index: 3;
  display: flex; flex-direction: column;
  align-items: center; justify-content: flex-start;
  gap: 22px;
  padding: 0 32px;
  overflow: hidden;
}
#sd-root .sd-tagline {
  font: 500 16px 'Chakra Petch';
  letter-spacing: .2em;
  color: #9aa3b8;
  text-transform: uppercase;
}
#sd-root .sd-cards {
  display: flex; gap: 18px;
  align-items: stretch;
  flex-wrap: wrap; justify-content: center;
}
#sd-root .sd-card {
  --accent: #28e0ff;
  --edge-proximity: 0;
  --cursor-angle: 90deg;
  position: relative;
  width: 274px; height: 144px;
  border: none;
  background: transparent;
  border-radius: 14px;
  cursor: pointer;
  padding: 0;
  color: inherit;
  font-family: inherit;
  text-align: left;
  overflow: hidden;
}
#sd-root .sd-card-edge {
  position: absolute; inset: 0;
  border-radius: 14px;
  padding: 1.5px;
  background: conic-gradient(from var(--cursor-angle), var(--accent), rgba(255,255,255,0.06) 120deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: calc(0.45 + var(--edge-proximity) / 180);
  pointer-events: none;
}
#sd-root .sd-card-inner {
  display: flex; flex-direction: column;
  justify-content: space-between;
  position: relative; z-index: 1;
  width: 100%; height: 100%;
  background: #0c0f1a;
  border-radius: 13px;
  padding: 22px;
  transition: background .2s;
}
#sd-root .sd-card:hover .sd-card-inner {
  background: #10142a;
}
#sd-root .sd-card-head {
  display: flex; align-items: center; justify-content: space-between;
}
#sd-root .sd-card-kicker {
  font: 600 12px 'IBM Plex Mono', monospace;
  letter-spacing: .2em;
  color: var(--accent);
}
#sd-root .sd-card-arrow {
  font: 700 22px 'Chakra Petch';
  color: var(--accent);
}
#sd-root .sd-card-title {
  font: 700 30px 'Chakra Petch';
  line-height: 1;
  color: #f5f7fb;
}
#sd-root .sd-card-sub {
  font: 500 13px 'Chakra Petch';
  color: #9aa3b8;
  margin-top: 6px;
  letter-spacing: .06em;
}
#sd-root .sd-controls-hint {
  font: 500 12px 'IBM Plex Mono', monospace;
  color: #67708a;
  letter-spacing: .08em;
}

/* SUPERSONIC — 3가지 버그 픽스 */

/* ASCII 컨테이너 고정 + 넘침 방지 */
#sd-root .sd-title-band {
  pointer-events: none;
  overflow: hidden;
}
#sd-root .ascii-text-container {
  position: absolute; inset: 0;
  overflow: hidden;
  pointer-events: auto;
}
#sd-root .ascii-text-container > * {
  position: absolute; inset: 0;
}

/* #sd-falling — 평상시 숨김, 전환 시에만 활성 */
#sd-root .sd-falling {
  position: absolute; inset: 0; z-index: 6;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}

/* ─── BorderGlow (React Bits 정식 포팅) ─── */
#sd-root .border-glow-card {
  --edge-proximity: 0;
  --cursor-angle: 45deg;
  --edge-sensitivity: 30;
  --color-sensitivity: calc(var(--edge-sensitivity) + 20);
  --border-radius: 14px;
  --glow-padding: 40px;
  --cone-spread: 25;
  --fill-opacity: 0.5;
  --card-bg: #0c0f1a;
  --glow-color: hsl(190deg 100% 70% / 100%);
  --glow-color-60: hsl(190deg 100% 70% / 60%);
  --glow-color-50: hsl(190deg 100% 70% / 50%);
  --glow-color-40: hsl(190deg 100% 70% / 40%);
  --glow-color-30: hsl(190deg 100% 70% / 30%);
  --glow-color-20: hsl(190deg 100% 70% / 20%);
  --glow-color-10: hsl(190deg 100% 70% / 10%);

  position: relative;
  border-radius: var(--border-radius);
  isolation: isolate;
  transform: translate3d(0, 0, 0.01px);
  display: grid;
  border: 1px solid rgb(255 255 255 / 15%);
  background: var(--card-bg);
  overflow: visible;
  box-shadow:
    rgba(0, 0, 0, 0.1) 0px 1px 2px,
    rgba(0, 0, 0, 0.1) 0px 2px 4px,
    rgba(0, 0, 0, 0.1) 0px 4px 8px,
    rgba(0, 0, 0, 0.1) 0px 8px 16px,
    rgba(0, 0, 0, 0.1) 0px 16px 32px,
    rgba(0, 0, 0, 0.1) 0px 32px 64px;
}

#sd-root .border-glow-card::before,
#sd-root .border-glow-card::after,
#sd-root .border-glow-card > .edge-light {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  transition: opacity 0.25s ease-out;
  z-index: -1;
}

#sd-root .border-glow-card:not(:hover):not(.sweep-active)::before,
#sd-root .border-glow-card:not(:hover):not(.sweep-active)::after,
#sd-root .border-glow-card:not(:hover):not(.sweep-active) > .edge-light {
  opacity: 0;
  transition: opacity 0.75s ease-in-out;
}

/* colored mesh-gradient border */
#sd-root .border-glow-card::before {
  border: 1px solid transparent;
  background:
    linear-gradient(var(--card-bg) 0 100%) padding-box,
    linear-gradient(rgb(255 255 255 / 0%) 0% 100%) border-box,
    var(--gradient-one, radial-gradient(at 80% 55%, hsla(268, 100%, 76%, 1) 0px, transparent 50%)) border-box,
    var(--gradient-two, radial-gradient(at 69% 34%, hsla(349, 100%, 74%, 1) 0px, transparent 50%)) border-box,
    var(--gradient-three, radial-gradient(at 8% 6%, hsla(136, 100%, 78%, 1) 0px, transparent 50%)) border-box,
    var(--gradient-four, radial-gradient(at 41% 38%, hsla(192, 100%, 64%, 1) 0px, transparent 50%)) border-box,
    var(--gradient-five, radial-gradient(at 86% 85%, hsla(186, 100%, 74%, 1) 0px, transparent 50%)) border-box,
    var(--gradient-six, radial-gradient(at 82% 18%, hsla(52, 100%, 65%, 1) 0px, transparent 50%)) border-box,
    var(--gradient-seven, radial-gradient(at 51% 4%, hsla(12, 100%, 72%, 1) 0px, transparent 50%)) border-box,
    var(--gradient-base, linear-gradient(#c299ff 0 100%)) border-box;

  opacity: calc((var(--edge-proximity) - var(--color-sensitivity)) / (100 - var(--color-sensitivity)));

  mask-image:
    conic-gradient(
      from var(--cursor-angle) at center,
      black calc(var(--cone-spread) * 1%),
      transparent calc((var(--cone-spread) + 15) * 1%),
      transparent calc((100 - var(--cone-spread) - 15) * 1%),
      black calc((100 - var(--cone-spread)) * 1%)
    );
}

/* colored mesh-gradient fill near edges */
#sd-root .border-glow-card::after {
  border: 1px solid transparent;
  background:
    var(--gradient-one, radial-gradient(at 80% 55%, hsla(268, 100%, 76%, 1) 0px, transparent 50%)) padding-box,
    var(--gradient-two, radial-gradient(at 69% 34%, hsla(349, 100%, 74%, 1) 0px, transparent 50%)) padding-box,
    var(--gradient-three, radial-gradient(at 8% 6%, hsla(136, 100%, 78%, 1) 0px, transparent 50%)) padding-box,
    var(--gradient-four, radial-gradient(at 41% 38%, hsla(192, 100%, 64%, 1) 0px, transparent 50%)) padding-box,
    var(--gradient-five, radial-gradient(at 86% 85%, hsla(186, 100%, 74%, 1) 0px, transparent 50%)) padding-box,
    var(--gradient-six, radial-gradient(at 82% 18%, hsla(52, 100%, 65%, 1) 0px, transparent 50%)) padding-box,
    var(--gradient-seven, radial-gradient(at 51% 4%, hsla(12, 100%, 72%, 1) 0px, transparent 50%)) padding-box,
    var(--gradient-base, linear-gradient(#c299ff 0 100%)) padding-box;

  mask-image:
    linear-gradient(to bottom, black, black),
    radial-gradient(ellipse at 50% 50%, black 40%, transparent 65%),
    radial-gradient(ellipse at 66% 66%, black 5%, transparent 40%),
    radial-gradient(ellipse at 33% 33%, black 5%, transparent 40%),
    radial-gradient(ellipse at 66% 33%, black 5%, transparent 40%),
    radial-gradient(ellipse at 33% 66%, black 5%, transparent 40%),
    conic-gradient(from var(--cursor-angle) at center, transparent 5%, black 15%, black 85%, transparent 95%);

  mask-composite: subtract, add, add, add, add, add;
  opacity: calc(var(--fill-opacity, 0.5) * (var(--edge-proximity) - var(--color-sensitivity)) / (100 - var(--color-sensitivity)));
  mix-blend-mode: soft-light;
}

/* outer glow layer */
#sd-root .border-glow-card > .edge-light {
  inset: calc(var(--glow-padding) * -1);
  pointer-events: none;
  z-index: 1;

  mask-image:
    conic-gradient(
      from var(--cursor-angle) at center, black 2.5%, transparent 10%, transparent 90%, black 97.5%
    );

  opacity: calc((var(--edge-proximity) - var(--edge-sensitivity)) / (100 - var(--edge-sensitivity)));
  mix-blend-mode: plus-lighter;
}

#sd-root .border-glow-card > .edge-light::before {
  content: "";
  position: absolute;
  inset: var(--glow-padding);
  border-radius: inherit;
  box-shadow:
    inset 0 0 0 1px var(--glow-color),
    inset 0 0 1px 0 var(--glow-color-60),
    inset 0 0 3px 0 var(--glow-color-50),
    inset 0 0 6px 0 var(--glow-color-40),
    inset 0 0 15px 0 var(--glow-color-30),
    inset 0 0 25px 2px var(--glow-color-20),
    inset 0 0 50px 2px var(--glow-color-10),
    0 0 1px 0 var(--glow-color-60),
    0 0 3px 0 var(--glow-color-50),
    0 0 6px 0 var(--glow-color-40),
    0 0 15px 0 var(--glow-color-30),
    0 0 25px 2px var(--glow-color-20),
    0 0 50px 2px var(--glow-color-10);
}

#sd-root .border-glow-inner {
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: auto;
  z-index: 1;
}

/* 계정 칩 단일 — 드롭다운 */
#sd-root .sd-acct-cluster {
  position: relative;
  pointer-events: auto;
}
#sd-root .sd-acct-chip {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(12,15,26,.88);
  border-radius: 999px;
  padding: 6px 14px 6px 6px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  color: #f5f7fb;
}
#sd-root .sd-acct-chip:hover {
  border-color: rgba(40,224,255,.5);
}
#sd-root .sd-acct-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #28e0ff 0%, #ff5cc8 100%);
  color: #04222a;
  font: 700 13px 'Chakra Petch';
}
#sd-root .sd-acct-chip b {
  font: 700 14px 'Chakra Petch';
  color: #f5f7fb;
}
#sd-root .sd-acct-status {
  font: 600 10px 'IBM Plex Mono', monospace;
  letter-spacing: .15em;
  color: #7a8398;
  border-left: 1px solid rgba(255,255,255,.12);
  padding-left: 10px;
}
#sd-root .sd-acct-caret {
  font: 700 12px 'Chakra Petch';
  color: #9aa3b8;
  margin-left: 4px;
  transition: transform .2s ease;
}
#sd-root .sd-acct-chip.open .sd-acct-caret {
  transform: rotate(180deg);
}
#sd-root .sd-acct-panel {
  position: absolute;
  top: calc(100% + 10px); right: 0;
  width: 320px;
  z-index: 9;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(10,12,20,.96);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 24px 60px rgba(0,0,0,.6);
  backdrop-filter: blur(12px);
}
#sd-root .sd-acct-panel[hidden] { display: none; }
#sd-root .sd-acct-section { display: flex; flex-direction: column; gap: 8px; }
#sd-root .sd-acct-section-title {
  font: 600 11px 'IBM Plex Mono', monospace;
  letter-spacing: .12em;
  color: #7a8398;
  margin-bottom: 2px;
}
#sd-root .sd-acct-input {
  width: 100%; height: 36px;
  border: 1px solid rgba(255,255,255,.14);
  background: #05060a;
  color: #fff;
  border-radius: 8px;
  padding: 0 12px;
  font: 500 14px 'Chakra Petch';
  outline: none;
}
#sd-root .sd-acct-input:focus { border-color: #28e0ff; }
#sd-root .sd-acct-row {
  display: flex; align-items: center; gap: 10px;
}
#sd-root .sd-acct-color-label {
  display: flex; align-items: center; gap: 6px;
  font: 600 11px 'IBM Plex Mono', monospace;
  color: #7a8398;
  letter-spacing: .12em;
}
#sd-root .sd-acct-color-label input[type="color"] {
  width: 30px; height: 30px;
  border: 1px solid rgba(255,255,255,.14);
  background: #05060a;
  border-radius: 6px;
  cursor: pointer;
  padding: 2px;
}
#sd-root .sd-acct-save {
  flex: 1;
  height: 34px;
  border: none;
  border-radius: 8px;
  background: #28e0ff;
  color: #04222a;
  font: 700 13px 'Chakra Petch';
  letter-spacing: .04em;
  cursor: pointer;
}
#sd-root .sd-acct-save:hover { filter: brightness(1.08); }
#sd-root .sd-acct-cars {
  font: 600 11px 'IBM Plex Mono', monospace;
  color: #9aa3b8;
  letter-spacing: .1em;
  margin-top: 2px;
}
#sd-root .sd-acct-divider {
  height: 1px;
  background: rgba(255,255,255,.08);
  margin: 14px 0;
}
#sd-root .sd-acct-hint {
  font: 500 12px 'Chakra Petch';
  color: #7a8398;
  line-height: 1.4;
  margin: 0;
}
#sd-root .sd-acct-auth-row {
  display: flex; gap: 8px;
}
#sd-root .sd-acct-auth-row .sd-pill { flex: 1; text-align: center; }

/* SSD 로고 — 토픽바/칩/매칭 */
#sd-root .sd-logo-img {
  display: block;
  height: 38px;
  width: auto;
  filter: drop-shadow(0 0 12px rgba(255, 86, 48, 0.4));
}
#sd-root .sd-acct-avatar {
  background: #FF5630 url('assets/SSD-Logo-Assets/favicon-brand.png') center/cover no-repeat;
  color: transparent;
  font-size: 0;
}
#sd-matchmaking .sd-mm-content::before {
  content: '';
  display: block;
  width: 110px; height: 110px;
  background: url('assets/SSD-Logo-Assets/favicon-brand.png') center/contain no-repeat;
  filter: drop-shadow(0 0 24px rgba(255, 86, 48, 0.5));
  margin-bottom: 6px;
}

/* 연습장 패널 — Hyperspeed 위에 자연스럽게 얹힘 */
#sd-root .sd-screen-practice {
  position: absolute; inset: 0; z-index: 5;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  pointer-events: auto;
}
#sd-root .sd-screen-practice[hidden] { display: none; }
#sd-root .sd-practice-card {
  width: min(560px, 92vw);
  border: 1px solid rgba(255, 86, 48, .35);
  background: rgba(10, 10, 11, .72);
  border-radius: 18px;
  padding: 38px 40px;
  text-align: center;
  backdrop-filter: blur(14px);
  box-shadow: 0 32px 80px rgba(0,0,0,.55), inset 0 0 60px rgba(255,86,48,.05);
}
#sd-root .sd-practice-kicker {
  font: 600 12px 'IBM Plex Mono', monospace;
  letter-spacing: .34em;
  color: #FF5630;
  margin-bottom: 18px;
}
#sd-root .sd-practice-title {
  font: 700 56px 'Chakra Petch';
  letter-spacing: .04em;
  color: #f5f7fb;
  text-shadow: 0 0 24px rgba(255,86,48,.4);
  margin-bottom: 8px;
}
#sd-root .sd-practice-sub {
  font: 500 14px 'IBM Plex Mono', monospace;
  letter-spacing: .14em;
  color: #9aa3b8;
  margin-bottom: 28px;
}
#sd-root .sd-practice-actions {
  display: flex; gap: 12px; justify-content: center;
  margin-bottom: 22px;
}
#sd-root .sd-practice-btn {
  border: 1px solid rgba(255,255,255,.22);
  background: rgba(255,255,255,.04);
  color: #f5f7fb;
  border-radius: 10px;
  padding: 13px 26px;
  font: 600 13px 'IBM Plex Mono', monospace;
  letter-spacing: .18em;
  cursor: pointer;
  transition: all .15s;
}
#sd-root .sd-practice-btn:hover {
  border-color: rgba(255, 86, 48, .6);
  color: #FF5630;
}
#sd-root .sd-practice-btn.primary {
  background: linear-gradient(135deg, #FF5630 0%, #ff8a5b 100%);
  border-color: transparent;
  color: #0A0A0B;
}
#sd-root .sd-practice-btn.primary:hover {
  filter: brightness(1.08);
  color: #0A0A0B;
}
#sd-root .sd-practice-hint {
  font: 500 11px 'IBM Plex Mono', monospace;
  letter-spacing: .14em;
  color: #67708a;
}

/* FREE ROAM 토스트 */
#sd-root .sd-free-toast {
  position: absolute;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.92);
  z-index: 30;
  display: flex; flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 22px 40px;
  border-radius: 14px;
  background: rgba(10, 10, 11, 0.78);
  border: 1px solid rgba(238, 42, 13, 0.45);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 48px rgba(0,0,0,.5), inset 0 0 40px rgba(238,42,13,.08);
  opacity: 0;
  transition: opacity .35s ease, transform .35s ease;
  pointer-events: none;
}
#sd-root .sd-free-toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.0);
}
#sd-root .sd-free-toast span {
  font: 700 28px 'Chakra Petch';
  letter-spacing: .14em;
  color: #ee2a0d;
  text-shadow: 0 0 20px rgba(238,42,13,.55);
}
#sd-root .sd-free-toast small {
  font: 600 11px 'IBM Plex Mono', monospace;
  letter-spacing: .26em;
  color: #f1e4df;
  text-transform: uppercase;
}

/* OLD 프로필 위젯 — SD 메뉴 chip 으로 대체. 영구 hide. */
#profile-widget { display: none !important; }

/* 연습장 EXIT 버튼 — SD 메뉴로 복귀. */
#sd-practice-exit {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  background: rgba(10, 10, 11, 0.78);
  border: 1px solid rgba(255, 86, 48, 0.55);
  border-radius: 6px;
  color: #F4F3F1;
  font: 700 12px 'IBM Plex Mono', monospace;
  letter-spacing: .22em;
  text-transform: uppercase;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 120ms ease, border-color 120ms ease, transform 80ms ease;
}
#sd-practice-exit:hover {
  background: rgba(255, 86, 48, 0.18);
  border-color: #FF5630;
}
#sd-practice-exit:active { transform: scale(0.96); }
#sd-practice-exit span {
  color: #FF5630;
  font-size: 14px;
}

/* GARAGE modal — reparents the existing .lobby-car-panel out from under the
   hidden .main-menu so car selection is reachable from the SD card menu. */
#sd-garage-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(5, 6, 10, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
#sd-garage-modal.is-open { display: flex; }
#sd-garage-modal .sd-garage-box {
  width: min(420px, 92vw);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#sd-garage-modal .sd-garage-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px;
}
#sd-garage-modal .sd-garage-bar span {
  font: 900 13px 'IBM Plex Mono', monospace;
  letter-spacing: .22em;
  color: #a855ff;
  text-transform: uppercase;
}
#sd-garage-modal .sd-garage-bar button {
  padding: 7px 14px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(10, 10, 11, 0.78);
  color: #F4F3F1;
  font: 700 11px 'IBM Plex Mono', monospace;
  letter-spacing: .18em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
#sd-garage-modal .sd-garage-bar button:hover {
  border-color: #FF5630;
  color: #FF5630;
}
#sd-garage-modal .lobby-car-panel {
  grid-column: unset;
  width: 100%;
  max-height: min(70vh, 560px);
}

/* ──────────────────────────────────────────────────────────────
   GLOBAL BUTTON UNIFICATION — SuperSonic Drift aesthetic
   모든 .btn-primary / .btn-secondary / .btn-link / .btn-small / .btn-icon
   를 홈화면 SD 카드 디자인에 맞춤.
   Ink #0A0A0B / Sonic #FF5630 / Paper #F4F3F1, Chakra Petch + IBM Plex Mono
   ────────────────────────────────────────────────────────────── */

.btn-primary,
.btn-secondary {
  padding: 12px 30px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: 'IBM Plex Mono', 'Chakra Petch', monospace;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    transform 80ms ease,
    box-shadow 200ms ease;
}

.btn-primary {
  background: #FF5630;
  color: #0A0A0B;
  border-color: #FF5630;
  box-shadow: 0 0 24px rgba(255, 86, 48, 0.35);
}
.btn-primary:hover {
  background: #ff7150;
  border-color: #ff7150;
  box-shadow: 0 0 36px rgba(255, 86, 48, 0.55);
}
.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled {
  background: #2a1610;
  border-color: #5a2f25;
  color: #6b5048;
  box-shadow: none;
  cursor: not-allowed;
}

.btn-secondary {
  background: rgba(10, 10, 11, 0.78);
  color: #F4F3F1;
  border-color: rgba(244, 243, 241, 0.18);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.btn-secondary:hover {
  background: rgba(255, 86, 48, 0.12);
  border-color: #FF5630;
  color: #FF5630;
}
.btn-secondary:active { transform: scale(0.97); }
.btn-secondary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-small {
  height: 30px;
  padding: 0 14px;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
}

.btn-link {
  background: transparent;
  border: none;
  color: #F4F3F1;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 8px 4px;
  transition: color 140ms ease;
}
.btn-link:hover {
  color: #FF5630;
  text-decoration: none;
}

.btn-icon {
  background: rgba(10, 10, 11, 0.78);
  border: 1px solid rgba(244, 243, 241, 0.18);
  color: #F4F3F1;
  border-radius: 8px;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 80ms ease;
}
.btn-icon:hover {
  background: rgba(255, 86, 48, 0.14);
  border-color: #FF5630;
  color: #FF5630;
}
.btn-icon:active { transform: scale(0.94); }

/* ──────────────────────────────────────────────────────────────
   SD GLOBAL OVERRIDE — 모든 오버레이/패널/입력 SuperSonic Drift 스킨
   Tokens: Ink #0A0A0B · Sonic #FF5630 · Paper #F4F3F1
   Fonts: 'Chakra Petch' (heading) · 'IBM Plex Mono' (utility)
   ────────────────────────────────────────────────────────────── */

:root {
  --sd-ink: #0A0A0B;
  --sd-sonic: #FF5630;
  --sd-paper: #F4F3F1;
  --sd-glass: rgba(10, 10, 11, 0.82);
  --sd-edge-soft: rgba(244, 243, 241, 0.12);
  --sd-edge-strong: rgba(244, 243, 241, 0.24);
  --sd-sonic-soft: rgba(255, 86, 48, 0.18);
  --sd-sonic-glow: 0 0 24px rgba(255, 86, 48, 0.45);
}

/* ── global toast ── */
.global-toast-container {
  z-index: 9000 !important;
}
.global-toast {
  background: var(--sd-glass) !important;
  border: 1px solid var(--sd-edge-soft) !important;
  border-left: 3px solid var(--sd-sonic) !important;
  border-radius: 8px !important;
  color: var(--sd-paper) !important;
  font-family: 'IBM Plex Mono', monospace !important;
  font-size: 0.78rem !important;
  letter-spacing: .14em !important;
  text-transform: uppercase !important;
  padding: 12px 18px !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.55);
}
.global-toast b { color: var(--sd-sonic) !important; font-weight: 700; }
.global-toast time { color: var(--sd-paper) !important; opacity: .85; }

/* ── lobby toast ── */
.lobby-toast {
  background: var(--sd-glass) !important;
  border: 1px solid var(--sd-sonic-soft) !important;
  border-radius: 8px !important;
  color: var(--sd-paper) !important;
  font-family: 'IBM Plex Mono', monospace !important;
  font-size: 0.78rem !important;
  letter-spacing: .14em !important;
  text-transform: uppercase !important;
  padding: 10px 16px !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: var(--sd-sonic-glow);
}
.lobby-car-toast {
  background: var(--sd-glass) !important;
  border: 1px solid var(--sd-sonic-soft) !important;
  border-radius: 6px;
  color: var(--sd-paper) !important;
  font-family: 'IBM Plex Mono', monospace !important;
  font-size: 0.72rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  padding: 8px 14px;
}

/* ── ad slots — 실제 광고 없어도 자리 확보 ── */
.ad-placeholder,
.result-ad-slot {
  background: var(--sd-glass) !important;
  border: 1px dashed var(--sd-edge-strong) !important;
  border-radius: 10px !important;
  color: rgba(244, 243, 241, 0.4) !important;
  font-family: 'IBM Plex Mono', monospace !important;
  font-size: 0.7rem !important;
  letter-spacing: .24em !important;
  text-transform: uppercase !important;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.ad-placeholder small,
.result-ad-slot small {
  color: rgba(244, 243, 241, 0.28) !important;
  font-size: 0.6rem;
  letter-spacing: .2em;
}
.ad-placeholder span,
.result-ad-slot span {
  color: var(--sd-sonic) !important;
  font-weight: 700;
}

/* 사이즈 표준 — banner 728x90, side 300x250, results 320x100 */
#ad-main-menu-banner {
  width: 100%;
  max-width: 728px;
  height: 90px;
  margin: 14px auto 0;
}
#ad-lobby-side {
  width: 100%;
  height: 250px;
  margin-top: 12px;
}
#ad-game-over-banner {
  width: 100%;
  max-width: 320px;
  height: 100px;
  margin: 14px auto 0;
}
/* 메인 lobby-hub 광고 숨김 override 제거 — 자리 확보 우선 */
.hero-content.lobby-hub > #ad-main-menu-banner { display: flex !important; }

/* ── profile widget (chip + panel) ── 화면 우상단 ── */
.profile-widget { display: none !important; } /* SD chip로 대체 — DOM은 남김(레퍼런스용) */

/* ── results box ── */
.results-box {
  background: var(--sd-glass) !important;
  border: 1px solid var(--sd-edge-soft) !important;
  border-radius: 14px !important;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7), var(--sd-sonic-glow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--sd-paper);
}
.results-box::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 86, 48, 0.06), transparent 30%);
}
.results-title {
  font-family: 'Chakra Petch', sans-serif !important;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--sd-paper);
}
.results-title.new { color: var(--sd-sonic) !important; }
.results-time {
  font-family: 'IBM Plex Mono', 'Courier New', monospace !important;
  color: var(--sd-paper) !important;
}
.results-subtitle { color: rgba(244, 243, 241, 0.6); }

/* ── help screen panel ── */
.help-screen-panel {
  background: var(--sd-glass) !important;
  border: 1px solid var(--sd-edge-soft) !important;
  border-radius: 14px !important;
  color: var(--sd-paper);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.help-screen-panel h2,
.help-screen-panel h3 {
  font-family: 'Chakra Petch', sans-serif !important;
  letter-spacing: .06em;
  color: var(--sd-paper);
}
.help-screen-panel kbd {
  background: rgba(255, 86, 48, 0.12);
  border: 1px solid var(--sd-sonic);
  color: var(--sd-sonic);
  font-family: 'IBM Plex Mono', monospace;
  border-radius: 4px;
  padding: 2px 8px;
}

/* ── track card (선택 카드) ── */
.track-card {
  background: var(--sd-glass) !important;
  border: 1px solid var(--sd-edge-soft) !important;
  border-radius: 12px !important;
  color: var(--sd-paper);
  transition: border-color 160ms ease, transform 120ms ease, box-shadow 200ms ease;
}
.track-card:hover {
  border-color: var(--sd-sonic) !important;
  transform: translateY(-3px);
  box-shadow: var(--sd-sonic-glow);
}
.track-card.selected {
  border-color: var(--sd-sonic) !important;
  background: rgba(255, 86, 48, 0.08) !important;
  box-shadow: var(--sd-sonic-glow);
}
.track-card h3 {
  font-family: 'Chakra Petch', sans-serif;
  letter-spacing: .06em;
  text-transform: uppercase;
}

/* ── lobby panes (multiplayer) ── */
.lobby-pane,
.lobby-room-pane {
  background: var(--sd-glass) !important;
  border: 1px solid var(--sd-edge-soft) !important;
  border-radius: 14px !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--sd-paper);
}
.lobby-pane h2,
.lobby-pane h3,
.lobby-room-pane h2,
.lobby-room-pane h3 {
  font-family: 'Chakra Petch', sans-serif;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--sd-paper);
}
.lobby-tab {
  background: transparent !important;
  border: 1px solid var(--sd-edge-soft) !important;
  color: rgba(244, 243, 241, 0.55) !important;
  font-family: 'IBM Plex Mono', monospace !important;
  letter-spacing: .22em;
  text-transform: uppercase;
  padding: 8px 18px;
  border-radius: 6px;
  cursor: pointer;
  transition: color 140ms ease, border-color 140ms ease, background 140ms ease;
}
.lobby-tab.active {
  background: var(--sd-sonic-soft) !important;
  border-color: var(--sd-sonic) !important;
  color: var(--sd-sonic) !important;
}
.lobby-tab:hover { color: var(--sd-paper) !important; }
.lobby-conn-state {
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: .18em;
  text-transform: uppercase;
  font-size: 0.7rem;
  color: rgba(244, 243, 241, 0.55);
}
.lobby-conn-state.online { color: var(--sd-sonic); }
.lobby-conn-state.disconnected { color: #ffb35a; }

/* ── mpresults box ── */
.mpresults-box {
  background: var(--sd-glass) !important;
  border: 1px solid var(--sd-edge-soft) !important;
  border-radius: 14px !important;
  color: var(--sd-paper);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7), var(--sd-sonic-glow);
}
.mpresults-box h2 {
  font-family: 'Chakra Petch', sans-serif !important;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--sd-paper);
}

/* ── leaderboard overlay ── */
#leaderboard-overlay {
  background: rgba(5, 6, 10, 0.85) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
#leaderboard-overlay .leaderboard-panel,
#leaderboard-overlay .leaderboard-container,
.leaderboard-modal {
  background: var(--sd-glass) !important;
  border: 1px solid var(--sd-edge-soft) !important;
  border-radius: 14px !important;
  color: var(--sd-paper);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
}
.leaderboard-tab {
  background: transparent !important;
  border: 1px solid var(--sd-edge-soft) !important;
  color: rgba(244, 243, 241, 0.55) !important;
  font-family: 'IBM Plex Mono', monospace !important;
  letter-spacing: .2em;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
}
.leaderboard-tab.active {
  background: var(--sd-sonic-soft) !important;
  border-color: var(--sd-sonic) !important;
  color: var(--sd-sonic) !important;
}
.leaderboard-tab:hover { color: var(--sd-paper) !important; }

/* ── auth screen — Login/Signup form ── */
#screen-auth .auth-card,
#screen-auth .auth-panel,
#screen-auth form {
  color: var(--sd-paper);
}
#screen-auth h2 {
  font-family: 'Chakra Petch', sans-serif !important;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--sd-paper);
}
#screen-auth label {
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: .14em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: rgba(244, 243, 241, 0.6);
}
#screen-auth input[type="text"],
#screen-auth input[type="email"],
#screen-auth input[type="password"],
#screen-auth input[type="search"],
#screen-auth input[type="number"],
.profile-field input,
.lobby-private-code,
#lobby-private-code {
  background: var(--sd-ink) !important;
  border: 1px solid var(--sd-edge-strong) !important;
  border-radius: 6px !important;
  color: var(--sd-paper) !important;
  font-family: 'IBM Plex Mono', monospace !important;
  letter-spacing: .08em;
  padding: 10px 14px;
  transition: border-color 140ms ease, box-shadow 200ms ease;
}
#screen-auth input:focus,
.profile-field input:focus,
#lobby-private-code:focus {
  outline: none;
  border-color: var(--sd-sonic) !important;
  box-shadow: 0 0 0 3px rgba(255, 86, 48, 0.18);
}
#screen-auth select,
.lobby-private-track,
.lobby-quick-track,
.lobby-room-track-select,
.leaderboard-track-filter {
  background: var(--sd-ink) !important;
  border: 1px solid var(--sd-edge-strong) !important;
  color: var(--sd-paper) !important;
  font-family: 'IBM Plex Mono', monospace !important;
  border-radius: 6px;
  padding: 8px 12px;
}

/* ── screen-header / screen-footer ── */
.screen-header h2,
.screen-header h1 {
  font-family: 'Chakra Petch', sans-serif !important;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--sd-paper);
}
.screen-header p,
.screen-header .subtitle {
  color: rgba(244, 243, 241, 0.55);
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: .14em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

/* ── modal overlays generic ── */
.modal,
.modal-content,
.profile-editor-overlay .profile-editor-card {
  background: var(--sd-glass) !important;
  border: 1px solid var(--sd-edge-soft) !important;
  border-radius: 14px !important;
  color: var(--sd-paper) !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* ── tab buttons generic (main-board-tab 등) ── */
.main-board-tab {
  background: transparent !important;
  border: 1px solid var(--sd-edge-soft) !important;
  color: rgba(244, 243, 241, 0.55) !important;
  font-family: 'IBM Plex Mono', monospace !important;
  letter-spacing: .18em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 0.7rem;
  cursor: pointer;
}
.main-board-tab.active,
.main-board-tab[aria-selected="true"] {
  background: var(--sd-sonic-soft) !important;
  border-color: var(--sd-sonic) !important;
  color: var(--sd-sonic) !important;
}

/* ── 레이스 시작 카운트다운 (MagicRings + 3/2/1/START!) ── */
#race-countdown-root {
  position: fixed;
  inset: 0;
  z-index: 9500;
  pointer-events: none;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10,10,11,0.72);
  opacity: 1;
  transition: opacity 700ms cubic-bezier(0.4, 0, 0.6, 1);
}
#race-countdown-root.rc-hide { opacity: 0; }
#race-countdown-root .rc-rings {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 45vmin;
  height: 45vmin;
  z-index: 1;
  pointer-events: none;
}

/* center column: F1 lights row above 3/2/1 text */
#race-countdown-root .rc-center {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(18px, 3vmin, 36px);
  pointer-events: none;
}

/* F1-style 5-light ladder */
#race-countdown-root .rc-lights {
  display: flex;
  gap: clamp(12px, 2.2vmin, 28px);
  padding: clamp(10px, 1.6vmin, 18px) clamp(18px, 2.6vmin, 32px);
  background: rgba(8, 8, 10, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  box-shadow: 0 0 30px rgba(0,0,0,0.6), inset 0 0 22px rgba(0,0,0,0.65);
}
#race-countdown-root .rc-light {
  width: clamp(28px, 4.4vmin, 56px);
  height: clamp(28px, 4.4vmin, 56px);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #2a0808 0%, #120303 65%, #050101 100%);
  box-shadow: inset 0 0 6px rgba(0,0,0,0.85), inset 0 0 14px rgba(255,0,0,0.05);
  transition: background 90ms ease-out, box-shadow 90ms ease-out;
}
#race-countdown-root .rc-light.rc-light-on {
  background: radial-gradient(circle at 35% 30%, #ff8888 0%, #ff1a1a 45%, #6a0202 100%);
  box-shadow:
    0 0 18px rgba(255, 40, 30, 0.95),
    0 0 42px rgba(255, 60, 20, 0.7),
    inset 0 0 8px rgba(255, 200, 180, 0.6);
}
#race-countdown-root .rc-light.rc-light-go {
  background: radial-gradient(circle at 35% 30%, #d6ffd0 0%, #2dff70 45%, #0a5d28 100%);
  box-shadow:
    0 0 26px rgba(45, 255, 112, 0.95),
    0 0 60px rgba(45, 255, 112, 0.65),
    inset 0 0 8px rgba(220, 255, 220, 0.6);
  animation: rcGoLightPulse 700ms ease-out both;
}
@keyframes rcGoLightPulse {
  0%   { transform: scale(0.6); opacity: 0; }
  35%  { transform: scale(1.25); opacity: 1; }
  100% { transform: scale(1.0); opacity: 1; }
}

/* 두 slot stacked → 크로스페이드 (텍스트 교체 시 끊김 없음) */
#race-countdown-root .rc-stack {
  position: relative;
  z-index: 10;
  display: grid;
  place-items: center;
  pointer-events: none;
}
#race-countdown-root .rc-slot {
  grid-area: 1 / 1;
  font-family: 'Chakra Petch', 'IBM Plex Mono', sans-serif;
  font-weight: 700;
  font-size: clamp(120px, 22vw, 320px);
  line-height: 1;
  letter-spacing: 0.02em;
  color: #F4F3F1;
  text-shadow:
    0 0 24px rgba(255, 86, 48, 0.85),
    0 0 60px rgba(255, 86, 48, 0.6),
    0 0 120px rgba(255, 86, 48, 0.35);
  user-select: none;
  opacity: 0;
  transform: scale(1);
  will-change: transform, opacity, filter, letter-spacing;
}
#race-countdown-root .rc-slot.rc-variant-go {
  font-size: clamp(120px, 22vw, 360px);
  color: #d6ffd0;
  text-shadow:
    0 0 32px rgba(45, 255, 112, 0.95),
    0 0 80px rgba(45, 255, 112, 0.75),
    0 0 160px rgba(20, 200, 70, 0.5);
}
#race-countdown-root .rc-slot.rc-variant-free {
  font-size: clamp(60px, 10vw, 160px);
  letter-spacing: 0.18em;
}

/* incoming animations (등장) — 매우 부드러운 ease, 긴 fade tail */
#race-countdown-root .rc-slot.rc-in-pop {
  animation: rcInPop 1100ms cubic-bezier(0.16, 0.7, 0.2, 1) both;
}
#race-countdown-root .rc-slot.rc-in-go {
  animation: rcInGo 1300ms cubic-bezier(0.16, 0.7, 0.2, 1) both;
}
#race-countdown-root .rc-slot.rc-in-free {
  animation: rcInFree 2000ms cubic-bezier(0.16, 0.7, 0.2, 1) both;
}
/* outgoing — 긴 부드러운 fadeout (incoming 과 충분히 겹침) */
#race-countdown-root .rc-slot.rc-out {
  animation: rcOut 1000ms cubic-bezier(0.4, 0, 0.6, 1) both;
}

@keyframes rcInPop {
  0%   { opacity: 0;   transform: scale(1.5); filter: blur(8px); }
  35%  { opacity: 0.7; transform: scale(1.05); filter: blur(1px); }
  60%  { opacity: 1;   transform: scale(1.0); filter: blur(0); }
  100% { opacity: 1;   transform: scale(1.0); filter: blur(0); }
}
@keyframes rcInGo {
  0%   { opacity: 0;   transform: scale(0.65); filter: blur(6px); letter-spacing: 0; }
  30%  { opacity: 1;   transform: scale(1.25); filter: blur(0);   letter-spacing: 0.1em; }
  65%  { opacity: 1;   transform: scale(1.15); letter-spacing: 0.12em; }
  100% { opacity: 0;   transform: scale(1.5);  filter: blur(2px); letter-spacing: 0.22em; }
}
@keyframes rcInFree {
  0%   { opacity: 0;   transform: scale(0.8);  filter: blur(10px); letter-spacing: 0.04em; }
  20%  { opacity: 1;   transform: scale(1.0);  filter: blur(0);    letter-spacing: 0.18em; }
  75%  { opacity: 1;   transform: scale(1.0);  letter-spacing: 0.20em; }
  100% { opacity: 0;   transform: scale(1.12); filter: blur(3px); letter-spacing: 0.26em; }
}
@keyframes rcOut {
  0%   { opacity: 1;   transform: scale(1.0);  filter: blur(0); }
  60%  { opacity: 0.3; transform: scale(0.92); filter: blur(3px); }
  100% { opacity: 0;   transform: scale(0.85); filter: blur(6px); }
}
