/* ============================================================
   TETRIS · 竖屏移动端
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg: #05070d;
  --ink: #eaf2ff;
  --muted: #8494af;
  --dim: #5a6780;
  --stroke: rgba(148, 163, 184, 0.14);
  --cyan: #22d3ee;
  --cyan-soft: #a5f3fc;
  --violet: #a78bfa;
  --pink: #f472b6;
  --amber: #fbbf24;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --font: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-touch-callout: none;
}

button {
  font-family: inherit;
  color: inherit;
  -webkit-appearance: none;
  appearance: none;
}

button:focus-visible {
  outline: 2px solid rgba(103, 232, 249, 0.8);
  outline-offset: 2px;
}

/* ---------- 背景 ---------- */
.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 50% -10%, #101c33 0%, #070c16 45%, #04060c 100%);
}

.bg-grid {
  position: absolute;
  inset: -10%;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.055) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(70% 60% at 50% 42%, #000 15%, transparent 80%);
  -webkit-mask-image: radial-gradient(70% 60% at 50% 42%, #000 15%, transparent 80%);
  opacity: 0.7;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.5;
  will-change: transform;
}
.orb-a {
  width: 70vw; height: 70vw; max-width: 430px; max-height: 430px;
  background: rgba(8, 145, 178, 0.5);
  top: -18%; left: -24%;
  animation: drift-a 22s ease-in-out infinite alternate;
}
.orb-b {
  width: 82vw; height: 82vw; max-width: 500px; max-height: 500px;
  background: rgba(109, 40, 217, 0.42);
  bottom: -24%; right: -30%;
  animation: drift-b 26s ease-in-out infinite alternate;
}
.orb-c {
  width: 42vw; height: 42vw; max-width: 250px; max-height: 250px;
  background: rgba(190, 24, 93, 0.24);
  top: 40%; right: -18%;
  animation: drift-a 18s ease-in-out infinite alternate-reverse;
}
@keyframes drift-a {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(8%, 6%, 0) scale(1.12); }
}
@keyframes drift-b {
  from { transform: translate3d(0, 0, 0) scale(1.05); }
  to   { transform: translate3d(-7%, -5%, 0) scale(1); }
}

/* ---------- 应用布局 ---------- */
#app {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 100vh;
  height: var(--app-h, 100dvh);
  max-width: 600px;
  margin: 0 auto;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: clamp(6px, 1.4vh, 12px);
  padding: calc(var(--safe-t) + 8px)
           calc(var(--safe-r) + 10px)
           calc(var(--safe-b) + 8px)
           calc(var(--safe-l) + 10px);
  overflow: hidden;
}

/* ---------- 顶部 HUD ---------- */
.hud {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
}

.score-wrap {
  flex: 0 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1;
}

.kicker {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.22em;
  color: var(--dim);
  line-height: 1.2;
}

