:root {
  color-scheme: dark;
  --bg: #111318;
  --panel: #1b2028;
  --line: #323a46;
  --text: #eef4f8;
  --muted: #91a0ad;
  --cyan: #44d9ff;
  --pink: #ff5aa8;
  --yellow: #ffd166;
  --green: #70e000;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
}

body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 18px;
  background:
    radial-gradient(circle at 20% 0%, rgba(68, 217, 255, 0.16), transparent 32%),
    radial-gradient(circle at 80% 100%, rgba(255, 90, 168, 0.13), transparent 34%),
    var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body:has(.top-screen:not(.is-hidden)) {
  background:
    radial-gradient(circle at 18% 18%, rgba(68, 217, 255, 0.18), transparent 30%),
    radial-gradient(circle at 76% 64%, rgba(255, 90, 168, 0.14), transparent 28%),
    linear-gradient(145deg, #050812 0%, #081426 46%, #02040a 100%);
}

.shell {
  width: min(100%, 760px);
  max-width: 100%;
  display: grid;
  gap: 12px;
}

.screen {
  display: grid;
  gap: 12px;
}

.is-hidden {
  display: none !important;
}

.top-screen {
  position: relative;
  min-height: min(900px, calc(100vh - 36px));
  max-height: calc(100vh - 36px);
  align-content: start;
  gap: clamp(10px, 1.8vh, 18px);
  overflow: hidden;
  padding: clamp(12px, 2.4vh, 22px);
  border: 1px solid rgba(87, 223, 255, 0.2);
  border-radius: 8px;
  background:
    linear-gradient(rgba(68, 217, 255, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(68, 217, 255, 0.055) 1px, transparent 1px),
    radial-gradient(circle at 22% 18%, rgba(68, 217, 255, 0.16), transparent 28%),
    radial-gradient(circle at 82% 48%, rgba(255, 90, 168, 0.12), transparent 28%),
    rgba(3, 7, 18, 0.72);
  background-size: 36px 36px, 36px 36px, auto, auto, auto;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.5), inset 0 0 80px rgba(68, 217, 255, 0.05);
}

.top-screen::before,
.top-screen::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border-radius: 8px;
}

.top-screen::before {
  inset: 14% auto auto 7%;
  width: 58px;
  height: 58px;
  border: 1px solid rgba(68,217,255,0.34);
  background: rgba(68,217,255,0.07);
  box-shadow: 0 0 28px rgba(68,217,255,0.2);
  transform: rotate(-12deg);
}

.top-screen::after {
  right: 8%;
  bottom: 12%;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, #fff7c2, #ffd166 45%, #a56b00 100%);
  box-shadow: 0 0 26px rgba(255, 209, 102, 0.58);
}

.lab-header {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
}

.lab-link {
  color: rgba(238, 244, 248, 0.88);
  font-family: "Didot", "Bodoni 72", "Times New Roman", serif;
  font-size: clamp(15px, 2.4vw, 20px);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
  text-shadow: 0 0 18px rgba(68,217,255,0.18);
  transition: color 180ms ease, text-shadow 180ms ease, transform 180ms ease;
}

.lab-link:hover {
  color: #ffffff;
  text-shadow: 0 0 22px rgba(68,217,255,0.62), 0 0 30px rgba(255,90,168,0.28);
  transform: translateY(-1px);
}

.top-bar,
.clear-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(27, 32, 40, 0.88);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

.top-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 20px;
}

h1,
h2 {
  margin: 4px 0 0;
  font-size: clamp(28px, 6vw, 46px);
  line-height: 1;
  letter-spacing: 0;
}

.primary-action {
  min-width: 138px;
  border-color: rgba(68, 217, 255, 0.7);
  background:
    radial-gradient(circle at 28% 22%, rgba(255,255,255,0.54), transparent 22%),
    linear-gradient(135deg, rgba(68,217,255,0.96), rgba(255,90,168,0.88));
  color: #061018;
}

.top-hero {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(210px, 0.58fr);
  gap: clamp(14px, 3vw, 28px);
  align-items: center;
}

.hero-copy {
  display: grid;
  gap: 8px;
  justify-items: start;
}

.hero-kicker {
  color: rgba(68, 217, 255, 0.82);
  font-size: clamp(10px, 1.8vw, 13px);
  font-weight: 900;
  letter-spacing: 0.16em;
}

.top-hero h1 {
  margin: 0;
  color: #eefbff;
  font-size: clamp(42px, 9.5vw, 86px);
  line-height: 0.9;
  text-shadow:
    0 0 12px rgba(68, 217, 255, 0.72),
    0 0 34px rgba(68, 217, 255, 0.32),
    0 0 54px rgba(255, 90, 168, 0.18);
}

.game-preview {
  position: relative;
  min-height: 0;
  width: min(100%, 270px);
  aspect-ratio: 0.72;
  justify-self: end;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
  transform: perspective(900px) rotateY(-11deg) rotateZ(2deg);
  transition: transform 180ms ease, filter 180ms ease;
}

.game-preview:hover {
  filter: brightness(1.08);
  transform: perspective(900px) rotateY(-8deg) rotateZ(1deg) translateY(-2px);
}

.preview-board {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border: 1px solid rgba(111, 207, 255, 0.42);
  border-radius: 8px;
  background: #08111f;
  box-shadow: 0 22px 55px rgba(0, 0, 0, 0.46), 0 0 32px rgba(68, 217, 255, 0.15);
}

.preview-grid {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(94, 129, 177, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(94, 129, 177, 0.18) 1px, transparent 1px);
  background-size: 33.33% 12.5%, 25% 12.5%;
}

.preview-block,
.preview-cell,
.preview-ball,
.preview-beam {
  position: absolute;
  display: grid;
  place-items: center;
}

.preview-block {
  width: 25%;
  aspect-ratio: 1;
  color: #051018;
  font-size: 14px;
  font-weight: 1000;
  border-radius: 4px;
  box-shadow: inset 0 7px rgba(255,255,255,0.24), inset -8px -8px rgba(0,0,0,0.18);
}

