:root {
  --ink: #04100b;
  --ink-2: #071a12;
  --cream: #f4f1e4;
  --mint: #7dffc4;
  --mint-deep: #2bd694;
  --lime: #dcff79;
  --coral: #ff5c67;
  --gold: #ffd166;
  --line: rgba(205, 255, 230, 0.16);
  --line-strong: rgba(205, 255, 230, 0.28);
  --muted: rgba(232, 249, 240, 0.58);
  --serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #020604;
  color: var(--cream);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse at 50% 45%, #0a1d15 0%, #030906 58%, #010302 100%);
}

button {
  font: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 3px;
}

.app {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 0;
}

.stage {
  position: relative;
  width: min(96vw, calc(92vh * 16 / 9), 1680px);
  aspect-ratio: 16 / 9;
  max-height: 100vh;
  overflow: hidden;
  isolation: isolate;
  border-radius: clamp(16px, 2vw, 30px);
  border: 1px solid rgba(198, 255, 226, 0.13);
  background: #06110c;
  box-shadow:
    0 50px 130px rgba(0, 0, 0, 0.72),
    0 0 0 1px rgba(0, 0, 0, 0.5) inset,
    0 0 120px rgba(39, 198, 139, 0.06);
  user-select: none;
  touch-action: none;
}

/* 未开摄像头时的舞台背景 */
.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(circle at 79% 15%, rgba(255, 92, 103, 0.16), transparent 25%),
    radial-gradient(circle at 14% 86%, rgba(83, 255, 190, 0.13), transparent 34%),
    radial-gradient(circle at 52% 45%, rgba(23, 67, 50, 0.85), transparent 65%),
    repeating-linear-gradient(90deg, transparent 0 79px, rgba(220, 255, 236, 0.022) 80px),
    repeating-linear-gradient(0deg, transparent 0 79px, rgba(220, 255, 236, 0.018) 80px),
    linear-gradient(150deg, #0a2118 0%, #05120c 55%, #020705 100%);
}

.stage::after {
  content: "果";
  position: absolute;
  z-index: 0;
  right: -0.08em;
  bottom: -0.28em;
  font-family: var(--serif);
  font-size: clamp(300px, 44vw, 780px);
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px rgba(194, 255, 222, 0.06);
  pointer-events: none;
  transform: rotate(-4deg);
}

.camera {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  filter: saturate(0.86) contrast(1.06) brightness(0.76);
  opacity: 0;
  transition: opacity 0.9s ease;
}

.stage.live .camera { opacity: 1; }

.camera-shade {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(2, 8, 5, 0.64) 0%, rgba(2, 8, 5, 0.1) 26%, rgba(2, 8, 5, 0.04) 55%, rgba(2, 8, 5, 0.62) 100%),
    radial-gradient(ellipse at 50% 45%, transparent 42%, rgba(1, 5, 3, 0.58) 100%);
  opacity: 0;
  transition: opacity 0.9s ease;
}

.stage.live .camera-shade { opacity: 1; }

.game {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.grain {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0.075;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
}

.edge {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  border-radius: inherit;
  box-shadow:
    inset 0 0 100px rgba(0, 0, 0, 0.35),
    inset 0 0 0 1px rgba(224, 255, 240, 0.04);
}

/* ---------- HUD ---------- */
.hud {
  position: absolute;
  top: clamp(14px, 2.3vw, 30px);
  left: clamp(16px, 2.8vw, 40px);
  right: clamp(16px, 2.8vw, 40px);
  z-index: 5;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.stage.playing .hud,
.stage.paused .hud,
.stage.over .hud {
  opacity: 1;
  transform: none;
}

.hud-card {
  position: relative;
  min-width: clamp(88px, 9vw, 128px);
  padding: 9px clamp(13px, 1.5vw, 20px) 11px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(11, 34, 25, 0.72), rgba(4, 14, 10, 0.42));
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(16px) saturate(1.1);
}

.score-card::before {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--mint), transparent);
  opacity: 0.6;
}

.hud-label {
  display: block;
  margin-bottom: 4px;
  font-size: clamp(8px, 0.68vw, 10px);
  font-weight: 600;
  letter-spacing: 0.24em;
  color: rgba(206, 255, 230, 0.55);
}

