/* =========================================================================
 * style.css —— 浅色小清新 × 赛博霓虹 的界面皮肤
 * ========================================================================= */

:root {
  --ink: #2f3358;
  --ink-soft: #6d739e;
  --ink-faint: #9aa0c4;
  --cyan: #35d8ff;
  --cyan-deep: #12b8e8;
  --pink: #ff6fd8;
  --purple: #9b8cff;
  --lime: #7de8ad;
  --yellow: #ffd76b;
  --panel: rgba(255, 255, 255, 0.76);
  --panel-solid: rgba(255, 255, 255, 0.94);
  --stroke: rgba(255, 255, 255, 0.92);
  --shadow: 0 20px 55px rgba(118, 138, 205, 0.22);
  --shadow-sm: 0 8px 22px rgba(118, 138, 205, 0.18);
  --radius: 26px;
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui,
    -apple-system, "Segoe UI", Roboto, sans-serif;
  --intensity: 0;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;         /* 别触发下拉刷新 / 橡皮筋 */
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(160deg, #dff4ff 0%, #ffe8f6 48%, #eee9ff 100%);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  font-variant-numeric: tabular-nums;
}

#app {
  position: fixed;
  inset: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
input { user-select: text; -webkit-user-select: text; }

#canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; }

/* 难度越高，四周的氛围光越浓（浅色调，不压抑） */
#app::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(125% 95% at 50% 50%, rgba(255, 255, 255, 0) 62%, rgba(155, 140, 255, 0.28) 100%);
  opacity: calc(0.3 + var(--intensity) * 0.5);
  transition: opacity .4s ease;
  z-index: 3;
}

/* 受击红色呼吸 */
body.flash-hit #app::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  background: radial-gradient(120% 90% at 50% 55%, rgba(255, 120, 170, 0) 40%, rgba(255, 90, 150, 0.55) 100%);
  animation: hitFlash .2s ease-out;
}
@keyframes hitFlash { from { opacity: 0; } 40% { opacity: 1; } to { opacity: 0; } }

.hidden { display: none !important; }
.muted { color: var(--ink-faint); font-size: 12px; font-weight: 500; }
.center { text-align: center; }

/* ============================ HUD ============================ */
#hud { position: absolute; inset: 0; z-index: 6; pointer-events: none; }

.hud-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px 0;
}

.hud-left, .hud-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hud-right { justify-content: flex-end; }

.hud-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 84px;
  padding: 8px 14px 9px 16px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  overflow: hidden;
}
.hud-card::before {
  content: "";
  position: absolute;
  left: 6px; top: 10px; bottom: 10px;
  width: 3px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--cyan), var(--pink));
  box-shadow: 0 0 10px rgba(53, 216, 255, 0.75);
}
.hud-label {
  font-size: 10px;
  letter-spacing: .14em;
  color: var(--ink-faint);
  font-weight: 700;
  text-transform: uppercase;
}
.hud-value { font-size: 24px; font-weight: 800; line-height: 1.1; color: var(--ink); }
.hud-value.small { font-size: 17px; font-weight: 700; }
.hud-value.small i { font-style: normal; font-size: 11px; color: var(--ink-faint); margin-left: 3px; }
.score-card .hud-value {
  background: linear-gradient(96deg, var(--cyan-deep), var(--purple) 55%, var(--pink));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 6px rgba(120, 180, 255, .35));
}