.block-a { left: 0; top: 18%; background: #ff9f2f; }
.block-b { left: 50%; top: 18%; background: #e7ecff; }
.block-c { left: 25%; top: 34%; background: #67e0bb; }

.preview-cell {
  left: 62%;
  top: 36%;
  width: 25%;
  aspect-ratio: 1;
  color: #fff;
  font-size: 10px;
  font-weight: 1000;
  border: 1px solid rgba(255, 90, 168, 0.86);
  border-radius: 8px;
  background: rgba(255, 90, 168, 0.22);
  box-shadow: 0 0 22px rgba(255, 90, 168, 0.48), inset 0 0 24px rgba(255,255,255,0.14);
}

.preview-beam {
  left: 14%;
  top: 72%;
  width: 76%;
  height: 3px;
  transform-origin: left center;
  background: linear-gradient(90deg, rgba(255,255,255,0), #ffeaa1, rgba(255,255,255,0));
  box-shadow: 0 0 14px rgba(255, 209, 102, 0.8);
}

.beam-a { transform: rotate(-19deg); }
.beam-b { transform: rotate(23deg); }

.preview-ball {
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, #fff7c2, #ffd166 42%, #a56b00);
  box-shadow: 0 0 22px rgba(255, 209, 102, 0.74);
}

.ball-a { left: 10%; bottom: 10%; }
.ball-b { right: 9%; top: 58%; }

.top-menu {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.menu-button {
  min-height: 66px;
  border-color: rgba(68,217,255,0.34);
  background:
    linear-gradient(135deg, rgba(12, 24, 44, 0.95), rgba(13, 20, 34, 0.88)),
    rgba(27,32,40,0.86);
  color: #eef4f8;
  font-size: clamp(14px, 2.2vw, 18px);
  box-shadow: 0 0 24px rgba(68,217,255,0.1), inset 0 0 22px rgba(68,217,255,0.06);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.menu-button:hover {
  transform: translateY(-2px);
  border-color: rgba(68,217,255,0.82);
  box-shadow: 0 0 30px rgba(68,217,255,0.24), inset 0 0 24px rgba(255,90,168,0.08);
}

.home-action {
  display: grid;
  place-items: center;
  gap: 2px;
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1;
}

.home-action span {
  font-size: 11px;
  font-weight: 1000;
  text-transform: uppercase;
  color: var(--muted);
}

.level-preview-panel {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
  padding: 11px;
  border: 1px solid rgba(68,217,255,0.22);
  border-radius: 8px;
  background:
    radial-gradient(circle at 20% 0%, rgba(68,217,255,0.12), transparent 32%),
    rgba(2, 7, 17, 0.68);
  box-shadow: 0 18px 48px rgba(0,0,0,0.34), 0 0 28px rgba(68,217,255,0.08), inset 0 0 30px rgba(255,255,255,0.025);
  cursor: pointer;
}

.level-preview-panel::after {
  content: "Start";
  position: absolute;
  left: 50%;
  top: 58%;
  z-index: 2;
  transform: translate(-50%, -50%);
  padding: 10px 28px;
  border: 1px solid rgba(255, 209, 102, 0.72);
  border-radius: 999px;
  background: rgba(8, 12, 22, 0.76);
  color: #fff7c2;
  font-size: clamp(22px, 4vw, 28px);
  font-weight: 1000;
  text-shadow: 0 0 16px rgba(255, 209, 102, 0.62);
  box-shadow: 0 0 24px rgba(255, 209, 102, 0.2);
  pointer-events: none;
}

.top-screen.is-drawer-open .level-preview-panel {
  display: none;
}

.preview-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
}

.preview-heading strong {
  color: #eefbff;
  font-size: 18px;
  text-shadow: 0 0 14px rgba(68,217,255,0.34);
}

#topLevelPreview {
  width: 100%;
  height: auto;
  aspect-ratio: 720 / 360;
  display: block;
  border: 1px solid rgba(120,150,190,0.36);
  border-radius: 8px;
  background: #070d18;
  box-shadow: 0 0 22px rgba(68,217,255,0.08);
  opacity: 0.72;
}

.top-drawer {
  position: relative;
  z-index: 2;
  max-height: min(56vh, 540px);
  overflow: auto;
  padding: 12px;
  border: 1px solid rgba(68,217,255,0.22);
  border-radius: 8px;
  background: rgba(3, 8, 18, 0.86);
  box-shadow: inset 0 0 36px rgba(68,217,255,0.06);
}

#topStagePanel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  overflow: hidden;
}

#topStagePanel.is-hidden {
  display: none;
}

.top-screen.is-drawer-open .top-drawer:not(.is-hidden) {
  max-height: max(320px, calc(100vh - 360px));
}

.stage-select-preview {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(68,217,255,0.22);
  border-radius: 8px;
  background:
    radial-gradient(circle at 30% 0%, rgba(68,217,255,0.12), transparent 38%),
    rgba(2, 7, 17, 0.72);
  box-shadow: 0 14px 36px rgba(0,0,0,0.3), inset 0 0 24px rgba(255,255,255,0.025);
}

#stageSelectPreview {
  width: 100%;
  height: auto;
  aspect-ratio: 720 / 360;
  display: block;
  border: 1px solid rgba(120,150,190,0.36);
  border-radius: 8px;
  background: #070d18;
  opacity: 0.82;
  pointer-events: none;
}

.preview-start-button {
  position: absolute;
  left: 50%;
  top: 58%;
  z-index: 8;
  transform: translate(-50%, -50%);
  min-height: 0;
  padding: 10px 30px;
  border: 1px solid rgba(255, 209, 102, 0.78);
  border-radius: 999px;
  background: rgba(8, 12, 22, 0.78);
  color: #fff7c2;
  font-size: clamp(22px, 4vw, 28px);
  font-weight: 1000;
  text-shadow: 0 0 16px rgba(255, 209, 102, 0.62);
  box-shadow: 0 0 28px rgba(255, 209, 102, 0.23), inset 0 0 18px rgba(255,255,255,0.04);
  pointer-events: auto;
  touch-action: manipulation;
}

.preview-start-button:hover,
.preview-start-button:focus-visible,
.preview-start-button:active {
  transform: translate(-50%, -50%);
}

.preview-start-button:disabled {
  display: none;
  opacity: 0.38;
  border-color: rgba(120, 150, 190, 0.28);
  color: rgba(238, 244, 248, 0.7);
  box-shadow: none;
  cursor: default;
}

.how-panel {
  color: rgba(238,244,248,0.86);
  font-weight: 800;
  line-height: 1.5;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.stats-grid > div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid rgba(68,217,255,0.18);
  border-radius: 8px;
  background: rgba(255,255,255,0.035);
}

.stats-grid span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.stats-grid strong {
  color: #eefbff;
  font-size: 24px;
  text-shadow: 0 0 14px rgba(68,217,255,0.24);
}

.how-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.how-columns article {
  display: grid;
  gap: 7px;
  align-content: start;
}

.how-columns h2,
.how-columns h3 {
  margin: 0;
}

.how-columns h2 {
  color: #eefbff;
  font-size: 20px;
}

.how-columns h3 {
  color: #44d9ff;
  font-size: 13px;
}

.how-panel p {
  margin: 0;
  font-size: 13px;
}

.how-panel p + p {
  margin-top: 6px;
}

.stage-grid {
  display: grid;
  gap: 14px;
  overflow: auto;
  padding-right: 2px;
}

.side-section {
  display: grid;
  gap: 10px;
}

.side-section h2 {
  margin: 0;
  color: #eef4f8;
  font-size: 22px;
  line-height: 1;
}

.super-title {
  margin: 8px 0 0;
  color: #ffd166;
  font-size: 13px;
  font-weight: 1000;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 0 0 14px rgba(255, 209, 102, 0.36);
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.stage-button {
  min-height: 62px;
  display: grid;
  align-content: center;
  gap: 4px;
  text-align: center;
  overflow: hidden;
}

.stage-button.is-selected {
  border-color: rgba(255, 209, 102, 0.78);
  box-shadow: 0 0 26px rgba(255, 209, 102, 0.22), inset 0 0 20px rgba(255, 209, 102, 0.08);
}

.stage-button strong {
  font-size: 26px;
}

.stage-button[disabled] {
  opacity: 0.38;
  cursor: default;
}

.stage-button.is-locked {
  opacity: 0.48;
  border-color: rgba(120, 150, 190, 0.18);
}

.stage-button.is-locked strong,
.stage-button.is-locked .label {
  color: rgba(170, 185, 204, 0.7);
}

.super-stage-button {
  border-color: rgba(255, 209, 102, 0.38);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 209, 102, 0.14), transparent 48%),
    rgba(27, 32, 40, 0.86);
  box-shadow: 0 0 20px rgba(255, 209, 102, 0.1), 0 12px 34px rgba(0, 0, 0, 0.26);
}

