:root {
  --ink: #e6f0ff;
  --muted: #8fa3c0;
  --accent: #9fe3ff;
  --line: rgba(150, 190, 255, 0.22);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: #02040a;
  color: var(--ink);
  font-family: var(--font);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

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

button {
  font-family: inherit;
  touch-action: manipulation;
  cursor: pointer;
}

.hidden { display: none !important; }

/* ---------- 菜单 / 结算 ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(2, 4, 10, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.panel {
  width: 100%;
  max-width: 400px;
  padding: 28px 24px 22px;
  text-align: center;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(18, 28, 50, 0.84), rgba(8, 12, 24, 0.88));
  box-shadow: 0 0 60px -20px rgba(90, 140, 255, 0.45);
}

.eyebrow {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.3em;
  color: var(--accent);
}

h1 {
  margin: 8px 0 12px;
  font-size: clamp(26px, 7vw, 34px);
  font-weight: 700;
  letter-spacing: 0.06em;
  background: linear-gradient(120deg, #ffffff 0%, #bfe6ff 50%, #8aa8ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tip {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
}

.field { margin: 14px 0; }

.label {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--muted);
}

.seg {
  display: flex;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.seg button {
  flex: 1;
  padding: 9px 6px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  transition: background 0.2s, color 0.2s;
}

.seg button.on {
  color: #f2fbff;
  background: rgba(159, 227, 255, 0.16);
  box-shadow: inset 0 0 0 1px rgba(159, 227, 255, 0.45);
}

.mode-desc {
  min-height: 44px;
  margin: 16px 0 10px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}

.primary,
.ghost {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 13px;
  border-radius: 12px;
  font-size: 17px;
  letter-spacing: 0.2em;
  color: #f5fbff;
}

.primary {
  border: 1px solid rgba(159, 227, 255, 0.6);
  background: linear-gradient(180deg, rgba(120, 200, 255, 0.28), rgba(60, 110, 200, 0.22));
  box-shadow: 0 0 24px -8px rgba(111, 170, 255, 0.6);
}

.ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 15px;
}

.best {
  min-height: 18px;
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.result-title {
  margin: 4px 0 8px;
  font-size: 28px;
  letter-spacing: 0.08em;
  color: #f1f7ff;
}

.result-sub {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
}

.result-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.result-stats > div {
  padding: 14px 8px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.result-stats .k {
  display: block;
  font-size: 12px;
  letter-spacing: 0.15em;
  color: var(--muted);
}

.result-stats b {
  display: block;
  margin-top: 4px;
  font-size: 30px;
  font-variant-numeric: tabular-nums;
  color: #f2fbff;
}

/* ---------- 局内 HUD ---------- */
.hud {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

.hud-top {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.stat .k {
  display: block;
  font-size: 12px;
  letter-spacing: 0.15em;
  color: var(--muted);
}

.stat .v {
  font-size: 30px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #f2fbff;
  text-shadow: 0 0 14px rgba(140, 200, 255, 0.5);
}

.stat .t {
  margin-left: 4px;
  font-size: 14px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.hud-menu {
  pointer-events: auto;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(8, 12, 24, 0.55);
  color: var(--ink);
  font-size: 13px;
}

.hud-bottom {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  max-width: 560px;
  margin: 0 auto;
}

.tension-text {
  margin-bottom: 6px;
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.bar {
  height: 9px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(150, 190, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
}

.fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #5fa8ff, #e6f6ff);
  transition: width 0.2s ease-out;
}

.fill.low {
  background: linear-gradient(90deg, #ff5a3c, #ffb35c);
}

.skill-btn {
  position: absolute;
  right: 0;
  bottom: 34px;
  pointer-events: auto;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  border: 1px solid rgba(150, 205, 255, 0.55);
  background: radial-gradient(circle at 50% 34%, rgba(120, 195, 255, 0.95), rgba(18, 52, 112, 0.9) 70%);
  color: #eaf6ff;
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 0.04em;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-shadow: 0 0 20px rgba(90, 170, 255, 0.45);
  transition: transform 0.12s ease, opacity 0.2s ease, box-shadow 0.2s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.skill-btn:active {
  transform: scale(0.93);
}

.skill-btn.off {
  opacity: 0.34;
  box-shadow: none;
}

.skill-cost {
  font-size: 10px;
  color: rgba(220, 240, 255, 0.85);
  font-variant-numeric: tabular-nums;
}

.combo {
  position: absolute;
  left: 50%;
  top: 34%;
  transform: translate(-50%, -50%);
  text-align: center;
  opacity: 0;
  transition: opacity 0.3s;
}

.combo.on { opacity: 1; }

.combo-num {
  display: inline-block;
  font-size: clamp(48px, 12vw, 88px);
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: #eaf6ff;
  text-shadow: 0 0 24px rgba(140, 200, 255, 0.6);
}

.combo-label {
  margin-top: 6px;
  font-size: 13px;
  letter-spacing: 0.4em;
  color: var(--muted);
}

/* 连击 10 以上：青色高光 + 数字放大 */
.combo.hot .combo-num {
  color: #9ff0ff;
  text-shadow: 0 0 30px rgba(120, 240, 255, 0.95), 0 0 60px rgba(90, 200, 255, 0.5);
}

.combo.pop .combo-num {
  animation: pop 0.25s ease-out;
}

@keyframes pop {
  0% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

@media (max-width: 380px) {
  .stat .v { font-size: 26px; }
  .hud-menu { padding: 6px 11px; font-size: 12px; }
}

/* 特殊事件提示条 */
.event-toast {
  position: absolute;
  left: 50%;
  top: 78px;
  transform: translate(-50%, -8px);
  max-width: 82vw;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
  color: #d9f2ff;
  background: rgba(10, 24, 42, 0.72);
  border: 1px solid rgba(130, 200, 255, 0.35);
  box-shadow: 0 0 24px rgba(90, 170, 255, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
}

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