/* 飞机大战 · 界面样式（深色霓虹 HUD 风格） */
:root {
  --bg: #050b1c;
  --panel: rgba(9, 18, 38, 0.9);
  --line: rgba(125, 249, 255, 0.18);
  --cyan: #7df9ff;
  --blue: #38bdf8;
  --gold: #ffd166;
  --pink: #f472b6;
  --red: #ff5d73;
  --green: #4ade80;
  --text: #e8f3ff;
  --muted: #8fa6c8;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(ellipse at 50% -10%, #16294f 0%, #070e20 45%, #030711 100%);
  color: var(--text);
  font-family: var(--font);
  overflow: hidden;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .32;
  background-image: linear-gradient(rgba(80,140,220,.07) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(80,140,220,.07) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse at 50% 40%, #000 20%, transparent 78%);
}

.app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }

/* ---------- 顶栏 ---------- */
.topbar {
  flex: 0 0 auto; height: 54px; padding: 0 clamp(12px, 3vw, 28px);
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid rgba(125,249,255,.09);
}
.brand { display: flex; align-items: center; gap: 10px; letter-spacing: .16em; font-weight: 800; font-size: 15px; }
.brand-mark { color: var(--cyan); font-size: 13px; text-shadow: 0 0 14px var(--cyan); }
.brand-text em { color: var(--cyan); font-style: normal; margin-left: 6px; }
.top-actions { display: flex; gap: 8px; }
.chip {
  min-width: 44px; height: 32px; padding: 0 12px; border-radius: 9px; cursor: pointer;
  background: rgba(125,249,255,.07); border: 1px solid var(--line); color: var(--text);
  font: 600 12px var(--font); letter-spacing: .04em; transition: .18s;
}
.chip:hover { background: rgba(125,249,255,.16); border-color: var(--cyan); transform: translateY(-1px); }
.chip.off { opacity: .5; }

/* ---------- 舞台 ---------- */
.stage-wrap { flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 8px 0; }
.stage {
  position: relative;
  width: min(480px, calc(100vw - 20px), calc((100vh - 122px) * 0.6));
  width: min(480px, calc(100vw - 20px), calc((100dvh - 122px) * 0.6));
  aspect-ratio: 480 / 800;
  border-radius: 18px; overflow: hidden;
  border: 1px solid rgba(125,249,255,.22);
  box-shadow: 0 0 0 1px rgba(0,0,0,.6), 0 22px 70px rgba(0,0,0,.65), 0 0 60px rgba(56,189,248,.13);
  background: #050b1c;
}
#game { display: block; width: 100%; height: 100%; touch-action: none; }