.collection-panel {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  margin-top: 6px;
  padding: 12px;
  border: 1px solid rgba(255, 209, 102, 0.2);
  border-radius: 8px;
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 209, 102, 0.1), transparent 42%),
    rgba(255,255,255,0.026);
}

.collection-panel h3 {
  margin: 0;
  color: #ffd166;
  font-size: 18px;
  text-transform: uppercase;
}

.collection-panel p {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.collection-grid {
  display: grid;
  gap: 8px;
}

.title-button {
  min-height: 64px;
  text-align: center;
  padding: 14px 16px;
  border-color: rgba(255, 209, 102, 0.34);
  color: #fff7c2;
  font-size: clamp(17px, 3.3vw, 22px);
  font-weight: 1000;
  background:
    linear-gradient(135deg, rgba(55, 42, 13, 0.82), rgba(15, 20, 33, 0.9)),
    rgba(27, 32, 40, 0.86);
  box-shadow: 0 0 24px rgba(255, 209, 102, 0.12), inset 0 0 24px rgba(255, 209, 102, 0.06);
}

.hud,
.controls {
  display: grid;
  gap: 10px;
}

.hud {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.controls {
  grid-template-columns: minmax(220px, 0.95fr) minmax(280px, 1.45fr) auto;
  align-items: stretch;
}

.hud > div,
button,
.volley,
.aim-control,
.item-card {
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(27, 32, 40, 0.86);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.26);
}

.hud > div {
  display: grid;
  align-content: center;
  justify-items: center;
}

.label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

strong {
  font-variant-numeric: tabular-nums;
  font-size: 22px;
  line-height: 1;
}

canvas {
  width: 100%;
  aspect-ratio: 720 / 890;
  display: block;
  border: 1px solid #3c4654;
  border-radius: 8px;
  background: #080a0f;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  touch-action: none;
}

.playfield {
  position: relative;
}

.playfield canvas {
  width: 100%;
}

#fireworks {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  box-shadow: none;
  pointer-events: none;
}

.clear-overlay,
.game-modal {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: clamp(12px, 4vw, 32px);
  background: rgba(1, 6, 14, 0.34);
  pointer-events: auto;
}

.toast {
  position: absolute;
  left: 50%;
  top: 52%;
  z-index: 5;
  min-width: min(82%, 330px);
  transform: translate(-50%, -50%);
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 18px 22px;
  border: 1px solid rgba(255, 209, 102, 0.72);
  border-radius: 8px;
  background: rgba(10, 13, 18, 0.82);
  box-shadow: 0 0 34px rgba(255, 209, 102, 0.24), inset 0 0 24px rgba(255, 209, 102, 0.08);
  pointer-events: none;
}

.toast strong {
  color: #fff6ca;
  font-size: 30px;
  text-align: center;
  text-shadow: 0 0 18px rgba(255, 209, 102, 0.58);
}

.toast span {
  color: #eef4f8;
  font-size: 18px;
  font-weight: 1000;
}

.toast small {
  color: #ffd166;
  font-size: 16px;
  font-weight: 1000;
  line-height: 0.96;
  display: grid;
  justify-items: center;
  text-align: center;
  text-shadow: 0 0 14px rgba(255, 209, 102, 0.5);
}

.toast small span {
  display: block;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  text-align: center;
}

.toast small .super-bonus-label {
  margin-top: 0;
}

.toast small .super-bonus-multiplier {
  margin-top: 0;
  font-size: 1em;
  line-height: 0.96;
}

.toast.is-amazing {
  min-width: min(84%, 360px);
  gap: 6px;
  padding: 16px 22px;
}

.toast.is-amazing > span {
  color: #ffffff;
  font-size: clamp(42px, 10vw, 64px);
  line-height: 0.92;
  text-shadow: 0 0 22px rgba(255, 255, 255, 0.52);
}

.toast.is-amazing small {
  font-size: 16px;
}

button {
  color: var(--text);
  cursor: pointer;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0;
}

button[disabled] {
  cursor: default;
  opacity: 0.42;
}

.inventory {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  grid-column: 1 / -1;
}

.item-card {
  position: relative;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 48px;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  text-align: left;
}

.item-card[disabled] {
  cursor: default;
  opacity: 0.42;
}

.item-card.is-selected {
  border-color: #ffd166;
  box-shadow: 0 0 22px rgba(255, 209, 102, 0.34), inset 0 0 18px rgba(255, 209, 102, 0.08);
}

.item-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.38);
  background:
    radial-gradient(circle at 32% 25%, rgba(255,255,255,0.95), rgba(255,255,255,0.2) 22%, transparent 28%),
    conic-gradient(from 30deg, #fff7c2, #44d9ff, #ff5aa8, #fff7c2);
  color: #0b0e14;
  font-size: 15px;
  font-weight: 1000;
  box-shadow: 0 0 16px rgba(255, 209, 102, 0.24);
}