.shield-card { min-width: auto; }
.shields { display: flex; gap: 6px; padding-top: 2px; }
.shield {
  width: 22px; height: 22px;
  border-radius: 8px 8px 9px 9px;
  background: linear-gradient(150deg, #ffffff, #cdf3ff 40%, #9fe8ff);
  border: 1.5px solid rgba(53, 216, 255, .85);
  box-shadow: 0 0 10px rgba(53, 216, 255, .55), inset 0 -3px 6px rgba(53, 216, 255, .35);
  position: relative;
  transition: transform .25s cubic-bezier(.3, 1.6, .5, 1), opacity .25s, box-shadow .25s;
}
.shield::after {
  content: "";
  position: absolute; inset: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .95);
  box-shadow: 0 0 8px rgba(255, 255, 255, .9);
}
.shield.lost {
  opacity: .38;
  background: #e9edf7;
  border-color: #cfd6ea;
  box-shadow: none;
  transform: scale(.86);
}
.shield.lost::after { background: #cfd6ea; box-shadow: none; }
.shield.gain { animation: shieldGain .6s cubic-bezier(.3, 1.7, .5, 1); }
@keyframes shieldGain {
  0% { transform: scale(.6) rotate(-18deg); }
  60% { transform: scale(1.25) rotate(6deg); }
  100% { transform: scale(1) rotate(0); }
}

.combo {
  padding: 7px 15px;
  border-radius: 14px;
  font-weight: 800;
  font-size: 15px;
  color: #fff;
  background: linear-gradient(100deg, var(--cyan), var(--purple) 60%, var(--pink));
  box-shadow: 0 8px 20px rgba(155, 140, 255, .42), 0 0 18px rgba(255, 111, 216, .4);
  text-shadow: 0 1px 2px rgba(70, 40, 120, .25);
}
.combo.pop { animation: comboPop .35s cubic-bezier(.3, 1.7, .5, 1); }
@keyframes comboPop { 0% { transform: scale(.7); } 55% { transform: scale(1.16); } 100% { transform: scale(1); } }

.icon-btn {
  pointer-events: auto;
  width: 44px; height: 44px;
  border-radius: 15px;
  border: 1px solid var(--stroke);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 16px;
  color: var(--ink);
  cursor: pointer;
  transition: transform .16s ease, box-shadow .2s ease, background .2s;
  display: grid; place-items: center;
}
.icon-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(118, 138, 205, .3); }
.icon-btn:active { transform: translateY(0) scale(.96); }
.icon-btn.off { color: var(--ink-faint); }

#hud-hint {
  position: absolute;
  left: 50%; bottom: 26px;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
  animation: floatIn .4s ease;
}
@keyframes floatIn { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

#toast {
  position: absolute;
  left: 50%; bottom: 92px;
  transform: translateX(-50%);
  padding: 11px 24px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 15px;
  color: var(--ink);
  background: linear-gradient(100deg, rgba(255, 255, 255, .96), rgba(232, 246, 255, .96));
  border: 1.5px solid rgba(53, 216, 255, .55);
  box-shadow: 0 10px 30px rgba(118, 138, 205, .28), 0 0 22px rgba(53, 216, 255, .3);
  white-space: nowrap;
}
#toast.pop { animation: toastPop .4s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes toastPop {
  0% { opacity: 0; transform: translate(-50%, 14px) scale(.9); }
  100% { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

#debug {
  position: absolute; right: 18px; bottom: 18px;
  font-size: 11px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--ink-faint);
  background: rgba(255, 255, 255, .62);
  padding: 6px 10px; border-radius: 10px;
  border: 1px solid var(--stroke);
}

/* ============================ 覆盖层 ============================ */
.screen {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  animation: screenIn .28s ease;
}
@keyframes screenIn { from { opacity: 0; } to { opacity: 1; } }

.panel {
  position: relative;
  width: 100%;
  max-width: 720px;
  margin: auto;                      /* 内容超高时仍能完整滚动，不会被裁掉顶部 */
  padding: 30px 32px 26px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px) saturate(1.25);
  -webkit-backdrop-filter: blur(20px) saturate(1.25);
  overflow: hidden;
}
.panel::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--cyan), var(--purple) 45%, var(--pink) 80%, var(--yellow));
  box-shadow: 0 0 18px rgba(155, 140, 255, .55);
}
.small-panel { max-width: 420px; text-align: center; }
.over-panel { max-width: 560px; }

.title-wrap { text-align: center; }
.title {
  margin: 4px 0 2px;
  font-size: clamp(34px, 6.4vw, 56px);
  font-weight: 900;
  letter-spacing: .06em;
  line-height: 1.05;
  background: linear-gradient(96deg, var(--cyan-deep), var(--purple) 48%, var(--pink));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 14px rgba(130, 170, 255, .5));
}
.subtitle {
  margin: 0;
  font-size: 12px;
  letter-spacing: .42em;
  color: var(--ink-faint);
  font-weight: 700;
  text-transform: uppercase;
}
.tagline { text-align: center; color: var(--ink-soft); font-size: 14px; margin: 12px 0 20px; }

.h2 { margin: 2px 0 6px; font-size: 26px; font-weight: 900; letter-spacing: .04em; }

.best-row {
  text-align: center;
  margin-top: 12px;
  font-size: 13px;
  color: var(--ink-soft);
}
.best-row b {
  font-size: 17px;
  margin-left: 6px;
  color: var(--cyan-deep);
}

.section { margin-top: 22px; }
.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 10px;
}
.section-head .muted { margin-left: auto; }
.link-btn {
  background: none; border: none; padding: 0 2px;
  color: var(--ink-faint); font-size: 12px; font-weight: 700;
  cursor: pointer; text-decoration: underline dotted;
  font-family: var(--font);
}
.link-btn:hover { color: var(--pink); }

