/* 音弹 TONEBALL —— 科幻 HUD + 漫画风连击板（竖屏） */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  width: 100%; height: 100%;
  background: #05070f;
  overflow: hidden;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  color: #eaf2ff;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}
#game { display: block; position: fixed; inset: 0; }

/* 全局扫描线 + 暗角，营造机甲屏幕感 */
body::after {
  content: ''; position: fixed; inset: 0; z-index: 6; pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(0,0,0,0) 52%, rgba(0,0,0,.34) 100%),
    repeating-linear-gradient(0deg, rgba(120,200,255,.045) 0 1px, transparent 1px 4px);
}

/* 页面刚打开时的一层黑幕，慢慢淡掉，像机器开机 */
#veil {
  position: fixed; inset: 0; z-index: 40; background: #05070f;
  pointer-events: none;
  animation: veilOut 1.3s ease .15s both;
}
@keyframes veilOut { from { opacity: 1; } to { opacity: 0; } }

/* ---------- 科幻面板 ---------- */
#hud {
  position: fixed; top: 0; left: 0; right: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 8px; padding: 12px 12px 0;
  pointer-events: none;
}
/* 开局时两块面板依次滑入 */
#hud.intro .panel-main { animation: hudIn .7s cubic-bezier(.2,1.5,.4,1) both; }
#hud.intro .panel-sys { animation: hudIn .7s cubic-bezier(.2,1.5,.4,1) .30s both; }
#hud.intro #mute { animation: hudIn .65s cubic-bezier(.2,1.5,.4,1) .58s both; }
#hud.intro #ver { animation: hudIn .65s cubic-bezier(.2,1.5,.4,1) .74s both; }
@keyframes hudIn {
  from { opacity: 0; transform: translateY(-24px) scale(.94); }
  to   { opacity: 1; transform: none; }
}
.panel {
  position: relative;
  padding: 7px 12px 9px;
  background: linear-gradient(180deg, rgba(12,22,44,.80), rgba(5,9,20,.90));
  clip-path: polygon(0 11px, 11px 0, 100% 0, 100% calc(100% - 11px), calc(100% - 11px) 100%, 0 100%);
  box-shadow: inset 0 0 0 1px rgba(79,209,255,.45), 0 0 20px rgba(79,209,255,.14);
}
.panel-tag {
  font-size: 10px; letter-spacing: 3px; font-weight: 700;
  color: rgba(79,209,255,.85);
  padding-bottom: 3px; margin-bottom: 2px;
  border-bottom: 1px solid rgba(79,209,255,.25);
}
.panel-num {
  font-family: "SF Mono", Consolas, "Courier New", monospace;
  font-size: clamp(30px, 9.5vw, 52px);
  font-weight: 800; line-height: 1.05; color: #ffd166;
  text-shadow: 0 0 16px rgba(255,180,60,.65);
  font-variant-numeric: tabular-nums;
}
.panel-sub {
  margin-top: 3px; font-size: 10px; letter-spacing: 1px;
  color: rgba(230,242,255,.5);
}
.panel-sub b { color: #7CFC9B; font-family: Consolas, monospace; }

.panel-sys { min-width: 42%; padding: 8px 11px; }
.sys-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 10px; letter-spacing: 1.2px;
  color: rgba(230,242,255,.55);
  padding: 2px 0;
}
.sys-row b {
  font-family: Consolas, monospace; font-size: 13px; color: #4fd1ff;
  text-shadow: 0 0 10px rgba(79,209,255,.5);
}
.sys-meter {
  margin-top: 6px; height: 5px; background: rgba(79,209,255,.13);
  clip-path: polygon(0 0, 100% 0, calc(100% - 3px) 100%, 0 100%);
  overflow: hidden;
}
.sys-meter i {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, #4fd1ff, #b794f6, #ff7b54);
  box-shadow: 0 0 12px rgba(120,180,255,.8);
  transition: width .18s linear;
}