.item-card[data-item="power"] .item-icon {
  background:
    radial-gradient(circle at 32% 25%, rgba(255,255,255,0.95), rgba(255,255,255,0.22) 22%, transparent 28%),
    linear-gradient(135deg, #ffd1e7, #ff4f8f 52%, #651039);
  box-shadow: 0 0 18px rgba(255, 79, 143, 0.38);
}

.item-card[data-item="split"] .item-icon {
  background:
    radial-gradient(circle at 32% 25%, rgba(255,255,255,0.95), rgba(255,255,255,0.22) 22%, transparent 28%),
    linear-gradient(135deg, #c8f6ff, #44d9ff 52%, #0b5870);
  box-shadow: 0 0 18px rgba(68, 217, 255, 0.38);
}

.item-card[data-item="big"] .item-icon {
  background:
    radial-gradient(circle at 32% 25%, rgba(255,255,255,0.95), rgba(255,255,255,0.22) 22%, transparent 28%),
    linear-gradient(135deg, #fff4ba, #ffd166 52%, #6f4d05);
  box-shadow: 0 0 18px rgba(255, 209, 102, 0.4);
}

.item-name {
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0;
}

.item-card strong {
  justify-self: end;
  font-size: 20px;
}

.assist-controls {
  display: grid;
  grid-template-columns: repeat(3, 66px);
  gap: 8px;
  align-content: center;
  justify-content: end;
}

.assist-button {
  width: 66px;
  min-height: 66px;
  padding: 7px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  font-size: 11px;
  line-height: 1.08;
  text-align: center;
  color: #eefaff;
}

.assist-button.is-active {
  border-color: var(--yellow);
  box-shadow: 0 0 18px rgba(255, 209, 102, 0.45);
}

.assist-button.is-active .assist-icon {
  color: var(--yellow);
  filter:
    drop-shadow(0 0 8px rgba(255, 209, 102, 0.72))
    drop-shadow(0 0 16px rgba(255, 209, 102, 0.34));
}

.assist-icon {
  width: 28px;
  height: 28px;
  color: #9fefff;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter:
    drop-shadow(0 0 6px rgba(68, 217, 255, 0.62))
    drop-shadow(0 0 13px rgba(68, 217, 255, 0.25));
  transition: transform 0.16s ease, color 0.16s ease, filter 0.16s ease;
}

.assist-icon-fast {
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 1.25;
}

.assist-button:hover .assist-icon,
.assist-button:focus-visible .assist-icon {
  color: #ffffff;
  transform: translateY(-1px) scale(1.07);
}

.assist-label {
  display: block;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
  text-shadow: 0 0 10px rgba(68, 217, 255, 0.34);
}

.volley {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  justify-items: center;
  gap: 7px;
  padding: 8px 12px;
}

.bullet-stepper {
  display: grid;
  grid-template-columns: 48px 82px 48px;
  align-items: center;
  gap: 8px;
}

.bullet-shot-label {
  grid-column: 1 / -1;
  justify-self: center;
  line-height: 1;
}

.bullet-readout {
  position: relative;
  display: inline-grid;
  place-items: center;
  min-width: 86px;
}

.bullet-remaining {
  color: #eef4f8;
  font-size: 30px;
  text-shadow: 0 0 14px rgba(68, 217, 255, 0.22);
}

.bullet-remaining.is-bump {
  animation: bulletBump 0.42s ease-out;
  color: #fff6ca;
  text-shadow: 0 0 20px rgba(255, 209, 102, 0.62);
}

.bullet-gain {
  position: absolute;
  right: -34px;
  top: 2px;
  color: #ffd166;
  font-size: 17px;
  font-weight: 1000;
  text-shadow: 0 0 14px rgba(255, 209, 102, 0.7);
  pointer-events: none;
}

.bullet-gain.is-floating {
  animation: bulletGainFloat 0.9s ease-out forwards;
}

.bullet-remaining.is-low {
  color: #ff4e62;
  animation: bulletLowPulse 1.15s ease-in-out infinite;
  text-shadow: 0 0 18px rgba(255, 78, 98, 0.62);
}

@keyframes bulletBump {
  0% {
    transform: scale(1);
  }
  42% {
    transform: scale(1.16);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes bulletGainFloat {
  0% {
    opacity: 0;
    transform: translateY(8px) scale(0.92);
  }
  18% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-22px) scale(1.04);
  }
}

@keyframes bulletLowPulse {
  0%,
  100% {
    opacity: 0.72;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.06);
  }
}

.stepper-button {
  width: 48px;
  height: 48px;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  font-size: 26px;
  line-height: 1;
}

#volleyValue {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 48px;
  color: #ffffff;
  font-size: 34px;
  text-align: center;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: ns-resize;
}

#volleyValue::after {
  content: attr(data-delta);
  position: absolute;
  left: 50%;
  top: -12px;
  color: #ffd166;
  font-size: 14px;
  font-weight: 1000;
  opacity: 0;
  pointer-events: none;
  text-shadow: 0 0 12px rgba(255, 209, 102, 0.72);
  transform: translate(-50%, 8px) scale(0.92);
}

#volleyValue.is-swipe-up {
  animation: volleySwipeUp 0.22s ease-out;
}

#volleyValue.is-swipe-down {
  animation: volleySwipeDown 0.22s ease-out;
}

#volleyValue.is-swipe-up::after,
#volleyValue.is-swipe-down::after {
  animation: volleyDeltaFloat 0.5s ease-out forwards;
}