.keys-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.key-item {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  font-size: 13px;
  color: var(--ink-soft);
  padding: 9px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .58);
  border: 1px solid rgba(255, 255, 255, .8);
}
kbd {
  display: inline-block;
  min-width: 26px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 800;
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(180deg, #ffffff, #eaf4ff);
  border: 1px solid rgba(53, 216, 255, .5);
  border-bottom-width: 2px;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(118, 138, 205, .18);
  text-align: center;
}

/* 排行榜 */
.lb-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.lb-row {
  display: grid;
  grid-template-columns: 40px 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 9px 13px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .62);
  border: 1px solid rgba(255, 255, 255, .8);
  font-size: 14px;
  transition: transform .18s ease;
}
.lb-row:hover { transform: translateX(3px); }
.lb-rank { font-weight: 800; color: var(--ink-faint); font-size: 13px; }
.lb-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-dist { font-size: 12px; color: var(--ink-faint); }
.lb-score {
  font-weight: 900;
  background: linear-gradient(96deg, var(--cyan-deep), var(--pink));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lb-row.is-new {
  background: linear-gradient(100deg, rgba(214, 245, 255, .95), rgba(255, 224, 245, .95));
  border-color: rgba(255, 111, 216, .6);
  box-shadow: 0 0 20px rgba(255, 111, 216, .35);
  animation: comboPop .45s cubic-bezier(.3, 1.7, .5, 1);
}
.lb-empty { padding: 14px; font-size: 13px; color: var(--ink-faint); text-align: center; }
.lb-list.compact .lb-row { padding: 7px 12px; font-size: 13px; }

/* 按钮 */
.btn {
  font-family: var(--font);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .02em;
  padding: 13px 24px;
  border-radius: 16px;
  border: 1px solid var(--stroke);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform .16s ease, box-shadow .22s ease, filter .2s;
  background: var(--panel-solid);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(118, 138, 205, .32); }
.btn:active { transform: translateY(0) scale(.98); }
.btn.primary {
  color: #fff;
  background: linear-gradient(100deg, var(--cyan) 0%, var(--purple) 52%, var(--pink) 100%);
  border-color: rgba(255, 255, 255, .7);
  box-shadow: 0 12px 30px rgba(155, 140, 255, .45), 0 0 22px rgba(53, 216, 255, .35);
  text-shadow: 0 1px 2px rgba(70, 40, 120, .28);
}
.btn.primary:hover { filter: saturate(1.12) brightness(1.03); }
.btn.primary kbd {
  background: rgba(255, 255, 255, .9);
  border-color: rgba(255, 255, 255, .9);
  color: var(--ink);
}
.btn.ghost {
  background: rgba(255, 255, 255, .55);
  color: var(--ink-soft);
}
.btn.big { width: 100%; padding: 17px 24px; font-size: 17px; margin-top: 6px; }

.btn-col { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.btn-row { display: flex; gap: 12px; margin-top: 20px; }
.btn-row .btn { flex: 1; }

/* 结算面板 */
.result-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 14px;
}
.result {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .6);
  border: 1px solid rgba(255, 255, 255, .85);
  display: flex; flex-direction: column; gap: 3px;
}
.r-label { font-size: 11px; letter-spacing: .1em; color: var(--ink-faint); font-weight: 700; }
.r-value { font-size: 22px; font-weight: 900; }
.badge {
  display: inline-block;
  margin-top: 10px;
  padding: 8px 18px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 14px;
  color: #fff;
  background: linear-gradient(100deg, var(--yellow), var(--pink) 70%);
  box-shadow: 0 8px 24px rgba(255, 183, 94, .45);
  animation: badgeIn .6s cubic-bezier(.3, 1.7, .5, 1);
}
@keyframes badgeIn {
  0% { opacity: 0; transform: scale(.5) rotate(-8deg); }
  70% { transform: scale(1.1) rotate(2deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}
.rank {
  margin-top: 10px;
  font-size: 14px;
  font-weight: 800;
  color: var(--purple);
}
.name-entry {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 18px;
  background: linear-gradient(100deg, rgba(215, 246, 255, .9), rgba(255, 225, 246, .9));
  border: 1.5px solid rgba(255, 111, 216, .45);
  box-shadow: 0 0 22px rgba(155, 140, 255, .25);
}
.name-entry label { display: block; font-size: 12px; font-weight: 800; color: var(--ink-soft); margin-bottom: 8px; }
.name-row { display: flex; gap: 10px; }
.name-row input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  font-size: 16px;
  font-weight: 800;
  font-family: var(--font);
  color: var(--ink);
  border-radius: 14px;
  border: 1.5px solid rgba(53, 216, 255, .5);
  background: rgba(255, 255, 255, .95);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.name-row input:focus {
  border-color: var(--pink);
  box-shadow: 0 0 0 4px rgba(255, 111, 216, .18);
}
.foot-note {
  margin: 18px 0 0;
  font-size: 12px;
  color: var(--ink-faint);
  text-align: center;
  line-height: 1.7;
}

/* 载入 & 转场 */
.loader { text-align: center; }
.loader-ring {
  width: 62px; height: 62px;
  margin: 0 auto 18px;
  border-radius: 50%;
  border: 5px solid rgba(255, 255, 255, .85);
  border-top-color: var(--cyan);
  border-right-color: var(--pink);
  animation: spin .9s linear infinite;
  box-shadow: 0 0 26px rgba(53, 216, 255, .45);
}
@keyframes spin { to { transform: rotate(360deg); } }
#loading-text { font-size: 14px; color: var(--ink-soft); font-weight: 600; }
#loading { background: linear-gradient(160deg, #e6f7ff 0%, #ffeaf7 100%); z-index: 20; }

.fade {
  position: absolute;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(120% 120% at 50% 50%, #ffffff 30%, #eaf6ff 70%, #ffe6f6 100%);
  transition: opacity .24s ease;
}
.fade.on { opacity: 1; }

/* ============================ 触屏手势层 ============================ */
.keys-touch, .touch-only { display: none !important; }
html.is-touch .keys-touch { display: grid !important; }
html.is-touch .keys-desktop { display: none !important; }
html.is-touch .desktop-only { display: none !important; }
html.is-touch .touch-only { display: inline !important; }

/* 整屏都是手势区；z-index 排在 HUD 之下，所以右上角按钮照样能点 */
.touch-ui {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  background: transparent;
  -webkit-tap-highlight-color: transparent;
}

/* 手指跟随光环：转向变青、触发动作变粉并闪出「跳 / 趴」 */
.touch-dot {
  position: absolute;
  left: 0; top: 0;
  width: 84px; height: 84px;
  margin: -42px 0 0 -42px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.9);
  background: radial-gradient(circle, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.05) 72%);
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.45), inset 0 0 16px rgba(255, 255, 255, 0.3);
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s ease, border-color .16s ease, box-shadow .16s ease;
  will-change: transform;
}
.touch-dot.on { opacity: .82; }
.touch-dot.steer {
  border-color: rgba(53, 216, 255, 0.95);
  box-shadow: 0 0 22px rgba(53, 216, 255, 0.6), inset 0 0 18px rgba(53, 216, 255, 0.28);
}
.touch-dot.act {
  border-color: rgba(255, 111, 216, 0.95);
  box-shadow: 0 0 22px rgba(255, 111, 216, 0.6), inset 0 0 18px rgba(255, 111, 216, 0.28);
}
.dot-label {
  font-size: 15px;
  font-weight: 900;
  color: var(--ink);
  text-shadow: 0 1px 4px rgba(255, 255, 255, 0.95);
  opacity: 0;
  transform: scale(.7);
  transition: opacity .12s ease, transform .18s cubic-bezier(.3, 1.7, .5, 1);
}
.touch-dot.flash .dot-label { opacity: 1; transform: scale(1); }

