:root {
  --bg-space: #0b1324;
  --panel: rgba(15, 25, 48, 0.92);
  --line: rgba(148, 179, 214, 0.25);
  --accent: #e96312;
  --cyan: #4fd1c5;
  --gold: #ffd700;
  --text: #f3f6fa;
  --muted: #9eb0c7;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background: var(--bg-space);
  color: var(--text);
  overflow: hidden;
  user-select: none;
}
#app {
  position: relative;
  width: 100vw;
  height: 100vh;
}
#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  background: radial-gradient(circle at 50% 25%, #162447, #091020);
}
.screen {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 16px;
  background: rgba(7, 13, 27, 0.78);
  backdrop-filter: blur(5px);
}
.hidden { display: none !important; }
#game-hud.screen {
  background: transparent;
  backdrop-filter: none;
  pointer-events: none;
  justify-content: space-between;
  padding: 0;
}

.menu-card, .modal-card {
  width: min(640px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 26px 24px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  max-height: 94vh;
  overflow-y: auto;
}
.menu-eyebrow {
  font-size: 12px;
  color: var(--cyan);
  letter-spacing: 1px;
  font-weight: 700;
  margin-bottom: 6px;
}
h1 {
  font-size: clamp(28px, 5vw, 42px);
  color: var(--gold);
  margin-bottom: 8px;
}
h2 {
  font-size: clamp(22px, 4vw, 30px);
  margin-bottom: 10px;
}
.menu-sub {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 18px;
  line-height: 1.6;
}
.section-cap {
  font-size: 13px;
  font-weight: 700;
  color: #dce6f2;
  margin-bottom: 10px;
}
.tier-select { margin-bottom: 18px; }
.tier-pills {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.tier-btn {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.tier-btn.active {
  background: var(--cyan);
  color: #091322;
  border-color: var(--cyan);
}
.characters {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-bottom: 20px;
}
.char-card {
  width: 148px;
  padding: 14px 10px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.char-card.selected {
  border-color: var(--gold);
  background: rgba(255, 215, 0, 0.12);
}
.char-card small { font-size: 11px; color: var(--muted); line-height: 1.4; }
.mode-select, .modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 10px;
}
.space-btn {
  padding: 11px 24px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  border: 0;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.space-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.primary-btn { background: var(--accent); color: #fff; }
.secondary-btn { background: rgba(255, 255, 255, 0.12); color: #fff; border: 1px solid var(--line); }
.menu-footer {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.menu-footer a { color: #cbd8e8; text-decoration: none; }
.menu-footer a:hover { text-decoration: underline; }

/* HUD */
.hud-top {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 18px;
}
.hud-top-left { display: flex; flex-direction: column; gap: 6px; }
.heart {
  width: 22px;
  height: 22px;
  background: #ff5a5f;
  clip-path: polygon(50% 100%, 0 46%, 0 12%, 25% 0, 50% 22%, 75% 0, 100% 12%, 100% 46%);
  display: inline-block;
  margin-right: 4px;
}
.bomb-bar { display: flex; align-items: center; gap: 5px; font-size: 13px; }
.bomb-label { color: var(--gold); font-weight: 700; }
.bomb-hint { color: var(--muted); font-size: 11px; }
.eye-timer-box {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(11, 19, 36, 0.8);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  flex-wrap: wrap;
}
.eye-break-btn {
  border: 1px solid rgba(79, 209, 197, 0.5);
  background: rgba(79, 209, 197, 0.16);
  color: #b2f5ea;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
  cursor: pointer;
}
.score { font-size: 20px; font-weight: 800; color: var(--gold); }
.hud-middle { flex: 1; display: flex; align-items: center; justify-content: center; }
.combo { font-size: 38px; font-weight: 800; color: #ff9f43; text-shadow: 0 4px 16px rgba(0, 0, 0, 0.7); }
.hud-bottom { width: 100%; text-align: center; padding-bottom: 34px; }
.input-display {
  display: inline-block;
  font-size: 28px;
  font-weight: 800;
  padding: 8px 28px;
  background: rgba(11, 19, 36, 0.85);
  border: 2px solid var(--cyan);
  border-radius: 14px;
}

.eye-badge {
  display: inline-block;
  background: rgba(79, 209, 197, 0.16);
  color: var(--cyan);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 10px;
}
.eye-desc { font-size: 15px; color: #dce6f2; line-height: 1.7; margin-bottom: 14px; }
.eye-countdown { font-size: 20px; font-weight: 800; color: var(--gold); margin-bottom: 16px; }
.final-score { font-size: 22px; color: var(--gold); margin: 12px 0 20px; }

/* Mobile controls */
#mobile-controls {
  position: fixed;
  bottom: 0; left: 0; width: 100%; height: 160px;
  z-index: 20;
  display: flex;
  background: rgba(9, 16, 32, 0.82);
  border-top: 1px solid var(--line);
}
.mobile-left { flex: 1; display: flex; align-items: center; justify-content: center; }
#joystick-base {
  width: 80px; height: 80px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.25);
  display: flex; align-items: center; justify-content: center;
  touch-action: none;
}
#joystick-knob {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--cyan); pointer-events: none;
}
.mobile-right {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 5px; padding-right: 8px;
}
#mobile-numpad {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px;
  width: 100%; max-width: 188px;
}
.num-btn {
  height: 36px; border-radius: 8px; border: 1px solid var(--line);
  background: rgba(79, 209, 197, 0.2); color: #fff; font-weight: 700;
}
.del-btn { background: rgba(229, 62, 62, 0.35); }
.fire-btn { background: rgba(233, 99, 18, 0.75); }
.bomb-mobile-btn {
  width: 100%; max-width: 188px; height: 28px;
  border-radius: 8px; border: 1px solid rgba(255, 215, 0, 0.4);
  background: rgba(233, 99, 18, 0.45); color: #fff; font-size: 12px;
}
