:root {
  color-scheme: dark;
  --bg: #050914;
  --panel: rgba(8, 18, 41, 0.72);
  --panel-strong: rgba(7, 16, 36, 0.92);
  --line: rgba(126, 214, 255, 0.22);
  --text: #f5fbff;
  --muted: #9db4d3;
  --cyan: #48d8ff;
  --gold: #ffd36a;
  --red: #ff5c6c;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 20% 10%, rgba(72, 216, 255, 0.18), transparent 28rem),
    radial-gradient(circle at 85% 18%, rgba(151, 80, 255, 0.18), transparent 30rem),
    linear-gradient(145deg, #030612 0%, #08152c 48%, #030712 100%);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

button {
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.game-shell {
  display: grid;
  grid-template-columns: minmax(320px, 68vh) minmax(260px, 360px);
  gap: 24px;
  align-items: center;
  justify-content: center;
  min-height: 100svh;
  padding: 24px;
}

.stage-wrap {
  position: relative;
  width: min(100%, 68vh);
  max-width: 680px;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #030712;
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.48),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.hud {
  position: absolute;
  inset: 14px 14px auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  pointer-events: none;
}

.hud-card {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(4, 12, 28, 0.62);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(12px);
}

.hud-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.hud-card strong {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: var(--text);
  font-size: clamp(15px, 2.2vw, 22px);
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.boss-meter {
  position: absolute;
  top: 86px;
  left: 14px;
  right: 14px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid rgba(255, 92, 108, 0.36);
  border-radius: 8px;
  background: rgba(38, 6, 17, 0.62);
  color: #ffdce1;
  font-size: 12px;
  backdrop-filter: blur(12px);
}

.boss-meter div {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.boss-meter i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red), #ffb05c);
  box-shadow: 0 0 16px rgba(255, 92, 108, 0.75);
}

.center-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(calc(100% - 34px), 420px);
  padding: 28px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(126, 214, 255, 0.26);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(13, 32, 70, 0.84), rgba(5, 12, 29, 0.92)),
    radial-gradient(circle at 50% 0%, rgba(72, 216, 255, 0.18), transparent 80%);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  text-align: center;
  backdrop-filter: blur(18px);
}

.center-panel.compact {
  padding: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1;
}

h1 {
  font-size: clamp(34px, 7vw, 62px);
}

h2 {
  font-size: clamp(28px, 4vw, 42px);
}

.center-panel p:not(.eyebrow),
.briefing p {
  color: #c8d8ee;
  line-height: 1.7;
}

.center-panel button,
.briefing button {
  min-height: 46px;
  margin-top: 12px;
  padding: 0 24px;
  border-radius: 8px;
  background: linear-gradient(135deg, #38d8ff, #7868ff);
  color: #02101c;
  font-weight: 900;
  box-shadow: 0 12px 34px rgba(72, 216, 255, 0.3);
}

.briefing {
  display: grid;
  gap: 18px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(18px);
}

.briefing h2 {
  margin-bottom: 12px;
}

.tips {
  display: grid;
  gap: 8px;
}

.tips span {
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: #dbe8fb;
  font-size: 14px;
}

.touch-controls {
  position: absolute;
  inset: auto 18px calc(18px + env(safe-area-inset-bottom)) 18px;
  display: none;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
}

.stick,
.fire-pad {
  pointer-events: auto;
  touch-action: none;
  user-select: none;
}

.stick {
  position: relative;
  width: 112px;
  height: 112px;
  border: 1px solid rgba(126, 214, 255, 0.28);
  border-radius: 50%;
  background: rgba(6, 18, 42, 0.5);
  backdrop-filter: blur(12px);
}

.stick i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 46px;
  height: 46px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, var(--cyan) 32%, #1d5cff);
  box-shadow: 0 0 24px rgba(72, 216, 255, 0.58);
}

.fire-pad {
  width: 92px;
  height: 92px;
  border: 1px solid rgba(255, 211, 106, 0.38);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff4b6, #ff9b32 40%, #d92c2c);
  color: #270909;
  font-size: 14px;
  font-weight: 900;
  box-shadow: 0 0 28px rgba(255, 157, 50, 0.34);
}

@media (max-width: 900px) {
  .game-shell {
    display: block;
    min-height: 100svh;
    padding: 0;
  }

  .stage-wrap {
    width: 100vw;
    height: 100svh;
    max-width: none;
    border: 0;
    border-radius: 0;
  }

  .briefing {
    display: none;
  }

  .touch-controls {
    display: flex;
  }
}

@media (max-width: 520px) {
  .hud {
    inset: calc(10px + env(safe-area-inset-top)) 10px auto;
    grid-template-columns: repeat(3, 1fr);
  }

  .hide-small {
    display: none;
  }

  .hud-card {
    padding: 7px 8px;
  }

  .boss-meter {
    top: calc(72px + env(safe-area-inset-top));
    left: 10px;
    right: 10px;
  }

  .center-panel {
    padding: 22px;
  }
}