/* ---------- 连击数：只在左上角计分板里占一行，绝不落到台面上 ---------- */
.chain-row {
  display: flex; align-items: baseline; gap: 6px;
  margin-top: 5px; padding-top: 4px;
  border-top: 1px solid rgba(79,209,255,.25);
  font-size: 10px; letter-spacing: 1.2px;
  color: rgba(230,242,255,.42);
  transition: color .2s ease;
}
.chain-row b {
  font-family: Consolas, monospace; font-size: 15px; line-height: 1;
  color: rgba(230,242,255,.55);
  font-variant-numeric: tabular-nums;
  transition: color .15s ease, text-shadow .15s ease;
}
.chain-row i {
  font-style: normal; font-size: 11px; font-weight: 700;
  color: rgba(230,242,255,.35);
  transition: color .15s ease;
}
/* 连击亮起来的时候（1.6 秒内有效）才上色，冷却后自动熄灭，不抢视线 */
.chain-row.hot { color: rgba(255,123,84,.95); }
.chain-row.hot b { color: #ff9c6b; text-shadow: 0 0 12px rgba(255,123,84,.75); }
.chain-row.hot i { color: #ffd166; }
/* 每次命中时数字弹一下，漫画打击感留在这一小块里 */
.chain-row.pop b { animation: chainPop .26s cubic-bezier(.2,1.7,.4,1); }
@keyframes chainPop {
  0%   { transform: scale(1.55) rotate(-4deg); color: #fff; }
  60%  { transform: scale(.94) rotate(1deg); }
  100% { transform: scale(1) rotate(0); }
}

/* ---------- 静音键 / 底部提示 ---------- */
#mute {
  position: fixed; z-index: 7; right: 12px; top: 108px;
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; color: #4fd1ff; cursor: pointer;
  background: rgba(8,14,30,.85);
  box-shadow: inset 0 0 0 1px rgba(79,209,255,.45), 0 0 14px rgba(79,209,255,.25);
}
#mute.off { color: #5a6478; box-shadow: inset 0 0 0 1px rgba(120,140,170,.3); }
/* 版本号：固定右下角，方便确认跑的是哪一版（排查“改了没生效”） */
#ver {
  position: fixed; z-index: 7; right: 12px; bottom: 30px;
  font: 700 10px Consolas, monospace; letter-spacing: 1px;
  color: rgba(143,216,255,.5); pointer-events: none;
  text-shadow: 0 0 6px rgba(79,209,255,.35);
}
#hint {
  position: fixed; z-index: 5; left: 0; right: 0; bottom: 10px;
  text-align: center; font-size: 11px; letter-spacing: 1px;
  color: rgba(230,242,255,.34); pointer-events: none;
}

/* ---------- 开始 / 结束遮罩 ---------- */
#overlay {
  position: fixed; inset: 0; z-index: 10;
  display: none; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 42%, rgba(14,26,54,.82), rgba(3,5,12,.95));
  backdrop-filter: blur(3px);
}
#overlay.show { display: flex; }
#overlay.fading { opacity: 0; pointer-events: none; }
#overlay { transition: opacity .4s ease; }
/* 菜单态：卡片沉到下部，给上部封面主视觉让位 */
#overlay.low { align-items: flex-end; padding-bottom: 7vh; }
.card {
  text-align: center; padding: 30px 24px; max-width: 88vw;
  animation: pop .35s ease;
  clip-path: polygon(0 16px, 16px 0, 100% 0, 100% calc(100% - 16px), calc(100% - 16px) 100%, 0 100%);
  box-shadow: inset 0 0 0 1px rgba(79,209,255,.4);
  background: linear-gradient(180deg, rgba(12,22,44,.7), rgba(5,9,20,.85));
}
@keyframes pop { from { transform: scale(.86); opacity: 0; } to { transform: scale(1); opacity: 1; } }
#ov-title {
  font-size: clamp(28px, 9vw, 46px); font-weight: 900; letter-spacing: 2px;
  background: linear-gradient(92deg, #ffd166, #ff7b54, #b794f6);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-bottom: 12px;
}
#ov-text { font-size: clamp(14px, 4.2vw, 18px); line-height: 1.75; margin-bottom: 24px; opacity: .92; }
#ov-text .small { display: inline-block; margin-top: 8px; font-size: clamp(12px, 3.4vw, 14px); opacity: .62; }
#ov-text b { color: #ffd166; }
#startBtn {
  font-size: clamp(17px, 5.4vw, 22px); font-weight: 800; color: #05070f;
  background: linear-gradient(92deg, #ffd166, #ff7b54);
  border: none; border-radius: 999px; padding: 13px 40px; cursor: pointer;
  box-shadow: 0 0 26px rgba(255,170,60,.5);
  transition: transform .12s;
}
#startBtn:active { transform: scale(.94); }