@font-face {
  font-family: "Rajdhani";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("./assets/fonts/rajdhani/rajdhani-400-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Rajdhani";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("./assets/fonts/rajdhani/rajdhani-500-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Rajdhani";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("./assets/fonts/rajdhani/rajdhani-600-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Rajdhani";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("./assets/fonts/rajdhani/rajdhani-700-latin.woff2") format("woff2");
}

:root {
  color-scheme: dark;
  font-family:
    Rajdhani, "Avenir Next", Inter, system-ui, -apple-system, sans-serif;
  background: #000;
  color: #effbff;
}

* {
  box-sizing: border-box;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(#0bd9ff0a 1px, transparent 1px),
    linear-gradient(90deg, #0bd9ff0a 1px, transparent 1px),
    radial-gradient(circle at 50% 8%, #0c263b 0, transparent 32rem),
    #000;
  background-size: 32px 32px, 32px 32px, auto, auto;
}

button {
  min-height: 2.75rem;
  border: 1px solid #32cfee88;
  border-radius: 999px;
  padding: 0.65rem 1rem;
  background: linear-gradient(180deg, #142a43, #091525);
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow:
    inset 0 1px #ffffff18,
    0 0 0.9rem #00c8ff12;
  letter-spacing: 0.025em;
}

button:hover {
  border-color: #6ae8ff;
  background: linear-gradient(180deg, #1b3b5c, #0b1e34);
  box-shadow: 0 0 1.2rem #00d9ff32;
}

button:focus-visible,
canvas:focus-visible {
  outline: 3px solid #7ee7ff;
  outline-offset: 3px;
}

.game-shell {
  position: relative;
  container-type: inline-size;
  width: min(
    calc(100% - 1.5rem),
    42rem,
    calc((100svh - 15rem) * 2 / 3)
  );
  margin: 0 auto;
  padding: 0.75rem 0 1rem;
}

body:has(.start-menu-screen:not([hidden])) .game-shell {
  width: min(calc(100% - 1.5rem), 42rem);
}

.game-header {
  display: grid;
  gap: 0.45rem;
  width: 100%;
  margin-bottom: 0.55rem;
}

.app-update {
  display: none;
  text-align: center;
  font-size: 0.85rem;
}

body:has(#landing-menu:not([hidden]), #mode-menu:not([hidden])) .app-update {
  display: grid;
  gap: 0.25rem;
  justify-items: center;
}

.app-update button {
  min-height: 44px;
  padding: 0.4rem 0.8rem;
  font-size: 0.9rem;
}

.brand-lockup {
  position: relative;
  width: 100%;
  padding-inline: 0;
  text-align: center;
}

.eyebrow {
  margin: 0 0 0.15rem;
  color: #53e7ff;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 14cqw, 4.6rem);
  line-height: 0.9;
  letter-spacing: 0.055em;
  text-align: center;
  text-shadow:
    0 0 0.35rem #21d9ff55,
    0 0 1.5rem #21d9ff55;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
}

.release-tag {
  position: absolute;
  right: 0;
  bottom: -0.15rem;
  border: 1px solid #53e7ff99;
  border-radius: 999px;
  padding: 0.15rem 0.42rem 0.1rem;
  background: #071727dd;
  color: #7ee7ff;
  box-shadow: 0 0 0.8rem #00d9ff22;
  font-size: clamp(0.52rem, 1.6vw, 0.66rem);
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1.2;
  text-transform: uppercase;
  white-space: nowrap;
}

.controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
  width: 100%;
}

.controls button {
  width: 100%;
  min-width: 0;
  min-height: 1.9rem;
  padding-inline: 0.35rem;
  padding-block: 0.18rem;
  font-size: 0.9rem;
  white-space: nowrap;
}

.controls:not(:has(button:not([hidden]))) {
  display: none;
}

.audio-toggle {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding-inline: 0;
}

.audio-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.3rem;
  min-width: 0;
}

.audio-toggle svg {
  display: block;
  width: 1.05rem;
  height: 1.05rem;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.audio-toggle[data-muted="true"] {
  border-color: #ff496888;
  color: #8d99a8;
  background: linear-gradient(180deg, #281520, #10080d);
}

.audio-toggle[data-muted="true"]::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2.1rem;
  height: 3px;
  border-radius: 999px;
  background: #ff4968;
  box-shadow: 0 0 0.45rem #ff315faa;
  content: "";
  transform: translate(-50%, -50%) rotate(-42deg);
}

.bot-panel {
  position: fixed;
  z-index: 6;
  right: 1rem;
  bottom: 1rem;
  display: grid;
  gap: 0.45rem;
  min-width: 9rem;
  border: 1px solid #7ee7ffaa;
  border-radius: 0.8rem;
  padding: 0.7rem;
  background: #02070df2;
  box-shadow: 0 0 1.5rem #00d9ff22;
  color: #dffaff;
}

.bot-panel[hidden] {
  display: none;
}

.bot-panel strong {
  color: #7ee7ff;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.bot-panel button {
  min-height: 2.2rem;
  padding-block: 0.35rem;
}

.confirmation-dialog {
  width: min(calc(100% - 2rem), 25rem);
  max-width: none;
  margin: auto;
  border: 0;
  padding: 0;
  overflow: visible;
  background: transparent;
  color: inherit;
}

.confirmation-dialog::backdrop {
  background: #000;
}

.confirmation-card {
  border: 2px solid #b797ff;
  border-radius: 1rem;
  padding: 1.35rem;
  background:
    linear-gradient(#b797ff0b 1px, transparent 1px),
    linear-gradient(90deg, #b797ff0b 1px, transparent 1px),
    #02070d;
  background-size: 22px 22px;
  box-shadow: 0 1.5rem 4rem #000e, 0 0 2.2rem #b797ff44;
  text-align: center;
}

.confirmation-card h2 {
  margin: 0.25rem 0 0.65rem;
  font-size: 1.75rem;
}

.confirmation-card > p:not(.eyebrow) {
  margin: 0 auto;
  color: #c9d7ed;
  line-height: 1.5;
}

.confirmation-actions {
  display: flex;
  justify-content: center;
  gap: 0.65rem;
  margin-top: 1.25rem;
}

.confirmation-accept {
  border-color: #ff6b7d;
  background: linear-gradient(180deg, #4a1b2a, #210810);
}

.confirmation-accept:hover {
  border-color: #ff9baa;
  background: linear-gradient(180deg, #68263a, #310c19);
  box-shadow: 0 0 1.2rem #ff426844;
}

.start-menu-screen {
  width: 100%;
}

.start-menu {
  position: relative;
  display: flex;
  min-height: clamp(25rem, 68svh, 30rem);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid #30d5ff66;
  border-radius: 1.2rem;
  padding: clamp(1.75rem, 6vw, 3.25rem);
  overflow: hidden;
  background:
    linear-gradient(#24d7ff0b 1px, transparent 1px),
    linear-gradient(90deg, #24d7ff0b 1px, transparent 1px),
    radial-gradient(circle at 50% 0, #18496f 0, transparent 22rem),
    #010409;
  background-size: 24px 24px, 24px 24px, auto, auto;
  box-shadow:
    0 1.5rem 4rem #000b,
    inset 0 0 2.5rem #00d9ff0b;
  isolation: isolate;
  text-align: center;
}

.start-menu::before {
  position: absolute;
  z-index: -1;
  top: 52%;
  left: 50%;
  width: min(88%, 32rem);
  aspect-ratio: 1;
  border: 1px solid #53e7ff1f;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 8%, #d9ffffcc 0 2px, transparent 3px),
    radial-gradient(circle, transparent 0 22%, #53e7ff18 22.2% 22.6%, transparent 22.8% 38%, #53e7ff12 38.2% 38.6%, transparent 38.8% 54%, #b797ff10 54.2% 54.6%, transparent 54.8%),
    conic-gradient(from 45deg, transparent 0 15%, #53e7ff0d 15.5% 16%, transparent 16.5% 48%, #b797ff0d 48.5% 49%, transparent 49.5% 100%);
  box-shadow: inset 0 0 3rem #30d5ff08, 0 0 3rem #30d5ff08;
  content: "";
  opacity: 0.78;
  transform: translate(-50%, -50%) rotate(0deg) scaleY(0.62);
  animation: menu-orbit-turn 24s linear infinite;
}

.start-menu::after {
  position: absolute;
  z-index: -1;
  inset: 0;
  background:
    radial-gradient(circle at 13% 18%, #d9ffff80 0 1px, transparent 1.6px),
    radial-gradient(circle at 83% 22%, #53e7ff70 0 1px, transparent 1.7px),
    radial-gradient(circle at 74% 71%, #b797ff70 0 1px, transparent 1.7px),
    radial-gradient(circle at 22% 78%, #53e7ff66 0 1px, transparent 1.6px),
    radial-gradient(circle at 91% 49%, #d9ffff55 0 1px, transparent 1.5px),
    linear-gradient(115deg, transparent 0 49.8%, #53e7ff08 50%, transparent 50.2%);
  content: "";
  pointer-events: none;
}

.landing-menu {
  gap: clamp(1.5rem, 5vw, 2.25rem);
}

.landing-menu h2 {
  margin: 0;
  font-size: clamp(0.78rem, 2.7vw, 1rem);
  letter-spacing: 0.18em;
  line-height: 1;
  white-space: nowrap;
}

.landing-menu h2::before,
.landing-menu h2::after {
  width: clamp(2.5rem, 10vw, 5.5rem);
}

.landing-play-button {
  position: relative;
  display: grid;
  width: min(88%, 21rem);
  min-height: 6.5rem;
  grid-template-columns: 3.75rem auto;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  overflow: hidden;
  border-color: #55ffd7cc;
  border-radius: 1.4rem;
  background:
    radial-gradient(circle at 50% 0, #55ffd73b, transparent 72%),
    linear-gradient(145deg, #164b46, #071a22);
  box-shadow:
    inset 0 1px #eafff955,
    inset 0 0 2rem #55ffd718,
    0 0 2rem #37ffe033;
  color: #efffff;
  text-transform: uppercase;
}

.landing-play-button::before {
  position: absolute;
  inset: -50% auto -50% -35%;
  width: 22%;
  background: linear-gradient(90deg, transparent, #efffff88, transparent);
  content: "";
  transform: skewX(-18deg);
  animation: landing-play-sweep 2.4s ease-in-out infinite;
}

.landing-play-button strong {
  font-size: clamp(2.25rem, 9vw, 3.5rem);
  letter-spacing: 0.16em;
  line-height: 0.9;
  text-shadow: 0 0 1rem #55ffd799;
}

.landing-play-icon {
  display: grid;
  width: 3.5rem;
  height: 3.5rem;
  place-items: center;
  border: 1px solid #baffefaa;
  border-radius: 50%;
  background: #55ffd71a;
  box-shadow: inset 0 0 1rem #55ffd722, 0 0 1rem #55ffd733;
}

.landing-play-icon svg {
  width: 1.75rem;
  fill: #efffff;
  filter: drop-shadow(0 0 0.35rem #55ffd7);
}

.landing-play-button:hover {
  border-color: #baffef;
  background:
    radial-gradient(circle at 50% 0, #55ffd75c, transparent 72%),
    linear-gradient(145deg, #1d6259, #092633);
  box-shadow: inset 0 1px #ffffff77, 0 0 2.5rem #37ffe055;
}

@keyframes landing-play-sweep {
  0%, 48% { left: -35%; opacity: 0; }
  58% { opacity: 0.9; }
  82%, 100% { left: 120%; opacity: 0; }
}

.menu-meta {
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.menu-meta-lower,
.public-info-links {
  display: flex;
  align-items: center;
}

.menu-meta-lower {
  justify-content: space-between;
  gap: 0.75rem;
}

.public-info-links {
  justify-content: center;
  gap: 0.65rem;
}

.public-info-links button {
  min-height: 0;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
  color: #708b9c;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.public-info-links button + button::before {
  content: none;
}

.public-info-links button + button {
  border-left: 1px solid #315a68;
  padding-left: 0.65rem;
}

.public-info-links button:hover,
.public-info-links button:focus-visible {
  background: transparent;
  box-shadow: none;
  color: #7ee7ff;
}

.game-version {
  margin: 0;
  color: #7f9aab;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

#feedback-link {
  color: #7f9aab;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1;
  text-decoration-color: #53e7ff55;
  text-underline-offset: 0.18em;
  text-transform: uppercase;
}

#feedback-link:hover,
#feedback-link:focus-visible {
  color: #7ee7ff;
  text-decoration-color: #53e7ff;
}

[data-game-version] {
  color: #8dc7d6;
  font-variant-numeric: tabular-nums;
  text-transform: none;
}

.info-dialog {
  width: min(calc(100% - 1.25rem), 37rem);
  max-width: none;
  max-height: min(88svh, 42rem);
  margin: auto;
  border: 0;
  padding: 0;
  overflow: visible;
  background: transparent;
  color: inherit;
}

.info-dialog::backdrop {
  background: #000d;
  backdrop-filter: blur(3px);
}

.info-card {
  max-height: min(88svh, 42rem);
  border: 1px solid #53e7ffaa;
  border-radius: 1rem;
  padding: clamp(1rem, 4vw, 1.65rem);
  overflow-y: auto;
  background:
    linear-gradient(#24d7ff0a 1px, transparent 1px),
    linear-gradient(90deg, #24d7ff0a 1px, transparent 1px),
    radial-gradient(circle at 50% 0, #153c5b 0, transparent 24rem),
    #010409;
  background-size: 22px 22px, 22px 22px, auto, auto;
  box-shadow: 0 1.5rem 4rem #000e, 0 0 2.2rem #30d5ff33;
}

.info-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.info-header h2 {
  margin: 0;
  color: #83ecff;
  font-size: clamp(1.65rem, 7vw, 2.4rem);
  line-height: 1;
  text-transform: uppercase;
}

.info-close-button {
  width: 2.4rem;
  min-height: 2.4rem;
  flex: 0 0 2.4rem;
  padding: 0 0 0.1rem;
  color: #9cb6c8;
  font-size: 1.5rem;
  line-height: 1;
}

.info-tabs {
  display: grid;
  margin: 1.2rem 0 1.4rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
}

.info-tabs button {
  min-height: 2.35rem;
  border-radius: 0.55rem;
  padding: 0.35rem;
  color: #8298aa;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.info-tabs button[aria-current="page"] {
  border-color: #55ffd7aa;
  background: linear-gradient(180deg, #123c3c, #071a22);
  color: #dffff8;
  box-shadow: inset 0 0 1rem #32ffe012, 0 0 0.8rem #32ffe018;
}

.info-card section h3 {
  margin: 0 0 0.7rem;
  color: #dffaff;
  font-size: 1.15rem;
}

.info-card section p {
  margin: 0.75rem 0 0;
  color: #c3d2df;
  line-height: 1.55;
}

.info-card a {
  color: #7ee7ff;
  text-underline-offset: 0.18em;
}

.info-version,
.info-note {
  border-left: 2px solid #55ffd788;
  padding: 0.55rem 0.75rem;
  background: #55ffd708;
}

.settings-dialog {
  width: min(calc(100% - 1.5rem), 29rem);
  max-width: none;
  margin: auto;
  border: 0;
  padding: 0;
  overflow: visible;
  background: transparent;
  color: inherit;
}

.settings-dialog:focus {
  outline: none;
}

.settings-dialog::backdrop {
  background:
    radial-gradient(circle at 50% 42%, #17647a52, #000e 62%);
  backdrop-filter: blur(5px) saturate(0.8);
}

.settings-card {
  position: relative;
  border: 1px solid #55c7dc;
  border-radius: 1rem;
  padding: clamp(1.1rem, 4vw, 1.5rem);
  overflow: hidden;
  background:
    linear-gradient(#8eeaff12 1px, transparent 1px),
    linear-gradient(90deg, #8eeaff12 1px, transparent 1px),
    radial-gradient(circle at 50% -20%, #2387a07a 0, transparent 18rem),
    linear-gradient(155deg, #0c3341, #061923 72%);
  background-size: 20px 20px, 20px 20px, auto, auto;
  box-shadow:
    inset 0 1px #ffffff2b,
    inset 0 0 2rem #4bdcf019,
    0 1.5rem 4rem #000e,
    0 0 2rem #36bfd54a;
}

.settings-dialog[open] .settings-card {
  animation: settings-card-enter 220ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes settings-card-enter {
  from { opacity: 0; transform: translateY(0.45rem) scale(0.975); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.settings-card::before {
  position: absolute;
  top: 0;
  right: 12%;
  left: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, #c6e5f0aa, transparent);
  box-shadow: 0 0 0.75rem #9cc9d8aa;
  content: "";
}

.settings-header {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 2.8rem;
  padding-inline: 2.75rem;
  text-align: center;
}

.settings-header h2 {
  margin: 0;
  color: #f0fcff;
  font-size: clamp(1.65rem, 7vw, 2.15rem);
  letter-spacing: 0.07em;
  line-height: 1;
  text-shadow: 0 0 1rem #72d9e888;
  text-transform: uppercase;
}

.settings-close-button {
  position: absolute;
  top: -0.2rem;
  right: -0.25rem;
  width: 2.35rem;
  min-height: 2.35rem;
  flex: 0 0 2.35rem;
  border-color: #86c5d199;
  padding: 0 0 0.1rem;
  background: #102e39;
  color: #e4f7fb;
  font-size: 1.45rem;
  line-height: 1;
}

.settings-options {
  display: grid;
  gap: 0.65rem;
  margin-top: 1.1rem;
}

.settings-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid #91a8b1;
  border-radius: 0.75rem;
  padding: 0.85rem 1rem;
  background: #28353b;
  box-shadow: inset 0 1px #ffffff1f, 0 0.45rem 1rem #00101566;
  cursor: pointer;
  text-align: left;
}

.settings-toggle > span:first-child {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.settings-toggle strong {
  color: #e8fbff;
  font-size: 1rem;
}

.settings-toggle small {
  color: #c5dce2;
  font-size: 0.78rem;
}

.settings-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.settings-toggle-track {
  position: relative;
  width: 2.8rem;
  height: 1.5rem;
  flex: 0 0 2.8rem;
  border: 1px solid #a6c3cc;
  border-radius: 999px;
  background: #06141a;
  box-shadow: inset 0 0.15rem 0.45rem #0008;
  transition: border-color 160ms ease, background 160ms ease;
}

.settings-toggle-track::after {
  position: absolute;
  top: 0.18rem;
  left: 0.2rem;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: #dbe9ed;
  box-shadow: 0 0.1rem 0.3rem #000a;
  content: "";
  transition: transform 160ms ease, background 160ms ease;
}

.settings-toggle input:checked + .settings-toggle-track {
  border-color: #55ffd7;
  background: #174f49;
  box-shadow: inset 0 0 0.6rem #55ffd733, 0 0 0.7rem #55ffd722;
}

.settings-toggle input:checked + .settings-toggle-track::after {
  background: #dffff8;
  transform: translateX(1.36rem);
}

.settings-toggle input:focus-visible + .settings-toggle-track {
  outline: 2px solid #83ecff;
  outline-offset: 3px;
}

.mode-settings-button {
  position: relative;
  top: -0.35rem;
  width: min(40%, 11.2rem);
  min-width: 9.5rem;
  min-height: 2.1rem;
  align-self: center;
  border-color: #66bfd0;
  border-radius: 0.6rem;
  padding: 0.28rem 0.7rem;
  background: linear-gradient(180deg, #235263, #102d38);
  box-shadow: inset 0 1px #ffffff22, 0 0 0.9rem #43b9cf33;
  color: #ebfbff;
  font-size: 0.72rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.mode-settings-button:hover,
.mode-settings-button:focus-visible {
  border-color: #a5effb;
  background: linear-gradient(180deg, #2f6b7e, #16404e);
  box-shadow: inset 0 1px #ffffff2b, 0 0 1.2rem #43cfe955;
  color: #ffffff;
}

.info-note {
  border-left-color: #ffd16688;
  background: #ffd16608;
  color: #d8ccaa !important;
  font-size: 0.88rem;
}

@media (min-width: 32.01rem) {
  .start-menu {
    padding-top: 2rem;
    padding-bottom: 8.4rem;
  }

  .menu-meta {
    bottom: 1rem;
    gap: 0.65rem;
  }

  .menu-meta-lower {
    justify-content: center;
  }

  #feedback-link {
    border: 1px solid #53e7ff55;
    border-radius: 999px;
    padding: 0.42rem 0.72rem 0.36rem;
    background: linear-gradient(180deg, #102435aa, #06101add);
    box-shadow: inset 0 1px #ffffff0d, 0 0 0.7rem #00d9ff12;
    color: #9bb8c7;
    text-decoration: none;
  }

  #feedback-link:hover,
  #feedback-link:focus-visible {
    border-color: #53e7ffaa;
    background: linear-gradient(180deg, #163247cc, #081725ee);
    box-shadow: inset 0 1px #ffffff14, 0 0 0.9rem #00d9ff22;
  }

  .game-version {
    position: absolute;
    right: 0;
  }
}

@keyframes menu-orbit-turn {
  to { transform: translate(-50%, -50%) rotate(360deg) scaleY(0.62); }
}

.start-menu-screen:not([hidden]) .start-menu {
  animation: menu-panel-enter 320ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.start-menu-screen:not([hidden]) h2,
.start-menu-screen:not([hidden]) .landing-play-button,
.start-menu-screen:not([hidden]) .mode-options button,
.start-menu-screen:not([hidden]) .mode-settings-button,
.start-menu-screen:not([hidden]) > .menu-back-button {
  animation: menu-item-enter 360ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.start-menu-screen:not([hidden]) .mode-options button:nth-child(1) {
  animation-delay: 50ms;
}

.start-menu-screen:not([hidden]) .mode-options button:nth-child(2) {
  animation-delay: 90ms;
}

.start-menu-screen:not([hidden]) .mode-options button:nth-child(3) {
  animation-delay: 130ms;
}

.start-menu-screen:not([hidden]) > .menu-back-button {
  animation-delay: 170ms;
}

@keyframes menu-panel-enter {
  from { opacity: 0; transform: scale(0.985); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes menu-item-enter {
  from { opacity: 0; transform: translateY(0.55rem); }
  to { opacity: 1; transform: translateY(0); }
}

.start-menu h2 {
  position: relative;
  margin: 0 0 clamp(1.75rem, 5vw, 2.5rem);
  color: #83ecff;
  font-size: clamp(2.25rem, 7vw, 3.35rem);
  font-weight: 800;
  letter-spacing: 0.07em;
  line-height: 0.95;
  text-shadow:
    0 0 0.45rem #30d5ff66,
    0 0 1.6rem #30d5ff44;
  text-transform: uppercase;
  white-space: nowrap;
}

.start-menu h2::before,
.start-menu h2::after {
  position: absolute;
  top: 50%;
  width: clamp(1.25rem, 5vw, 3.5rem);
  height: 2px;
  background: linear-gradient(90deg, transparent, #83ecff);
  box-shadow: 0 0 0.7rem #30d5ffaa;
  content: "";
  transform: translateY(-50%);
}

.start-menu h2::before {
  right: calc(100% + 0.7rem);
}

.start-menu h2::after {
  left: calc(100% + 0.7rem);
  background: linear-gradient(90deg, #83ecff, transparent);
}

.mode-options {
  display: grid;
  width: min(100%, 28rem);
  grid-template-columns: minmax(12rem, 28rem);
  justify-content: center;
  gap: 0.75rem;
}

.mode-options button {
  display: flex;
  width: 100%;
  min-height: 6rem;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.mode-options strong {
  font-size: 1.45rem;
  font-weight: 700;
}

.mode-options button {
  position: relative;
  display: grid;
  min-height: 6rem;
  grid-template-columns: 4rem minmax(0, 1fr) auto;
  gap: 0.9rem;
  overflow: hidden;
  padding: 0.75rem 1rem;
  text-align: left;
}

.mode-options button::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 0.22rem;
  background: currentColor;
  box-shadow: 0 0 1rem currentColor;
  content: "";
  opacity: 0.8;
}

.mode-emblem {
  display: grid;
  width: 3.65rem;
  height: 3.65rem;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: #020b10aa;
  box-shadow: inset 0 0 1rem currentColor, 0 0 0.8rem #0008;
  opacity: 0.82;
}

.mode-emblem svg {
  width: 2.5rem;
  height: 2.5rem;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.mode-emblem svg .orb-shell {
  stroke: #dffaff;
  stroke-width: 1.35;
}

.mode-emblem svg .orb-red {
  fill: #f65b74;
}

.mode-emblem svg .orb-blue {
  fill: #50c8f4;
}

.mode-emblem svg .orb-yellow {
  fill: #ffd064;
}

.mode-emblem svg .orb-core {
  fill: #071722;
  stroke: #dffaffaa;
  stroke-width: 1;
}

.mode-emblem svg .orb-symbol {
  fill: none;
  stroke: #06131c;
  stroke-width: 2.3;
}

.mode-emblem svg .icon-energy {
  stroke: #73f2a6;
  stroke-width: 1.7;
}

.mode-emblem svg .endurance-pressure {
  stroke: #ffd36f;
  stroke-width: 1.7;
}

.mode-emblem svg .match-burst {
  fill: #65f29a;
  stroke: #efffff;
  stroke-width: 0.8;
  filter: drop-shadow(0 0 3px #55f29a);
}

.mode-emblem svg .endurance-shield {
  fill: none;
  stroke: #ffc857;
  stroke-width: 2.2;
  filter: drop-shadow(0 0 3px #ffc857);
}

.mode-emblem svg .logic-key {
  fill: none;
  stroke: #c3a6ff;
  stroke-width: 2.2;
  filter: drop-shadow(0 0 3px #b797ff);
}

.mode-emblem svg .logic-links {
  stroke: #b797ff;
  stroke-width: 1.5;
}

.mode-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.28rem;
}

.mode-copy strong {
  line-height: 1;
}

.mode-new {
  margin-left: 0.28rem;
  color: #63e7ff;
  font-size: 0.62em;
  letter-spacing: 0.08em;
  text-shadow: 0 0 0.7rem #30d5ff;
  text-transform: uppercase;
}

.mode-copy .mode-tagline {
  color: #b8c9dc;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  line-height: 1;
  white-space: nowrap;
}

.mode-copy .mode-progress {
  color: #ffd166;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.mode-availability {
  display: inline-flex;
  align-items: center;
  gap: 0.36rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 0.25rem 0.5rem;
  background: #02070dcc;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  line-height: 1;
  white-space: nowrap;
}

.mode-availability[data-state="online"] {
  color: #55ffd7;
  box-shadow: inset 0 0 0.55rem #55ffd712, 0 0 0.65rem #55ffd714;
}

.status-light {
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 50%;
  background: #55ffd7;
  box-shadow: 0 0 0.6rem #55ffd7;
  animation: mode-status-pulse 1.8s ease-in-out infinite;
}

@keyframes mode-status-pulse {
  50% { opacity: 0.45; box-shadow: 0 0 0.2rem #55ffd7; }
}

.lock-icon {
  width: 0.72rem;
  height: 0.72rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.mode-options .mode-arcade {
  border-color: #55f29aaa;
  background:
    radial-gradient(circle at 50% 0, #36f58c22 0, transparent 75%),
    linear-gradient(135deg, #123c2d, #071c18);
  color: #dcffe9;
  box-shadow: inset 0 0 1.5rem #36f58c12, 0 0 1rem #36f58c18;
}

.mode-options .mode-arcade::after {
  position: absolute;
  top: -45%;
  bottom: -45%;
  left: -38%;
  width: 24%;
  background: linear-gradient(90deg, transparent, #baffcf66, transparent);
  content: "";
  pointer-events: none;
  transform: skewX(-18deg);
  animation: arcade-energy-sweep 1.35s 220ms cubic-bezier(0.2, 0.72, 0.24, 1) both;
}

@keyframes arcade-energy-sweep {
  from { left: -38%; opacity: 0; }
  15% { opacity: 1; }
  78% { opacity: 0.9; }
  to { left: 118%; opacity: 0; }
}

.mode-options .mode-arcade:hover {
  border-color: #8dffb6;
  background:
    radial-gradient(circle at 50% 0, #36f58c38 0, transparent 75%),
    linear-gradient(135deg, #18503a, #09271d);
  box-shadow: inset 0 0 1.5rem #36f58c1c, 0 0 1.3rem #36f58c2c;
}

.mode-options .mode-endurance {
  border-color: #ffc857bb;
  background:
    radial-gradient(circle at 50% 0, #ffc8572b 0, transparent 75%),
    linear-gradient(135deg, #493414, #211707);
  color: #fff1cc;
  box-shadow: inset 0 0 1.5rem #ffc85714, 0 0 1rem #ffc85720;
}

.mode-options .mode-endurance::after {
  position: absolute;
  top: -45%;
  bottom: -45%;
  left: -38%;
  width: 24%;
  background: linear-gradient(90deg, transparent, #ffe2a066, transparent);
  content: "";
  pointer-events: none;
  transform: skewX(-18deg);
  animation: arcade-energy-sweep 1.35s 260ms cubic-bezier(0.2, 0.72, 0.24, 1) both;
}

.mode-options .mode-endurance:hover {
  border-color: #ffe09a;
  background:
    radial-gradient(circle at 50% 0, #ffc85740 0, transparent 75%),
    linear-gradient(135deg, #624818, #352509);
  box-shadow: inset 0 0 1.5rem #ffc85720, 0 0 1.3rem #ffc85738;
}

.mode-options .mode-puzzle {
  border-color: #b797ffaa;
  background:
    radial-gradient(circle at 50% 0, #b797ff22 0, transparent 75%),
    linear-gradient(135deg, #2c2050, #0d1228);
  color: #eee8ff;
  box-shadow: inset 0 0 1.5rem #b797ff12, 0 0 1rem #b797ff18;
}

.mode-options .mode-puzzle::after {
  position: absolute;
  top: -45%;
  bottom: -45%;
  left: -38%;
  width: 24%;
  background: linear-gradient(90deg, transparent, #e0d4ff66, transparent);
  content: "";
  pointer-events: none;
  transform: skewX(-18deg);
  animation: arcade-energy-sweep 1.35s 220ms cubic-bezier(0.2, 0.72, 0.24, 1) both;
}

.mode-options .mode-puzzle:hover {
  border-color: #d0baff;
  background:
    radial-gradient(circle at 50% 0, #b797ff38 0, transparent 75%),
    linear-gradient(135deg, #3b2b69, #121a38);
}

.mode-options button:disabled {
  border-color: #52617266;
  background: linear-gradient(135deg, #18202a, #090d13);
  color: #718093;
  box-shadow: inset 0 0 1.2rem #ffffff06;
  cursor: not-allowed;
  filter: saturate(0.25);
  opacity: 0.74;
}

.mode-options button:disabled .mode-tagline,
.mode-options button:disabled .mode-availability {
  color: #697586;
}

.mode-options button:disabled .mode-emblem {
  border-color: #637082;
  background: linear-gradient(145deg, #111821, #05080d);
  box-shadow: inset 1px 1px #ffffff08, inset -1px -1px #000b;
  color: #647184;
  opacity: 0.72;
}

.menu-back-button {
  display: block;
  width: min(100%, 15rem);
  min-height: 2.75rem;
  margin: 0.8rem auto 0;
  border-color: #53e7ff66;
  background: linear-gradient(180deg, #102b38, #07151d);
  color: #bceefa;
  box-shadow: inset 0 1px #ffffff12, 0 0 0.8rem #30d5ff18;
  font-size: 0.88rem;
  text-transform: uppercase;
}

.menu-back-button:hover {
  border-color: #83ecffaa;
  background: linear-gradient(180deg, #173b4c, #09202c);
  color: #fff;
  box-shadow: inset 0 1px #ffffff18, 0 0 1rem #30d5ff30;
}

.puzzle-selector-card {
  gap: 0.8rem;
}

.puzzle-selector-card label {
  color: #a9ddeb;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.puzzle-selector-card select,
.puzzle-dev-panel select {
  width: 100%;
  border: 1px solid #b797ffaa;
  border-radius: 0.55rem;
  padding: 0.65rem;
  background: #08111d;
  color: #f0ecff;
  font: inherit;
}

.puzzle-menu-details,
.puzzle-load-error {
  min-height: 2.5rem;
  margin: 0;
  color: #b8c9dc;
  line-height: 1.35;
}

.puzzle-load-error {
  color: #ff8fa0;
  white-space: pre-line;
}

[hidden] {
  display: none !important;
}

.game-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid #30d5ff66;
  border-radius: 1.2rem;
  background: #010409;
  box-shadow:
    0 1.5rem 4rem #000b,
    0 0 2rem #00cfff12;
}

/* Trial identity and wave progress share one card, like the other modes. */
.game-hud[data-mode="endurance"] #level-value {
  font-size: clamp(0.72rem, 3.2cqw, 1.05rem);
  white-space: nowrap;
}

.game-hud[data-mode="endurance"] .pressure-indicator[data-warning="1"] {
  animation: endurance-wave-warning 1s ease-in-out infinite;
}

.game-hud .stage-score-indicator[data-target-rank] {
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.game-hud .stage-score-indicator[data-target-rank]::after {
  position: absolute;
  inset: 0 18% auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, currentColor, transparent);
  opacity: 0.65;
  pointer-events: none;
  content: "";
}

.game-hud .stage-score-indicator[data-target-rank="gold"] {
  color: #ffd166;
  border-color: #ffd16699;
  background: linear-gradient(180deg, #3c2d0e, #171006);
  box-shadow: inset 0 0 0.75rem #ffd16616, 0 0 0.55rem #ffd16618;
}

.game-hud .stage-score-indicator[data-target-rank="gold"] span,
.game-hud .stage-score-indicator[data-target-rank="gold"] strong {
  color: #ffd166;
  text-shadow: 0 0 0.55rem #ffd16655;
}

.game-hud .stage-score-indicator[data-target-rank="silver"] {
  color: #d9e5ef;
  border-color: #aeb8c499;
  background: linear-gradient(180deg, #303943, #121820);
  box-shadow: inset 0 0 0.75rem #d9e5ef12, 0 0 0.5rem #aeb8c414;
}

.game-hud .stage-score-indicator[data-target-rank="silver"] span,
.game-hud .stage-score-indicator[data-target-rank="silver"] strong {
  color: #d9e5ef;
  text-shadow: 0 0 0.45rem #d9e5ef38;
}

.game-hud .stage-score-indicator[data-target-rank="bronze"] {
  color: #e09a62;
  border-color: #d8874e99;
  background: linear-gradient(180deg, #422617, #1b0e08);
  box-shadow: inset 0 0 0.75rem #e09a6214, 0 0 0.5rem #d8874e16;
}

.game-hud .stage-score-indicator[data-target-rank="bronze"] span,
.game-hud .stage-score-indicator[data-target-rank="bronze"] strong {
  color: #e09a62;
  text-shadow: 0 0 0.45rem #d8874e44;
}

@keyframes endurance-wave-warning {
  50% { box-shadow: inset 0 0 1rem #ff557c24, 0 0 0.8rem #ff315f55; }
}

.puzzle-dev-panel {
  position: absolute;
  z-index: 4;
  top: 6.1rem;
  right: 0.45rem;
  display: grid;
  width: min(12.5rem, 46%);
  gap: 0.3rem;
  border: 1px solid #b797ff88;
  border-radius: 0.65rem;
  padding: 0.55rem;
  background: #070b15e8;
  box-shadow: 0 0 1rem #000a;
  color: #cbd7e8;
  font-size: 0.68rem;
}

.puzzle-dev-panel strong {
  color: #d7c9ff;
  font-size: 0.78rem;
}

.puzzle-dev-panel select,
.puzzle-dev-panel button {
  min-height: 1.8rem;
  padding: 0.2rem 0.4rem;
  font-size: 0.65rem;
}

.puzzle-result {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem;
  background: radial-gradient(circle at 50% 42%, #251a46, #050912 68%);
  text-align: center;
}

.puzzle-result[data-outcome="failed"] {
  background: radial-gradient(circle at 50% 42%, #3a0b19, #050912 68%);
}

.puzzle-result > .eyebrow {
  color: #6be9ff;
  font-size: clamp(0.95rem, 3.6vw, 1.15rem);
  font-weight: 900;
  letter-spacing: 0.16em;
  text-shadow: 0 0 0.75rem #30d5ff55;
}

.puzzle-result h2 {
  margin: 0;
  color: #8affdf;
  font-size: clamp(2.4rem, 10vw, 3.5rem);
  line-height: 0.95;
  text-transform: uppercase;
}

.puzzle-result[data-outcome="failed"] h2 {
  color: #ff8195;
}

.puzzle-result p {
  margin: 0;
}

.failure-reason-banner {
  position: relative;
  display: block;
  width: min(100%, 25rem);
  min-height: 3.2rem;
  overflow: hidden;
  border: 1px solid #ff4968;
  border-radius: 0.55rem;
  background:
    linear-gradient(90deg, #ff315f0d, transparent 28% 72%, #ff315f0d),
    repeating-linear-gradient(
      135deg,
      #36030d 0,
      #36030d 0.85rem,
      #08070b 0.85rem,
      #08070b 1.7rem
    );
  box-shadow:
    inset 0 0 1.25rem #000c,
    0 0 1.15rem #ff315f30;
  color: #fff4f6;
}

.failure-reason-banner::after {
  position: absolute;
  z-index: 0;
  inset: 0;
  background: linear-gradient(
    100deg,
    transparent 0 40%,
    #ffb1bd20 48%,
    #fff1f455 50%,
    #ffb1bd20 52%,
    transparent 60% 100%
  );
  content: "";
  pointer-events: none;
  transform: translateX(-100%);
  animation: failure-banner-scan 2.8s ease-in-out infinite;
}

.failure-reason-track {
  position: relative;
  z-index: 1;
  display: flex;
  width: 200%;
  min-height: 3.2rem;
  align-items: center;
  animation: failure-reason-scroll 5.2s linear infinite;
  will-change: transform;
}

.failure-reason-track [data-failure-reason-copy] {
  display: grid;
  width: 50%;
  flex: none;
  grid-template-columns: auto auto auto;
  place-content: center;
  gap: 0.65rem;
  padding-inline: 0.75rem;
  font-size: clamp(0.85rem, 3.5vw, 1rem);
  font-weight: 900;
  letter-spacing: 0.12em;
  line-height: 1;
  text-shadow:
    0 2px 0 #620016,
    0 0 0.7rem #ff4968;
  text-transform: uppercase;
  white-space: nowrap;
}

.failure-reason-track [data-failure-reason-copy]::before,
.failure-reason-track [data-failure-reason-copy]::after {
  color: #ff8195;
  content: "◆";
  font-size: 0.6em;
  text-shadow: 0 0 0.6rem #ff315f;
}

@keyframes failure-reason-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

@keyframes failure-banner-scan {
  0%,
  18% { transform: translateX(-100%); }
  72%,
  100% { transform: translateX(100%); }
}

.puzzle-result-actions {
  display: grid;
  width: min(100%, 16rem);
  gap: 0.65rem;
}

#puzzle-result-retry {
  position: relative;
  overflow: hidden;
  border-color: #55ffd7;
  background: #168a68;
  box-shadow:
    inset 0 1px #d9ffff55,
    0 0 1.15rem #37ffe066;
  color: #ffffff;
  font-weight: 800;
  text-shadow: 0 0 0.55rem #d9ffff99;
  animation: tally-ready-breathe 1.8s ease-in-out infinite;
}

#puzzle-result-retry::before {
  position: absolute;
  inset: 0 auto 0 -12%;
  width: 38%;
  background: linear-gradient(
    100deg,
    transparent 0,
    #d9ffff14 28%,
    #efffffaa 50%,
    #d9ffff14 72%,
    transparent 100%
  );
  content: "";
  pointer-events: none;
  opacity: 0;
  transform: skewX(-18deg) translateX(-180%);
  animation: tally-ready-flow 1.8s ease-in-out 220ms infinite;
}

#puzzle-result-retry:hover {
  border-color: #a2ffe9;
  background: #1ba87e;
  box-shadow:
    inset 0 1px #efffff66,
    0 0 1.35rem #37ffe088;
}

.puzzle-menu-card {
  justify-content: flex-start;
  min-height: min(clamp(25rem, 68svh, 30rem), calc(100svh - 11rem));
  max-height: calc(100svh - 11rem);
  overflow-y: auto;
  padding: clamp(1.1rem, 4vw, 1.75rem);
}

.puzzle-menu-card > h2,
.puzzle-menu-card > .puzzle-entry-actions,
.puzzle-menu-card > .puzzle-dev-actions {
  flex-shrink: 0;
}

.puzzle-menu-card > .puzzle-selector {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  /* Leave room for focus rings and the earned medals' glow. */
  padding: 0.3rem;
}

.puzzle-menu-card h2 {
  margin-bottom: 0.9rem;
}

.puzzle-entry-actions {
  display: grid;
  width: 100%;
  gap: 0.55rem;
}

.puzzle-entry-actions button {
  min-height: 3rem;
}

.puzzle-entry-actions strong,
.puzzle-entry-actions span {
  display: block;
}

.puzzle-continue-campaign {
  position: relative;
  overflow: hidden;
  border-color: #58ffac;
  background: linear-gradient(180deg, #174f3a, #09271f);
  color: #edfff6;
  box-shadow: inset 0 1px #ffffff1f, 0 0 1.1rem #32ff9a30;
}

.puzzle-continue-campaign span {
  color: #bfffe0;
}

.puzzle-continue-campaign span[data-medal="gold"] { color: #ffd166; }
.puzzle-continue-campaign span[data-medal="silver"] { color: #d9e5ef; }
.puzzle-continue-campaign span[data-medal="bronze"] { color: #e09a62; }

.puzzle-continue-campaign:hover,
.puzzle-continue-campaign:focus-visible {
  border-color: #beffdc;
  background:
    radial-gradient(circle at 50% 0, #73ffc64a, transparent 70%),
    linear-gradient(180deg, #236a4d, #0d3529);
  box-shadow:
    inset 0 0 0 1px #d8ffea2e,
    inset 0 1px #ffffff38,
    0 0 1.35rem #45ffab52;
  color: #fff;
  transform: translateY(-1px);
}

.puzzle-continue-campaign:focus-visible {
  outline-color: #8cffc6;
}

.puzzle-continue-campaign:active {
  border-color: #8fffc3;
  background: linear-gradient(180deg, #194d39, #0a2b21);
  box-shadow: inset 0 2px 0.5rem #00170e88, 0 0 0.9rem #45ffab3d;
  transform: translateY(0);
}

.puzzle-continue-campaign::after,
#puzzle-group-continue::after,
#play-again-button::after {
  position: absolute;
  inset: -50% auto -50% -35%;
  width: 22%;
  background: linear-gradient(90deg, transparent, #efffff88, transparent);
  content: "";
  pointer-events: none;
  transform: skewX(-18deg);
  animation: landing-play-sweep 2.4s ease-in-out infinite;
}

.puzzle-entry-actions span {
  margin-top: 0.15rem;
  color: #b8c9dc;
  font-size: 0.68rem;
}

.puzzle-selector {
  display: grid;
  width: 100%;
  gap: 0.65rem;
  margin-top: 0.85rem;
}

.puzzle-selector > h3 {
  margin: 0;
  color: #e5dcff;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.puzzle-group-list {
  display: grid;
  width: 100%;
  gap: 0.65rem;
}

.puzzle-group-block {
  display: grid;
  gap: 0.3rem;
}

.puzzle-group-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.puzzle-group-block h3 {
  margin: 0;
  color: #b797ff;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-align: left;
  text-transform: uppercase;
}

.puzzle-dev-actions {
  display: grid;
  width: 100%;
  gap: 0.4rem;
  margin-top: 0.7rem;
  padding-top: 0.7rem;
  border-top: 1px solid #66589a66;
}

.puzzle-dev-actions label {
  color: #ffb3bf;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.puzzle-dev-actions select {
  width: 100%;
  min-height: 2.25rem;
  border: 1px solid #ff819566;
  border-radius: 0.45rem;
  padding: 0.35rem 0.5rem;
  background: #100b16;
  color: #f5e9ed;
  font: inherit;
  font-size: 0.7rem;
}

.puzzle-dev-actions button {
  width: 100%;
  border-color: #ff819588;
  color: #ffb3bf;
  font-size: 0.68rem;
}

.puzzle-stage-options {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.35rem;
}

.arcade-group-block .puzzle-stage-options {
  display: flex;
  justify-content: center;
}

.arcade-group-block .puzzle-stage-button {
  flex: 1 1 0;
}

.puzzle-stage-button {
  position: relative;
  overflow: hidden;
  min-width: 0;
  min-height: 3.4rem;
  border: 1px solid #64728a;
  border-radius: 0.65rem;
  padding: 0.35rem 0.15rem;
  background: linear-gradient(155deg, #172131, #090e17);
  font-size: 0.72rem;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.puzzle-stage-button:not(:disabled):hover {
  transform: translateY(-1px);
}

.puzzle-stage-button span {
  display: block;
  min-height: 1em;
  margin-top: 0.15rem;
  color: #ffd166;
  font-size: 0.62rem;
  letter-spacing: 0;
}

.puzzle-stage-button:disabled span {
  color: #738096;
}

.puzzle-stage-button[data-state="locked"] {
  border-color: #52617266;
  background: linear-gradient(145deg, #18202a, #090d13);
  box-shadow: inset 0 0 1.2rem #ffffff06;
  color: #718093;
  cursor: default;
  filter: saturate(0.2);
  opacity: 0.7;
}

.puzzle-stage-button[data-state="locked"]:hover {
  border-color: #71809388;
  background: linear-gradient(145deg, #1b2530, #0b1017);
  box-shadow: inset 0 0 1.2rem #ffffff09;
  opacity: 0.78;
}

.puzzle-stage-button[data-state="available"] {
  border-color: #58ffac;
  background:
    radial-gradient(circle at 50% 0, #32ff9a2e, transparent 72%),
    linear-gradient(145deg, #174f3a, #09271f);
  box-shadow: inset 0 1px #ffffff1f, 0 0 1rem #32ff9a38;
  color: #edfff6;
}

.puzzle-stage-button[data-state="available"] span {
  color: #aaffce;
}

.puzzle-stage-button[data-state="completed"][data-medal="gold"] {
  border-color: #ffd166;
  background:
    radial-gradient(circle at 50% 0, #ffe89838, transparent 72%),
    linear-gradient(145deg, #62410f, #241504);
  box-shadow: inset 0 1px #fff3b544, 0 0 0.9rem #ffd16638;
  color: #fff4c9;
}

.puzzle-stage-button[data-state="completed"][data-medal="gold"] span {
  color: #ffd166;
}

/* Silver stays neutral steel rather than icy/cyan, reserving that visual
   territory for a potential future Platinum tier. */
.puzzle-stage-button[data-state="completed"][data-medal="silver"] {
  border-color: #aeb8c4;
  background:
    radial-gradient(circle at 50% 0, #d8dee52b, transparent 72%),
    linear-gradient(145deg, #3b4652, #171d25);
  box-shadow: inset 0 1px #f4f7fa35, 0 0 0.75rem #aeb8c426;
  color: #eef1f4;
}

.puzzle-stage-button[data-state="completed"][data-medal="silver"] span {
  color: #c6ced7;
}

.puzzle-stage-button[data-state="completed"][data-medal="bronze"] {
  border-color: #d8874e;
  background:
    radial-gradient(circle at 50% 0, #f0a66f2e, transparent 72%),
    linear-gradient(145deg, #57301b, #211108);
  box-shadow: inset 0 1px #ffc18e35, 0 0 0.75rem #d87c4530;
  color: #ffe0c8;
}

.puzzle-stage-button[data-state="completed"][data-medal="bronze"] span {
  color: #e7a16e;
}

.endurance-menu-card h2 {
  color: #83ecff;
  text-shadow: 0 0 1rem #30d5ff66;
}

.endurance-selector > h3 {
  color: #8eeeff;
}

.endurance-trial-list {
  display: grid;
  gap: 0.45rem;
}

.endurance-trial-row {
  display: flex;
  gap: 0.4rem;
}

.endurance-trial-button {
  display: flex;
  min-height: 4.3rem;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.endurance-trial-button small {
  display: block;
  margin-top: 0.12rem;
  color: #9db3c2;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.endurance-endless-button {
  display: grid;
  width: 100%;
  min-height: 3.5rem;
  border-color: #b797ffaa;
  background: linear-gradient(145deg, #2c2050, #0d1228);
  color: #eee8ff;
}

.endurance-endless-button span {
  color: #c8b5f7;
  font-size: 0.65rem;
  text-transform: uppercase;
}

.endurance-endless-button:disabled {
  border-color: #52617266;
  background: #0b1017;
  color: #718093;
  opacity: 0.72;
}

.puzzle-group-summary {
  --group-recap-content-width: min(100%, 19rem);

  z-index: 5;
  padding: clamp(1rem, 5%, 2rem);
}

.puzzle-group-summary h2 {
  margin-bottom: 0.8rem;
}

.puzzle-medal-indicators {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  width: min(100%, 19rem);
  gap: clamp(0.35rem, 2vw, 0.7rem);
}

.puzzle-group-summary > .puzzle-medal-indicators {
  width: var(--group-recap-content-width);
}

#summary-results[data-stage-count="3"] {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: min(100%, 11.12rem);
}

#summary-results[data-stage-count="4"] {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: min(100%, 15.06rem);
}

.puzzle-medal-indicator {
  display: grid;
  aspect-ratio: 1;
  place-items: center;
  border: 2px solid #526078;
  border-radius: 50%;
  background: #101825;
  box-shadow: inset 0 0 0.65rem #0008;
  color: #9aa8bd;
  font-size: clamp(0.58rem, 2.2vw, 0.72rem);
  font-weight: 800;
}

.puzzle-medal-indicator[data-medal="gold"] {
  border-color: #ffd166;
  background: radial-gradient(circle at 35% 30%, #fff0a8, #b8700d 72%);
  box-shadow: 0 0 1rem #ffd16666;
  color: #311b00;
}

.puzzle-medal-indicator[data-medal="silver"] {
  border-color: #d9e5ef;
  background: radial-gradient(circle at 35% 30%, #fff, #8496a8 72%);
  box-shadow: 0 0 0.8rem #d9e5ef44;
  color: #17212a;
}

.puzzle-medal-indicator[data-medal="bronze"] {
  border-color: #e09a62;
  background: radial-gradient(circle at 35% 30%, #ffc18e, #8c4724 72%);
  box-shadow: 0 0 0.8rem #d87c4544;
  color: #271107;
}

.puzzle-group-stars {
  margin: 0.8rem 0 0;
  color: #ffd166;
  font-size: clamp(1.4rem, 6vw, 2rem);
  font-weight: 800;
}

.summary-actions.puzzle-group-actions {
  grid-template-columns: 1fr;
  justify-items: center;
  width: var(--group-recap-content-width);
  gap: 0.45rem;
  margin-top: 0.8rem;
}

.summary-actions.puzzle-group-actions button {
  width: 100%;
  min-height: 2.45rem;
  padding: 0.4rem 0.65rem;
  font-size: clamp(0.72rem, 2.5vw, 0.88rem);
}

#puzzle-group-continue,
#play-again-button {
  position: relative;
  overflow: hidden;
  border-color: #58ffac;
  background: linear-gradient(180deg, #174f3a, #09271f);
  color: #edfff6;
  box-shadow: 0 0 1rem #32ff9a2b;
}

#puzzle-group-menu,
#summary-menu-button {
  border-color: #927ac9;
  background: linear-gradient(180deg, #302450, #151027);
  color: #e5dcff;
}

.puzzle-group-summary:not([hidden]) .puzzle-medal-indicator {
  animation: summary-rise 320ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.puzzle-group-summary:not([hidden]) .puzzle-medal-indicator:nth-child(1) { animation-delay: 100ms; }
.puzzle-group-summary:not([hidden]) .puzzle-medal-indicator:nth-child(2) { animation-delay: 170ms; }
.puzzle-group-summary:not([hidden]) .puzzle-medal-indicator:nth-child(3) { animation-delay: 240ms; }
.puzzle-group-summary:not([hidden]) .puzzle-medal-indicator:nth-child(4) { animation-delay: 310ms; }
.puzzle-group-summary:not([hidden]) .puzzle-medal-indicator:nth-child(5) { animation-delay: 380ms; }

.puzzle-array-label {
  margin: 0 0 0.55rem;
  color: #58ffd2;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.puzzle-campaign-indicators {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  width: min(100%, 17rem);
  margin-bottom: 0.7rem;
}

.puzzle-campaign-indicators .puzzle-medal-indicator {
  width: 100%;
  font-size: clamp(0.48rem, 1.8vw, 0.62rem);
}

.round-summary {
  position: absolute;
  z-index: 3;
  inset: 0;
  width: 100%;
  height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 0;
  padding: clamp(1.25rem, 8%, 3rem);
  background:
    linear-gradient(#24d7ff0a 1px, transparent 1px),
    linear-gradient(90deg, #24d7ff0a 1px, transparent 1px),
    radial-gradient(circle at 50% 25%, #0b3441 0, #02070c 48%);
  background-color: #02070c;
  background-size: 24px 24px, 24px 24px, auto;
  box-shadow: inset 0 0 4rem #37ffe018;
  text-align: center;
}

.round-summary:not([hidden]) {
  display: flex;
}

.round-summary:not([hidden]) .eyebrow,
.round-summary:not([hidden]) h2,
.round-summary:not([hidden]) dl > div,
.round-summary:not([hidden]) .summary-actions {
  animation: summary-rise 420ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.round-summary:not([hidden]) h2 {
  animation-delay: 70ms;
}

.round-summary:not([hidden]) dl > div:nth-child(1) { animation-delay: 140ms; }
.round-summary:not([hidden]) dl > div:nth-child(2) { animation-delay: 190ms; }
.round-summary:not([hidden]) dl > div:nth-child(3) { animation-delay: 240ms; }
.round-summary:not([hidden]) dl > div:nth-child(4) { animation-delay: 290ms; }
.round-summary:not([hidden]) dl > div:nth-child(5) { animation-delay: 340ms; }
.round-summary:not([hidden]) dl > div:nth-child(6) { animation-delay: 420ms; }
.round-summary:not([hidden]) .summary-actions { animation-delay: 500ms; }

@keyframes summary-rise {
  from {
    opacity: 0;
    transform: translateY(0.8rem) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.round-summary .eyebrow {
  font-size: clamp(0.75rem, 2.5vw, 0.95rem);
}

.round-summary h2 {
  margin: 0.2rem 0 clamp(1.25rem, 5%, 2rem);
  font-size: clamp(2rem, 9vw, 3.25rem);
  line-height: 1;
  text-shadow: 0 0 1.5rem #37ffe044;
}

.round-summary dl {
  width: min(100%, 24rem);
  margin: 0;
}

.round-summary dl > div {
  display: flex;
  justify-content: space-between;
  padding: clamp(0.55rem, 2.2%, 0.85rem) 0.5rem;
  border-bottom: 1px solid #35486f;
  font-size: clamp(1rem, 3.6vw, 1.2rem);
}

.round-summary dt,
.round-summary dd {
  margin: 0;
}

.round-summary dd {
  font-weight: 800;
}

.round-summary .summary-total {
  margin-top: 0.35rem;
  border: 1px solid #55ffd766;
  border-radius: 0.65rem;
  background: #0a302b66;
  color: #55ffd7;
  font-size: clamp(1.3rem, 4.8vw, 1.65rem);
  font-weight: 800;
  box-shadow: 0 0 1.5rem #37ffe018;
}

.summary-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  width: min(100%, 24rem);
  margin-top: clamp(1.25rem, 5%, 2rem);
}

.summary-actions button {
  width: 100%;
  min-width: 0;
  min-height: 3.25rem;
  font-size: clamp(0.95rem, 3.5vw, 1.1rem);
}

.puzzle-summary {
  background:
    linear-gradient(#8e7dff0a 1px, transparent 1px),
    linear-gradient(90deg, #8e7dff0a 1px, transparent 1px),
    radial-gradient(circle at 50% 25%, #241d52 0, #030510 52%);
  background-size: 24px 24px, 24px 24px, auto;
  box-shadow: inset 0 0 4rem #9c7cff18;
}

/* The campaign recap lives inside the fixed-ratio board. Keep its complete
   hierarchy and navigation inside that surface at every supported viewport. */
.puzzle-summary:not(.puzzle-group-summary) {
  justify-content: flex-start;
  overflow: hidden;
  padding: clamp(0.7rem, 2.5%, 1.15rem);
}

.puzzle-summary:not(.puzzle-group-summary) .eyebrow {
  font-size: clamp(0.58rem, 1.8vw, 0.72rem);
}

.puzzle-summary:not(.puzzle-group-summary) h2 {
  margin: 0.05rem 0 0.3rem;
  font-size: clamp(1.65rem, 6vw, 2.45rem);
}

.puzzle-summary:not(.puzzle-group-summary) .puzzle-array-label {
  margin-bottom: 0.35rem;
  font-size: clamp(0.52rem, 1.7vw, 0.65rem);
}

.puzzle-summary:not(.puzzle-group-summary) .puzzle-campaign-indicators {
  width: min(100%, 11.5rem);
  gap: 0.3rem;
  margin-bottom: 0.85rem;
}

.puzzle-summary:not(.puzzle-group-summary) .arcade-campaign-indicators {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: min(100%, 9.45rem);
}

.puzzle-summary:not(.puzzle-group-summary) .puzzle-medal-indicator {
  border-width: 1px;
  font-size: clamp(0.42rem, 1.5vw, 0.55rem);
}

.puzzle-summary:not(.puzzle-group-summary) dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(100%, 20rem);
  gap: 0.3rem;
}

.puzzle-summary:not(.puzzle-group-summary) dl > div {
  min-width: 0;
  padding: 0.32rem 0.45rem;
  border: 1px solid #35486f;
  border-radius: 0.45rem;
  font-size: clamp(0.72rem, 2.5vw, 0.9rem);
}

.puzzle-summary:not(.puzzle-group-summary) dl > .puzzle-star-total,
.puzzle-summary:not(.puzzle-group-summary) dl > div:last-child {
  grid-column: 1 / -1;
}

.puzzle-summary:not(.puzzle-group-summary) dl > .puzzle-star-total {
  margin-top: 0;
  margin-bottom: 0.35rem;
  font-size: clamp(0.92rem, 3.2vw, 1.15rem);
}

.puzzle-summary:not(.puzzle-group-summary) .summary-actions {
  grid-template-columns: 1fr;
  gap: 0.45rem;
  width: min(100%, 20rem);
  margin-top: 0.85rem;
  padding-bottom: 0.1rem;
}

.puzzle-summary:not(.puzzle-group-summary) .summary-actions button {
  min-height: 2.35rem;
  font-size: clamp(0.7rem, 2.4vw, 0.85rem);
}

.puzzle-summary dl > div:nth-child(1) dd { color: #ffd166; }
.puzzle-summary dl > div:nth-child(2) dd { color: #dbe8ff; }
.puzzle-summary dl > div:nth-child(3) dd { color: #df9a62; }

.round-summary .puzzle-star-total {
  border-color: #b797ff88;
  background: #2c205088;
  color: #d7c9ff;
  box-shadow: 0 0 1.5rem #b797ff24;
}

#puzzle-play-again-button {
  border-color: #b797ffaa;
  background: linear-gradient(180deg, #3c2c72, #181136);
  color: #f2edff;
}

#puzzle-summary-menu-button {
  border-color: #63d3ffaa;
  background: linear-gradient(180deg, #17466a, #081f35);
  color: #effaff;
}

.game-hud {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.25rem, 1cqw, 0.4rem);
  min-height: 2.75rem;
  padding: 0.25rem calc(0.5rem + 3px);
  border-bottom: 1px solid #30d5ff55;
  background: #02070d;
  box-shadow: inset 0 -0.8rem 1.5rem #00d9ff08;
}

.game-hud > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.05rem;
  min-width: 0;
  padding: 0.14rem 0.1rem;
  border: 1px solid #30d5ff2e;
  border-radius: 0.45rem;
  background: linear-gradient(180deg, #10253a, #06101c);
}

.game-hud .hud-stage {
  border-color: #b797ff55;
  background: linear-gradient(180deg, #271d46, #100c22);
}

.game-hud .total-score-indicator {
  border-color: #5effdb55;
  background: linear-gradient(180deg, #12352f, #071914);
  box-shadow: inset 0 0 0.7rem #5effdb0c;
}

.total-score-indicator #run-total-value {
  color: #8affdf;
  text-shadow: 0 0 0.55rem #5effdb4d;
}

.game-hud .pressure-indicator {
  border-color: #ff557c55;
  background: linear-gradient(180deg, #271522, #110810);
  box-shadow: inset 0 0 0.7rem #ff315f0a;
}

.game-hud span {
  color: #75cfe1;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.game-hud strong {
  max-width: 100%;
  overflow: hidden;
  font-size: 1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-overflow: ellipsis;
}

.pressure-indicator,
.score-indicator {
  position: relative;
  overflow: hidden;
  transition:
    box-shadow 160ms ease,
    background-color 160ms ease;
}

.pressure-indicator > *,
.score-indicator > * {
  position: relative;
  z-index: 2;
}

.hud-indicator {
  position: relative;
  overflow: hidden;
}

.hud-indicator > * {
  position: relative;
  z-index: 2;
}

.pressure-indicator[data-warning="3"],
.pressure-indicator[data-warning="2"],
.pressure-indicator[data-warning="1"] {
  background: #ff315f0a;
  box-shadow:
    inset 0 0 0 1px #ff557c99,
    inset 0 0 1rem #ff315f12;
}

.pressure-indicator[data-warning="3"] #pressure-value {
  color: #ffd166;
  text-shadow: 0 0 0.55rem #ffd16655;
}

.pressure-indicator[data-warning="2"] #pressure-value {
  color: #ff9f43;
  text-shadow: 0 0 0.55rem #ff9f4355;
}

.pressure-indicator[data-warning="1"] #pressure-value {
  color: #ff557c;
  text-shadow: 0 0 0.65rem #ff315f66;
}

.pressure-indicator[data-reloading="true"] {
  border-color: #53e7ffcc !important;
  background: linear-gradient(180deg, #0c3545, #07151f) !important;
  box-shadow:
    inset 0 0 1rem #53e7ff2b,
    0 0 0.7rem #53e7ff1f !important;
}

.pressure-indicator[data-reloading="true"]::before,
.pressure-indicator[data-reloading="true"]::after {
  position: absolute;
  right: 0;
  left: 0;
  z-index: 1;
  pointer-events: none;
  content: "";
}

.pressure-indicator[data-reloading="true"]::before {
  inset: 0;
  background: linear-gradient(
    180deg,
    #53e7ff08,
    #53e7ff2d 48%,
    #5effdb18
  );
  animation: drop-reload-wash 430ms ease-out both;
}

.pressure-indicator[data-reloading="true"]::after {
  top: -3px;
  height: 3px;
  background: #b8fbff;
  box-shadow:
    0 0 0.45rem #53e7ff,
    0 0.45rem 0.8rem #53e7ff88;
  animation: drop-reload-scan 430ms cubic-bezier(0.2, 0.72, 0.28, 1) both;
}

.pressure-indicator[data-reloading="true"] #pressure-value {
  color: #eaffff;
  text-shadow: 0 0 0.7rem #53e7ff;
  animation: drop-value-reload 430ms ease-out both;
}

.score-indicator[data-banking="true"] {
  border-color: #53e7ffcc !important;
  background: linear-gradient(180deg, #0c3545, #07151f) !important;
  box-shadow:
    inset 0 0 1rem #53e7ff2b,
    0 0 0.7rem #53e7ff1f !important;
}

.score-indicator[data-banking="true"]::before,
.score-indicator[data-banking="true"]::after {
  position: absolute;
  right: 0;
  left: 0;
  z-index: 1;
  pointer-events: none;
  content: "";
}

.score-indicator[data-banking="true"]::before {
  inset: 0;
  background: linear-gradient(
    180deg,
    #53e7ff08,
    #53e7ff2d 48%,
    #5effdb18
  );
  animation: drop-reload-wash 430ms ease-out both;
}

.score-indicator[data-banking="true"]::after {
  top: -3px;
  height: 3px;
  background: #b8fbff;
  box-shadow:
    0 0 0.45rem #53e7ff,
    0 0.45rem 0.8rem #53e7ff88;
  animation: drop-reload-scan 430ms cubic-bezier(0.2, 0.72, 0.28, 1) both;
}

.score-indicator[data-banking="true"] strong {
  color: #eaffff;
  text-shadow: 0 0 0.7rem #53e7ff;
  animation: drop-value-reload 430ms ease-out both;
}

.hud-indicator[data-refreshing="true"] {
  border-color: #53e7ffcc !important;
  background: linear-gradient(180deg, #0c3545, #07151f) !important;
  box-shadow:
    inset 0 0 1rem #53e7ff2b,
    0 0 0.7rem #53e7ff1f !important;
}

.hud-indicator[data-refreshing="true"]::before,
.hud-indicator[data-refreshing="true"]::after {
  position: absolute;
  right: 0;
  left: 0;
  z-index: 1;
  pointer-events: none;
  content: "";
}

.hud-indicator[data-refreshing="true"]::before {
  inset: 0;
  background: linear-gradient(
    180deg,
    #53e7ff08,
    #53e7ff2d 48%,
    #5effdb18
  );
  animation: drop-reload-wash 430ms ease-out both;
}

.hud-indicator[data-refreshing="true"]::after {
  top: -3px;
  height: 3px;
  background: #b8fbff;
  box-shadow:
    0 0 0.45rem #53e7ff,
    0 0.45rem 0.8rem #53e7ff88;
  animation: drop-reload-scan 430ms cubic-bezier(0.2, 0.72, 0.28, 1) both;
}

.hud-indicator[data-refreshing="true"] strong {
  color: #eaffff;
  text-shadow: 0 0 0.7rem #53e7ff;
  animation: drop-value-reload 430ms ease-out both;
}

@keyframes drop-reload-scan {
  from { transform: translateY(0); }
  to { transform: translateY(2.75rem); }
}

@keyframes drop-reload-wash {
  0%, 100% { opacity: 0; }
  28%, 76% { opacity: 1; }
}

@keyframes drop-value-reload {
  0%, 38% { opacity: 0.3; transform: scaleY(0.45); }
  62% { opacity: 1; transform: scaleY(1.16); }
  100% { opacity: 1; transform: scaleY(1); }
}

#level-value {
  font-size: 0.7rem;
  white-space: nowrap;
}

canvas {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.game-panel {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.game-board {
  position: relative;
}

.stage-tally {
  position: absolute;
  z-index: 4;
  top: calc(50% - 20px);
  left: 50%;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  width: min(75%, 20rem);
  min-height: min(23rem, calc(100% - 2rem));
  border: 2px solid #55ffd7cc;
  overflow: hidden;
  border-radius: 1.65rem;
  padding: 0 1rem;
  background:
    radial-gradient(circle at 50% 0, #1a765755 0, transparent 44%),
    linear-gradient(145deg, #09251ff5, #02080df8 58%),
    #02080d;
  box-shadow:
    inset 0 1px #ffffff14,
    inset 0 0 1.5rem #37ffe00f,
    0 0 2.2rem #37ffe04d;
  text-align: center;
  transform: translate(-50%, -50%);
}

.stage-tally:not([hidden]) {
  animation: tally-panel-enter 420ms cubic-bezier(0.2, 0.85, 0.2, 1) both;
}

.stage-tally[data-mode="arcade"] {
  top: 50%;
  justify-content: center;
  width: min(78%, 20rem);
  min-height: min(19rem, calc(100% - 2rem));
  gap: clamp(0.5rem, 2.2%, 0.68rem);
  padding: 1rem;
}

.stage-tally::before {
  position: absolute;
  z-index: 2;
  inset: 0;
  border: 2px solid #8deeff;
  border-radius: inherit;
  clip-path: inset(0 50% 0 50% round 1.65rem);
  box-shadow:
    inset 0 0 0.8rem #37ffe044,
    0 0 1rem #37ffe077;
  content: "";
  pointer-events: none;
}

.stage-tally:not([hidden])::before {
  animation: tally-border-trace 620ms cubic-bezier(0.2, 0.8, 0.2, 1) 90ms
    both;
}

@keyframes tally-panel-enter {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-50% + 1rem)) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes tally-border-trace {
  from {
    opacity: 0.25;
    clip-path: inset(0 50% 0 50% round 1.65rem);
  }

  55% {
    opacity: 1;
  }

  to {
    opacity: 0;
    clip-path: inset(0 0 0 0 round 1.65rem);
  }
}

.stage-tally h2 {
  margin: 0;
  color: #efffff;
  font-size: clamp(1.45rem, 5.4vw, 2.05rem);
  line-height: 1;
  white-space: nowrap;
  text-transform: uppercase;
  text-shadow: 0 0 1rem #55ffd766;
}

.stage-tally dl {
  margin: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0 calc(1.35rem - 1px),
    #36535a2e calc(1.35rem - 1px) 1.35rem
  );
}

.stage-tally dl > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 1.35rem;
  border-bottom: 1px solid #36535a66;
  font-size: 0.9rem;
  text-transform: uppercase;
}

.stage-tally dt,
.stage-tally dd {
  margin: 0;
}

.stage-tally dt {
  font-weight: 800;
  letter-spacing: 0.04em;
}

.stage-tally dd {
  color: #bfffee;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.stage-tally .tally-drop dd {
  color: #ffd166;
  text-shadow: 0 0 0.65rem #ffd16655;
}

.tally-shot-stats {
  display: grid;
  gap: 0.12rem;
  margin: 0;
  color: #8cb9c4;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tally-shot-stats p {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
}

.tally-shot-stats strong {
  color: #efffff;
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
}

.tally-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 -0.2rem;
  border: 1px solid #55ffd766;
  border-radius: 0.55rem;
  padding: 0.35rem 0.5rem;
  background: #0a302b88;
  color: #8affdf;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tally-total strong {
  font-size: 1.2rem;
  font-variant-numeric: tabular-nums;
}

.tally-accolade {
  min-height: 1rem;
  margin: 0;
  color: #ffd166;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-shadow: 0 0 0.75rem #ffd16655;
}

.stage-tally[data-mode="puzzle"] .tally-accolade {
  min-height: 2.25rem;
}

.tally-medal-stars {
  display: block;
  min-height: 1rem;
  font-size: 1rem;
  letter-spacing: 0.16em;
  line-height: 1;
}

.tally-medal-stars:empty {
  display: none;
  min-height: 0;
}

.stage-tally[data-mode="puzzle"] {
  top: 50%;
  justify-content: center;
  width: min(78%, 20rem);
  min-height: min(19rem, calc(100% - 2rem));
  gap: clamp(0.5rem, 2.2%, 0.68rem);
  padding: 1rem;
  border-color: #b797ffaa;
  background:
    linear-gradient(#b797ff0d 1px, transparent 1px),
    linear-gradient(90deg, #b797ff0d 1px, transparent 1px),
    radial-gradient(circle at 50% 15%, #29205a 0, #070b16 58%);
  background-size: 18px 18px, 18px 18px, auto;
  box-shadow: inset 0 0 3rem #b797ff16, 0 0 2.5rem #000c;
}

.stage-tally[data-mode="endurance"] {
  top: 50%;
  justify-content: center;
  width: min(78%, 20rem);
  min-height: min(19rem, calc(100% - 2rem));
  gap: clamp(0.5rem, 2.2%, 0.68rem);
  padding: 1rem;
  border-color: #53e7ffcc;
  background:
    linear-gradient(#53e7ff0d 1px, transparent 1px),
    linear-gradient(90deg, #53e7ff0d 1px, transparent 1px),
    radial-gradient(circle at 50% 15%, #123e54 0, #050b13 62%);
  background-size: 18px 18px, 18px 18px, auto;
}

.stage-tally[data-mode="endurance"] .arcade-tally-only {
  display: none;
}

.endurance-campaign-indicators {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  width: min(100%, 15rem) !important;
}

.stage-tally[data-mode="puzzle"] .arcade-tally-only {
  display: none;
}

.stage-tally[data-mode="puzzle"] h2 {
  white-space: normal;
}

.puzzle-tally-content:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: clamp(0.45rem, 2%, 0.6rem);
}

.puzzle-tally-name {
  margin: -0.25rem 0 0;
  color: #b9a8e8;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.puzzle-tally-performance {
  margin: 0;
  border-block: 1px solid #b797ff44;
  background: #0c102377;
}

.puzzle-tally-performance > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 2rem;
  border-bottom: 1px solid #b797ff2b;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.puzzle-tally-performance > div:last-child {
  border-bottom: 0;
}

.puzzle-tally-performance dt,
.puzzle-tally-performance dd {
  margin: 0;
}

.puzzle-tally-performance dt {
  color: #aeb7d2;
  font-weight: 800;
}

.puzzle-tally-performance dd {
  color: #efffff;
  font-size: 1.15rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.puzzle-tally-result {
  min-height: 3.4rem;
}

.puzzle-tally-stars {
  min-height: 1.65rem;
  margin: 0;
  font-size: 1.7rem;
  letter-spacing: 0.16em;
  line-height: 1;
  text-shadow: 0 0 1rem currentColor;
}

.puzzle-tally-medal {
  display: block;
  min-height: 1.7rem;
  font-size: 1.45rem;
  letter-spacing: 0.16em;
  line-height: 1;
  text-shadow: 0 0 0.8rem currentColor;
}

.puzzle-tally-best {
  min-height: 1rem;
  margin: 0;
  color: #c8bafa;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.stage-tally[data-medal="gold"] .puzzle-tally-stars,
.stage-tally[data-medal="gold"] .puzzle-tally-medal { color: #ffd166; }
.stage-tally[data-medal="silver"] .puzzle-tally-stars,
.stage-tally[data-medal="silver"] .puzzle-tally-medal { color: #dbe8ff; }
.stage-tally[data-medal="bronze"] .puzzle-tally-stars,
.stage-tally[data-medal="bronze"] .puzzle-tally-medal { color: #df9a62; }

.stage-tally [data-puzzle-tally-step] {
  opacity: 0;
  filter: blur(3px);
  transform: translateY(0.3rem) scale(0.98);
  transition:
    opacity 160ms ease,
    filter 160ms ease,
    transform 180ms cubic-bezier(0.2, 0.9, 0.25, 1.15);
}

.stage-tally [data-puzzle-tally-step][data-revealed="true"] {
  opacity: 1;
  filter: none;
  transform: translateY(0) scale(1);
}

.stage-tally [data-puzzle-tally-step][data-active="true"] {
  animation: puzzle-tally-pop 220ms cubic-bezier(0.2, 0.9, 0.25, 1.25) both;
}

@keyframes puzzle-tally-pop {
  0% { transform: scale(0.88); }
  65% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

.stage-tally[data-medal="gold"] .tally-medal-stars,
.stage-tally[data-medal="gold"] .tally-accolade { color: #ffd166; }
.stage-tally[data-medal="silver"] .tally-medal-stars,
.stage-tally[data-medal="silver"] .tally-accolade { color: #dbe8ff; }
.stage-tally[data-medal="bronze"] .tally-medal-stars,
.stage-tally[data-medal="bronze"] .tally-accolade { color: #df9a62; }

.stage-tally [data-tally-step] {
  position: relative;
  overflow: hidden;
  opacity: 0;
  filter: blur(3px);
  transform: translateY(0.35rem) scale(0.985);
  transition:
    opacity 220ms ease,
    filter 220ms ease,
    transform 220ms cubic-bezier(0.2, 0.85, 0.2, 1);
}

.stage-tally [data-tally-step][data-revealed="true"] {
  opacity: 0.82;
  filter: none;
  transform: translateY(0) scale(1);
}

.stage-tally [data-tally-step][data-active="true"] {
  opacity: 1;
}

.stage-tally [data-tally-step]::after {
  position: absolute;
  z-index: 0;
  inset: 0;
  border-radius: 0.45rem;
  background: linear-gradient(
    90deg,
    transparent 0,
    #37ffe008 22%,
    #8deeff3d 50%,
    #37ffe008 78%,
    transparent 100%
  );
  content: "";
  opacity: 0;
  pointer-events: none;
  transform: translateX(-105%);
}

.stage-tally [data-tally-step][data-active="true"]::after {
  animation: tally-row-scan 420ms cubic-bezier(0.2, 0.75, 0.2, 1) both;
}

@keyframes tally-row-scan {
  0% {
    opacity: 0;
    transform: translateX(-105%);
  }

  30% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translateX(105%);
  }
}

.stage-tally [data-tally-step][data-counting="true"] dd,
.stage-tally [data-tally-step][data-counting="true"] strong {
  color: #efffff;
  text-shadow: 0 0 0.8rem #55ffd799;
}

.arcade-mastery-performance {
  border-block: 1px solid #55ffd744;
  background: #08201d77 !important;
}

.arcade-mastery-performance > div {
  border-bottom-color: #55ffd72b;
}

.stage-tally-actions {
  display: block;
  width: 100%;
}

.stage-tally[data-mode="puzzle"] .stage-tally-actions {
  display: block;
}

.stage-tally-actions > button {
  width: 100%;
  min-width: 0;
  min-height: 2.45rem;
  margin: 0;
  font-size: 0.9rem;
  text-transform: uppercase;
}

.tally-continue {
  position: relative;
  display: block;
  width: 82%;
  min-height: 2.45rem;
  margin: 0 auto;
  overflow: hidden;
  border-color: #53e7ff88;
  background: linear-gradient(180deg, #123145, #071723);
  color: #a9d9e3;
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tally-continue::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--tally-progress, 0) * 100%);
  background:
    linear-gradient(90deg, #1c71605c, #37ffe099),
    repeating-linear-gradient(
      -45deg,
      transparent 0 0.45rem,
      #d9ffff12 0.45rem 0.62rem
    );
  box-shadow: 0 0 0.9rem #37ffe055;
  content: "";
  pointer-events: none;
}

.tally-continue:disabled,
.tally-continue:disabled:hover {
  border-color: #53e7ff88;
  background: linear-gradient(180deg, #123145, #071723);
  color: #a9d9e3;
  cursor: progress;
  opacity: 1;
}

.stage-tally[data-ready="true"] .tally-continue {
  border-color: #55ffd7;
  background: #168a68;
  color: #ffffff;
  font-weight: 800;
  box-shadow:
    inset 0 1px #d9ffff55,
    0 0 1.15rem #37ffe066;
  text-shadow: 0 0 0.55rem #d9ffff99;
  animation:
    tally-continue-ready 320ms cubic-bezier(0.2, 0.9, 0.25, 1.2),
    tally-ready-breathe 1.8s ease-in-out 320ms infinite;
}

.stage-tally[data-ready="true"] .tally-continue::before {
  inset: 0 auto 0 -12%;
  width: 38%;
  background: linear-gradient(
    100deg,
    transparent 0,
    #d9ffff14 28%,
    #efffffaa 50%,
    #d9ffff14 72%,
    transparent 100%
  );
  box-shadow: none;
  opacity: 0;
  transform: skewX(-18deg) translateX(-180%);
  transition: none;
  animation: tally-ready-flow 1.8s ease-in-out 420ms infinite;
}

@keyframes tally-continue-ready {
  0% {
    background: #37ffe0;
    box-shadow: 0 0 1.7rem #37ffe0aa;
    transform: scale(0.985);
  }

  100% {
    background: #168a68;
    transform: scale(1);
  }
}

@keyframes tally-ready-breathe {
  0%,
  100% {
    filter: brightness(1);
  }

  50% {
    filter: brightness(1.13);
  }
}

@keyframes tally-ready-flow {
  0%,
  14% {
    opacity: 0;
    transform: skewX(-18deg) translateX(-180%);
  }

  28% {
    opacity: 0.8;
  }

  78% {
    opacity: 0.55;
  }

  92%,
  100% {
    opacity: 0;
    transform: skewX(-18deg) translateX(360%);
  }
}

.summary-best {
  color: #a9c3ca;
}

.summary-new-best {
  margin: 0.7rem 0 -0.4rem;
  color: #ffd166;
  font-size: clamp(0.95rem, 3.5vw, 1.15rem);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-shadow: 0 0 1rem #ffd16666;
}

/*
 * Canvas callouts scale with the game board because they are rendered in game
 * coordinates. Match that behavior for the DOM score recaps once the board is
 * wider than the compact layout, while preserving the existing phone sizing.
 */
@container (min-width: 32rem) {
  .controls {
    gap: clamp(0.5rem, 1.5cqw, 0.75rem);
  }

  .controls button {
    min-height: clamp(2.4rem, 6cqw, 3rem);
    padding-block: clamp(0.25rem, 0.7cqw, 0.35rem);
    font-size: clamp(0.9rem, 2.4cqw, 1.05rem);
  }

  .audio-toggle svg {
    width: clamp(1.05rem, 2.8cqw, 1.25rem);
    height: clamp(1.05rem, 2.8cqw, 1.25rem);
  }

  .game-hud {
    min-height: clamp(2.55rem, 8.5cqw, 3.6rem);
    padding-block: clamp(0.16rem, 0.53cqw, 0.24rem);
    padding-inline: clamp(0.7rem, 2cqw, 0.8rem);
  }

  .game-hud > div {
    gap: clamp(0.05rem, 0.17cqw, 0.08rem);
    padding-block: clamp(0.14rem, 0.47cqw, 0.2rem);
  }

  .game-hud span {
    font-size: clamp(0.58rem, 1.8cqw, 0.75rem);
  }

  .game-hud strong {
    font-size: clamp(1rem, 3cqw, 1.25rem);
  }

  #level-value {
    font-size: clamp(0.7rem, 2.6cqw, 1.05rem);
  }

  .stage-tally {
    top: calc(50% - clamp(1.25rem, 4.17cqw, 1.75rem));
    width: min(75%, 30rem);
    min-height: min(
      clamp(23rem, 76.67cqw, 32rem),
      calc(100% - 2rem)
    );
    padding-inline: clamp(1rem, 3.33cqw, 1.4rem);
  }

  .stage-tally:is(
    [data-mode="arcade"],
    [data-mode="puzzle"],
    [data-mode="endurance"]
  ) {
    top: 50%;
    width: min(78%, 30rem);
    min-height: min(
      clamp(23rem, 76.67cqw, 32rem),
      calc(100% - 2rem)
    );
    padding-inline: clamp(1rem, 3.33cqw, 1.4rem);
  }

  .stage-tally h2 {
    font-size: clamp(2.05rem, 6.8cqw, 2.85rem);
  }

  .stage-tally dl {
    background: repeating-linear-gradient(
      to bottom,
      transparent 0 calc(clamp(1.35rem, 4.5cqw, 1.9rem) - 1px),
      #36535a2e calc(clamp(1.35rem, 4.5cqw, 1.9rem) - 1px)
        clamp(1.35rem, 4.5cqw, 1.9rem)
    );
  }

  .stage-tally dl > div {
    min-height: clamp(1.35rem, 4.5cqw, 1.9rem);
    font-size: clamp(0.9rem, 3cqw, 1.25rem);
  }

  .tally-shot-stats {
    gap: clamp(0.12rem, 0.4cqw, 0.18rem);
    font-size: clamp(0.68rem, 2.27cqw, 0.95rem);
  }

  .tally-shot-stats strong {
    font-size: clamp(0.86rem, 2.87cqw, 1.2rem);
  }

  .tally-total {
    border-radius: clamp(0.55rem, 1.83cqw, 0.78rem);
    padding: clamp(0.35rem, 1.17cqw, 0.5rem)
      clamp(0.5rem, 1.67cqw, 0.7rem);
    font-size: clamp(0.95rem, 3.17cqw, 1.32rem);
  }

  .tally-total strong {
    font-size: clamp(1.2rem, 4cqw, 1.68rem);
  }

  .tally-accolade {
    min-height: clamp(1rem, 3.33cqw, 1.4rem);
    font-size: clamp(0.72rem, 2.4cqw, 1rem);
  }

  .tally-continue {
    min-height: clamp(2.45rem, 8.17cqw, 3.4rem);
    font-size: clamp(1.05rem, 3.5cqw, 1.45rem);
  }

  .round-summary {
    padding: clamp(3rem, 8cqw, 3.5rem);
  }

  .round-summary .eyebrow {
    font-size: clamp(0.95rem, 3.17cqw, 1.3rem);
  }

  .round-summary h2 {
    margin-bottom: clamp(2rem, 5cqw, 2.8rem);
    font-size: clamp(3.25rem, 10.83cqw, 4.5rem);
  }

  .round-summary dl,
  .summary-actions {
    width: min(100%, 30rem);
  }

  .round-summary dl > div {
    padding: clamp(0.85rem, 2.2cqw, 1.05rem)
      clamp(0.5rem, 1.67cqw, 0.7rem);
    font-size: clamp(1.2rem, 3.6cqw, 1.5rem);
  }

  .round-summary .summary-total {
    font-size: clamp(1.65rem, 4.8cqw, 2.05rem);
  }

  .summary-new-best {
    font-size: clamp(1.15rem, 3.5cqw, 1.35rem);
  }

  .summary-actions {
    gap: clamp(0.75rem, 2.5cqw, 1rem);
    margin-top: clamp(2rem, 5cqw, 2.8rem);
  }

  .summary-actions button {
    min-height: clamp(3.25rem, 10cqw, 4rem);
    font-size: clamp(1.1rem, 3.5cqw, 1.35rem);
  }

  .puzzle-group-summary {
    --group-recap-content-width:
      min(100%, clamp(22rem, 65cqw, 27rem));

    padding: clamp(2rem, 6cqw, 3rem);
  }

  .puzzle-group-summary h2 {
    margin-bottom: clamp(1rem, 2.5cqw, 1.4rem);
  }

  .puzzle-group-summary .puzzle-medal-indicators {
    width: var(--group-recap-content-width);
    gap: clamp(0.6rem, 1.8cqw, 0.8rem);
  }

  .puzzle-group-summary #summary-results[data-stage-count="3"] {
    width: min(100%, clamp(12.66rem, 38.16cqw, 15.88rem));
  }

  .puzzle-group-summary #summary-results[data-stage-count="4"] {
    width: min(100%, clamp(17.32rem, 51.58cqw, 21.44rem));
  }

  .puzzle-group-summary .puzzle-medal-indicator {
    font-size: clamp(0.72rem, 1.8cqw, 0.9rem);
  }

  .puzzle-group-stars {
    margin-top: clamp(1rem, 2.5cqw, 1.3rem);
    font-size: clamp(2rem, 5cqw, 2.6rem);
  }

  .summary-actions.puzzle-group-actions {
    width: var(--group-recap-content-width);
    gap: clamp(0.55rem, 1.5cqw, 0.7rem);
    margin-top: clamp(1rem, 2.5cqw, 1.3rem);
  }

  .summary-actions.puzzle-group-actions button {
    min-height: clamp(3rem, 8cqw, 3.4rem);
    padding: clamp(0.5rem, 1.3cqw, 0.65rem) 0.8rem;
    font-size: clamp(1rem, 2.7cqw, 1.15rem);
  }

  .puzzle-summary:not(.puzzle-group-summary) {
    justify-content: center;
    padding: clamp(1.5rem, 4cqw, 2rem);
  }

  .puzzle-summary:not(.puzzle-group-summary) .eyebrow {
    font-size: clamp(0.9rem, 2.3cqw, 1.05rem);
  }

  .puzzle-summary:not(.puzzle-group-summary) h2 {
    margin: 0.15rem 0 clamp(0.55rem, 1.5cqw, 0.75rem);
    font-size: clamp(2.5rem, 7cqw, 3.25rem);
  }

  .puzzle-summary:not(.puzzle-group-summary) .puzzle-array-label {
    margin-bottom: clamp(0.5rem, 1.5cqw, 0.7rem);
    font-size: clamp(0.7rem, 1.8cqw, 0.85rem);
  }

  .puzzle-summary:not(.puzzle-group-summary) .puzzle-campaign-indicators {
    width: min(100%, clamp(16rem, 45cqw, 19rem));
    gap: clamp(0.4rem, 1.25cqw, 0.55rem);
    margin-bottom: clamp(0.9rem, 2.5cqw, 1.15rem);
  }

  .puzzle-summary:not(.puzzle-group-summary) .arcade-campaign-indicators {
    width: min(100%, clamp(12.7rem, 36cqw, 15.1rem));
  }

  .puzzle-summary:not(.puzzle-group-summary) .puzzle-medal-indicator {
    border-width: 2px;
    font-size: clamp(0.58rem, 1.35cqw, 0.72rem);
  }

  .puzzle-summary:not(.puzzle-group-summary) dl {
    width: min(100%, 26rem);
  }

  .puzzle-summary:not(.puzzle-group-summary) dl > div {
    padding: clamp(0.55rem, 1.5cqw, 0.7rem)
      clamp(0.65rem, 1.8cqw, 0.8rem);
    font-size: clamp(1rem, 2.8cqw, 1.2rem);
  }

  .puzzle-summary:not(.puzzle-group-summary) dl > .puzzle-star-total {
    margin-bottom: clamp(0.45rem, 1.2cqw, 0.6rem);
    font-size: clamp(1.2rem, 3.4cqw, 1.4rem);
  }

  .puzzle-summary:not(.puzzle-group-summary) .summary-actions {
    width: min(100%, 26rem);
    gap: clamp(0.55rem, 1.5cqw, 0.7rem);
    margin-top: clamp(0.9rem, 2.5cqw, 1.15rem);
  }

  .puzzle-summary:not(.puzzle-group-summary) .summary-actions button {
    min-height: clamp(3rem, 8cqw, 3.4rem);
    font-size: clamp(1rem, 2.7cqw, 1.15rem);
  }
}


.status {
  position: relative;
  min-height: 1.75rem;
  margin: 0;
  padding: 0.25rem 1rem 0.2rem;
  border-top: 1px solid #30d5ff33;
  border-bottom: 1px solid #30d5ff44;
  color: #bfefff;
  background: #01050a;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.035em;
  text-align: center;
  transition:
    border-color 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease;
}

.status-message {
  display: inline-block;
  text-transform: uppercase;
}

.aim-guidance-step {
  display: inline-block;
  font: inherit;
  color: #ffffff;
  text-shadow: none;
}

.aim-guidance-step + .aim-guidance-step {
  margin-left: clamp(0.45rem, 1.8cqw, 0.7rem);
  color: #75cfe1;
}

.status-message-enter {
  animation: status-message-pop 300ms cubic-bezier(0.2, 0.78, 0.24, 1) both;
}

@keyframes status-message-pop {
  0% { opacity: 0.58; transform: scale(0.975); }
  62% { opacity: 1; transform: scale(1.025); }
  100% { opacity: 1; transform: scale(1); }
}

.status[data-tone="flight"] {
  overflow: hidden;
  border-color: color-mix(
    in srgb,
    var(--flight-color, #53e7ff) 58%,
    transparent
  );
  color: transparent;
  background:
    radial-gradient(
      circle at 50% 50%,
      color-mix(in srgb, var(--flight-color, #53e7ff) 42%, #07131a) 0,
      color-mix(in srgb, var(--flight-color, #53e7ff) 18%, #061018) 28%,
      #01070c 72%
    );
  font-size: 0;
  box-shadow: inset 0 0 0.8rem color-mix(
    in srgb,
    var(--flight-color, #53e7ff) 22%,
    transparent
  );
}

.status[data-tone="flight"]::before,
.status[data-tone="flight"]::after {
  position: absolute;
  top: 4px;
  bottom: 4px;
  width: 50%;
  pointer-events: none;
  content: "";
  animation: shot-tracking-symmetric 820ms ease-in-out
    infinite;
}

.status[data-tone="flight"]::before {
  left: 0;
  transform-origin: right center;
  background: linear-gradient(
    90deg,
    #f1ffff,
    color-mix(in srgb, var(--flight-color, #53e7ff) 92%, white) 5%,
    color-mix(in srgb, var(--flight-color, #53e7ff) 62%, transparent) 34%,
    color-mix(in srgb, var(--flight-color, #53e7ff) 12%, transparent)
  );
  box-shadow:
    inset 3px 0 0 #ffffff,
    inset 12px 0 1rem color-mix(
      in srgb,
      var(--flight-color, #53e7ff) 68%,
      transparent
    ),
    0 0 0.8rem color-mix(
      in srgb,
      var(--flight-color, #53e7ff) 54%,
      transparent
    );
}

.status[data-tone="flight"]::after {
  right: 0;
  transform-origin: left center;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--flight-color, #53e7ff) 12%, transparent),
    color-mix(in srgb, var(--flight-color, #53e7ff) 62%, transparent) 66%,
    color-mix(in srgb, var(--flight-color, #53e7ff) 92%, white) 95%,
    #f1ffff
  );
  box-shadow:
    inset -3px 0 0 #ffffff,
    inset -12px 0 1rem color-mix(
      in srgb,
      var(--flight-color, #53e7ff) 68%,
      transparent
    ),
    0 0 0.8rem color-mix(
      in srgb,
      var(--flight-color, #53e7ff) 54%,
      transparent
    );
}

@keyframes shot-tracking-symmetric {
  0%, 100% { opacity: 0.48; transform: scaleX(0.02); }
  50% { opacity: 1; transform: scaleX(1); }
}

.status[data-tone="good"] {
  border-color: #5effdb99;
  color: #eafff9;
  background:
    linear-gradient(#03100dd9, #03100dd9),
    repeating-linear-gradient(
      135deg,
      #0a352b 0,
      #0a352b 14px,
      #020807 14px,
      #020807 28px
    );
  box-shadow:
    inset 0 0 1rem #5effdb16,
    0 0.2rem 1rem #5effdb14;
  text-shadow: 0 0 0.7rem #5effdb55;
  text-transform: uppercase;
}

.status[data-tone="color-clear"] {
  overflow: hidden;
  border-color: var(--status-accent, #55ffd7);
  color: #ffffff;
  background:
    linear-gradient(
      90deg,
      #010509,
      color-mix(in srgb, var(--status-accent, #55ffd7) 48%, #071018) 24%,
      color-mix(in srgb, var(--status-accent, #55ffd7) 68%, #071018) 50%,
      color-mix(in srgb, var(--status-accent, #55ffd7) 48%, #071018) 76%,
      #010509
    );
  box-shadow:
    inset 0 0 1.2rem color-mix(in srgb, var(--status-accent, #55ffd7) 36%, transparent),
    0 0.2rem 1rem color-mix(in srgb, var(--status-accent, #55ffd7) 20%, transparent);
  text-shadow:
    0 1px #000,
    0 0 0.65rem color-mix(in srgb, var(--status-accent, #55ffd7) 74%, white);
  text-transform: uppercase;
}

.status[data-tone="warning"] {
  border-color: #ffd16688;
  color: #ffe9a6;
}

.status[data-tone="danger"] {
  border-color: #ff496888;
  color: #ffd9df;
}

.status[data-tone="pressure"] {
  overflow: hidden;
  border-color: #ff4968aa;
  color: #ffe4e9;
  background:
    linear-gradient(#1a050ad9, #1a050ad9),
    repeating-linear-gradient(
      135deg,
      #6f1428 0,
      #6f1428 12px,
      #140309 12px,
      #140309 24px
    );
  background-size: auto, 34px 34px;
  box-shadow:
    inset 0 0 1rem #ff315f24,
    0 0.2rem 1rem #ff315f18;
  text-shadow: 0 0 0.65rem #ff496899;
  text-transform: uppercase;
  animation: pressure-warning-sweep 420ms linear infinite;
}

@keyframes pressure-warning-sweep {
  from { background-position: 0 0, 0 0; }
  to { background-position: 0 0, -34px 34px; }
}

@container (min-width: 32rem) {
  .status {
    min-height: clamp(1.75rem, 5.2cqw, 2.15rem);
    padding-block: clamp(0.2rem, 0.7cqw, 0.32rem);
    font-size: clamp(0.78rem, 2.5cqw, 1.05rem);
  }
}

@media (max-width: 32rem) {
  .game-shell {
    width: min(100% - 0.75rem, 42rem);
    padding-top: 0.75rem;
  }

  .controls {
    gap: 0.3rem;
  }

  .audio-controls {
    gap: 0.2rem;
  }

  button {
    min-height: 2.75rem;
    padding: 0.55rem 0.75rem;
    font-size: 0.85rem;
  }

  .start-menu {
    padding-inline: 1rem;
  }

  .start-menu h2 {
    font-size: clamp(1.8rem, 9vw, 2.35rem);
    white-space: nowrap;
  }

  .start-menu h2::before,
  .start-menu h2::after {
    width: 0.65rem;
  }

  .start-menu h2::before {
    right: calc(100% + 0.3rem);
  }

  .start-menu h2::after {
    left: calc(100% + 0.3rem);
  }

  .mode-options button {
    min-height: 3.75rem;
  }

  .mode-options button {
    grid-template-columns: 2.65rem minmax(0, 1fr) auto;
    gap: 0.5rem;
    padding: 0.5rem 0.65rem;
  }

  .mode-emblem {
    width: 2.45rem;
    height: 2.45rem;
  }

  .mode-emblem svg {
    width: 1.7rem;
    height: 1.7rem;
  }

  .mode-options strong {
    font-size: 1.05rem;
  }

  .mode-copy .mode-tagline {
    font-size: 0.56rem;
    letter-spacing: 0.07em;
  }

  .mode-availability {
    gap: 0.25rem;
    padding: 0.2rem 0.35rem;
    font-size: 0.48rem;
    letter-spacing: 0.06em;
  }

  .lock-icon {
    width: 0.62rem;
    height: 0.62rem;
  }

  .game-header {
    gap: 0.55rem;
    margin-bottom: 0.55rem;
  }

  .release-tag {
    bottom: -0.25rem;
  }

  .game-hud > div {
    padding-inline: 0.1rem;
  }

  .game-hud span {
    font-size: 0.6rem;
  }

  .game-hud strong {
    font-size: 0.92rem;
  }

  #level-value {
    font-size: 0.68rem;
  }

  .stage-tally {
    padding-inline: 0.8rem;
  }

  .stage-tally dl > div {
    font-size: 0.82rem;
  }

  .stage-tally-actions > button {
    min-height: 2.8125rem;
    padding: 0.55rem 0.75rem;
    font-size: 0.96rem;
  }

  .tally-continue {
    width: 90%;
  }

  .summary-actions.puzzle-group-actions button,
  .puzzle-summary:not(.puzzle-group-summary) .summary-actions button {
    min-height: 2.8125rem;
    padding: 0.5rem 0.7rem;
    font-size: 0.96rem;
  }
}

@media (max-height: 46rem) {
  .game-shell {
    width: min(calc(100% - 0.75rem), calc((100svh - 11rem) * 2 / 3));
    padding-block: 0.35rem;
  }

  .game-header {
    margin-bottom: 0.35rem;
  }

  .status {
    min-height: 1.75rem;
    padding-block: 0.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }

  .status[data-tone="good"] {
    animation: none !important;
  }

  .status-message-enter {
    animation: none !important;
  }

  .status[data-tone="flight"]::before,
  .status[data-tone="flight"]::after {
    animation: none !important;
    transform: scaleX(1);
  }

  .status[data-tone="color-clear"],
  .hud-indicator[data-refreshing="true"]::before,
  .hud-indicator[data-refreshing="true"]::after,
  .hud-indicator[data-refreshing="true"] strong,
  .pressure-indicator[data-reloading="true"]::before,
  .pressure-indicator[data-reloading="true"]::after,
  .pressure-indicator[data-reloading="true"] #pressure-value,
  .score-indicator[data-banking="true"]::before,
  .score-indicator[data-banking="true"]::after,
  .score-indicator[data-banking="true"] strong {
    animation: none !important;
  }

  .status[data-tone="pressure"] {
    animation: none !important;
  }

  .stage-tally [data-tally-step] {
    opacity: 1;
    filter: none;
    transform: none;
    transition: none;
  }

  .stage-tally::before,
  .stage-tally [data-tally-step]::after {
    animation: none !important;
  }
}

/* Platinum uses a short directional cue and an icy metal finish. */
.platinum-entry {
  --platinum-secondary-width: clamp(5rem, 22%, 6rem);
  width: 100%;
  min-width: 0;
}
.platinum-launch-row { display: flex; gap: 0.45rem; }
.platinum-launch-row > button {
  min-width: 0;
  min-height: 3.5rem;
  height: 3.5rem;
  padding: 0.55rem 0.4rem;
  border-radius: 1rem;
  transition: flex-basis 300ms ease, border-color 160ms ease;
}
.platinum-launch-row > .puzzle-continue-campaign {
  flex: 1 1 calc(100% - var(--platinum-secondary-width) - 0.45rem);
}
.platinum-launch-row > .platinum-launch-button { flex: 1 1 var(--platinum-secondary-width); }
.platinum-entry[data-active="true"] .puzzle-continue-campaign { flex-basis: var(--platinum-secondary-width); }
.platinum-entry[data-active="true"] .platinum-launch-button {
  flex-basis: calc(100% - var(--platinum-secondary-width) - 0.45rem);
}
.platinum-entry[data-active="true"] .puzzle-continue-campaign {
  border-color: #506878;
  background: linear-gradient(#142a36, #0c1a22);
  box-shadow: inset 0 1px #ffffff18;
}
.platinum-entry[data-active="true"] .puzzle-continue-campaign::after { content: none; }
.platinum-launch-row strong { font-size: clamp(0.75rem, 3vw, 0.95rem); }
.platinum-launch-row span { font-size: 0.65rem; line-height: 1.25; margin-top: 0.2rem; }
.platinum-launch-row strong,
.platinum-launch-row span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.platinum-launch-button,
.puzzle-stage-button[data-state="completed"][data-medal="platinum"],
.puzzle-medal-indicator[data-medal="platinum"] {
  --platinum-surface:
    radial-gradient(ellipse at 35% 0, #dcfaff30, transparent 75%),
    linear-gradient(125deg, #4b697e 0%, #243e55 28%, #648394 48%, #294558 68%, #122638 100%);
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border-color: #c2f2ff;
  background: var(--platinum-surface);
  box-shadow: inset 0 1px #eeffff80, inset 0 -1px #5ca9c344, 0 0 1rem #94dcff35;
  color: #effdff;
  text-shadow: 0 1px 3px #00111c;
}
.platinum-launch-button:not(:disabled):hover,
.puzzle-stage-button[data-medal="platinum"]:hover {
  background: var(--platinum-surface);
  border-color: #f0ffff;
  box-shadow: inset 0 1px #fff9, 0 0 1.2rem #a7edff66;
  color: #fff;
}
.platinum-launch-button span,
.puzzle-stage-button[data-medal="platinum"] span,
.puzzle-stage-button[data-medal="platinum"] small { color: #d0f4ff; }
.platinum-launch-button:disabled {
  border-color: #52687b;
  background: linear-gradient(#1b2835, #0d1721);
  box-shadow: inset 0 1px #fff1;
  color: #aabac8;
  cursor: default;
}
.platinum-launch-button:disabled span { color: #92a5b7; }
.platinum-trophy {
  display: inline-block;
  width: 1em;
  height: 1em;
  fill: currentColor;
  stroke: none;
  vertical-align: -0.12em;
}
.platinum-launch-button .platinum-trophy { margin-right: 0.25em; }
.puzzle-stage-button .platinum-trophy { width: 1.2rem; height: 1.05rem; }
.puzzle-stage-button[data-medal="platinum"] span { min-height: 1.05rem; }
.puzzle-medal-indicator[data-medal="platinum"] { text-shadow: 0 1px 3px #00111c; }
.puzzle-stage-button[data-medal="platinum"]::after,
.puzzle-medal-indicator[data-medal="platinum"]::after {
  content: "";
  position: absolute;
  pointer-events: none;
  z-index: 1;
  inset: -35% -70%;
  background: linear-gradient(110deg, transparent 38%, #c5f4ff10 43%, #f4ffff7a 49%, #d4faff20 54%, transparent 60%);
  transform: translateX(-65%);
  opacity: 0;
  animation: platinum-shine 4.8s ease-in-out infinite;
}
/* startTime is shared in platinum-ui.ts; no stagger, including after remounts. */
@keyframes platinum-shine {
  0%, 12% { transform: translateX(-65%); opacity: 0; }
  20% { opacity: 0.8; }
  42% { opacity: 0.8; }
  52%, 100% { transform: translateX(65%); opacity: 0; }
}
.stage-tally[data-medal="platinum"] .puzzle-tally-stars,
.stage-tally[data-medal="platinum"] .puzzle-tally-medal { color: #d0f4ff; }
.stage-tally[data-medal="platinum"] .puzzle-tally-stars .platinum-trophy {
  width: 1.65rem;
  height: 1.65rem;
  filter: drop-shadow(0 0 0.35rem #9ee6ff88);
}
.platinum-run-label {
  margin: 0 0 0.25rem;
  color: #d0f4ff;
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-align: center;
  text-transform: uppercase;
}
.platinum-unlock-notice {
  margin: 0;
  padding: 0.55rem;
  border: 1px solid #c2f2ff80;
  border-radius: 0.6rem;
  background: linear-gradient(125deg, #4b697e66, #122638);
  color: #d0f4ff;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.035em;
  line-height: 1.4;
  text-shadow: 0 1px 2px #00111c, 0 0 0.6rem #9ee6ff44;
  text-align: center;
}
.game-hud .stage-score-indicator[data-target-rank="platinum"] {
  border-color: #b3efff;
  box-shadow: inset 0 1px #eeffff55, 0 0 0.75rem #9ee6ff28;
}
.game-hud .stage-score-indicator[data-target-rank="platinum"] span,
.game-hud .stage-score-indicator[data-target-rank="platinum"] strong { color: #d0f4ff; }
.game-hud .stage-score-indicator[data-target-rank="platinum"][data-last-orb="true"] {
  border-color: #ffd166;
  box-shadow: inset 0 1px #fff4, 0 0 0.9rem #ffd16666;
}
.game-hud .stage-score-indicator[data-target-rank="platinum"][data-last-orb="true"] strong {
  color: #ffd166;
}
@media (prefers-reduced-motion: reduce) {
  .platinum-launch-row > button { transition: none; }
  .puzzle-stage-button[data-medal="platinum"]::after,
  .puzzle-medal-indicator[data-medal="platinum"]::after { animation: none; opacity: 0; }
}