@keyframes volleySwipeUp {
  0% { transform: translateY(0) scale(1); }
  45% { transform: translateY(-4px) scale(1.08); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes volleySwipeDown {
  0% { transform: translateY(0) scale(1); }
  45% { transform: translateY(4px) scale(1.08); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes volleyDeltaFloat {
  0% {
    opacity: 0;
    transform: translate(-50%, 8px) scale(0.92);
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -16px) scale(1.04);
  }
}

.volley output,
.angle-readout output {
  width: 74px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #10151d;
  color: var(--text);
  font: 800 14px ui-sans-serif, system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}

.aim-control {
  position: relative;
  min-height: 204px;
  padding: 52px 18px 12px;
  overflow: hidden;
}

.protractor {
  position: relative;
  width: min(100%, 360px);
  height: 128px;
  margin: 0 auto;
  touch-action: none;
  cursor: grab;
}

.protractor:active {
  cursor: grabbing;
}

.arc {
  position: absolute;
  left: 50%;
  bottom: 12px;
  width: 310px;
  height: 155px;
  transform: translateX(-50%);
  border: 2px solid rgba(68, 217, 255, 0.75);
  border-bottom: 0;
  border-radius: 310px 310px 0 0;
  background:
    radial-gradient(ellipse at 50% 100%, rgba(255, 90, 168, 0.18), transparent 40%),
    linear-gradient(180deg, rgba(68, 217, 255, 0.14), rgba(17, 24, 39, 0.28));
  box-shadow: inset 0 12px 22px rgba(255,255,255,0.06), 0 0 24px rgba(68, 217, 255, 0.16);
}

.ticks {
  position: absolute;
  left: 50%;
  bottom: 12px;
  width: 310px;
  height: 155px;
  transform: translateX(-50%);
  border-radius: 310px 310px 0 0;
  background:
    repeating-conic-gradient(from 270deg at 50% 100%, rgba(255,255,255,0.54) 0deg 1deg, transparent 1deg 10deg);
  mask: radial-gradient(ellipse at 50% 100%, transparent 0 76px, #000 77px 80px, transparent 81px);
}

.aim-needle {
  position: absolute;
  left: 50%;
  bottom: 20px;
  width: 54px;
  height: 122px;
  transform: translateX(-50%) rotate(0deg);
  transform-origin: 50% 100%;
  border-radius: 999px 999px 10px 10px;
  background:
    radial-gradient(circle at 50% 0, rgba(255,255,255,0.42), transparent 18px),
    linear-gradient(90deg, transparent 0 22px, rgba(255,255,255,0.72) 22px 24px, #44d9ff 24px 30px, rgba(255,255,255,0.62) 30px 32px, transparent 32px);
  box-shadow: 0 0 18px rgba(68, 217, 255, 0.62);
  pointer-events: none;
}

.aim-handle {
  position: absolute;
  left: 50%;
  top: -19px;
  width: 44px;
  height: 44px;
  transform: translateX(-50%);
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.92);
  background:
    radial-gradient(circle at 34% 28%, #ffffff 0 10%, #ffd1e7 18%, transparent 24%),
    repeating-conic-gradient(from 6deg, rgba(255,255,255,0.42) 0deg 10deg, rgba(120,15,72,0.2) 10deg 22deg),
    radial-gradient(circle at 50% 50%, #ff6fb5 0 36%, #d7227d 58%, #6f0c42 100%);
  box-shadow: 0 0 24px rgba(255, 90, 168, 0.88), inset 0 -7px 14px rgba(0,0,0,0.34);
}

.aim-handle::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.34);
  background: radial-gradient(circle at 40% 35%, rgba(255,255,255,0.7), rgba(255,255,255,0.08) 42%, rgba(0,0,0,0.16) 100%);
}

.fire-button {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 74px;
  height: 74px;
  min-height: 0;
  transform: translateX(-50%);
  border-radius: 50%;
  border-color: rgba(255, 90, 168, 0.72);
  background:
    radial-gradient(circle at 35% 25%, rgba(255,255,255,0.95), rgba(255,209,231,0.65) 16%, rgba(255,90,168,0.92) 44%, rgba(85,11,52,0.98) 100%);
  box-shadow: 0 0 22px rgba(255, 90, 168, 0.5), inset 0 -8px 20px rgba(0,0,0,0.36);
  font-size: 15px;
}

.fire-button:hover,
.fire-button:focus-visible {
  border-color: #ffffff;
  box-shadow: 0 0 28px rgba(255, 90, 168, 0.74), inset 0 -8px 20px rgba(0,0,0,0.36);
  transform: translateX(-50%);
}

.fire-button:active {
  transform: translateX(-50%);
}

.angle-readout {
  position: absolute;
  right: 10px;
  bottom: 8px;
  display: grid;
  gap: 3px;
  justify-items: end;
}

.angle-range {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.controls {
  grid-template-columns: minmax(0, 1fr);
}

.aim-control {
  display: none;
}

.volley {
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  min-height: 88px;
  padding: 10px 14px;
  column-gap: 18px;
  row-gap: 0;
}

.bullet-panel {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 7px;
  min-width: 0;
}

.bullet-stepper {
  justify-self: center;
  align-self: center;
}

.fire-button {
  position: static;
  left: auto;
  bottom: auto;
  justify-self: center;
  align-self: center;
  transform: none;
}

.fire-button:hover,
.fire-button:focus-visible {
  transform: translateY(-1px);
}

.fire-button:active {
  transform: translateY(1px);
}

.playfield .angle-readout {
  right: 12px;
  bottom: 12px;
  z-index: 4;
  padding: 6px 8px;
  border: 1px solid rgba(120, 150, 190, 0.34);
  border-radius: 7px;
  background: rgba(8, 12, 20, 0.72);
  backdrop-filter: blur(5px);
  pointer-events: none;
}

button:hover,
button:focus-visible {
  border-color: var(--cyan);
  outline: none;
  transform: translateY(-1px);
}

button:active {
  transform: translateY(1px);
}

.clear-panel,
.modal-panel {
  width: min(92%, 430px);
  padding: 18px;
  backdrop-filter: blur(8px);
  background: rgba(16, 21, 29, 0.9);
}

.game-modal {
  background: rgba(1, 6, 14, 0.42);
  pointer-events: auto;
}

.modal-panel {
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5), 0 0 36px rgba(255, 90, 168, 0.12);
  text-align: center;
}

.modal-panel p {
  margin: 12px 0 18px;
  color: #d7e0ea;
  font-size: 17px;
  font-weight: 800;
}

.modal-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.score-list {
  display: grid;
  gap: 8px;
  margin: 18px 0;
}

.score-list > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

dt {
  color: var(--muted);
  font-weight: 800;
}

dd {
  margin: 0;
  font-size: 22px;
  font-weight: 1000;
  font-variant-numeric: tabular-nums;
  white-space: pre-line;
}

.clear-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 10px;
}

.clear-overlay.is-title-replay .clear-actions {
  grid-template-columns: minmax(0, 1fr);
}

.clear-overlay.is-title-replay #nextStage {
  display: none;
}

.clear-overlay.is-title-replay #clearTop {
  min-height: 54px;
  font-size: 18px;
}

.clear-overlay.is-ending {
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 209, 102, 0.16), transparent 30%),
    radial-gradient(circle at 28% 78%, rgba(68, 217, 255, 0.13), transparent 34%),
    rgba(1, 6, 14, 0.36);
}

.clear-overlay.is-ending .clear-panel {
  width: min(92%, 520px);
  border: 1px solid rgba(255, 209, 102, 0.42);
  background:
    linear-gradient(145deg, rgba(16, 21, 29, 0.92), rgba(8, 12, 22, 0.92)),
    radial-gradient(circle at 50% 0%, rgba(255, 209, 102, 0.14), transparent 52%);
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.58),
    0 0 42px rgba(255, 209, 102, 0.18),
    inset 0 0 42px rgba(68, 217, 255, 0.06);
  text-align: center;
}

.clear-overlay.is-ending .clear-panel h2 {
  margin: 4px 0 6px;
  color: #fff7c2;
  font-size: clamp(34px, 7vw, 54px);
  line-height: 0.96;
  text-shadow:
    0 0 16px rgba(255, 209, 102, 0.7),
    0 0 32px rgba(68, 217, 255, 0.28);
}

.ending-credits {
  display: grid;
  gap: 9px;
  margin: 12px 0 16px;
  color: #dfeaf2;
  font-weight: 800;
}

.ending-credits p {
  margin: 0;
}

.ending-credits span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.ending-credits strong {
  display: block;
  margin-top: 3px;
  font-size: 22px;
}

.ending-lead {
  color: #ffffff;
  font-size: 18px;
}

