:root {
  color-scheme: dark;
  --ink: #e8fbff;
  --muted: #8fa4c4;
  --cyan: #74eaf5;
  --red: #ff816f;
  --gold: #ffd166;
  --panel: #0d1830;
  --line: rgba(116, 234, 245, 0.42);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #050914;
  color: var(--ink);
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  touch-action: none;
}

button { font: inherit; }

.game-shell {
  width: min(1180px, 100vw);
  padding: 16px;
}

.topbar {
  height: 64px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-bottom: 0;
  background: #0b1429;
}

.brand, .eyebrow {
  color: var(--cyan);
  letter-spacing: 0.18em;
  font-size: 12px;
  font-weight: 700;
}

.center-hud {
  min-width: 280px;
  text-align: center;
}

.score { font-size: 18px; letter-spacing: 0.05em; }
.score strong { color: var(--cyan); font-size: 22px; }

.boss-hud {
  min-height: 18px;
  margin-top: 3px;
  color: var(--gold);
  font-size: 13px;
  letter-spacing: 0.04em;
}

.status-group {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 16px;
}

.damage { color: var(--muted); font-size: 14px; }
.damage strong { color: var(--red); font-size: 18px; }

.icon-button {
  width: 42px;
  height: 36px;
  border: 1px solid var(--line);
  color: var(--cyan);
  background: transparent;
  cursor: pointer;
}
.icon-button:hover { background: rgba(116, 234, 245, 0.12); }

.arena-wrap {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #070d1e;
  aspect-ratio: 16 / 9;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  cursor: none;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(5, 9, 20, 0.57);
}
.hidden { display: none; }

.menu-content {
  width: min(430px, calc(100% - 40px));
  padding: 30px;
  text-align: center;
  background: rgba(13, 24, 48, 0.95);
  border: 1px solid var(--line);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
.menu-content.compact { width: min(360px, calc(100% - 40px)); }

h1, h2 { margin: 8px 0 10px; letter-spacing: 0.05em; }
h1 { font-size: clamp(36px, 6vw, 64px); }
h2 { font-size: 36px; }
.menu-content p { margin: 0 0 22px; color: var(--muted); }

.primary-button, .secondary-button {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--cyan);
  cursor: pointer;
}
.primary-button {
  color: #06121e;
  background: var(--cyan);
  font-weight: 700;
}
.primary-button:hover { background: #b5f8fc; }
.secondary-button {
  margin-top: 10px;
  color: var(--ink);
  background: transparent;
  border-color: rgba(143, 164, 196, 0.5);
}
.secondary-button:hover { border-color: var(--cyan); }

.controls {
  margin-top: 20px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.03em;
}
.controls span { color: var(--cyan); margin: 0 6px; }

.mobile-controls {
  position: absolute;
  inset: auto 0 0;
  display: none;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 38px 28px;
  pointer-events: none;
}

.joystick {
  width: 126px;
  height: 126px;
  border: 2px solid rgba(116, 234, 245, 0.45);
  border-radius: 50%;
  background: rgba(13, 24, 48, 0.42);
  pointer-events: auto;
  position: relative;
}

.joystick-knob {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(116, 234, 245, 0.82);
  position: absolute;
  left: 38px;
  top: 38px;
  box-shadow: 0 0 24px rgba(116, 234, 245, 0.34);
}

.fire-button {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  border: 2px solid rgba(255, 129, 111, 0.72);
  color: #ffe9e4;
  background: rgba(255, 129, 111, 0.32);
  font-weight: 800;
  pointer-events: auto;
}
.fire-button:active { background: rgba(255, 129, 111, 0.58); }

@media (hover: none), (pointer: coarse), (max-width: 860px) {
  .game-shell { padding: 0; }
  .topbar {
    height: 58px;
    padding: 0 10px;
    gap: 8px;
    grid-template-columns: 0.8fr auto 0.8fr;
  }
  .brand { font-size: 9px; }
  .center-hud { min-width: 150px; }
  .score { font-size: 14px; }
  .score strong { font-size: 18px; }
  .boss-hud { font-size: 10px; }
  .status-group { gap: 8px; }
  .damage { font-size: 11px; }
  .icon-button { width: 36px; height: 32px; }
  .arena-wrap {
    width: 100vw;
    height: calc(100vh - 58px);
    aspect-ratio: auto;
  }
  .mobile-controls { display: flex; }
  .controls { font-size: 11px; line-height: 1.8; }
}