.score {
  font-size: clamp(19px, 5.8vw, 25px);
  font-weight: 800;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  white-space: nowrap;
  background: linear-gradient(180deg, #ffffff, #b7c6df);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 12px rgba(120, 180, 255, 0.15));
}
.score.bump { animation: score-bump 0.24s ease; }
@keyframes score-bump {
  0% { transform: scale(1); }
  35% { transform: scale(1.09); filter: drop-shadow(0 0 14px rgba(34, 211, 238, 0.6)); }
  100% { transform: scale(1); }
}

.best-line {
  font-size: 8.5px;
  color: var(--muted);
  letter-spacing: 0.12em;
  font-weight: 700;
  white-space: nowrap;
}
.best-line b {
  color: #aab8cf;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.hud-chips {
  margin-left: auto;
  display: flex;
  align-items: stretch;
  padding: 4px 1px;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  background: rgba(15, 22, 36, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 42px;
  padding: 0 5px;
  line-height: 1;
}
.chip + .chip { border-left: 1px solid rgba(148, 163, 184, 0.12); }
.chip b {
  font-size: clamp(12px, 3.6vw, 15px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.hud-tools {
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
}
.icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease, border-color 0.15s ease;
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:active { transform: scale(0.92); background: rgba(255, 255, 255, 0.08); }
.icon-btn:disabled { opacity: 0.32; pointer-events: none; }

.ico-sound-off { display: none; }
body.is-muted .ico-sound-on { display: none; }
body.is-muted .ico-sound-off { display: block; }

/* ---------- 游戏主区域 ---------- */
.field {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(5px, 1.4vw, 10px);
}

.rail {
  flex: 0 0 auto;
  width: clamp(44px, 11.5vw, 62px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(8px, 2vh, 16px);
}

.panel {
  position: relative;
  width: 100%;
  border-radius: 13px;
  border: 1px solid var(--stroke);
  background: linear-gradient(180deg, rgba(20, 29, 47, 0.82), rgba(9, 14, 24, 0.82));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  padding: 7px 5px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  transition: opacity 0.2s ease;
}

.panel-title {
  margin: 0;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.2em;
  color: var(--dim);
  line-height: 1;
}

.mini-wrap {
  width: 100%;
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mini { display: block; border-radius: 4px; }

.next-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.next-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.combo-panel { gap: 3px; }
.combo-value {
  font-size: clamp(14px, 4vw, 18px);
  font-weight: 800;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  transition: color 0.2s ease, text-shadow 0.2s ease;
}
.combo-panel.is-active .combo-value {
  color: var(--amber);
  text-shadow: 0 0 14px rgba(251, 191, 36, 0.45);
}

.panel.is-pulsing { animation: panel-pulse 0.32s ease; }
@keyframes panel-pulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.06); border-color: rgba(34, 211, 238, 0.5); }
  100% { transform: scale(1); }
}

.board-stage {
  flex: 1 1 auto;
  min-width: 0;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.board-frame {
  position: relative;
  padding: 5px;
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.02) 42%, rgba(255, 255, 255, 0.06));
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 0 34px rgba(34, 211, 238, 0.07);
  will-change: transform;
}
.board-frame::before {
  content: "";
  position: absolute;
  inset: -28px -20px;
  border-radius: 36px;
  background: radial-gradient(50% 45% at 50% 50%, rgba(34, 211, 238, 0.16), transparent 72%);
  filter: blur(12px);
  z-index: -1;
  pointer-events: none;
}
.board-frame.shake { animation: board-shake 0.2s ease; }
@keyframes board-shake {
  0%, 100% { transform: translate3d(0, 0, 0); }
  20% { transform: translate3d(-2px, 1px, 0); }
  40% { transform: translate3d(2px, -1px, 0); }
  60% { transform: translate3d(-1px, 2px, 0); }
  80% { transform: translate3d(1px, -1px, 0); }
}

#board {
  display: block;
  width: 220px;
  height: 440px;
  border-radius: 11px;
  background: #070b14;
  touch-action: none;
  cursor: grab;
}

/* ---------- 飘字 ---------- */
.toasts {
  position: absolute;
  left: 0;
  right: 0;
  top: 9%;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  pointer-events: none;
}
.toast {
  font-size: clamp(15px, 4.6vw, 22px);
  font-weight: 900;
  letter-spacing: 0.14em;
  color: #fff;
  white-space: nowrap;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.65);
  animation: toast-rise 0.95s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}
.toast.tetris {
  color: var(--cyan-soft);
  text-shadow: 0 0 22px rgba(34, 211, 238, 0.85), 0 2px 8px #000;
}
.toast.tspin {
  color: #ddd6fe;
  text-shadow: 0 0 22px rgba(167, 139, 250, 0.9), 0 2px 8px #000;
}
.toast.combo {
  font-size: clamp(12px, 3.8vw, 16px);
  color: #fde68a;
  text-shadow: 0 0 20px rgba(251, 191, 36, 0.8), 0 2px 8px #000;
}
.toast.perfect {
  color: #fff;
  text-shadow: 0 0 26px rgba(255, 255, 255, 0.9), 0 0 44px rgba(34, 211, 238, 0.85);
}
.toast.levelup {
  color: #d9f99d;
  text-shadow: 0 0 20px rgba(163, 230, 53, 0.8), 0 2px 8px #000;
}
@keyframes toast-rise {
  0% { opacity: 0; transform: translateY(12px) scale(0.9); }
  16% { opacity: 1; transform: translateY(0) scale(1.04); }
  30% { transform: translateY(-2px) scale(1); }
  72% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-28px) scale(0.98); }
}