.ending-continue {
  color: #9fefff;
  text-shadow: 0 0 14px rgba(68, 217, 255, 0.44);
}

.ending-super {
  color: #ffd166;
  text-shadow: 0 0 14px rgba(255, 209, 102, 0.34);
}

.clear-overlay.is-ending .clear-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.clear-overlay.is-ending .clear-actions button {
  min-height: 48px;
  padding-inline: 10px;
  font-size: clamp(12px, 2.8vw, 15px);
  line-height: 1.1;
}

.clear-overlay.is-title-replay .clear-actions {
  grid-template-columns: minmax(0, 1fr);
}

.ending-rights {
  color: var(--muted);
  font-size: 12px;
}

.unlock-notice {
  margin: 4px 0 10px;
  color: #ff8cc4;
  font-size: 16px;
  font-weight: 1000;
  text-align: center;
  text-shadow: 0 0 14px rgba(255, 90, 168, 0.36);
}

@media (max-width: 620px) {
  body {
    padding: 6px;
    align-items: start;
  }

  .shell,
  .screen {
    gap: 7px;
  }

  .hud,
  .inventory,
  .controls {
    gap: 6px;
  }

  .hud {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .hud > div {
    min-height: 42px;
  }

  .label {
    font-size: 9px;
  }

  .playfield {
    width: min(100%, 46vh);
    justify-self: center;
  }

  .controls {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .top-bar,
  .clear-actions {
    grid-template-columns: 1fr;
  }

  .top-screen {
    min-height: calc(100dvh - 12px);
    max-height: calc(100dvh - 12px);
    padding: 10px;
    gap: 9px;
  }

  .top-hero {
    grid-template-columns: 1fr;
    gap: 10px;
    justify-items: center;
    text-align: center;
  }

  .hero-copy {
    justify-items: center;
  }

  .top-hero h1 {
    font-size: clamp(36px, 13vw, 58px);
  }

  .game-preview {
    width: min(42vw, 150px);
    justify-self: center;
    transform: perspective(700px) rotateY(-7deg) rotateZ(1deg);
  }

  .top-menu {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .menu-button {
    min-height: 56px;
  }

  .level-preview-panel {
    padding: 8px;
    gap: 6px;
  }

  .level-preview-panel::after,
  .preview-start-button {
    padding: 9px 24px;
    font-size: 22px;
  }

  .preview-heading strong {
    font-size: 15px;
  }

  #topLevelPreview {
    aspect-ratio: 720 / 300;
  }

  .top-drawer {
    max-height: 50vh;
    padding: 9px;
  }

  .top-screen.is-drawer-open .top-drawer:not(.is-hidden) {
    max-height: max(300px, calc(100dvh - 315px));
  }

  #topStagePanel {
    gap: 8px;
  }

  .stage-select-preview {
    padding: 8px;
    gap: 6px;
  }

  #stageSelectPreview {
    aspect-ratio: 720 / 360;
  }

  .stats-grid,
  .how-columns {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .stats-grid > div {
    padding: 9px;
  }

  .how-columns h2 {
    font-size: 17px;
  }

  .how-columns h3,
  .how-panel p {
    font-size: 12px;
  }

  .stage-grid {
    gap: 12px;
  }

  .level-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }

  .stage-button {
    min-height: 56px;
  }

  .assist-controls {
    grid-template-columns: repeat(3, 54px);
    justify-content: center;
  }

  .hud > div,
  button,
  .volley,
  .aim-control,
  .item-card {
    min-height: 48px;
  }

  .aim-control {
    grid-column: 1 / -1;
    min-height: 150px;
    padding: 30px 10px 8px;
  }

  strong {
    font-size: 15px;
  }

  button {
    font-size: 13px;
  }

  .assist-button {
    width: 54px;
    min-height: 48px;
    font-size: 9px;
    padding: 5px;
    gap: 1px;
  }

  .assist-icon {
    width: 22px;
    height: 22px;
  }

  .assist-label {
    font-size: 8px;
  }

  .volley {
    min-height: 50px;
    padding: 6px 8px;
  }

  .bullet-stepper {
    grid-template-columns: 42px 70px 42px;
    gap: 6px;
  }

  .bullet-remaining {
    font-size: 24px;
  }

  .bullet-gain {
    right: -28px;
    font-size: 15px;
  }

  .stepper-button {
    width: 42px;
    height: 42px;
    font-size: 23px;
  }

  #volleyValue {
    min-height: 42px;
    font-size: 28px;
  }

  .protractor {
    width: min(100%, 286px);
    height: 98px;
  }

  .arc,
  .ticks {
    width: 236px;
    height: 118px;
  }

  .ticks {
    mask: radial-gradient(ellipse at 50% 100%, transparent 0 60px, #000 61px 64px, transparent 65px);
  }

  .aim-needle {
    height: 92px;
    width: 48px;
  }

  .aim-handle {
    width: 38px;
    height: 38px;
    top: -16px;
  }

  .fire-button {
    width: 60px;
    height: 60px;
    font-size: 13px;
  }

  .item-card {
    grid-template-columns: 34px minmax(0, 1fr) 28px;
    min-height: 46px;
    padding: 5px 7px;
    gap: 6px;
  }

  .item-icon {
    width: 34px;
    height: 34px;
    font-size: 12px;
  }

  .item-name {
    font-size: 11px;
  }

  .item-card strong {
    font-size: 15px;
  }

  .inventory {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .modal-panel {
    padding: 14px;
  }

  .modal-panel p {
    font-size: 15px;
  }
}

@media (orientation: portrait) and (max-width: 900px) {
  html,
  body {
    height: 100dvh;
    overflow: hidden;
  }

  body {
    padding: 4px;
    align-items: start;
  }

  .shell {
    width: min(100%, 680px);
    height: calc(100dvh - 8px);
    gap: 5px;
  }

  .play-screen {
    height: 100%;
    grid-template-rows: auto minmax(0, auto) auto;
    align-content: start;
    gap: 5px;
  }

  .hud {
    gap: 5px;
  }

  .hud > div {
    min-height: 38px;
    padding: 3px 2px;
  }

  .hud > div,
  button,
  .volley,
  .aim-control,
  .item-card {
    border-radius: 7px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
  }

  .label {
    font-size: 9px;
  }

  strong {
    font-size: 16px;
  }

  .playfield {
    width: min(100%, max(300px, calc((100dvh - 318px) * 0.809)));
    justify-self: center;
  }

  canvas {
    border-radius: 6px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.34);
  }

  .controls {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 5px;
  }

  .volley {
    min-height: 42px;
    padding: 4px 7px;
    gap: 6px;
  }

  .bullet-stepper {
    grid-template-columns: 38px 62px 38px;
    gap: 5px;
  }

  .bullet-remaining {
    font-size: 21px;
  }

  .bullet-gain {
    right: -24px;
    font-size: 13px;
  }

  .stepper-button {
    width: 38px;
    height: 38px;
    font-size: 21px;
  }

  #volleyValue {
    min-height: 38px;
    font-size: 25px;
  }

  .assist-controls {
    grid-template-columns: repeat(3, 52px);
    gap: 5px;
    justify-content: center;
  }

  .assist-button {
    width: 52px;
    min-height: 44px;
    padding: 4px;
    font-size: 9px;
    gap: 1px;
  }

  .assist-icon {
    width: 21px;
    height: 21px;
  }

  .assist-label {
    font-size: 8px;
  }

  .aim-control {
    grid-column: 1 / -1;
    min-height: 132px;
    padding: 24px 8px 6px;
  }

  .protractor {
    width: min(100%, 270px);
    height: 86px;
  }

  .arc,
  .ticks {
    width: 220px;
    height: 110px;
  }

  .ticks {
    mask: radial-gradient(ellipse at 50% 100%, transparent 0 54px, #000 55px 58px, transparent 59px);
  }

  .aim-needle {
    height: 82px;
    width: 42px;
  }

  .aim-handle {
    width: 34px;
    height: 34px;
    top: -14px;
  }

  .fire-button {
    width: 56px;
    height: 56px;
    font-size: 12px;
  }

  .angle-readout {
    right: 7px;
    bottom: 5px;
  }

  .angle-readout output {
    width: 62px;
    height: 28px;
    font-size: 12px;
  }

  .inventory {
    gap: 5px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .item-card {
    grid-template-columns: 30px minmax(0, 1fr) 24px;
    min-height: 39px;
    padding: 4px 6px;
    gap: 5px;
  }

  .item-icon {
    width: 30px;
    height: 30px;
    font-size: 11px;
  }

  .item-name {
    font-size: 10px;
  }

  .item-card strong {
    font-size: 14px;
  }
}

@media (orientation: portrait) and (max-height: 760px) {
  .shell,
  .screen,
  .play-screen {
    gap: 4px;
  }

  .playfield {
    width: min(100%, max(280px, calc((100dvh - 288px) * 0.809)));
  }

  .hud > div {
    min-height: 34px;
  }

  .aim-control {
    min-height: 116px;
    padding-top: 20px;
  }

  .protractor {
    height: 76px;
  }

  .arc,
  .ticks {
    width: 200px;
    height: 100px;
  }

  .aim-needle {
    height: 72px;
  }

  .fire-button {
    width: 50px;
    height: 50px;
  }

  .item-card {
    min-height: 35px;
  }
}

@media (max-width: 600px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  body {
    padding:
      max(8px, env(safe-area-inset-top))
      8px
      max(10px, calc(env(safe-area-inset-bottom) + 8px));
    place-items: start center;
  }

  .shell {
    width: min(100%, 430px);
    max-width: 100%;
    height: auto;
    min-height: 0;
  }

  .top-screen {
    width: 100%;
    min-height: 0;
    height: auto;
    max-height: none;
    gap: 7px;
    padding: 9px;
    overflow: hidden;
    background-size: 28px 28px, 28px 28px, auto, auto, auto;
  }

  .top-screen::before {
    width: 36px;
    height: 36px;
    opacity: 0.55;
  }

  .top-screen::after {
    width: 16px;
    height: 16px;
    opacity: 0.65;
  }

  .lab-header {
    justify-content: center;
    min-width: 0;
  }

  .lab-link {
    max-width: 100%;
    font-size: clamp(12px, 3.4vw, 14px);
    letter-spacing: 0.02em;
    line-height: 1.15;
    text-align: center;
    white-space: normal;
  }

  .top-hero {
    grid-template-columns: minmax(0, 1fr) minmax(72px, 0.25fr);
    gap: 7px;
    align-items: center;
    justify-items: stretch;
    text-align: left;
  }

  .hero-copy {
    width: 100%;
    justify-items: start;
    gap: 3px;
  }

  .hero-kicker {
    max-width: 100%;
    font-size: clamp(8px, 2.45vw, 10px);
    letter-spacing: 0.1em;
    line-height: 1.15;
  }

  .top-hero h1 {
    max-width: 100%;
    font-size: clamp(29px, 9vw, 40px);
    line-height: 0.92;
    text-align: left;
  }

  .game-preview {
    display: block;
    width: min(21vw, 78px);
    min-width: 64px;
    justify-self: end;
    transform: perspective(560px) rotateY(-8deg) rotateZ(1deg);
  }

  .top-menu {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .menu-button {
    min-width: 0;
    min-height: 44px;
    padding: 7px 6px;
    font-size: clamp(12px, 3.55vw, 14px);
    line-height: 1.05;
    overflow-wrap: normal;
  }

  .primary-action {
    min-width: 0;
  }

  .level-preview-panel {
    width: 100%;
    max-width: 100%;
    gap: 4px;
    padding: 6px;
    overflow: hidden;
  }

  .preview-heading {
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
  }

  .preview-heading .label {
    font-size: 8px;
    line-height: 1;
  }

  .preview-heading strong {
    font-size: clamp(16px, 4.8vw, 20px);
  }

  #topLevelPreview {
    width: 100%;
    max-width: 100%;
    height: clamp(118px, 23vh, 166px);
    height: clamp(118px, 23svh, 166px);
    max-height: 166px;
    aspect-ratio: 720 / 360;
    border-radius: 7px;
  }

  .play-screen {
    height: auto;
    min-height: 0;
    max-height: none;
    grid-template-rows: auto minmax(0, auto) auto;
    gap: 5px;
    overflow: visible;
    padding-bottom: max(6px, env(safe-area-inset-bottom));
  }

  .hud {
    gap: 4px;
  }

  .hud > div {
    min-height: 34px;
    padding: 2px;
  }

  .hud .label {
    font-size: 8px;
    line-height: 1;
  }

  .hud strong {
    font-size: 15px;
  }

  .playfield {
    width: min(100%, 360px, max(286px, calc((100vh - 286px) * 0.809)));
    width: min(100%, 360px, max(286px, calc((100dvh - 286px) * 0.809)));
    justify-self: center;
  }

  .controls {
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
  }

  .volley {
    min-height: 64px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 5px 12px;
    column-gap: 10px;
    row-gap: 3px;
  }

  .volley > .label {
    font-size: 9px;
  }

  .volley > .label:first-child {
    grid-column: 1;
    justify-self: center;
    align-self: end;
    text-align: center;
    width: 100%;
  }

  .bullet-readout {
    grid-column: 1;
    grid-row: 2;
    justify-self: center;
    width: 100%;
    min-width: 62px;
  }

  .bullet-remaining {
    font-size: 30px;
  }

  .bullet-stepper {
    grid-template-columns: 32px minmax(54px, 1fr) 32px;
    grid-column: 2;
    grid-row: 1 / span 2;
    width: 100%;
    max-width: 148px;
    justify-self: center;
    gap: 3px 5px;
    align-self: center;
  }

  .bullet-shot-label {
    grid-column: 1 / -1;
    justify-self: center;
    width: 100%;
    font-size: 9px;
    align-self: end;
    text-align: center;
  }

  .stepper-button {
    width: 34px;
    height: 34px;
    font-size: 20px;
    touch-action: manipulation;
  }

  #volleyValue {
    min-height: 34px;
    font-size: 28px;
    min-width: 54px;
    border-radius: 8px;
    touch-action: none;
  }

  .aim-control {
    grid-column: auto;
    min-height: 58px;
    padding: 5px 86px 5px 8px;
    overflow: hidden;
  }

  .protractor {
    width: 100%;
    height: 48px;
    display: grid;
    place-items: center;
    margin: 0;
  }

  .arc,
  .ticks {
    display: none;
  }

  .aim-needle {
    display: none;
  }

  .aim-handle {
    display: none;
  }

  .fire-button {
    position: static;
    width: 48px;
    height: 48px;
    font-size: 11px;
    transform: none;
  }

  .angle-readout {
    right: 6px;
    bottom: 6px;
  }

  .angle-readout .label {
    font-size: 8px;
  }

  .angle-readout output {
    width: 58px;
    height: 26px;
    font-size: 11px;
  }

  .fire-button:hover,
  .fire-button:focus-visible,
  .fire-button:active {
    transform: none;
  }

  .assist-controls {
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    justify-content: stretch;
  }

  .assist-button {
    width: 100%;
    min-height: 40px;
    padding: 3px;
    gap: 0;
  }

  .assist-icon {
    width: 19px;
    height: 19px;
  }

  .assist-label {
    font-size: 8px;
  }

  .inventory {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
  }

  .item-card {
    grid-template-columns: 26px minmax(0, 1fr) 20px;
    min-height: 34px;
    padding: 3px 5px;
    gap: 4px;
  }

  .item-icon {
    width: 26px;
    height: 26px;
    font-size: 10px;
  }

  .item-name {
    font-size: 9px;
  }

  .item-card strong {
    font-size: 12px;
  }

  .top-drawer {
    max-height: calc(100vh - 220px);
    max-height: calc(100svh - 220px);
    padding: 8px;
  }

  .top-screen.is-drawer-open .top-drawer:not(.is-hidden) {
    max-height: calc(100vh - 190px);
    max-height: calc(100svh - 190px);
  }

  .clear-overlay {
    align-items: start;
    padding: 12px 10px max(18px, calc(env(safe-area-inset-bottom) + 14px));
    background: rgba(1, 6, 14, 0.42);
  }

  .clear-panel {
    width: min(92vw, 330px);
    max-height: min(58vh, 440px);
    max-height: min(58dvh, 440px);
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    gap: 7px;
    padding: 13px 14px;
    overflow: hidden;
  }

  .clear-panel h2 {
    margin-top: 0;
    font-size: clamp(24px, 8vw, 34px);
    line-height: 0.98;
  }

  .score-list {
    min-height: 0;
    margin: 2px 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 3px;
    gap: 3px;
  }

  .score-list > div {
    padding: 6px 0;
    gap: 8px;
  }

  dt {
    font-size: 13px;
  }

  dd {
    font-size: 20px;
  }

  .clear-actions {
    grid-template-columns: minmax(0, 1fr) 74px;
    gap: 7px;
  }

  .clear-actions button {
    min-height: 42px;
    font-size: 13px;
  }
}