.num {
  display: block;
  font-size: clamp(24px, 2.75vw, 42px);
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--cream);
  text-shadow: 0 0 24px rgba(125, 255, 196, 0.14);
}

.hud-right {
  display: flex;
  align-items: flex-start;
  gap: clamp(10px, 1.4vw, 18px);
}

.lives {
  display: flex;
  gap: 5px;
  height: 34px;
  padding: 8px 11px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(4, 14, 10, 0.44);
  backdrop-filter: blur(12px);
}

.life {
  width: clamp(14px, 1.25vw, 18px);
  height: clamp(14px, 1.25vw, 18px);
  color: var(--coral);
  filter: drop-shadow(0 0 7px rgba(255, 92, 103, 0.45));
  transition: transform 0.25s ease, opacity 0.25s ease, color 0.25s ease;
}

.life svg { display: block; width: 100%; height: 100%; fill: currentColor; }
.life.lost { color: rgba(255, 255, 255, 0.15); filter: none; transform: scale(0.82); }

.timer-card { text-align: right; }
.timer-card .num { color: var(--lime); }
.timer-card.low .num { color: var(--coral); animation: timerPulse 1s ease-in-out infinite; }

.combo-pill {
  position: absolute;
  top: clamp(8px, 1vw, 16px);
  left: 50%;
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 8px 16px 9px;
  border: 1px solid rgba(220, 255, 121, 0.35);
  border-radius: 999px;
  background: rgba(19, 38, 20, 0.64);
  box-shadow: 0 0 28px rgba(220, 255, 121, 0.14);
  backdrop-filter: blur(14px);
  color: var(--lime);
  opacity: 0;
  transform: translate(-50%, -8px) scale(0.9);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.combo-pill.show {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.combo-pill span {
  font-size: 10px;
  letter-spacing: 0.18em;
  color: rgba(233, 255, 181, 0.7);
}

.combo-pill b {
  font-size: clamp(20px, 1.8vw, 28px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.combo-pill i {
  font-style: normal;
  font-size: 12px;
  opacity: 0.7;
}

/* ---------- 状态与底部 ---------- */
.status-pill {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: clamp(58px, 7.5vh, 82px);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border: 1px solid rgba(205, 255, 230, 0.13);
  border-radius: 999px;
  background: rgba(3, 12, 8, 0.48);
  backdrop-filter: blur(12px);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted);
  transform: translateX(-50%);
  transition: opacity 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
}

.stage.idle .status-pill { opacity: 0; }

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 10px var(--mint);
  animation: breathe 2.4s ease-in-out infinite;
}

.status-pill.warn { color: var(--gold); border-color: rgba(255, 209, 102, 0.25); }
.status-pill.warn .status-dot { background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.status-pill.error { color: #ff9ba2; border-color: rgba(255, 92, 103, 0.3); }
.status-pill.error .status-dot { background: var(--coral); box-shadow: 0 0 10px var(--coral); animation: none; }

.stage-foot {
  position: absolute;
  z-index: 6;
  left: clamp(16px, 2.4vw, 34px);
  right: clamp(16px, 2.4vw, 34px);
  bottom: clamp(14px, 2vh, 24px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.foot-left { display: flex; gap: 8px; pointer-events: auto; }
.foot-right { display: flex; align-items: center; gap: 12px; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(205, 255, 230, 0.14);
  border-radius: 50%;
  background: rgba(4, 14, 10, 0.4);
  color: rgba(232, 249, 240, 0.7);
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: color 0.2s, border-color 0.2s, background 0.2s, opacity 0.2s;
}

.icon-btn:hover { color: var(--cream); border-color: var(--line-strong); background: rgba(14, 35, 26, 0.66); }
.icon-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn svg path:first-child { fill: currentColor; stroke: none; }
.icon-btn.muted .sound-wave { opacity: 0.2; }
#pauseBtn { opacity: 0.35; pointer-events: none; }
.stage.playing #pauseBtn { opacity: 1; pointer-events: auto; }
.stage.paused #pauseBtn { opacity: 1; pointer-events: auto; }

.engine-label,
.fps {
  font-size: 9px;
  letter-spacing: 0.18em;
  color: rgba(220, 255, 235, 0.3);
  font-variant-numeric: tabular-nums;
}

.fps {
  min-width: 86px;
  text-align: right;
  letter-spacing: 0.08em;
  color: rgba(220, 255, 235, 0.68);
  white-space: nowrap;
}

/* ---------- 开始界面 ---------- */
.screen {
  position: absolute;
  inset: 0;
  z-index: 6;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.start-screen {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.72fr);
  align-items: center;
  gap: clamp(24px, 4vw, 72px);
  padding: clamp(28px, 5.2vw, 84px) clamp(26px, 5.4vw, 88px) clamp(46px, 6vh, 70px);
  background:
    linear-gradient(90deg, rgba(2, 9, 6, 0.9) 0%, rgba(2, 9, 6, 0.62) 48%, rgba(2, 9, 6, 0.18) 100%),
    linear-gradient(0deg, rgba(2, 7, 5, 0.62) 0%, transparent 34%);
}

.start-copy {
  position: relative;
  z-index: 1;
  max-width: 650px;
  animation: riseIn 0.9s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: clamp(9px, 0.78vw, 11px);
  font-weight: 600;
  letter-spacing: 0.28em;
  color: rgba(152, 255, 209, 0.72);
  white-space: nowrap;
}

.eyebrow-line {
  width: clamp(24px, 3vw, 44px);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--mint));
  opacity: 0.8;
}

.logo {
  display: flex;
  align-items: flex-start;
  gap: 0.02em;
  margin: clamp(12px, 1.8vw, 22px) 0 clamp(12px, 1.4vw, 18px);
  font-family: var(--serif);
  font-size: clamp(84px, 11.6vw, 184px);
  font-weight: 900;
  line-height: 0.86;
  letter-spacing: -0.09em;
}

.logo > span:first-child {
  color: var(--cream);
  text-shadow: 0 12px 50px rgba(0, 0, 0, 0.4);
}

.logo-accent {
  position: relative;
  color: transparent;
  background: linear-gradient(150deg, #eaffb0 0%, var(--mint) 45%, #1fc98b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 0 34px rgba(90, 255, 190, 0.25));
}

.logo-accent::after {
  content: "";
  position: absolute;
  left: 12%;
  right: 0;
  bottom: 6%;
  height: 3px;
  border-radius: 50%;
  background: linear-gradient(90deg, transparent, var(--mint), transparent);
  opacity: 0.55;
  transform: rotate(-2deg);
}

.tagline {
  margin: 0 0 clamp(22px, 3.2vh, 36px);
  font-size: clamp(14px, 1.25vw, 19px);
  line-height: 1.9;
  letter-spacing: 0.06em;
  color: rgba(235, 250, 241, 0.68);
}

.start-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.camera-setup {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin: clamp(14px, 2vh, 22px) 0 0;
}

.setup-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.setup-field > span {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: rgba(174, 242, 211, 0.58);
}

.setup-field select {
  min-width: 148px;
  max-width: 230px;
  height: 34px;
  padding: 0 28px 0 11px;
  border: 1px solid rgba(181, 255, 222, 0.22);
  border-radius: 9px;
  color: rgba(238, 255, 247, 0.9);
  background: rgba(8, 24, 17, 0.78);
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.03em;
  outline: none;
  cursor: pointer;
}

.setup-field select:focus {
  border-color: rgba(125, 255, 196, 0.6);
  box-shadow: 0 0 0 3px rgba(125, 255, 196, 0.1);
}

.setup-field select option { background: #07130e; color: #e8fff4; }

.setup-refresh {
  height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(181, 255, 222, 0.2);
  border-radius: 9px;
  color: rgba(202, 255, 231, 0.72);
  background: rgba(8, 24, 17, 0.5);
  font: inherit;
  font-size: 10px;
  letter-spacing: 0.12em;
  cursor: pointer;
}

.setup-refresh:hover {
  color: #e9fff5;
  border-color: rgba(125, 255, 196, 0.5);
}

.setup-refresh:disabled { opacity: 0.5; cursor: wait; }

.mode-hint {
  margin: 9px 0 0;
  font-size: clamp(9px, 0.75vw, 11px);
  line-height: 1.5;
  letter-spacing: 0.03em;
  color: rgba(174, 242, 211, 0.55);
}

.practice-toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 12px 0 0;
  padding: 7px 11px 7px 9px;
  border: 1px solid rgba(181, 255, 222, 0.18);
  border-radius: 9px;
  background: rgba(8, 24, 17, 0.46);
  color: rgba(222, 255, 241, 0.82);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.practice-toggle:hover {
  border-color: rgba(125, 255, 196, 0.46);
  background: rgba(10, 32, 22, 0.62);
}

.practice-toggle input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: #7dffc4;
  cursor: pointer;
}

.practice-toggle span {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  font-size: clamp(9px, 0.75vw, 11px);
  letter-spacing: 0.02em;
}

.practice-toggle b {
  color: #c9ffe6;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.practice-toggle em {
  font-style: normal;
  color: rgba(174, 242, 211, 0.55);
}

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: clamp(46px, 4.2vw, 56px);
  padding: 0 clamp(20px, 2.1vw, 30px);
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: clamp(13px, 1vw, 15px);
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.btn:active { transform: translateY(1px) scale(0.99); }
.btn:disabled,
.btn:disabled:hover {
  opacity: 0.38;
  cursor: not-allowed;
  filter: grayscale(0.7);
  transform: none;
  box-shadow: none;
}

.btn.primary {
  color: #042016;
  background: linear-gradient(135deg, #d8ff9d 0%, #7dffc4 48%, #38e3a4 100%);
  box-shadow: 0 12px 40px rgba(56, 227, 164, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 54px rgba(56, 227, 164, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.btn.ghost {
  color: rgba(238, 252, 244, 0.82);
  border-color: rgba(205, 255, 230, 0.2);
  background: rgba(9, 25, 18, 0.32);
  backdrop-filter: blur(12px);
}

.btn.ghost:hover {
  color: var(--cream);
  border-color: rgba(205, 255, 230, 0.4);
  background: rgba(17, 41, 30, 0.6);
}

.cam-icon {
  position: relative;
  width: 17px;
  height: 12px;
  border: 1.6px solid currentColor;
  border-radius: 3px;
}

.cam-icon::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 5px;
  width: 5px;
  height: 5px;
  border: 1.4px solid currentColor;
  border-radius: 50%;
}

.cam-icon::after {
  content: "";
  position: absolute;
  top: 2px;
  right: -4px;
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
  border-left: 4px solid currentColor;
}

.privacy {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: clamp(14px, 2vh, 20px) 0 0;
  font-size: clamp(9px, 0.75vw, 11px);
  letter-spacing: 0.04em;
  color: rgba(215, 243, 229, 0.42);
}

.lock-icon {
  position: relative;
  width: 9px;
  height: 7px;
  border: 1px solid currentColor;
  border-radius: 1.5px;
}

.lock-icon::before {
  content: "";
  position: absolute;
  left: 1px;
  bottom: 5px;
  width: 5px;
  height: 5px;
  border: 1px solid currentColor;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
}

.how-card {
  position: relative;
  justify-self: end;
  width: min(100%, 360px);
  padding: clamp(22px, 2.3vw, 32px);
  border: 1px solid rgba(205, 255, 230, 0.14);
  border-radius: clamp(18px, 1.8vw, 26px);
  background:
    linear-gradient(160deg, rgba(15, 40, 29, 0.64), rgba(4, 14, 9, 0.46));
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(20px) saturate(1.1);
  overflow: hidden;
  animation: riseIn 1s 0.1s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.how-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 12%;
  right: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(125, 255, 196, 0.55), transparent);
}

.how-kicker {
  display: block;
  margin-bottom: 18px;
  font-size: 9px;
  letter-spacing: 0.26em;
  color: rgba(152, 255, 209, 0.5);
}

.how-list {
  display: grid;
  gap: clamp(12px, 1.6vh, 18px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.how-list li {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 10px;
  align-items: start;
}

.how-list b {
  padding-top: 2px;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--mint);
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}

.how-list strong {
  display: block;
  margin-bottom: 3px;
  font-size: clamp(12px, 0.9vw, 14px);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(245, 252, 247, 0.9);
}

.how-list span {
  display: block;
  font-size: clamp(10px, 0.72vw, 11.5px);
  line-height: 1.55;
  color: rgba(218, 242, 229, 0.42);
}

.how-foot {
  margin-top: clamp(18px, 2.4vh, 26px);
  padding-top: 16px;
  border-top: 1px solid rgba(205, 255, 230, 0.08);
  font-size: 9px;
  letter-spacing: 0.06em;
  color: rgba(215, 243, 229, 0.35);
}

.key {
  display: inline-block;
  min-width: 20px;
  margin: 0 3px 0 8px;
  padding: 2px 5px;
  border: 1px solid rgba(205, 255, 230, 0.14);
  border-radius: 4px;
  text-align: center;
  font-size: 8px;
  color: rgba(235, 250, 241, 0.55);
}

.key:first-child { margin-left: 0; }

.reticle {
  position: absolute;
  top: -40px;
  right: -34px;
  width: 150px;
  height: 150px;
  opacity: 0.5;
  pointer-events: none;
}

.reticle-ring {
  position: absolute;
  border: 1px solid rgba(125, 255, 196, 0.28);
  border-radius: 50%;
}

.ring-a { inset: 20px; border-style: dashed; animation: spin 18s linear infinite; }
.ring-b { inset: 43px; border-color: rgba(125, 255, 196, 0.5); }

.reticle-cross,
.reticle-cross::before {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 46px;
  height: 1px;
  background: rgba(125, 255, 196, 0.36);
  transform: translate(-50%, -50%);
}

.reticle-cross::before {
  content: "";
  width: 1px;
  height: 46px;
  transform: translate(-50%, -50%);
}

.reticle-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 16px var(--mint);
  transform: translate(-50%, -50%);
}

/* ---------- 弹层 ---------- */
.modal-screen {
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2, 8, 5, 0.58);
  backdrop-filter: blur(16px) saturate(0.85);
}

.modal-card {
  position: relative;
  width: min(100%, 470px);
  padding: clamp(28px, 3.6vw, 46px);
  border: 1px solid rgba(205, 255, 230, 0.16);
  border-radius: clamp(20px, 2vw, 28px);
  background:
    radial-gradient(circle at 80% 0%, rgba(125, 255, 196, 0.09), transparent 40%),
    linear-gradient(155deg, rgba(15, 40, 29, 0.95), rgba(4, 13, 9, 0.96));
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  text-align: left;
  animation: modalIn 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.modal-kicker {
  display: block;
  margin-bottom: 12px;
  font-size: 9px;
  letter-spacing: 0.26em;
  color: rgba(152, 255, 209, 0.55);
}

.modal-card h2 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: clamp(32px, 3.4vw, 48px);
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.modal-card > p {
  margin: 0 0 28px;
  font-size: 12.5px;
  line-height: 1.8;
  color: rgba(224, 245, 233, 0.55);
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.modal-actions .btn { min-height: 46px; font-size: 13px; }

.over-card {
  background:
    radial-gradient(circle at 82% 2%, rgba(255, 92, 103, 0.13), transparent 38%),
    linear-gradient(155deg, rgba(31, 20, 20, 0.96), rgba(7, 13, 10, 0.97));
}

.over-card .modal-kicker { color: rgba(255, 146, 153, 0.65); }

.final-score {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 20px 0 22px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(205, 255, 230, 0.1);
}

.final-score span {
  padding-bottom: 9px;
  font-size: 10px;
  letter-spacing: 0.16em;
  color: rgba(218, 242, 229, 0.45);
}

.final-score strong {
  font-size: clamp(52px, 6.6vw, 82px);
  line-height: 0.9;
  font-weight: 600;
  color: var(--lime);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 40px rgba(220, 255, 121, 0.18);
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stats-row div {
  padding: 12px;
  border: 1px solid rgba(205, 255, 230, 0.09);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.stats-row span {
  display: block;
  margin-bottom: 6px;
  font-size: 9px;
  letter-spacing: 0.08em;
  color: rgba(218, 242, 229, 0.4);
}

.stats-row b {
  font-size: clamp(16px, 1.6vw, 22px);
  font-weight: 600;
  color: rgba(245, 252, 247, 0.9);
  font-variant-numeric: tabular-nums;
}

/* ---------- 倒计时 / 闪光 / toast ---------- */
.countdown {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: grid;
  place-items: center;
  pointer-events: none;
  background: radial-gradient(circle, rgba(3, 14, 9, 0.12) 0%, rgba(3, 9, 6, 0.44) 80%);
}

.countdown.hidden { display: none; }

.countdown span {
  font-family: var(--serif);
  font-size: clamp(120px, 17vw, 260px);
  font-weight: 900;
  line-height: 1;
  color: var(--cream);
  text-shadow: 0 0 80px rgba(125, 255, 196, 0.35);
  animation: countPop 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.flash {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  background: #fff;
  opacity: 0;
}

.flash.fire { animation: flash 0.42s ease-out; }
.flash.bomb { background: #ff3b47; animation: flashBomb 0.7s ease-out; }

.toast {
  position: absolute;
  z-index: 9;
  left: 50%;
  bottom: 16%;
  max-width: min(80%, 520px);
  padding: 11px 18px;
  border: 1px solid rgba(255, 92, 103, 0.3);
  border-radius: 12px;
  background: rgba(23, 9, 11, 0.88);
  color: #ffc4c8;
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 12px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
  backdrop-filter: blur(10px);
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

.rotate-hint {
  display: none;
  position: absolute;
  z-index: 10;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  font-size: 9px;
  letter-spacing: 0.08em;
  color: rgba(220, 255, 235, 0.35);
  white-space: nowrap;
}

/* ---------- 动画 ---------- */
@keyframes riseIn {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: none; }
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@keyframes countPop {
  0% { opacity: 0; transform: scale(1.5); filter: blur(8px); }
  30% { opacity: 1; transform: scale(1); filter: blur(0); }
  75% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.92); }
}

@keyframes flash {
  0% { opacity: 0.55; }
  100% { opacity: 0; }
}

@keyframes flashBomb {
  0% { opacity: 0.8; }
  18% { opacity: 0.2; }
  36% { opacity: 0.55; }
  100% { opacity: 0; }
}

@keyframes breathe {
  0%, 100% { opacity: 0.55; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.15); }
}

@keyframes timerPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- 响应式 ---------- */
@media (max-width: 980px) {
  .start-screen {
    grid-template-columns: 1fr;
    padding: 8% 7%;
  }
  .how-card { display: none; }
  .start-copy { max-width: 640px; }
  .logo { font-size: clamp(88px, 17vw, 150px); }
}

@media (max-height: 560px) {
  .logo { font-size: clamp(68px, 10vw, 120px); }
  .tagline { font-size: 13px; margin-bottom: 18px; }
  .start-actions { gap: 8px; }
  .btn { min-height: 42px; }
  .how-card { padding: 18px; }
  .how-list { gap: 9px; }
  .how-foot { display: none; }
  .status-pill { bottom: 46px; }
  .hud-card { padding: 6px 12px 8px; }
}

@media (max-aspect-ratio: 1/1) {
  .stage {
    width: 100vw;
    height: 100vh;
    max-height: none;
    border-radius: 0;
    border: none;
  }
  .rotate-hint { display: block; }
  .start-screen { align-items: start; padding-top: 10vh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   3D 版覆盖层
   ============================================================ */

.stage {
  background: #030906;
}

.stage::before {
  background:
    radial-gradient(circle at 72% 30%, rgba(28, 111, 76, 0.32), transparent 42%),
    radial-gradient(circle at 18% 82%, rgba(255, 92, 103, 0.09), transparent 36%),
    linear-gradient(155deg, #071710 0%, #030b07 58%, #010403 100%);
}

.stage::after {
  display: none;
}

.scene {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  touch-action: none;
}

.camera-shade {
  display: none;
}

/* 摄像头小窗 */
.cam-preview {
  position: absolute;
  z-index: 5;
  top: clamp(76px, 8.2vw, 112px);
  right: clamp(18px, 2.8vw, 40px);
  width: clamp(116px, 12vw, 168px);
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border: 1px solid rgba(190, 255, 222, 0.18);
  border-radius: 14px;
  background: rgba(3, 12, 8, 0.72);
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.36),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  opacity: 0;
  transform: translateY(-6px) scale(0.96);
  transition: opacity 0.5s ease, transform 0.5s ease;
  pointer-events: none;
}

.stage.live .cam-preview {
  opacity: 1;
  transform: none;
}

.cam-preview .camera {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  filter: saturate(0.72) contrast(1.04) brightness(0.82);
  opacity: 1;
}

.cam-preview::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(180deg, rgba(2, 8, 5, 0.08), rgba(2, 8, 5, 0.55)),
    radial-gradient(ellipse at 50% 40%, transparent 42%, rgba(1, 5, 3, 0.36));
  pointer-events: none;
}

.cam-live,
.cam-label {
  position: absolute;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: rgba(224, 255, 238, 0.7);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}

.cam-live {
  top: 7px;
  left: 8px;
}

.cam-live i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 8px var(--coral);
  animation: livePulse 1.6s ease-in-out infinite;
}

.cam-label {
  right: 8px;
  bottom: 6px;
  font-weight: 500;
  letter-spacing: 0.08em;
  opacity: 0.65;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.8); }
}

/* 3D 标题角标 */
.logo {
  display: flex;
  align-items: flex-start;
  gap: 0.02em;
}

.logo-3d {
  margin: 0.5em 0 0 0.42em;
  padding: 0.36em 0.44em;
  border: 1px solid rgba(125, 255, 196, 0.35);
  border-radius: 0.26em;
  font-family: var(--sans);
  font-size: clamp(10px, 1vw, 14px);
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1;
  color: var(--mint);
  background: rgba(125, 255, 196, 0.06);
  box-shadow: 0 0 24px rgba(125, 255, 196, 0.12);
  text-shadow: 0 0 16px rgba(125, 255, 196, 0.4);
}

.start-screen {
  background:
    linear-gradient(90deg, rgba(2, 9, 6, 0.94) 0%, rgba(2, 9, 6, 0.62) 44%, rgba(2, 9, 6, 0.04) 100%),
    linear-gradient(0deg, rgba(2, 7, 5, 0.7) 0%, transparent 38%);
}

.engine-label {
  letter-spacing: 0.18em;
}

.renderer-note {
  margin: 12px 0 0;
  font-size: 10px;
  line-height: 1.5;
  letter-spacing: 0.04em;
  color: rgba(183, 219, 202, 0.72);
}

.renderer-note.warn {
  color: #ffd166;
}

.perf-panel {
  position: absolute;
  z-index: 9;
  top: 96px;
  left: 18px;
  max-width: min(620px, calc(100% - 36px));
  padding: 10px 12px;
  border: 1px solid rgba(125, 255, 196, 0.18);
  border-radius: 10px;
  background: rgba(2, 9, 6, 0.82);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
  line-height: 1.65;
  color: rgba(205, 255, 230, 0.78);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  pointer-events: none;
}

.perf-panel.hidden {
  display: none;
}

@media (max-width: 760px) {
  .cam-preview { display: none; }
  .logo-3d { font-size: 10px; }
  .perf-panel { top: 78px; left: 12px; font-size: 10px; }
}

/* ---------- 右上角快捷操作 / 历史记录 ---------- */
.top-actions {
  position: absolute;
  top: clamp(14px, 2.4vw, 28px);
  right: clamp(16px, 2.8vw, 40px);
  z-index: 8;
  display: flex;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.stage.idle .top-actions {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.top-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid rgba(205, 255, 230, 0.18);
  border-radius: 999px;
  background: rgba(5, 22, 15, 0.72);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(14px) saturate(1.1);
  color: rgba(225, 255, 238, 0.76);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.top-action svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.top-action:hover {
  border-color: rgba(125, 255, 196, 0.55);
  background: rgba(15, 53, 36, 0.86);
  color: var(--mint);
}

.history-screen {
  z-index: 9;
}

.history-card {
  width: min(100%, 620px);
  max-height: min(88vh, 760px);
  display: flex;
  flex-direction: column;
}

.history-summary {
  display: flex;
  gap: 28px;
  margin: 18px 0 4px;
  padding: 12px 0 16px;
  border-bottom: 1px solid rgba(205, 255, 230, 0.1);
}

.history-summary div {
  display: flex;
  align-items: baseline;
  gap: 9px;
}

.history-summary span {
  font-size: 10px;
  letter-spacing: 0.12em;
  color: rgba(224, 245, 233, 0.48);
}

.history-summary b {
  font-family: var(--serif);
  font-size: 26px;
  line-height: 1;
  color: var(--mint);
}

.history-list {
  display: grid;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 50vh;
  gap: 7px;
  margin: 14px -4px 0 0;
  padding-right: 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(125, 255, 196, 0.28) transparent;
}

.history-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border: 1px solid rgba(205, 255, 230, 0.1);
  border-radius: 12px;
  background: rgba(10, 30, 21, 0.48);
}

.history-row.is-best {
  border-color: rgba(125, 255, 196, 0.36);
  background: linear-gradient(100deg, rgba(38, 92, 63, 0.42), rgba(10, 30, 21, 0.42));
}

.history-rank {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 10px;
  color: rgba(183, 219, 202, 0.48);
  text-align: center;
}

.history-body {
  min-width: 0;
}

.history-line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}

.history-score {
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1;
  color: var(--cream);
}

.history-tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
}

.history-tag {
  padding: 2px 6px;
  border: 1px solid rgba(205, 255, 230, 0.13);
  border-radius: 4px;
  color: rgba(183, 219, 202, 0.58);
  font-size: 9px;
  letter-spacing: 0.05em;
}

.history-sub {
  margin-top: 5px;
  overflow: hidden;
  color: rgba(224, 245, 233, 0.42);
  font-size: 10px;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-badge {
  padding: 3px 7px;
  border: 1px solid rgba(125, 255, 196, 0.35);
  border-radius: 999px;
  color: var(--mint);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.history-empty {
  margin: 22px 0 6px;
  padding: 22px 12px;
  border: 1px dashed rgba(205, 255, 230, 0.14);
  border-radius: 12px;
  color: rgba(224, 245, 233, 0.42);
  font-size: 12px;
  text-align: center;
}

.history-card .modal-actions {
  margin-top: 18px;
}

.history-card .modal-actions .btn {
  flex: 1 1 120px;
}

.history-confirm {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
  padding: 13px 14px;
  border: 1px solid rgba(255, 92, 103, 0.34);
  border-radius: 12px;
  background: linear-gradient(120deg, rgba(78, 25, 29, 0.62), rgba(24, 13, 15, 0.55));
}

.history-confirm[hidden] {
  display: none;
}

.history-confirm-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 170px;
}

.history-confirm-copy strong {
  color: #ffd9dc;
  font-size: 12px;
  font-weight: 700;
}

.history-confirm-copy span {
  color: rgba(255, 217, 220, 0.48);
  font-size: 10px;
}

.history-confirm-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.history-confirm-actions .btn {
  min-height: 36px;
  padding: 0 14px;
  font-size: 11.5px;
}

.btn.danger {
  border-color: rgba(255, 92, 103, 0.52);
  background: linear-gradient(160deg, rgba(118, 34, 41, 0.92), rgba(56, 17, 21, 0.94));
  color: #ffe8ea;
  box-shadow: 0 8px 24px rgba(80, 10, 18, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.btn.danger:hover {
  border-color: rgba(255, 120, 130, 0.8);
  background: linear-gradient(160deg, rgba(151, 44, 53, 0.96), rgba(76, 22, 28, 0.96));
}

@media (max-width: 760px) {
  .history-confirm {
    align-items: stretch;
  }
  .history-confirm-actions {
    width: 100%;
    margin-left: 0;
  }
  .history-confirm-actions .btn {
    flex: 1;
  }
}

.history-empty[hidden],
.history-list[hidden] {
  display: none;
}

@media (max-width: 760px) {
  .top-actions { top: 12px; right: 12px; gap: 6px; }
  .top-action { min-height: 31px; padding: 0 10px; font-size: 10.5px; }
  .top-action svg { width: 13px; height: 13px; }
  .history-card { padding: 22px 18px; }
  .history-summary { gap: 18px; }
  .history-row { grid-template-columns: 26px minmax(0, 1fr); gap: 8px; padding: 9px 10px; }
  .history-badge { display: none; }
}


/* 3D 反走私主题：保留暗色舞台，只把主视觉换成冰蓝。 */
body.theme-customs-3d .logo-accent {
  background: linear-gradient(150deg, #f2ffff 0%, #b9f4ff 42%, #42b9e8 100%);
  -webkit-background-clip: text;
  background-clip: text;
}
body.theme-customs-3d .logo-accent::after {
  background: linear-gradient(90deg, transparent, #8fe8ff, transparent);
}
body.theme-customs-3d .eyebrow-line {
  background: linear-gradient(90deg, transparent, #8fe8ff);
}
body.theme-customs-3d .score-card .num {
  color: #c9f7ff;
}
body.theme-customs-3d .status-dot {
  background: #8fe8ff;
  box-shadow: 0 0 10px #8fe8ff;
}