/* ---------- HUD ---------- */
.hud { position: absolute; inset: 0; pointer-events: none; padding: 12px 13px; display: flex; flex-direction: column; }
.hud-top { display: flex; justify-content: space-between; align-items: flex-start; }
.label { display: block; font-size: 10px; letter-spacing: .18em; color: var(--muted); text-transform: uppercase; }
.score-value {
  font-size: clamp(22px, 5.6vw, 30px); font-weight: 800; line-height: 1.1;
  font-variant-numeric: tabular-nums; text-shadow: 0 0 18px rgba(125,249,255,.45);
}
.best-line { font-size: 10px; color: var(--muted); letter-spacing: .08em; }
.best-line b { color: var(--gold); }
.hud-right { text-align: right; }
.wave-chip {
  display: inline-block; padding: 4px 11px; border-radius: 20px; font-size: 11px; letter-spacing: .12em;
  background: rgba(125,249,255,.1); border: 1px solid var(--line); color: var(--muted);
}
.wave-chip b { color: var(--cyan); font-size: 14px; margin-left: 4px; }
.lives { margin-top: 9px; display: flex; gap: 6px; justify-content: flex-end; }
.life {
  width: 13px; height: 15px; background: var(--cyan);
  clip-path: polygon(50% 0, 100% 45%, 100% 100%, 50% 78%, 0 100%, 0 45%);
  box-shadow: 0 0 12px var(--cyan);
}
.life.empty { background: rgba(140,170,210,.22); box-shadow: none; }
.shield-dot { width: 9px; height: 9px; border-radius: 50%; border: 2px solid #5eead4; box-shadow: 0 0 10px #5eead4; }

.boss-bar { position: absolute; top: 76px; left: 13px; right: 13px; transition: opacity .3s; }
.boss-bar.hidden { opacity: 0; }
.boss-title { display: flex; justify-content: space-between; font-size: 10px; letter-spacing: .2em; color: var(--red); margin-bottom: 4px; }
.bar { height: 9px; border-radius: 6px; background: rgba(4,10,24,.8); border: 1px solid var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0%; border-radius: 6px; transition: width .12s linear; }
#bossFill { background: linear-gradient(90deg, #ff5d73, #ffb84d); box-shadow: 0 0 16px #ff5d73; }

.hud-bottom { margin-top: auto; }
.rage-row { display: flex; align-items: center; gap: 9px; margin-bottom: 9px; }
.rage-row .label { min-width: 30px; }
.bar.rage { flex: 1; height: 11px; }
#rageFill { background: linear-gradient(90deg, #7c3aed, #f472b6, #ffd166); box-shadow: 0 0 16px #f472b6; }
.rage-state { min-width: 62px; text-align: right; font-size: 10px; font-weight: 800; color: var(--gold); letter-spacing: .06em; }
.rage-state.ready { animation: blink .7s infinite; }
@keyframes blink { 50% { opacity: .35; } }
.gear-row { display: flex; gap: 7px; }
.gear {
  flex: 1; min-width: 0; padding: 6px 8px; border-radius: 9px;
  background: rgba(5,14,32,.62); border: 1px solid rgba(125,249,255,.12); text-align: center;
}
.gear b { display: block; margin-top: 3px; font-size: 11px; color: var(--cyan); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-bar { height: 5px; margin-top: 7px; border-radius: 4px; background: rgba(255,255,255,.1); overflow: hidden; }
.mini-bar i { display: block; height: 100%; width: 100%; background: #5eead4; box-shadow: 0 0 8px #5eead4; }

/* ---------- 提示 / 成就 ---------- */
.toast-layer { position: absolute; top: 24%; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 5px; pointer-events: none; }
.toast {
  padding: 5px 14px; border-radius: 20px; font-size: 12px; font-weight: 700;
  background: rgba(6,16,34,.8); border: 1px solid currentColor; backdrop-filter: blur(6px);
  animation: toastIn 1.4s ease forwards;
}
@keyframes toastIn { 0% { opacity: 0; transform: translateY(10px) scale(.9); } 18% { opacity: 1; transform: none; } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px); } }
.achv-layer { position: absolute; top: 14%; right: 12px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.achv-card {
  display: flex; align-items: center; gap: 9px; padding: 8px 13px; border-radius: 11px;
  background: linear-gradient(100deg, rgba(60,42,12,.95), rgba(12,20,40,.95));
  border: 1px solid var(--gold); box-shadow: 0 0 22px rgba(255,209,102,.28);
  animation: achvIn 2.6s ease forwards;
}
.achv-card .icon { color: var(--gold); font-size: 18px; }
.achv-card .txt small { display: block; font-size: 9px; letter-spacing: .16em; color: var(--muted); }
.achv-card .txt b { font-size: 12px; color: var(--gold); }
@keyframes achvIn { 0% { opacity: 0; transform: translateX(40px); } 12% { opacity: 1; transform: none; } 82% { opacity: 1; } 100% { opacity: 0; transform: translateX(30px); } }

/* ---------- 触屏按钮 ---------- */
.touch-controls { position: absolute; right: 12px; bottom: 108px; display: none; gap: 10px; pointer-events: auto; }
.touch-btn {
  width: 66px; height: 66px; border-radius: 50%; cursor: pointer; color: #04101e; font-weight: 800;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 2px solid rgba(255,255,255,.5); font-family: var(--font); font-size: 12px;
}
.touch-btn small { font-size: 8px; opacity: .7; letter-spacing: .06em; }
.touch-btn.ult { background: radial-gradient(circle at 35% 30%, #ffe9a8, #f472b6); box-shadow: 0 0 22px rgba(244,114,182,.55); }
.touch-btn.ult.ready { animation: ultPulse .55s infinite alternate; }
@keyframes ultPulse { to { transform: scale(1.12); box-shadow: 0 0 34px rgba(255,209,102,.9); } }
.touch-btn.dashbtn { background: radial-gradient(circle at 35% 30%, #b8fff2, #38bdf8); box-shadow: 0 0 20px rgba(56,189,248,.5); }
@media (hover: none), (max-width: 720px) { .touch-controls { display: flex; } }

/* ---------- 覆盖层 ---------- */
.overlay {
  position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center;
  padding: 18px; opacity: 0; visibility: hidden; pointer-events: none;
  background: radial-gradient(ellipse at 50% 35%, rgba(8,20,44,.72), rgba(2,6,16,.94));
  backdrop-filter: blur(7px); transition: opacity .28s, visibility .28s;
  overflow-y: auto;
}
.overlay.show { opacity: 1; visibility: visible; pointer-events: auto; }
.panel {
  width: 100%; max-width: 380px; padding: 24px 22px; border-radius: 18px; text-align: center;
  background: linear-gradient(160deg, rgba(16,32,62,.94), rgba(6,13,30,.96));
  border: 1px solid var(--line); box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 20px 60px rgba(0,0,0,.5);
}
.overlay.show .panel { animation: panelIn .35s cubic-bezier(.2,.9,.3,1.2); }
@keyframes panelIn { from { transform: translateY(18px) scale(.96); opacity: 0; } }
.eyebrow { font-size: 10px; letter-spacing: .36em; color: var(--cyan); opacity: .8; }
.big-title { margin: 8px 0 6px; font-size: clamp(30px, 8vw, 42px); font-weight: 900; letter-spacing: .08em;
  background: linear-gradient(100deg, #fff, var(--cyan) 55%, var(--blue)); -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 40px rgba(125,249,255,.25); }
.tagline { margin: 0 0 20px; font-size: 12px; color: var(--muted); line-height: 1.6; }
h2 { margin: 0 0 16px; font-size: 24px; letter-spacing: .06em; }
.section-label { font-size: 10px; letter-spacing: .22em; color: var(--muted); text-transform: uppercase; margin: 0 0 9px; text-align: left; }

.diff-row { display: flex; gap: 8px; margin-bottom: 16px; }
.diff {
  flex: 1; padding: 10px 4px; border-radius: 10px; cursor: pointer; font: 700 12px var(--font); letter-spacing: .08em;
  color: var(--muted); background: rgba(125,249,255,.05); border: 1px solid rgba(125,249,255,.14); transition: .18s;
}
.diff:hover { color: var(--text); border-color: var(--cyan); }
.diff.active { color: #04101e; background: linear-gradient(120deg, var(--cyan), var(--blue)); border-color: transparent; box-shadow: 0 0 20px rgba(125,249,255,.4); }

.primary-btn, .ghost-btn {
  width: 100%; padding: 12px; border-radius: 11px; cursor: pointer; font: 800 14px var(--font);
  letter-spacing: .1em; transition: .18s; margin-top: 9px;
}
.primary-btn { color: #04101e; border: none; background: linear-gradient(110deg, var(--cyan), #5eead4 55%, var(--blue)); box-shadow: 0 8px 26px rgba(56,189,248,.28); }
.primary-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 34px rgba(56,189,248,.45); }
.ghost-btn { color: var(--muted); background: transparent; border: 1px solid rgba(125,249,255,.18); font-weight: 600; }
.ghost-btn:hover { color: var(--text); border-color: var(--cyan); }

.rank-box { margin-top: 18px; padding-top: 14px; border-top: 1px solid rgba(125,249,255,.1); }
.rank-list { list-style: none; margin: 0; padding: 0; text-align: left; }
.rank-list li { display: flex; align-items: center; gap: 10px; padding: 6px 2px; font-size: 12px; border-bottom: 1px dashed rgba(125,249,255,.08); }
.rank-list li .no { width: 20px; color: var(--cyan); font-weight: 800; }
.rank-list li .pts { flex: 1; font-variant-numeric: tabular-nums; font-weight: 700; }
.rank-list li .meta { color: var(--muted); font-size: 10px; }
.rank-list li.empty { color: var(--muted); justify-content: center; border: none; padding: 12px 0; }

.how-line { display: flex; gap: 10px; align-items: flex-start; text-align: left; margin-bottom: 12px; font-size: 12px; color: var(--text); line-height: 1.55; }
.how-line kbd { flex: 0 0 auto; min-width: 62px; padding: 5px 7px; text-align: center; border-radius: 7px; font: 700 11px var(--font);
  background: rgba(125,249,255,.1); border: 1px solid var(--line); color: var(--cyan); }
.tip { font-size: 11px; color: var(--muted); line-height: 1.7; text-align: left; padding: 10px 12px; border-radius: 9px; background: rgba(125,249,255,.05); }
.small-panel { max-width: 300px; }

.over-panel { max-width: 360px; }
.record-badge { display: inline-block; padding: 4px 14px; margin-bottom: 10px; border-radius: 20px; font-size: 11px; font-weight: 800;
  color: #2b1a00; background: linear-gradient(100deg, #ffd166, #ff9f43); box-shadow: 0 0 20px rgba(255,209,102,.5); }
.record-badge.hidden { display: none; }
.final-label { font-size: 10px; letter-spacing: .24em; color: var(--muted); }
.final-score { font-size: clamp(38px, 11vw, 54px); font-weight: 900; line-height: 1.12; font-variant-numeric: tabular-nums;
  color: var(--gold); text-shadow: 0 0 30px rgba(255,209,102,.4); margin-bottom: 14px; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-bottom: 12px; }
.stat { padding: 8px 4px; border-radius: 9px; background: rgba(125,249,255,.05); border: 1px solid rgba(125,249,255,.1); }
.stat span { display: block; font-size: 9px; letter-spacing: .06em; color: var(--muted); }
.stat b { display: block; margin-top: 3px; font-size: 15px; color: var(--text); font-variant-numeric: tabular-nums; }
.achv-chips { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; margin-bottom: 6px; }
.achv-chips span { padding: 3px 9px; border-radius: 14px; font-size: 10px; color: var(--gold); border: 1px solid rgba(255,209,102,.4); background: rgba(255,209,102,.07); }

.footer { flex: 0 0 auto; text-align: center; padding: 8px; font-size: 10px; letter-spacing: .2em; color: rgba(143,166,200,.45); }
.hidden { display: none !important; }

@media (max-height: 680px) {
  .panel { padding: 16px; }
  .tagline { margin-bottom: 12px; }
  .rank-box { margin-top: 10px; }
  .big-title { margin: 4px 0; }
}
@media (max-width: 380px) {
  .topbar { height: 46px; }
  .brand { font-size: 12px; }
  .chip { min-width: 38px; padding: 0 8px; }
  .hud { padding: 9px; }
}