@media (min-width: 601px) and (max-width: 900px) and (orientation: portrait) {
  .top-screen {
    max-height: none;
    gap: 10px;
  }

  .top-hero {
    grid-template-columns: minmax(0, 1fr) minmax(150px, 0.42fr);
  }

  .top-hero h1 {
    font-size: clamp(54px, 8.5vw, 74px);
  }

  .game-preview {
    width: min(100%, 190px);
  }

  #topLevelPreview {
    max-height: 34vh;
    max-height: 34svh;
    object-fit: contain;
  }
}

/* Shared inline fire layout */
.controls {
  grid-template-columns: minmax(0, 1fr);
}

.volley {
  order: 1;
}

.inventory {
  order: 2;
}

.assist-controls {
  order: 3;
}

.aim-control {
  display: none !important;
}

.volley {
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  justify-items: stretch;
}

.bullet-panel {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 7px;
}

.bullet-stepper {
  justify-self: center;
}

.fire-button {
  position: static;
  left: auto;
  bottom: auto;
  transform: none !important;
}

.playfield .angle-readout {
  right: 12px;
  bottom: 12px;
}

.assist-controls {
  width: 100%;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  justify-content: stretch;
  gap: 10px;
}

.assist-button {
  width: 100%;
  min-height: 58px;
  padding: 7px 10px;
}

