:root {
  --bg: #16123d;
  --ink: #fff9ff;
  --muted: #c8c3f7;
  --panel: rgba(34, 27, 89, 0.72);
  --panel-strong: rgba(255, 255, 255, 0.13);
  --line: rgba(255, 255, 255, 0.22);
  --pink: #ff62bd;
  --mint: #54f0d8;
  --yellow: #ffe66d;
  --orange: #ff9c55;
  --blue: #70b7ff;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 98, 189, 0.32), transparent 25rem),
    radial-gradient(circle at 84% 14%, rgba(84, 240, 216, 0.28), transparent 22rem),
    linear-gradient(135deg, #201456 0%, #101633 48%, #24114e 100%);
}

button {
  font: inherit;
}

.page-shell {
  width: min(1180px, calc(100vw - 28px));
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 22px 0;
}

.game-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 18px;
  background: rgba(13, 12, 42, 0.7);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

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

.brand {
  display: flex;
  align-items: center;
  min-width: 260px;
  gap: 12px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 16px;
  color: #251454;
  font-size: 28px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--yellow), #fff7b1 48%, var(--mint));
  box-shadow: 0 12px 32px rgba(84, 240, 216, 0.28);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(24px, 3.2vw, 38px);
  line-height: 1.05;
  letter-spacing: 0;
}

.brand p {
  max-width: 430px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.hud-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(74px, 1fr));
  gap: 8px;
  width: min(520px, 100%);
}

.hud-item {
  min-height: 58px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-strong);
}

.hud-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.hud-item strong {
  display: block;
  margin-top: 4px;
  font-size: 23px;
  line-height: 1;
  color: #ffffff;
}

.hearts strong {
  color: #ff7dcf;
  letter-spacing: 1px;
}

.stage-wrap {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 22px;
  background: #130f3f;
}

canvas {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 360px;
  touch-action: none;
}

.mission-panel {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 174px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 18px;
  background: var(--panel);
  backdrop-filter: blur(14px);
}

.mission-panel h2 {
  font-size: 17px;
  margin-bottom: 10px;
}

.mission-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  color: #efeaff;
  font-size: 13px;
  border-top: 1px solid rgba(255, 255, 255, 0.13);
}

.mission-row strong {
  color: var(--yellow);
}

.best-score {
  margin-top: 10px;
  padding: 9px 10px;
  border-radius: 14px;
  color: #27174f;
  font-size: 13px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--yellow), #ffffff);
}

.control-hint {
  position: absolute;
  left: 18px;
  bottom: 18px;
  display: flex;
  gap: 7px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 15px;
  color: #efeaff;
  font-size: 12px;
  background: rgba(16, 13, 52, 0.68);
  backdrop-filter: blur(12px);
}

kbd {
  min-width: 32px;
  padding: 4px 7px;
  border-radius: 8px;
  color: #22144d;
  font-size: 11px;
  font-weight: 900;
  text-align: center;
  background: #ffffff;
}

.touch-pad {
  position: absolute;
  left: 18px;
  bottom: 18px;
  display: none;
  gap: 6px;
  flex-direction: column;
  align-items: center;
}

.touch-pad div {
  display: flex;
  gap: 6px;
}

.touch-pad button {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 13px;
  color: #ffffff;
  font-size: 17px;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(14px);
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: linear-gradient(135deg, rgba(11, 8, 38, 0.54), rgba(28, 13, 70, 0.28));
}

.overlay.hidden {
  pointer-events: none;
  opacity: 0;
  transition: opacity 180ms ease;
}

.modal {
  width: min(440px, 100%);
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 24px;
  text-align: center;
  background: rgba(28, 20, 76, 0.86);
  box-shadow: 0 24px 74px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(18px);
}

.modal-kicker {
  color: var(--mint);
  font-size: 14px;
  font-weight: 900;
}

.modal h2 {
  margin-top: 7px;
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.05;
}

.modal p:last-of-type {
  margin: 12px auto 0;
  max-width: 350px;
  color: var(--muted);
  line-height: 1.65;
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.primary-btn,
.ghost-btn {
  min-width: 128px;
  min-height: 46px;
  padding: 0 18px;
  border: 0;
  border-radius: 15px;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
}

.primary-btn {
  color: #251454;
  background: linear-gradient(135deg, var(--yellow), #ffffff 48%, var(--mint));
  box-shadow: 0 14px 32px rgba(84, 240, 216, 0.28);
}

.ghost-btn {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

@media (max-width: 900px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .hud-grid {
    width: 100%;
  }

  .mission-panel {
    top: 10px;
    right: 10px;
    width: 150px;
    padding: 10px;
  }
}

@media (max-width: 680px) {
  .page-shell {
    width: min(100vw - 14px, 1180px);
    padding: 8px 0;
  }

  .game-card {
    padding: 10px;
    border-radius: 20px;
  }

  .brand {
    min-width: 0;
  }

  .brand p {
    display: none;
  }

  .hud-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
  }

  .hud-item {
    min-height: 47px;
    padding: 7px 6px;
    border-radius: 12px;
  }

  .hud-item span {
    font-size: 10px;
  }

  .hud-item strong {
    font-size: 18px;
  }

  canvas {
    min-height: 330px;
  }

  .mission-panel {
    width: 130px;
    font-size: 12px;
  }

  .mission-row {
    padding: 6px 0;
    font-size: 12px;
  }

  .control-hint {
    display: none;
  }

  .touch-pad {
    display: flex;
  }
}
