:root {
  --bg: #080b1b;
  --panel: rgba(20, 25, 58, 0.76);
  --panel-border: rgba(255, 255, 255, 0.12);
  --text: #f8f7ff;
  --muted: #a8acd0;
  --purple: #9d7cff;
  --cyan: #67e8f9;
  --yellow: #ffdb6e;
  --pink: #ff70b7;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--bg); }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 8%, rgba(157, 124, 255, 0.2), transparent 28rem),
    radial-gradient(circle at 86% 18%, rgba(103, 232, 249, 0.12), transparent 24rem),
    var(--bg);
}

button { font: inherit; }

.game-shell {
  width: min(100% - 32px, 720px);
  margin: 0 auto;
  padding: 28px 0 24px;
}

.topbar, .hud, .controls { position: relative; z-index: 2; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--cyan);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .18em;
}

h1, h2, p { margin-top: 0; }

h1 {
  margin-bottom: 0;
  font-size: clamp(26px, 6vw, 42px);
  line-height: 1;
  letter-spacing: -.06em;
}

.sound-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--panel-border);
  border-radius: 50%;
  color: var(--text);
  background: rgba(255, 255, 255, .07);
  cursor: pointer;
  transition: .2s ease;
}

.sound-button:hover, .sound-button:focus-visible { border-color: var(--cyan); transform: translateY(-2px); }

.hud {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin-bottom: 12px;
}

.hud-card {
  padding: 10px 12px;
  border: 1px solid var(--panel-border);
  border-radius: 15px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hud-card span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .06em;
}

.hud-card strong {
  display: block;
  margin-top: 2px;
  font-size: clamp(16px, 4vw, 22px);
  letter-spacing: .02em;
}

.stage-wrap {
  position: relative;
  height: min(68vh, 620px);
  min-height: 430px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 26px;
  background: #111936;
  box-shadow: var(--shadow);
  isolation: isolate;
}

.stage-wrap::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(17, 25, 54, .2), rgba(7, 10, 26, .5));
  content: "";
}

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

.screen {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(7, 9, 27, .48);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}

.screen.is-visible { opacity: 1; pointer-events: auto; }

.screen-card {
  width: min(100%, 390px);
  padding: clamp(26px, 7vw, 48px);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 25px;
  background: rgba(16, 20, 50, .9);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
  backdrop-filter: blur(18px);
}

.logo-orbit {
  display: grid;
  width: 54px;
  height: 54px;
  margin-bottom: 25px;
  place-items: center;
  border: 1px solid rgba(255, 219, 110, .55);
  border-radius: 50%;
  color: var(--yellow);
  font-size: 24px;
  box-shadow: 0 0 34px rgba(255, 219, 110, .22);
}

.screen-card h2 {
  margin-bottom: 18px;
  font-size: clamp(42px, 11vw, 72px);
  line-height: .92;
  letter-spacing: -.08em;
}

.screen-card h2 em { color: var(--yellow); font-style: normal; }

.screen-copy {
  max-width: 32ch;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

.primary-button {
  display: flex;
  width: 100%;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border: 0;
  border-radius: 13px;
  color: #161127;
  background: var(--yellow);
  box-shadow: 0 12px 30px rgba(255, 219, 110, .18);
  font-weight: 800;
  cursor: pointer;
  transition: .2s ease;
}

.primary-button:hover, .primary-button:focus-visible { transform: translateY(-2px); box-shadow: 0 16px 34px rgba(255, 219, 110, .28); }

.best-line { margin: 18px 0 0; color: var(--muted); font-size: 12px; }
.best-line strong { color: var(--yellow); }

.final-score {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin: 24px 0;
  padding: 18px 0;
  border-top: 1px solid var(--panel-border);
  border-bottom: 1px solid var(--panel-border);
  color: var(--muted);
  font-size: 13px;
}

.final-score strong { color: var(--yellow); font-size: 46px; line-height: .8; }

.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 18px 0 8px;
}

.controls p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; text-align: center; }
.controls p span { color: rgba(168, 172, 208, .7); }

.control-button {
  display: grid;
  width: 62px;
  height: 48px;
  place-items: center;
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  color: var(--text);
  background: rgba(255, 255, 255, .08);
  font-size: 24px;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  transition: .12s ease;
}

.control-button:active, .control-button.is-down { color: var(--bg); background: var(--cyan); transform: scale(.95); }

.footer-note { color: rgba(168, 172, 208, .65); font-size: 11px; text-align: center; }

@media (max-width: 480px) {
  .game-shell { width: min(100% - 20px, 720px); padding-top: 18px; }
  .stage-wrap { min-height: 490px; border-radius: 21px; }
  .screen-card { padding: 26px 22px; }
  .controls { gap: 14px; }
  .control-button { width: 58px; }
}