@media (orientation: portrait) and (max-width: 900px) {
  .playfield {
    width: min(100%, max(306px, calc((100dvh - 248px) * 0.809)));
  }

  .volley {
    min-height: 66px;
    padding: 6px 10px;
    column-gap: 10px;
  }

  .bullet-panel {
    gap: 4px;
  }

  .bullet-panel .label,
  .bullet-shot-label {
    font-size: 9px;
  }

  .bullet-stepper {
    grid-template-columns: 34px minmax(52px, 64px) 34px;
    gap: 4px;
  }

  .fire-button {
    width: 52px;
    height: 52px;
    font-size: 12px;
  }
}

@media (max-width: 600px) {
  body {
    padding-top: max(28px, calc(env(safe-area-inset-top) + 16px));
  }

  .playfield {
    width: min(100%, 370px, max(300px, calc((100dvh - 228px) * 0.809)));
  }

  .volley {
    grid-template-columns: minmax(0, 1fr) 54px minmax(0, 1fr);
    min-height: 62px;
    padding: 5px 8px;
    column-gap: 6px;
  }

  .bullet-readout {
    grid-column: auto;
    grid-row: auto;
    min-width: 0;
  }

  .bullet-remaining {
    font-size: 28px;
  }

  .bullet-stepper {
    grid-column: auto;
    grid-row: auto;
    width: 100%;
    max-width: 136px;
    grid-template-columns: 30px minmax(48px, 1fr) 30px;
    gap: 3px;
  }

  .stepper-button {
    width: 30px;
    height: 30px;
    font-size: 18px;
  }

  #volleyValue {
    min-height: 30px;
    min-width: 48px;
    font-size: 25px;
  }

  .fire-button {
    width: 50px;
    height: 50px;
    font-size: 11px;
  }

  .playfield .angle-readout {
    right: 7px;
    bottom: 7px;
    padding: 4px 6px;
  }
}
