/* ============================================================
   小米车主刹车挑战 · HyperOS 浅色座舱风
   主色:小米橙 #FF6900 / 米字蓝 #2F7CF6 / 警示红 #F53F3F
   ============================================================ */
:root {
  --mi-orange: #ff6900;
  --mi-orange-deep: #e55d00;
  --mi-orange-soft: #fff1e6;
  --mi-blue: #2f7cf6;
  --mi-green: #00b578;
  --mi-red: #f53f3f;
  --ink: #1d2129;
  --ink-2: #4e5969;
  --ink-3: #86909c;
  --line: #e5e6eb;
  --bg: #f4f5f7;
  --card: #ffffff;
  --shadow: 0 12px 40px rgba(29, 33, 41, 0.08);
  --shadow-sm: 0 4px 16px rgba(29, 33, 41, 0.06);
  --radius: 22px;
  --radius-sm: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  font-family: "MiSans", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(900px 500px at 85% -10%, #ffe8d6 0%, transparent 60%),
    radial-gradient(700px 420px at -10% 110%, #e8f0ff 0%, transparent 55%),
    var(--bg);
  min-height: 100%;
  overflow-x: hidden;
  user-select: none;
}

.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 18px 22px 8px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ============ 顶栏 ============ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 2px 16px;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-logo {
  width: 46px; height: 46px;
  border-radius: 14px;
  background: linear-gradient(145deg, #ff7d1f, var(--mi-orange) 55%, var(--mi-orange-deep));
  color: #fff;
  font-size: 24px; font-weight: 800;
  display: grid; place-items: center;
  box-shadow: 0 8px 20px rgba(255, 105, 0, 0.35);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text b { font-size: 19px; letter-spacing: 1px; }
.brand-text span { font-size: 11px; color: var(--ink-3); letter-spacing: 2.5px; }

.top-actions { display: flex; align-items: center; gap: 10px; }

.icon-btn {
  width: 44px; height: 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--ink-2);
  cursor: pointer;
  display: grid; place-items: center;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover { color: var(--mi-orange); border-color: #ffd9bd; transform: translateY(-1px); }
.icon-btn:active { transform: translateY(0) scale(0.96); }
.icon-btn svg { width: 22px; height: 22px; }

#mute-btn .icon-sound-off { display: none; }
#mute-btn.muted .icon-sound-on { display: none; }
#mute-btn.muted .icon-sound-off { display: block; }

.lb-btn {
  height: 44px;
  padding: 0 16px;
  border: none;
  border-radius: 14px;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
  line-height: 1.15;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, background 0.15s ease;
}
.lb-btn b { font-size: 14px; letter-spacing: 1px; }
.lb-btn span { font-size: 11px; color: #ffb380; letter-spacing: 3px; }
.lb-btn:hover { background: var(--mi-orange); transform: translateY(-1px); }
.lb-btn:active { transform: scale(0.97); }

/* ---- 身份徽章 ---- */
.me-chip {
  height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  font-family: inherit;
  font-size: 14px; font-weight: 700; color: var(--ink);
  box-shadow: var(--shadow-sm);
  max-width: 200px;
  transition: all 0.15s ease;
}
.me-chip:hover { border-color: #ffd9bd; color: var(--mi-orange); transform: translateY(-1px); }
.me-chip b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-chip-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #c9cdd4;
  flex: none;
}
.me-chip.registered .me-chip-dot { background: var(--mi-green); box-shadow: 0 0 6px rgba(0, 181, 120, 0.6); }

/* ============ 舞台布局 ============ */
.stage {
  position: relative;
  flex: 1;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 260px;
  grid-template-rows: auto auto 1fr auto;
  grid-template-areas:
    "telemetry gauge force"
    "chart     gauge force"
    "chart     gauge force"
    "pedal     pedal pedal";
  gap: 16px;
  align-items: stretch;
  padding-bottom: 10px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.7);
  padding: 18px 20px;
  position: relative;
}

.card-title {
  font-size: 15px; font-weight: 700; letter-spacing: 1px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 14px;
}
.card-title > span { font-size: 10px; color: var(--ink-3); letter-spacing: 2px; font-weight: 500; }
.card-title.small { font-size: 13px; margin-bottom: 8px; }
.card-title .keys { display: flex; gap: 10px; }
.key { font-style: normal; font-size: 11px; font-weight: 500; }
.speed-key { color: var(--mi-orange); }
.force-key { color: var(--mi-blue); }

/* ---- 遥测卡 ---- */
.telemetry-card { grid-area: telemetry; }

.metric {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: baseline;
  gap: 6px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}
.metric:last-of-type { border-bottom: none; }
.metric-label { font-size: 13px; color: var(--ink-2); }
.metric b {
  font-size: 26px; font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
}
.metric .unit { font-size: 12px; color: var(--ink-3); }

.best-line {
  margin-top: 10px;
  font-size: 12px; color: var(--ink-3);
  display: flex; justify-content: space-between; align-items: center;
  background: var(--mi-orange-soft);
  border-radius: 10px;
  padding: 8px 12px;
}
.best-line b { color: var(--mi-orange); font-size: 15px; font-variant-numeric: tabular-nums; }

/* ---- 曲线卡 ---- */
.chart-card { grid-area: chart; display: flex; flex-direction: column; }
.chart-card canvas { width: 100%; height: auto; display: block; }
.chart-footnote { margin-top: 8px; font-size: 11px; color: var(--ink-3); }

/* ---- 速度表卡 ---- */
.gauge-card {
  grid-area: gauge;
  display: flex; flex-direction: column;
  overflow: hidden;
}

.status-tag {
  position: absolute; top: 16px; right: 16px;
  font-size: 12px; font-weight: 700; letter-spacing: 2px;
  padding: 6px 14px;
  border-radius: 999px;
  background: #f2f3f5;
  color: var(--ink-2);
  transition: all 0.2s ease;
}
.status-tag.boost { background: #e8f0ff; color: var(--mi-blue); }
.status-tag.brake-now {
  background: var(--mi-orange); color: #fff;
  box-shadow: 0 0 0 0 rgba(255, 105, 0, 0.5);
  animation: pulse-tag 0.9s ease-out infinite;
}
.status-tag.braking { background: var(--mi-orange-soft); color: var(--mi-orange-deep); }
.status-tag.done { background: #e6f8f0; color: var(--mi-green); }

@keyframes pulse-tag {
  0% { box-shadow: 0 0 0 0 rgba(255, 105, 0, 0.45); }
  70% { box-shadow: 0 0 0 12px rgba(255, 105, 0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 105, 0, 0); }
}

.gauge-wrap { position: relative; flex: 1; min-height: 300px; }
.gauge-svg { width: 100%; height: auto; display: block; margin-top: 6px; }

.gauge-track { fill: none; stroke: #eceef2; stroke-width: 14; stroke-linecap: round; }
.gauge-fill {
  fill: none; stroke: var(--mi-orange); stroke-width: 14; stroke-linecap: round;
  stroke-dasharray: 1000; stroke-dashoffset: 1000;
  filter: drop-shadow(0 2px 6px rgba(255, 105, 0, 0.35));
  transition: stroke 0.2s ease;
}
.gauge-card.brake-now .gauge-fill { stroke: var(--mi-red); filter: drop-shadow(0 2px 8px rgba(245, 63, 63, 0.4)); }

#gauge-ticks line { stroke: #c9cdd4; stroke-width: 2; }
#gauge-ticks line.major { stroke: #a9aeb8; stroke-width: 3; }
#gauge-ticks line.arm { stroke: var(--mi-green); stroke-width: 4; }
#gauge-labels text {
  font-size: 20px; fill: var(--ink-3);
  font-family: inherit; text-anchor: middle;
}
#gauge-labels text.arm { fill: var(--mi-green); font-weight: 700; }

.speed-readout {
  position: absolute; left: 0; right: 0; top: 34%;
  text-align: center;
  pointer-events: none;
}
.speed-value {
  font-size: clamp(72px, 9vw, 128px);
  font-weight: 800;
  letter-spacing: -4px;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.speed-unit { font-size: 15px; color: var(--ink-3); letter-spacing: 8px; margin-top: 2px; }
.speed-state {
  font-size: 19px; font-weight: 800; letter-spacing: 4px;
  margin-top: 14px; color: var(--ink-2);
  transition: color 0.15s ease;
}
.gauge-card.brake-now .speed-state { color: var(--mi-red); animation: blink-text 0.5s steps(2) infinite; }
@keyframes blink-text { 50% { opacity: 0.35; } }

.threshold {
  display: flex; align-items: center; gap: 12px;
  font-size: 12px; color: var(--ink-3); letter-spacing: 2px;
  margin-top: 4px;
}
.threshold .line { flex: 1; height: 1px; background: var(--line); }
.threshold b { color: var(--mi-green); font-size: 14px; }

.hold-feedback {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 12px 0 4px;
  text-align: center;
}
.hold-feedback span { font-size: 12px; color: var(--ink-3); }
.hold-feedback b { font-size: 22px; letter-spacing: 2px; color: var(--ink); }
.hold-feedback b.gold { color: var(--mi-orange); }
.hold-feedback b.danger { color: var(--mi-red); }

/* ---- 力度卡 ---- */
.force-card { grid-area: force; display: flex; flex-direction: column; }

.force-number { display: flex; align-items: baseline; gap: 6px; }
.force-number b {
  font-size: 46px; font-weight: 800;
  font-variant-numeric: tabular-nums; letter-spacing: -1px;
}
.force-number .unit { font-size: 14px; color: var(--ink-3); }
.force-caption { font-size: 12px; color: var(--ink-3); margin: 2px 0 14px; }

.force-gauge { position: relative; flex: 1; min-height: 240px; margin-left: 34px; }
.force-well {
  position: absolute; inset: 0 auto 0 0;
  width: 52px;
  border-radius: 12px;
  background: #f2f3f5;
  border: 1px solid var(--line);
  overflow: hidden;
}
.force-risk {
  position: absolute; left: 0; right: 0; top: 0; height: 6.25%;
  background: rgba(245, 63, 63, 0.25);
}
.force-fill {
  position: absolute; left: 0; right: 0; bottom: 0; height: 0;
  background: linear-gradient(180deg, #ff8a3d, var(--mi-orange));
  box-shadow: 0 0 18px rgba(255, 105, 0, 0.35);
}
.force-fill.hot { background: linear-gradient(180deg, #ff6b6b, var(--mi-red)); }
.force-grid {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(to top, transparent 0, transparent 27px, rgba(29,33,41,0.05) 28px, rgba(29,33,41,0.05) 29px);
}
.force-limit {
  position: absolute; left: -6px; width: 64px; height: 3px; top: 0;
  background: var(--mi-red);
  box-shadow: 0 0 10px rgba(245, 63, 63, 0.5);
}
.force-marker {
  position: absolute; left: -6px; width: 64px; height: 3px; bottom: 0;
  background: var(--ink);
  box-shadow: 0 0 8px rgba(29, 33, 41, 0.4);
  z-index: 2;
}
.force-tick {
  position: absolute; left: 60px;
  font-size: 11px; color: var(--ink-3);
  transform: translateY(50%);
  white-space: nowrap;
}
.force-tick b { color: var(--mi-red); font-weight: 700; }
.force-tick.t-max { top: 0; transform: translateY(-50%); }
.force-tick.t-1200 { top: 25%; }
.force-tick.t-800 { top: 50%; }
.force-tick.t-0 { top: 100%; transform: translateY(-50%); }

/* ---- 踏板 ---- */
.pedal-zone {
  grid-area: pedal;
  display: flex; flex-direction: column; align-items: center;
  gap: 10px;
  padding: 8px 0 4px;
}

.pedal {
  position: relative;
  width: min(340px, 72vw);
  cursor: pointer;
  touch-action: none;
  outline: none;
}
.pedal-arm {
  width: 14px; height: 46px;
  margin: 0 auto;
  background: linear-gradient(90deg, #d7dae0, #9aa0aa 50%, #d7dae0);
  border-radius: 6px 6px 0 0;
}
.pedal-pad {
  position: relative;
  height: 108px;
  border-radius: 20px;
  background: linear-gradient(180deg, #3a3f47, #23272e);
  box-shadow: 0 14px 0 #14171c, 0 22px 34px rgba(29, 33, 41, 0.35);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  transition: transform 0.06s ease, box-shadow 0.06s ease;
  overflow: hidden;
}
.pedal-pad::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.14), transparent 40%);
  pointer-events: none;
}
.pedal-ridge { width: 62%; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.14); }
.pedal-pad b { color: #ffb380; font-size: 18px; letter-spacing: 8px; margin-top: 2px; }

.pedal.pressed .pedal-pad {
  transform: translateY(10px);
  box-shadow: 0 4px 0 #14171c, 0 10px 18px rgba(29, 33, 41, 0.3);
  background: linear-gradient(180deg, #454b54, #2a2f37);
}
.pedal.pressed .pedal-pad b { color: var(--mi-orange); }

.pedal.broken { cursor: not-allowed; }
.pedal.broken .pedal-arm { transform: rotate(14deg); transform-origin: bottom; background: linear-gradient(90deg, #f0a58a, #8a4a35); }
.pedal.broken .pedal-pad {
  background: linear-gradient(180deg, #5a2c22, #331712);
  transform: translateY(12px) rotate(-2.5deg);
  box-shadow: 0 3px 0 #1c0b08, 0 8px 16px rgba(29, 33, 41, 0.3);
}
.pedal.broken .pedal-pad::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 46%, rgba(0,0,0,0.55) 47%, rgba(0,0,0,0.55) 53%, transparent 54%);
}
.pedal.broken .pedal-pad b { color: #ff8a7a; letter-spacing: 4px; }

.pedal-hint { font-size: 12px; color: var(--ink-3); letter-spacing: 1px; }

/* ---- 冲出赛道警告 ---- */
.offtrack-warning {
  position: absolute;
  top: 12px; left: 50%;
  transform: translateX(-50%) translateY(-8px);
  z-index: 30;
  background: var(--mi-red);
  color: #fff;
  font-size: 15px; font-weight: 700; letter-spacing: 1px;
  padding: 10px 22px;
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(245, 63, 63, 0.45);
  display: none;
  animation: warn-pop 0.5s ease infinite alternate;
}
.offtrack-warning.show { display: block; }
@keyframes warn-pop { from { transform: translateX(-50%) scale(1); } to { transform: translateX(-50%) scale(1.05); } }

/* ============ 遮罩层 ============ */
.overlay {
  position: absolute; inset: 0;
  z-index: 40;
  display: none;
  background: rgba(244, 245, 247, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: var(--radius);
  padding: 18px;
  overflow-y: auto;
}
.overlay.show { display: flex; }

.panel {
  margin: auto; /* 安全居中:内容超高时可完整滚动 */
  background: var(--card);
  border-radius: 26px;
  box-shadow: 0 30px 90px rgba(29, 33, 41, 0.18);
  padding: 34px 40px 30px;
  text-align: center;
  max-width: 640px;
  width: 100%;
  animation: panel-in 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes panel-in { from { transform: translateY(18px) scale(0.97); opacity: 0; } }

/* ---- 开场 ---- */
.eyebrow {
  display: inline-block;
  font-size: 12px; font-weight: 700; letter-spacing: 3px;
  color: var(--mi-orange);
  background: var(--mi-orange-soft);
  border-radius: 999px;
  padding: 6px 16px;
  margin-bottom: 16px;
}
.intro-panel h1 { font-size: clamp(30px, 4.6vw, 44px); line-height: 1.25; letter-spacing: 1px; }
.intro-panel h1 em { font-style: normal; color: var(--mi-orange); }

.goal-note { font-size: 15px; color: var(--ink-2); line-height: 1.7; margin: 14px 0 18px; }
.goal-note b { color: var(--ink); }

.quick-guide { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.quick-guide span {
  font-size: 14px;
  background: #f7f8fa;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 16px;
  color: var(--ink-2);
}
.quick-guide b { color: var(--mi-orange); margin-right: 8px; font-size: 13px; }

.goal-rules { font-size: 13px; color: var(--ink-3); margin-bottom: 18px; }

.track-stats {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  font-size: 13px; color: var(--ink-2);
  margin-bottom: 22px;
}
.track-stats b { color: var(--mi-orange); font-variant-numeric: tabular-nums; }
.track-stats i { width: 1px; height: 14px; background: var(--line); }

.btn-primary {
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 17px; font-weight: 700; letter-spacing: 2px;
  color: #fff;
  background: linear-gradient(135deg, #ff7d1f, var(--mi-orange) 60%, var(--mi-orange-deep));
  border-radius: 999px;
  padding: 15px 38px;
  box-shadow: 0 12px 28px rgba(255, 105, 0, 0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-primary span { margin-left: 6px; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 16px 34px rgba(255, 105, 0, 0.5); }
.btn-primary:active { transform: scale(0.97); }
.btn-primary.small { font-size: 14px; padding: 11px 24px; letter-spacing: 1px; }

.btn-ghost {
  border: 1px solid var(--line);
  cursor: pointer;
  font-family: inherit;
  font-size: 15px; font-weight: 600; letter-spacing: 2px;
  color: var(--ink-2);
  background: #f7f8fa;
  border-radius: 999px;
  padding: 14px 30px;
  transition: all 0.15s ease;
}
.btn-ghost:hover { border-color: #ffd9bd; color: var(--mi-orange); background: var(--mi-orange-soft); }

.brand-slogan { margin-top: 18px; font-size: 12px; color: var(--ink-3); letter-spacing: 4px; }

/* ---- 结算 ---- */
.result-panel { max-width: 600px; }
.result-kicker { font-size: 12px; font-weight: 800; letter-spacing: 5px; color: var(--mi-green); }
.result-panel.failed .result-kicker { color: var(--mi-red); }
.result-panel h2 { font-size: 34px; letter-spacing: 3px; margin: 10px 0 6px; }
.result-desc { font-size: 14px; color: var(--ink-2); line-height: 1.6; margin-bottom: 14px; }

.result-time b {
  font-size: clamp(56px, 8vw, 84px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -2px;
  color: var(--mi-orange);
  line-height: 1.1;
}
.result-panel.failed .result-time b { color: var(--mi-red); }
.result-time small { font-size: 20px; color: var(--ink-3); margin-left: 8px; }
.result-time-label { font-size: 12px; color: var(--ink-3); letter-spacing: 2px; margin: 4px 0 16px; }

.result-stats {
  display: flex; justify-content: space-between; gap: 10px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
  margin-bottom: 16px;
}
.result-stat { flex: 1; font-size: 12px; color: var(--ink-3); }
.result-stat strong {
  display: block;
  font-size: 19px; color: var(--ink);
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
}

.review-wrap { text-align: left; margin-bottom: 16px; }
.review-wrap canvas { width: 100%; height: auto; display: block; }

.result-note {
  font-size: 13px;
  color: var(--mi-orange-deep);
  min-height: 20px;
  margin-bottom: 12px;
  letter-spacing: 1px;
}

/* ---- 大侠登记 ---- */
#register { z-index: 60; }
.register-panel { max-width: 520px; }
.register-panel h1 { font-size: clamp(28px, 4vw, 38px); letter-spacing: 4px; margin: 6px 0 10px; }
.reg-row { display: flex; gap: 10px; margin: 18px 0 8px; }
#reg-name {
  flex: 1;
  height: 52px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 22px;
  font-size: 16px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
#reg-name:focus { border-color: var(--mi-orange); box-shadow: 0 0 0 3px rgba(255, 105, 0, 0.15); }
.reg-error {
  min-height: 20px;
  font-size: 13px;
  color: var(--mi-red);
  font-weight: 600;
}
.reg-error.shake { animation: shake 0.4s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-4px); }
}
.reg-tip { font-size: 12px; color: var(--ink-3); margin-bottom: 16px; }

.reg-roster {
  text-align: left;
  background: #f7f8fa;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.roster-title { font-size: 12px; color: var(--ink-3); margin-bottom: 8px; letter-spacing: 1px; }
.roster-title b { color: var(--mi-orange); }
.roster-chips { display: flex; flex-wrap: wrap; gap: 6px; max-height: 96px; overflow-y: auto; }
.roster-chips .chip {
  font-size: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
  color: var(--ink-2);
}
.roster-chips .chip.me { border-color: var(--mi-orange); color: var(--mi-orange); font-weight: 700; }
.roster-empty { font-size: 12px; color: var(--ink-3); }

.result-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---- 暂停 ---- */
.pause-panel { max-width: 380px; }
.pause-panel h2 { font-size: 28px; letter-spacing: 6px; margin-bottom: 8px; }
.pause-panel p { font-size: 14px; color: var(--ink-3); margin-bottom: 22px; }

/* ============ 排行榜抽屉 ============ */
.lb-backdrop {
  position: fixed; inset: 0;
  background: rgba(29, 33, 41, 0.35);
  backdrop-filter: blur(3px);
  z-index: 80;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.lb-backdrop.show { opacity: 1; }

.lb-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(400px, 92vw);
  background: var(--card);
  z-index: 90;
  box-shadow: -20px 0 60px rgba(29, 33, 41, 0.2);
  transform: translateX(105%);
  transition: transform 0.3s cubic-bezier(0.25, 0.9, 0.3, 1);
  display: flex; flex-direction: column;
  border-radius: 24px 0 0 24px;
}
.lb-panel.show { transform: translateX(0); }

.lb-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 22px 14px;
}
.lb-kicker { font-size: 11px; letter-spacing: 3px; color: var(--mi-orange); font-weight: 700; }
.lb-header h2 { font-size: 26px; letter-spacing: 2px; margin-top: 2px; }

.lb-columns {
  display: grid; grid-template-columns: 56px 1fr auto;
  padding: 10px 26px;
  font-size: 12px; color: var(--ink-3);
  border-bottom: 1px solid var(--line);
  letter-spacing: 2px;
}

.lb-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 14px 20px;
  list-style: none;
}
.lb-list li {
  display: grid; grid-template-columns: 56px 1fr auto;
  align-items: center;
  padding: 11px 12px;
  border-radius: 14px;
  font-size: 14px;
}
.lb-list li:nth-child(odd) { background: #f7f8fa; }
.lb-list li.top { background: var(--mi-orange-soft); }
.lb-list li.me { outline: 2px solid var(--mi-orange); }

.lb-rank {
  font-weight: 800; font-size: 16px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
li.top .lb-rank { color: var(--mi-orange); }
.lb-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 10px; }
.lb-name small { display: block; font-weight: 400; font-size: 11px; color: var(--ink-3); }
.lb-time { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink); }
.lb-time small { color: var(--ink-3); font-weight: 500; margin-left: 2px; }
.lb-empty { display: block; text-align: center; color: var(--ink-3); padding: 40px 0; }

/* 排行榜内的大侠名录 */
.lb-roster {
  border-top: 1px solid var(--line);
  padding: 12px 22px 16px;
}
.lb-roster summary {
  cursor: pointer;
  font-size: 13px; color: var(--ink-2);
  letter-spacing: 1px;
  outline: none;
  user-select: none;
}
.lb-roster summary b { color: var(--mi-orange); }
.lb-roster summary::marker { color: var(--mi-orange); }
.lb-roster .roster-chips { margin-top: 10px; max-height: 140px; }

/* ============ Toast ============ */
.toast {
  position: fixed;
  bottom: 30px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 120;
  background: var(--ink);
  color: #fff;
  font-size: 14px; font-weight: 600; letter-spacing: 1px;
  padding: 12px 26px;
  border-radius: 999px;
  box-shadow: 0 14px 40px rgba(29, 33, 41, 0.35);
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast b { color: #ffb380; }

/* ============ 页脚 ============ */
.footer {
  text-align: center;
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 1px;
  padding: 8px 0 14px;
}

/* ============ 移动端:一屏装下,踏板永远够得着 ============ */
@media (max-width: 960px) {
  html, body { overscroll-behavior: none; }
  body { touch-action: manipulation; }

  .page {
    padding: 6px 10px 4px;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  /* 顶栏紧凑化 */
  .topbar { padding: 2px 0 8px; gap: 8px; }
  .brand { gap: 8px; }
  .brand-logo { width: 36px; height: 36px; font-size: 18px; border-radius: 10px; }
  .brand-text b { font-size: 14px; }
  .brand-text span { display: none; }
  .top-actions { gap: 6px; }
  .icon-btn { width: 40px; height: 40px; border-radius: 12px; }
  .lb-btn { height: 40px; padding: 0 12px; border-radius: 12px; }
  .lb-btn b { font-size: 12px; }
  .lb-btn span { font-size: 10px; letter-spacing: 2px; }
  .me-chip { max-width: 110px; height: 40px; padding: 0 10px; font-size: 12px; }

  /* 舞台:纵向 flex,高度锁死一屏 */
  .stage {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-height: 0;
    padding-bottom: 0;
  }
  .card { padding: 10px 14px; border-radius: 18px; box-shadow: var(--shadow-sm); }
  .card-title { font-size: 12px; margin-bottom: 6px; }

  /* 1.速度表:弹性占满剩余空间,SVG 按高度缩放 */
  .gauge-card { order: 1; flex: 1 1 auto; min-height: 0; }
  .status-tag { top: 10px; right: 10px; font-size: 10px; padding: 4px 10px; letter-spacing: 1px; }
  .gauge-wrap { flex: 1; min-height: 0; display: flex; justify-content: center; overflow: hidden; }
  .gauge-svg { height: 100%; width: auto; max-width: 100%; margin-top: 0; }
  .speed-value { font-size: clamp(56px, 17vw, 88px); letter-spacing: -3px; }
  .speed-unit { font-size: 12px; letter-spacing: 6px; }
  .speed-state { font-size: 16px; margin-top: 8px; letter-spacing: 3px; }
  .threshold { font-size: 10px; margin-top: 2px; }
  .threshold b { font-size: 12px; }
  .hold-feedback { padding: 6px 0 0; gap: 2px; }
  .hold-feedback b { font-size: 17px; }
  .hold-feedback span { font-size: 11px; }

  /* 2.力度条:横置紧凑 */
  .force-card { order: 2; flex: none; padding-bottom: 22px; }
  .force-card .card-title { margin-bottom: 2px; }
  .force-number b { font-size: 26px; }
  .force-number .unit { font-size: 12px; }
  .force-caption { display: none; }
  .force-gauge { min-height: 0; height: 30px; margin: 26px 0 0; }
  .force-well { inset: 0; width: auto; border-radius: 8px; }
  .force-risk { top: 0; bottom: 0; left: auto; right: 0; width: 6.25%; height: auto; }
  .force-fill { top: 0; bottom: 0; left: 0; right: auto; height: auto; width: 0; }
  .force-grid { background: repeating-linear-gradient(to right, transparent 0, transparent 27px, rgba(29,33,41,0.05) 28px, rgba(29,33,41,0.05) 29px); }
  .force-limit { left: auto; right: 0; top: -5px; width: 3px; height: 40px; }
  .force-marker { left: auto; bottom: auto; top: -5px; width: 3px; height: 40px; margin-left: -1px; }
  .force-tick { left: auto; top: auto; transform: none; font-size: 10px; }
  .force-tick.t-max { right: -4px; top: -18px; }
  .force-tick.t-1200 { left: 75%; top: auto; bottom: -16px; transform: translateX(-50%); }
  .force-tick.t-800 { left: 50%; top: auto; bottom: -16px; transform: translateX(-50%); }
  .force-tick.t-0 { left: 0; top: auto; bottom: -16px; }

  /* 3.踏板:始终可见,不滚屏 */
  .pedal-zone { order: 3; flex: none; padding: 2px 0; gap: 4px; }
  .pedal { width: min(280px, 78vw); }
  .pedal-arm { height: 22px; width: 12px; }
  .pedal-pad {
    height: 78px; border-radius: 16px;
    box-shadow: 0 9px 0 #14171c, 0 14px 22px rgba(29, 33, 41, 0.3);
  }
  .pedal.pressed .pedal-pad { transform: translateY(7px); box-shadow: 0 2px 0 #14171c, 0 6px 12px rgba(29, 33, 41, 0.3); }
  .pedal-pad b { font-size: 15px; letter-spacing: 6px; }
  .pedal-ridge { height: 4px; }
  .pedal-hint { font-size: 10px; }

  /* 4.遥测:一行三列紧凑条 */
  .telemetry-card { order: 4; flex: none; display: flex; align-items: center; gap: 8px; padding: 8px 14px; }
  .telemetry-card .card-title, .telemetry-card .best-line { display: none; }
  .metric { flex: 1; border-bottom: none; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 0; }
  .metric-label { font-size: 10px; }
  .metric b { font-size: 18px; }
  .metric .unit { display: none; }

  /* 5.实时曲线手机端隐藏(结算页保留复盘曲线) */
  .chart-card { display: none; }

  .footer { display: none; }

  /* 遮罩与面板紧凑,可内部滚动 */
  .overlay { padding: 10px; border-radius: 18px; }
  .panel { padding: 20px 16px 16px; border-radius: 20px; }
  .eyebrow { font-size: 10px; padding: 4px 12px; margin-bottom: 10px; letter-spacing: 2px; }
  .intro-panel h1 { font-size: 24px; }
  .goal-note { font-size: 13px; margin: 8px 0 10px; }
  .quick-guide { gap: 6px; margin-bottom: 8px; }
  .quick-guide span { font-size: 12px; padding: 7px 10px; }
  .quick-guide b { font-size: 11px; margin-right: 5px; }
  .goal-rules { font-size: 11px; margin-bottom: 10px; }
  .track-stats { font-size: 12px; margin-bottom: 12px; }
  .btn-primary { font-size: 15px; padding: 13px 28px; }
  .brand-slogan { margin-top: 10px; font-size: 10px; letter-spacing: 3px; }
  .result-panel h2 { font-size: 26px; }
  .result-time b { font-size: 52px; }
  .result-desc { font-size: 13px; margin-bottom: 8px; }
  .result-stats { padding: 10px 0; margin-bottom: 10px; }
  .result-stat strong { font-size: 16px; }
  .review-wrap .card-title { font-size: 11px; }
  .reg-row { flex-direction: column; }
  #reg-name { height: 48px; }
  .register-panel h1 { font-size: 26px; }
  .reg-roster .roster-chips { max-height: 72px; }

  /* toast 移到上方,避免挡踏板 */
  .toast { top: 60px; bottom: auto; transform: translateX(-50%) translateY(-10px); }
  .toast.show { transform: translateX(-50%) translateY(0); }

  .offtrack-warning { top: 4px; font-size: 13px; padding: 8px 16px; width: max-content; max-width: 92vw; text-align: center; }

  /* 排行榜抽屉近全屏 */
  .lb-panel { width: min(400px, 100vw); border-radius: 0; }
}

/* 超矮屏(SE / 横屏)再压缩 */
@media (max-width: 960px) and (max-height: 740px) {
  .speed-value { font-size: 52px; letter-spacing: -2px; }
  .speed-unit { font-size: 11px; letter-spacing: 5px; }
  .speed-state { font-size: 14px; margin-top: 4px; }
  .threshold { display: none; }
  #pulse-note { display: none; }
  .hold-feedback { padding: 2px 0 0; gap: 0; }
  .hold-feedback b { font-size: 15px; }
  .hold-feedback span { font-size: 10px; }
  .pedal-arm { height: 14px; }
  .pedal-pad { height: 64px; }
  .force-gauge { height: 24px; margin-top: 20px; }
  .force-card { padding-bottom: 18px; }
  .metric b { font-size: 16px; }
}