/* ---------- 底部触控 ---------- */
.controls {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(6px, 1.6vw, 10px);
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding-bottom: 2px;
}

.pad-btn {
  height: clamp(46px, 7.6vh, 60px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 15px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.015));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 6px 18px rgba(0, 0, 0, 0.25);
  color: var(--ink);
  cursor: pointer;
  touch-action: none;
  user-select: none;
  transition: transform 0.07s ease, box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.pad-btn svg {
  width: clamp(18px, 5vw, 22px);
  height: clamp(18px, 5vw, 22px);
  pointer-events: none;
}
.pad-label {
  font-size: clamp(8px, 2.4vw, 10px);
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--muted);
  pointer-events: none;
}
.pad-btn.is-down {
  transform: scale(0.94);
  background: linear-gradient(180deg, rgba(34, 211, 238, 0.2), rgba(34, 211, 238, 0.06));
  border-color: rgba(34, 211, 238, 0.55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 0 22px rgba(34, 211, 238, 0.25);
}
.pad-btn.rotate {
  background: linear-gradient(180deg, rgba(34, 211, 238, 0.16), rgba(34, 211, 238, 0.03));
  border-color: rgba(34, 211, 238, 0.3);
}
.pad-btn.rotate svg { color: var(--cyan-soft); }
.pad-btn:disabled { opacity: 0.38; cursor: not-allowed; }
.pad-btn.hard {
  grid-column: 1 / -1;
  background: linear-gradient(180deg, rgba(244, 114, 182, 0.16), rgba(244, 114, 182, 0.035));
  border-color: rgba(244, 114, 182, 0.3);
}
.pad-btn.hard svg { color: #fbcfe8; }

/* ---------- 弹层 ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--safe-t) + 20px) 20px calc(var(--safe-b) + 20px);
  background: rgba(3, 5, 11, 0.66);
  backdrop-filter: blur(16px) saturate(130%);
  -webkit-backdrop-filter: blur(16px) saturate(130%);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s ease, visibility 0.28s ease;
  overflow: hidden;
}
.overlay.is-open { opacity: 1; visibility: visible; }

.overlay-card {
  width: 100%;
  max-width: 356px;
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: clamp(20px, 4.2vh, 30px) clamp(18px, 5vw, 26px);
  border-radius: 26px;
  text-align: center;
  background: linear-gradient(165deg, rgba(26, 36, 58, 0.94), rgba(8, 12, 22, 0.97));
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.09);
  transform: translateY(16px) scale(0.97);
  transition: transform 0.3s cubic-bezier(0.16, 0.8, 0.3, 1.15);
  scrollbar-width: none;
}
.overlay-card::-webkit-scrollbar { display: none; }
.overlay.is-open .overlay-card { transform: none; }

.logo-wrap { position: relative; margin-bottom: 16px; }
.logo-zh {
  margin: 0 0 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6em;
  text-indent: 0.6em;
  color: var(--muted);
}
.logo-en {
  margin: 0;
  font-size: clamp(42px, 15vw, 60px);
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: 0.06em;
  text-indent: 0.06em;
  background: linear-gradient(180deg, #e8fdff 0%, #67e8f9 38%, #22d3ee 60%, #6366f1 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 6px 26px rgba(34, 211, 238, 0.32));
}
.tagline {
  margin: 8px 0 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-indent: 0.28em;
  color: var(--dim);
}

.best-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(251, 191, 36, 0.24);
  background: rgba(251, 191, 36, 0.07);
  color: #fcd34d;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
}
.best-chip b {
  font-size: 14px;
  color: #fef3c7;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.cta {
  width: 100%;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, #22d3ee 0%, #38bdf8 45%, #818cf8 100%);
  color: #03121a;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.12em;
  cursor: pointer;
  box-shadow: 0 12px 32px rgba(34, 211, 238, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: transform 0.08s ease, box-shadow 0.2s ease;
}
.cta svg { width: 18px; height: 18px; }
.cta:active {
  transform: scale(0.97);
  box-shadow: 0 6px 18px rgba(34, 211, 238, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.hints {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 20px;
  text-align: left;
}
.hint {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.09);
  background: rgba(255, 255, 255, 0.03);
}
.hint-icon {
  flex: 0 0 auto;
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(34, 211, 238, 0.1);
  color: var(--cyan-soft);
  font-size: 13px;
  font-weight: 700;
}
.hint p {
  margin: 0;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.hint b {
  font-size: 11.5px;
  font-weight: 700;
  color: #dbe6f7;
  white-space: nowrap;
}
.hint small {
  font-size: 10px;
  color: var(--dim);
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.kbd-hint {
  margin: 14px 0 0;
  font-size: 9.5px;
  line-height: 1.7;
  letter-spacing: 0.04em;
  color: var(--dim);
}
.overlay-footer {
  margin-top: 16px;
  display: flex;
  justify-content: center;
}

.sound-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  cursor: pointer;
}
.sound-pill svg { width: 14px; height: 14px; }
.sound-pill:active { transform: scale(0.97); }

.overlay-card.narrow { max-width: 330px; }
.overlay-title {
  margin: 0;
  font-size: 27px;
  font-weight: 900;
  letter-spacing: 0.04em;
}
.over-kicker {
  margin: 0 0 6px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.34em;
  text-indent: 0.34em;
  color: var(--dim);
}
.muted-line {
  margin: 8px 0 20px;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--dim);
}
.btn-row {
  display: flex;
  gap: 9px;
  margin-top: 10px;
}
.btn-row .ghost-btn { flex: 1; }
.ghost-btn {
  height: 44px;
  padding: 0 14px;
  border-radius: 13px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.03);
  color: #b9c6dc;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease;
}
.ghost-btn:active { transform: scale(0.97); background: rgba(255, 255, 255, 0.06); }
.ghost-btn.wide { width: 100%; margin-top: 10px; }

.final-score {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 14px 0 6px;
}
.final-score span {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-indent: 0.24em;
  color: var(--dim);
}
.final-score b {
  font-size: clamp(36px, 11vw, 48px);
  font-weight: 900;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #ffffff, #8ea5c6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.new-best {
  display: inline-block;
  margin-top: 4px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(251, 191, 36, 0.3);
  background: rgba(251, 191, 36, 0.12);
  color: #fde68a;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
  animation: best-pulse 1.4s ease-in-out infinite;
}
.new-best[hidden] { display: none; }
@keyframes best-pulse {
  0%, 100% { box-shadow: 0 0 0 rgba(251, 191, 36, 0); }
  50% { box-shadow: 0 0 22px rgba(251, 191, 36, 0.25); }
}
.summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 18px 0 20px;
}
.summary > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 4px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.09);
  background: rgba(255, 255, 255, 0.03);
}
.summary span {
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--dim);
}
.summary b {
  font-size: 16px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* ---------- 存档与排行榜 ---------- */
.start-actions {
  display: flex;
  gap: 9px;
  margin-top: 10px;
}
.start-actions .continue-btn {
  flex: 1 1 auto;
  height: auto;
  min-height: 44px;
  padding: 6px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-color: rgba(34, 211, 238, 0.3);
  background: rgba(34, 211, 238, 0.08);
  color: #a5f3fc;
}
.start-actions .continue-btn b { font-size: 12.5px; letter-spacing: 0.1em; }
.start-actions .continue-btn small {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.start-actions .continue-btn[hidden] { display: none; }
.start-actions .continue-btn[hidden] + #btn-ranks { flex: 1 1 auto; }
.start-actions #btn-ranks { flex: 0 0 auto; min-width: 92px; }

.rank-note {
  display: block;
  width: -moz-fit-content;
  width: fit-content;
  margin: 6px auto 0;
  animation: none;
  border-color: rgba(34, 211, 238, 0.32);
  background: rgba(34, 211, 238, 0.12);
  color: #a5f3fc;
}

.rank-list {
  list-style: none;
  margin: 0 0 6px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  text-align: left;
}
.rank-row {
  display: grid;
  grid-template-columns: 30px auto 1fr;
  grid-template-areas: "num score meta" "num score time";
  align-items: center;
  gap: 2px 9px;
  padding: 8px 11px;
  border-radius: 13px;
  border: 1px solid rgba(148, 163, 184, 0.1);
  background: rgba(255, 255, 255, 0.03);
}
.rank-row.is-new {
  border-color: rgba(34, 211, 238, 0.42);
  background: rgba(34, 211, 238, 0.1);
  box-shadow: 0 0 18px rgba(34, 211, 238, 0.16);
}
.rank-num {
  grid-area: num;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: rgba(148, 163, 184, 0.14);
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.rank-row:nth-child(1) .rank-num { background: rgba(251, 191, 36, 0.22); color: #fef3c7; }
.rank-row:nth-child(2) .rank-num { background: rgba(203, 213, 225, 0.18); color: #e2e8f0; }
.rank-row:nth-child(3) .rank-num { background: rgba(251, 146, 60, 0.18); color: #fed7aa; }
.rank-score {
  grid-area: score;
  font-size: 16px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #eaf2ff;
  letter-spacing: 0.02em;
}
.rank-meta {
  grid-area: meta;
  justify-self: end;
  font-size: 9.5px;
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: nowrap;
}
.rank-time {
  grid-area: time;
  justify-self: end;
  font-size: 9px;
  letter-spacing: 0.04em;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.rank-empty {
  display: block;
  padding: 20px 12px;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--dim);
}

/* ---------- 横屏提示 ---------- */
.rotate-hint {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 80;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  background: rgba(4, 7, 13, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.rotate-hint p {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.1em;
}
.rotate-hint small {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--dim);
}
.rotate-phone {
  width: 44px;
  height: 70px;
  border: 2px solid rgba(165, 243, 252, 0.65);
  border-radius: 9px;
  position: relative;
  animation: rotate-phone 2.2s ease-in-out infinite;
}
.rotate-phone::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 5px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(165, 243, 252, 0.8);
  transform: translateX(-50%);
}
@keyframes rotate-phone {
  0%, 20% { transform: rotate(0deg); }
  60%, 100% { transform: rotate(90deg); }
}

.noscript {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #05070d;
  color: var(--ink);
  font-size: 14px;
  text-align: center;
}

/* ---------- 响应式 ---------- */
@media (pointer: coarse) {
  .kbd-hint { display: none; }
}

@media (max-height: 700px) {
  #app { gap: 6px; padding-top: calc(var(--safe-t) + 6px); padding-bottom: calc(var(--safe-b) + 6px); }
  .hud { min-height: 40px; }
  .score { font-size: 20px; }
  .pad-btn { height: 46px; }
  .hints { gap: 6px; margin-top: 16px; }
  .hint { padding: 7px 10px; }
  .overlay-card { padding-top: 20px; padding-bottom: 20px; }
  .logo-wrap { margin-bottom: 12px; }
}

@media (max-height: 620px) {
  .combo-panel { display: none; }
  .hint { padding: 6px 10px; }
  .hints { margin-top: 12px; }
  .cta { height: 48px; }
}

@media (max-width: 350px) {
  .rail { width: 44px; }
  .hud-chips { border-radius: 10px; }
  .chip { min-width: 38px; padding: 0 3px; }
  .icon-btn { width: 31px; height: 31px; }
  .pad-label { letter-spacing: 0.08em; }
  .hint b { font-size: 11px; }
}

@media (orientation: landscape) and (pointer: coarse) and (max-height: 560px) {
  .rotate-hint { display: flex; }
}

@media (prefers-reduced-motion: reduce) {
  .orb { animation: none; }
  .board-frame.shake { animation: none; }
  .new-best { animation: none; }
  .rotate-phone { animation: none; transform: rotate(90deg); }
  .score.bump { animation: none; }
}

/* ---------- 经验、手牌与升级选卡 ---------- */
.rogue-hud { flex: 0 0 auto; padding: 0 3px; }
.hazard-info { font-size: 9px; color: #99a8c0; margin-top: 5px; }
.xp-caption { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 10px; color: #b3c3dc; }
.xp-caption b { color: #a5f3fc; font-variant-numeric: tabular-nums; }
.xp-track { height: 5px; margin-top: 5px; overflow: hidden; border-radius: 8px; background: #18233b; }
.xp-track > span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #22d3ee, #a78bfa); transition: width .25s ease; }
.passive-list { display: flex; align-items: center; gap: 5px; overflow-x: auto; white-space: nowrap; min-height: 24px; max-width: 100%; font-size: 9px; color: #8494af; scrollbar-width: thin; }
.passive-badge { padding: 3px 6px; border: 1px solid var(--rarity); border-radius: 5px; color: var(--rarity); }
.rarity-white { --rarity: #d0dbea; --rarity-bg: rgba(208,219,234,.07); }
.rarity-blue { --rarity: #60b5ff; --rarity-bg: rgba(59,130,246,.13); }
.rarity-gold { --rarity: #fbd572; --rarity-bg: rgba(251,191,36,.12); }
.draft-panel { max-width: 760px; padding: 26px; }
.draft-panel .overlay-title { font-size: 25px; }
.draft-panel .muted-line { margin-bottom: 18px; }
.card-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; text-align: left; }
.draft-card { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; min-height: 280px; padding: 20px 16px; border-radius: 16px; border: 1px solid var(--rarity); background: linear-gradient(155deg, var(--rarity-bg), rgba(6,11,20,.85)); box-shadow: inset 0 1px 0 rgba(255,255,255,.07); text-align: left; cursor: pointer; transition: transform .18s ease, box-shadow .18s ease; }
.draft-card:hover, .draft-card:focus-visible { transform: translateY(-4px); box-shadow: 0 8px 28px var(--rarity-bg); }
.card-meta { font-size: 10px; color: var(--rarity); letter-spacing: .04em; }
.card-icon { color: var(--rarity); font-size: 36px; line-height: 1; }
.draft-card strong { font-size: 20px; letter-spacing: .04em; color: #f0f6ff; }
.card-desc { font-size: 12px; color: #aebed5; line-height: 1.8; }
.card-pick { margin-top: auto; font-size: 11px; color: var(--rarity); padding-top: 8px; }
.rarity-note { margin: 18px 0 0; color: #8b9bb5; font-size: 10px; line-height: 1.8; }
.shape-choice { display: flex; flex-direction: column; align-items: center; gap: 8px; min-height: 92px; padding: 12px; background: rgba(255,255,255,.04); border: 1px solid var(--piece-color); border-radius: 12px; cursor: pointer; color: var(--piece-color); }
.shape-choice canvas { width: 72px; height: 45px; }
.card-choices > .ghost-btn { grid-column: 1 / -1; }

@media (max-width: 600px) {
  #app { gap: 7px; }
  .draft-panel { padding: 22px 16px; max-width: 390px; }
  .draft-panel .overlay-title { font-size: 22px; }
  .card-choices { grid-template-columns: 1fr; gap: 9px; }
  .draft-card { display: grid; grid-template-columns: 38px 1fr; gap: 5px 12px; min-height: 120px; padding: 13px 15px; }
  .card-meta { grid-column: 2; font-size: 9px; }
  .card-icon { grid-column: 1; grid-row: 1 / 4; align-self: center; text-align: center; font-size: 31px; }
  .draft-card strong { grid-column: 2; font-size: 17px; }
  .card-desc { grid-column: 2; font-size: 11px; line-height: 1.6; }
  .card-pick { grid-column: 2; padding-top: 3px; font-size: 10px; }
  .card-choices:has(.shape-choice) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .shape-choice { padding: 10px 3px; font-size: 11px; }
  .rarity-note { margin-top: 12px; font-size: 9px; }
}
@media (max-height: 700px) {
  #app { gap: 5px; }
  .passive-list { min-height: 20px; }
  .draft-panel { padding-top: 16px; padding-bottom: 16px; }
  .draft-panel .muted-line { margin: 5px 0 12px; }
  .draft-card { min-height: 104px; gap: 4px 10px; }
}