/* 开局提示手势图例，几秒后淡出 */
.gesture-legend {
  position: absolute;
  left: 50%;
  bottom: calc(26px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  display: flex;
  gap: 14px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  white-space: nowrap;
  opacity: 0;
  transition: opacity .5s ease;
  pointer-events: none;
}
.touch-ui.show .gesture-legend { opacity: 1; }
.gesture-legend b { color: var(--cyan-deep); font-weight: 900; }

/* 竖屏提示 */
.rotate-hint {
  position: absolute;
  left: 50%;
  top: calc(19% + env(safe-area-inset-top, 0px));
  transform: translateX(-50%);
  z-index: 9;
  padding: 7px 15px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  white-space: nowrap;
  animation: floatIn 0.4s ease;
}

/* ============================ 响应式 ============================ */
/* 窄屏 / 矮屏（手机横竖屏都覆盖）：整体紧凑化 */
@media (max-width: 900px), (max-height: 560px) {
  .hud-top { padding: 8px 8px 0; gap: 6px; }
  .hud-left, .hud-right { gap: 6px; }
  .hud-card { min-width: 54px; padding: 5px 9px 6px 11px; border-radius: 12px; }
  .hud-card::before { left: 5px; top: 7px; bottom: 7px; width: 2.5px; }
  .hud-label { font-size: 8px; letter-spacing: .08em; }
  .hud-value { font-size: 17px; }
  .hud-value.small { font-size: 12.5px; }
  .hud-value.small i { font-size: 9px; }
  .shield { width: 16px; height: 16px; border-radius: 6px; }
  .shield::after { inset: 4px; }
  .combo { font-size: 11.5px; padding: 5px 10px; border-radius: 11px; }
  .icon-btn { width: 36px; height: 36px; border-radius: 12px; font-size: 13px; }
  #hud-hint {
    font-size: 11px;
    padding: 7px 13px;
    max-width: calc(100vw - 24px);
    white-space: normal;
    text-align: center;
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  }
  #toast { font-size: 13px; padding: 8px 16px; bottom: calc(50% - 18px); }
  #debug { display: none; }
  .gesture-legend { font-size: 11px; padding: 7px 13px; gap: 10px; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
  .touch-dot { width: 74px; height: 74px; margin: -37px 0 0 -37px; }

  .panel { padding: 18px 16px 16px; border-radius: 20px; }
  .title { font-size: clamp(26px, 7.5vw, 40px); }
  .subtitle { font-size: 9.5px; letter-spacing: .28em; }
  .tagline { font-size: 12px; margin: 8px 0 12px; }
  .section { margin-top: 14px; }
  .section-head { font-size: 12.5px; margin-bottom: 8px; }
  .key-item { font-size: 12px; padding: 7px 10px; border-radius: 12px; gap: 5px; }
  .btn { padding: 11px 18px; font-size: 14px; border-radius: 14px; gap: 7px; }
  .btn.big { padding: 14px 18px; font-size: 15px; }
  .best-row { font-size: 12px; margin-top: 8px; }
  .best-row b { font-size: 15px; }
  .lb-row { font-size: 12.5px; padding: 7px 10px; border-radius: 12px; }
  .lb-list.compact .lb-row { padding: 6px 9px; font-size: 12px; }
  .result-grid { gap: 8px; margin-top: 10px; }
  .result { padding: 9px 11px; border-radius: 13px; }
  .r-label { font-size: 10px; }
  .r-value { font-size: 17px; }
  .h2 { font-size: 21px; }
  .badge { font-size: 12.5px; padding: 6px 14px; }
  .name-entry { padding: 11px 12px; border-radius: 15px; }
  .name-row input { padding: 10px 12px; font-size: 15px; }
  .foot-note { font-size: 11px; margin-top: 12px; }
  .screen { padding: 12px 10px; }
}

/* 小手机竖屏：排行榜省掉「距离」列，避免挤成一行 */
@media (max-width: 480px) {
  .lb-row { grid-template-columns: 26px 1fr auto; }
  .lb-dist { display: none; }
}

/* 竖屏手机：HUD 太窄，压缩并舍掉「时速」卡片，保证一排放得下 */
@media (orientation: portrait) and (max-width: 620px) {
  .hud-top { padding: 8px 6px 0; gap: 4px; }
  .hud-left, .hud-right { gap: 4px; flex-wrap: nowrap; }
  .hud-card { min-width: 0; padding: 4px 8px 5px 10px; border-radius: 11px; }
  .hud-card::before { left: 4px; top: 6px; bottom: 6px; width: 2px; }
  .hud-label { font-size: 7px; letter-spacing: .04em; }
  .hud-value { font-size: 15px; }
  .hud-value.small { font-size: 11.5px; }
  .hud-value.small i { display: none; }
  .speed-card { display: none; }
  .shield-card { padding: 4px 8px 5px 10px; }
  .shield { width: 13px; height: 13px; border-radius: 5px; }
  .shield::after { inset: 3px; }
  .combo { font-size: 10.5px; padding: 4px 8px; }
  .icon-btn { width: 32px; height: 32px; border-radius: 10px; font-size: 12px; }
  .rotate-hint { font-size: 11px; padding: 6px 12px; }
}

/* 小手机横屏（高度很矮）：进一步压扁，保证手势区不挡赛道 */
@media (max-height: 430px) {
  .panel { padding: 14px 14px 12px; }
  .title { font-size: clamp(22px, 5.6vw, 32px); }
  .tagline { display: none; }
  .key-item { font-size: 11px; padding: 6px 9px; }
  .btn-row { margin-top: 12px; }
  .lb-row { font-size: 11.5px; padding: 5px 9px; }
  .gesture-legend { font-size: 10px; padding: 6px 11px; gap: 8px; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
  .touch-dot { width: 66px; height: 66px; margin: -33px 0 0 -33px; }
}
