:root {
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: #eefcff;
  background: #06161b;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  min-height: 100%;
}
body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: radial-gradient(
    circle at top,
    #153e48 0%,
    #07191f 58%,
    #041014 100%
  );
}
button {
  font: inherit;
}

.page-shell {
  width: 100%;
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.game-shell {
  position: relative;
  width: min(100vw, 430px);
  height: min(100vh, 860px);
  max-height: 100vh;
  overflow: hidden;
  isolation: isolate;
  background: #66b9ad;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.48);
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;

  /* D.14.1 — preserve hard pixel edges when the internal render buffer is
     enlarged to the responsive game canvas. */
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.hud {
  position: absolute;
  z-index: 3;
  inset: 18px 18px auto;
  display: grid;
  gap: 10px;
  pointer-events: none;
}

.score-block {
  width: fit-content;
  display: grid;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.28);
}

.score-block span,
.quality-copy span {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

#scoreText {
  font-size: 30px;
  line-height: 1;
  letter-spacing: -0.04em;
}

.quality-block {
  padding: 10px 12px 11px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  background: rgba(3, 31, 39, 0.38);
  backdrop-filter: blur(6px);
}

.quality-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.quality-copy strong {
  font-size: 12px;
}

.quality-track {
  height: 7px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.18);
}

.quality-fill {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #dcfff5, #54e6bd);
  transition: width 0.16s ease;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 10px;
  background: linear-gradient(
    180deg,
    rgba(2, 28, 36, 0.14),
    rgba(2, 19, 24, 0.84)
  );
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

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

.panel {
  width: 100%;
  padding: 28px 24px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 28px;
  background: linear-gradient(
    180deg,
    rgba(5, 47, 59, 0.92),
    rgba(3, 29, 37, 0.96)
  );
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(12px);
}

.drop {
  font-size: 50px;
}
.eyebrow {
  margin: 8px 0 12px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.16em;
  opacity: 0.72;
}

.start-panel h1 {
  margin: 0;
  font-size: clamp(46px, 14vw, 64px);
  line-height: 0.88;
  letter-spacing: -0.065em;
}

.start-panel h1 em {
  color: #91ffdd;
  font-style: normal;
}

.tagline {
  margin: 14px 0 8px;
  font-size: 19px;
  font-weight: 850;
}

.instructions {
  max-width: 320px;
  margin: 0 auto 22px;
  color: #d2eceb;
  font-size: 13px;
  line-height: 1.55;
}

.primary,
.secondary {
  width: 100%;
  min-height: 50px;
  border-radius: 16px;
  cursor: pointer;
  font-weight: 950;
  letter-spacing: 0.07em;
}

.primary {
  border: 0;
  color: #073127;
  background: linear-gradient(180deg, #adffe5, #59e5bb);
  box-shadow: 0 10px 28px rgba(62, 232, 181, 0.22);
}

.secondary {
  margin-top: 9px;
  color: #eefdfd;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
}

.primary:active,
.secondary:active {
  transform: scale(0.985);
}

.best {
  margin: 15px 0 0;
  font-size: 11px;
  letter-spacing: 0.13em;
  opacity: 0.78;
}

.controls {
  margin: 9px 0 0;
  color: #a8c7ca;
  font-size: 10px;
}

.result-panel h2 {
  margin: 0;
  font-size: 25px;
  letter-spacing: -0.03em;
}

.final-score {
  margin-top: 12px;
  color: #9fffe0;
  font-size: 56px;
  font-weight: 950;
  line-height: 0.95;
  letter-spacing: -0.06em;
}

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

.stats div {
  padding: 13px;
  text-align: left;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.07);
}

.stats span {
  display: block;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.09em;
  opacity: 0.62;
}

.stats strong {
  display: block;
  margin-top: 4px;
  font-size: 16px;
}

@media (min-width: 431px) {
  .game-shell {
    height: min(92vh, 860px);
    border-radius: 24px;
  }
}

/* Milestone A.5 — Intro & onboarding */
.hidden {
  opacity: 0;
  visibility: hidden;
}
.hud {
  transition: opacity 0.18s ease;
}
.brand {
  margin: 16px 0 0;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  opacity: 0.52;
}
.intro-panel h2 {
  margin: 0 0 12px;
  font-size: 31px;
  line-height: 1.02;
  letter-spacing: -0.045em;
}
.intro-icon {
  font-size: 52px;
  line-height: 1;
  margin-bottom: 6px;
}
.intro-copy {
  margin: 0 auto 20px;
  max-width: 315px;
  color: #d2eceb;
  font-size: 14px;
  line-height: 1.55;
}
.watershed-path {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 0 0 22px;
  padding: 13px 10px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.07);
  font-size: 21px;
}
.watershed-path span {
  font-size: 12px;
  opacity: 0.46;
}
.text-button {
  margin-top: 12px;
  padding: 8px 12px;
  border: 0;
  color: #a9c9cb;
  background: transparent;
  cursor: pointer;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
}
.compact-panel {
  padding-top: 24px;
}
.demo-meter {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  margin: 16px 0 18px;
}
.demo-fill {
  width: 100%;
}
.tutorial-prompt {
  position: absolute;
  z-index: 8;
  left: 18px;
  right: 18px;
  bottom: 24px;
  display: none;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 18px;
  text-align: center;
  background: rgba(3, 29, 37, 0.91);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  pointer-events: none;
}
.tutorial-prompt.visible {
  display: block;
}
.tutorial-prompt .eyebrow {
  margin: 0 0 4px;
}
.tutorial-prompt strong {
  display: block;
  font-size: 21px;
  letter-spacing: -0.025em;
}
.tutorial-prompt span {
  display: block;
  margin-top: 4px;
  color: #cce5e4;
  font-size: 12px;
}
.countdown-overlay {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: none;
  place-items: center;
  pointer-events: none;
  background: rgba(2, 24, 31, 0.12);
}
.countdown-overlay.visible {
  display: grid;
}
.countdown-overlay span {
  font-size: 94px;
  font-weight: 950;
  letter-spacing: -0.06em;
  color: #efffff;
  text-shadow: 0 12px 35px rgba(0, 0, 0, 0.32);
  animation: countPop 0.62s ease both;
}
@keyframes countPop {
  0% {
    opacity: 0;
    transform: scale(0.55);
  }
  35% {
    opacity: 1;
    transform: scale(1.08);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}
.how-list {
  display: grid;
  gap: 9px;
  margin: 18px 0 20px;
  text-align: left;
}
.how-list p {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 10px;
  align-items: center;
  margin: 0;
  padding: 10px 12px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.06);
}
.how-list b {
  text-align: center;
  font-size: 16px;
}
.how-list span {
  color: #d2eceb;
  font-size: 12px;
  line-height: 1.35;
}

/* Milestone B — Addictive gameplay */
.rush-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.streak-pill,
.power-pill {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(3, 31, 39, 0.42);
  backdrop-filter: blur(7px);
  transition:
    transform 0.15s ease,
    opacity 0.18s ease,
    background 0.18s ease;
}
.streak-pill span,
.power-pill strong {
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.11em;
}
.streak-pill strong {
  font-size: 16px;
}
.streak-pill.hot {
  transform: scale(1.05);
  background: rgba(22, 95, 82, 0.7);
}
.power-pill {
  margin-left: auto;
}
.hidden-pill {
  opacity: 0;
  transform: translateY(-4px);
}
.event-banner {
  position: absolute;
  z-index: 7;
  left: 50%;
  top: 105px;
  transform: translate(-50%, -14px);
  width: min(82%, 320px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  background: rgba(3, 29, 37, 0.88);
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(9px);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}
.event-banner.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
.event-banner > span {
  font-size: 24px;
}
.event-banner div {
  display: grid;
}
.event-banner strong {
  font-size: 12px;
  letter-spacing: 0.08em;
}
.event-banner small {
  margin-top: 2px;
  color: #cde4e3;
  font-size: 10px;
}
.pristine-banner {
  position: absolute;
  z-index: 6;
  left: 50%;
  top: 182px;
  transform: translate(-50%, -8px) scale(0.94);
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 13px;
  border-radius: 999px;
  background: rgba(226, 255, 247, 0.92);
  color: #075d4e;
  box-shadow: 0 12px 35px rgba(52, 239, 185, 0.24);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
  white-space: nowrap;
}
.pristine-banner.visible {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}
.pristine-banner strong {
  font-size: 12px;
  letter-spacing: 0.06em;
}
.pristine-banner small {
  font-size: 9px;
  font-weight: 900;
}
.audio-button {
  position: absolute;
  z-index: 12;
  right: 14px;
  bottom: 14px;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  color: #eefdfd;
  background: rgba(3, 29, 37, 0.52);
  backdrop-filter: blur(8px);
  cursor: pointer;
}
.game-shell.pristine {
  box-shadow:
    0 0 0 2px rgba(139, 255, 222, 0.18),
    0 28px 90px rgba(0, 0, 0, 0.48),
    0 0 52px rgba(94, 255, 205, 0.18);
}

/* Milestone C — Watershed identity */
.zone-row {
  display: flex;
  align-items: center;
  min-height: 30px;
}
.zone-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  background: rgba(3, 31, 39, 0.34);
  backdrop-filter: blur(7px);
}
.zone-pill span {
  font-size: 14px;
}
.zone-pill strong {
  font-size: 9px;
  font-weight: 950;
  letter-spacing: 0.11em;
}
.zone-banner {
  position: absolute;
  z-index: 8;
  left: 50%;
  top: 126px;
  transform: translate(-50%, -16px);
  width: min(84%, 326px);
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 15px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 18px;
  background: rgba(3, 29, 37, 0.92);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.22s ease,
    transform 0.22s ease;
}
.zone-banner.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
.zone-banner > span {
  font-size: 30px;
}
.zone-banner div {
  display: grid;
  text-align: left;
}
.zone-banner small {
  font-size: 8px;
  font-weight: 950;
  letter-spacing: 0.14em;
  opacity: 0.62;
}
.zone-banner strong {
  margin-top: 1px;
  font-size: 15px;
  letter-spacing: 0.045em;
}
.zone-banner em {
  margin-top: 2px;
  color: #cce9e5;
  font-size: 10px;
  font-style: normal;
}
.insight-card {
  margin: -2px 0 18px;
  padding: 14px 15px;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
}
.insight-card span {
  display: block;
  font-size: 8px;
  font-weight: 950;
  letter-spacing: 0.14em;
  opacity: 0.58;
}
.insight-card strong {
  display: block;
  margin-top: 5px;
  color: #a9ffe1;
  font-size: 14px;
}
.insight-card p {
  margin: 5px 0 0;
  color: #cde5e3;
  font-size: 11px;
  line-height: 1.45;
}
.result-panel {
  max-height: 94vh;
  overflow: auto;
}

/* Milestone D — retention/progression */
.menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 9px;
}
.secondary.mini {
  margin-top: 0;
  min-height: 44px;
  font-size: 10px;
  padding: 0 8px;
}
.currency-line {
  margin: 12px 0 0;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.1em;
  color: #cffff0;
}
.currency-line.big {
  font-size: 16px;
}
.zone-pill {
  justify-self: start;
  display: flex;
  gap: 7px;
  align-items: center;
  padding: 6px 9px;
  border-radius: 99px;
  background: rgba(3, 31, 39, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 9px;
  letter-spacing: 0.08em;
}
.zone-banner {
  top: 118px;
}
.zone-banner small:first-child {
  letter-spacing: 0.12em;
  opacity: 0.7;
}
.progression-panel {
  max-height: 90%;
  overflow: auto;
}
.progression-panel h2 {
  margin: 0 0 10px;
}
.restoration-list,
.achievement-list {
  display: grid;
  gap: 9px;
  margin: 16px 0;
  text-align: left;
}
.restore-card,
.achievement-card {
  padding: 13px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.055);
}
.restore-head,
.achievement-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.restore-head strong,
.achievement-head strong {
  font-size: 13px;
}
.restore-card p,
.achievement-card p {
  margin: 5px 0 9px;
  font-size: 11px;
  color: #c6e1df;
  line-height: 1.4;
}
.mini-track {
  height: 6px;
  border-radius: 99px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.12);
}
.mini-fill {
  height: 100%;
  background: linear-gradient(90deg, #8fffd8, #47d2a7);
}
.restore-button {
  margin-top: 9px;
  width: 100%;
  border: 0;
  border-radius: 11px;
  padding: 9px;
  font-weight: 900;
  color: #073127;
  background: #8fffd8;
}
.restore-button:disabled {
  opacity: 0.35;
}
.achievement-card.locked {
  opacity: 0.62;
}
.achievement-card.unlocked {
  border-color: rgba(143, 255, 216, 0.45);
}
.daily-goal {
  display: grid;
  margin: 16px 0;
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
}
.daily-goal span {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.15em;
  opacity: 0.7;
}
.daily-goal strong {
  font-size: 34px;
  color: #9fffe0;
}
.daily-status {
  min-height: 18px;
  font-size: 11px;
  color: #d4ebe9;
}
.insight-card {
  text-align: left;
  margin: 14px 0;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
}
.insight-card span {
  font-size: 9px;
  letter-spacing: 0.13em;
  font-weight: 900;
  opacity: 0.65;
}
.insight-card strong {
  display: block;
  margin-top: 5px;
  font-size: 12px;
}
.insight-card p {
  margin: 5px 0 0;
  font-size: 10px;
  line-height: 1.4;
  color: #cce3e2;
}
.achievement-toast {
  min-height: 0;
  margin: 8px 0;
  color: #fff5b6;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.5;
}

/* Milestone D.5 — visual polish + guardian selection */
.game-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    inset 0 -90px 130px rgba(3, 30, 34, 0.08);
}
.overlay {
  backdrop-filter: blur(8px);
  background: rgba(3, 22, 27, 0.48);
}
.panel {
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 24px 70px rgba(0, 18, 24, 0.38);
}
.redesigned-menu {
  width: min(92%, 390px);
  padding: 18px 18px 16px;
  border-radius: 30px;
  background: linear-gradient(
    180deg,
    rgba(7, 47, 57, 0.92),
    rgba(5, 31, 40, 0.96)
  );
}
.menu-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.creator-chip,
.drops-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 10px;
  letter-spacing: 0.12em;
  font-weight: 900;
}
.drops-chip {
  font-size: 12px;
  letter-spacing: 0;
}
.hero-mark {
  width: 92px;
  height: 92px;
  margin: 5px auto -2px;
  display: grid;
  place-items: center;
  position: relative;
}
.menu-character-icon {
  position: relative;
  z-index: 3;
  font-size: 54px;
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.25));
  animation: menuFloat 2.4s ease-in-out infinite;
}
.hero-ripple {
  position: absolute;
  border: 1px solid rgba(154, 246, 240, 0.2);
  border-radius: 50%;
  inset: 12px;
  animation: ripplePulse 2.5s ease-out infinite;
}
.ripple-two {
  inset: 0;
  animation-delay: 0.7s;
}
@keyframes menuFloat {
  50% {
    transform: translateY(-5px) scale(1.02);
  }
}
@keyframes ripplePulse {
  0% {
    transform: scale(0.7);
    opacity: 0.7;
  }
  100% {
    transform: scale(1.25);
    opacity: 0;
  }
}
.redesigned-menu h1 {
  font-size: clamp(42px, 11vw, 58px);
  line-height: 0.82;
  margin: 4px 0 8px;
  letter-spacing: -0.065em;
}
.redesigned-menu h1 em {
  color: #7cf1df;
  font-style: normal;
}
.redesigned-menu .tagline {
  margin: 0 auto 12px;
  max-width: 270px;
  color: #b7d9db;
  font-size: 13px;
}
.selected-runner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  text-align: left;
  padding: 9px 11px;
  margin: 0 0 10px;
  border-radius: 14px;
  background: rgba(134, 240, 222, 0.08);
  border: 1px solid rgba(134, 240, 222, 0.13);
}
.selected-runner span {
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.13em;
  color: #8ebbbd;
}
.selected-runner strong {
  font-size: 12px;
  letter-spacing: 0.08em;
}
.change-runner {
  border: 0;
  border-radius: 999px;
  padding: 6px 9px;
  background: #153f49;
  color: #bff8ee;
  font-weight: 900;
  font-size: 9px;
  cursor: pointer;
}
.play-hero {
  min-height: 52px;
  font-size: 15px;
  letter-spacing: 0.07em;
  box-shadow: 0 9px 28px rgba(83, 222, 194, 0.24);
}
.menu-stat-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 10px 0;
}
.menu-stat-row > div {
  padding: 9px 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.055);
  text-align: left;
}
.menu-stat-row span {
  display: block;
  color: #88adb1;
  font-size: 8px;
  letter-spacing: 0.12em;
  font-weight: 900;
}
.menu-stat-row strong {
  display: block;
  margin-top: 2px;
  font-size: 17px;
}
.feature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.feature-button {
  min-height: 60px;
  display: grid;
  grid-template-columns: 31px 1fr;
  gap: 8px;
  align-items: center;
  text-align: left;
  padding: 9px;
  cursor: pointer;
  color: #effeff;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.045);
  transition: 0.18s ease;
}
.feature-button:hover,
.feature-button:active {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.085);
}
.feature-icon {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(116, 234, 214, 0.12);
  font-weight: 1000;
  font-size: 17px;
}
.feature-button strong,
.feature-button small {
  display: block;
}
.feature-button strong {
  font-size: 10px;
}
.feature-button small {
  color: #87aeb1;
  font-size: 8px;
  margin-top: 2px;
  line-height: 1.25;
}
.footer-controls {
  margin: 10px 0 0 !important;
  font-size: 8px !important;
  opacity: 0.68;
}
.hud {
  margin: 10px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: linear-gradient(
    180deg,
    rgba(3, 36, 44, 0.86),
    rgba(3, 28, 35, 0.72)
  );
  box-shadow: 0 10px 26px rgba(0, 20, 24, 0.17);
  backdrop-filter: blur(10px);
}
.zone-pill,
.streak-pill,
.power-pill {
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(4, 39, 45, 0.7);
}
.result-panel,
.progression-panel,
.intro-panel {
  border-radius: 26px;
  background: linear-gradient(
    180deg,
    rgba(8, 53, 62, 0.96),
    rgba(5, 31, 39, 0.98)
  );
}
.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}
.section-heading h2 {
  margin-top: 2px;
}
.collection-count {
  flex: none;
  padding: 7px 9px;
  border-radius: 999px;
  background: rgba(120, 237, 218, 0.1);
  color: #a8f4e7;
  font-size: 10px;
  font-weight: 900;
}
.character-panel {
  max-height: 90%;
}
.character-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0;
  overflow: auto;
  padding: 2px;
}
.character-card {
  position: relative;
  min-height: 174px;
  border-radius: 20px;
  padding: 13px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(
    155deg,
    rgba(255, 255, 255, 0.08),
    rgba(255, 255, 255, 0.025)
  );
  text-align: left;
  color: #efffff;
  cursor: pointer;
  overflow: hidden;
}
.character-card.selected {
  border-color: #7af0dd;
  box-shadow:
    0 0 0 2px rgba(122, 240, 221, 0.16),
    0 12px 26px rgba(0, 0, 0, 0.16);
}
.character-card.locked {
  cursor: not-allowed;
  filter: saturate(0.55);
}
.character-card.locked::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(3, 21, 27, 0.36);
}
.character-avatar {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  margin: 0 auto 8px;
  border-radius: 50%;
  font-size: 39px;
  background: radial-gradient(
    circle at 35% 30%,
    rgba(255, 255, 255, 0.23),
    rgba(91, 224, 207, 0.08)
  );
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.character-card strong {
  display: block;
  text-align: center;
  font-size: 13px;
}
.character-card .char-title {
  display: block;
  text-align: center;
  color: #8ee6d8;
  font-size: 8px;
  letter-spacing: 0.1em;
  font-weight: 900;
  margin: 2px 0 7px;
}
.character-card p {
  margin: 0;
  text-align: center;
  color: #99b9bc;
  font-size: 9px;
  line-height: 1.35;
}
.character-lock {
  position: absolute;
  z-index: 3;
  inset: auto 9px 9px;
  border-radius: 9px;
  padding: 6px 7px;
  text-align: center;
  background: rgba(2, 18, 23, 0.88);
  color: #dbeeee;
  font-size: 8px;
  font-weight: 800;
}
.selected-badge {
  position: absolute;
  right: 8px;
  top: 8px;
  padding: 4px 6px;
  border-radius: 999px;
  background: #72ead8;
  color: #07323a;
  font-size: 7px;
  font-weight: 1000;
}
.unlock-note {
  padding: 10px;
  margin: 2px 0 12px;
  border-radius: 12px;
  background: rgba(255, 210, 101, 0.07);
  color: #d6cda8;
  font-size: 9px;
  line-height: 1.4;
}
@media (max-height: 760px) {
  .redesigned-menu {
    padding: 12px 14px;
  }
  .hero-mark {
    width: 70px;
    height: 70px;
  }
  .menu-character-icon {
    font-size: 43px;
  }
  .redesigned-menu h1 {
    font-size: 42px;
  }
  .feature-button {
    min-height: 52px;
  }
  .character-card {
    min-height: 150px;
  }
}

/* Milestone D.6 — in-game layout redesign */
.game-shell {
  border-radius: 28px;
  background: linear-gradient(180deg, #75c7bf 0%, #5bb7ae 100%);
}
.game-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(
      180deg,
      rgba(2, 23, 28, 0.28),
      rgba(2, 23, 28, 0) 22%,
      rgba(2, 23, 28, 0) 76%,
      rgba(2, 23, 28, 0.22)
    ),
    linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.08),
      transparent 16%,
      transparent 84%,
      rgba(0, 0, 0, 0.08)
    );
}
#gameCanvas {
  position: relative;
  z-index: 0;
}

.hud {
  inset: 10px 12px 10px;
  margin: 0;
  display: block;
  gap: 0;
  background: none;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
}
.hud-card {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(
    180deg,
    rgba(7, 42, 50, 0.9),
    rgba(5, 29, 36, 0.72)
  );
  box-shadow: 0 12px 30px rgba(0, 20, 26, 0.18);
  backdrop-filter: blur(10px);
}
.hud-top-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 8px;
}
.score-block {
  min-width: 108px;
  padding: 8px 11px;
  border-radius: 18px;
  text-align: right;
  align-self: start;
}
.score-block span,
.quality-copy span,
.pill-copy small,
.streak-pill span,
.power-pill span {
  display: block;
  font-size: 9px;
  line-height: 1;
  letter-spacing: 0.16em;
  font-weight: 900;
  color: #9fd0d4;
}
#scoreText {
  margin-top: 4px;
  font-size: 30px;
  line-height: 0.9;
}
.zone-pill {
  min-height: 56px;
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 8px;
  align-items: center;
  padding: 8px 11px;
  border-radius: 18px;
  justify-self: stretch;
}
.zone-pill > span {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  font-size: 18px;
  background: rgba(142, 241, 225, 0.12);
}
.pill-copy {
  display: grid;
  text-align: left;
  gap: 4px;
}
.zone-pill strong {
  font-size: 12px;
  letter-spacing: 0.08em;
}
.quality-block {
  margin-top: 7px;
  padding: 9px 12px 10px;
  border-radius: 18px;
}
.quality-copy strong {
  font-size: 18px;
  letter-spacing: -0.03em;
}
.quality-track {
  height: 8px;
  margin-top: 7px;
  background: rgba(255, 255, 255, 0.13);
}
.quality-fill {
  box-shadow: 0 0 18px rgba(95, 236, 183, 0.34);
}
.hud-bottom-row {
  position: absolute;
  left: 50%;
  bottom: 6px;
  transform: translateX(-50%);
  width: min(100%, 340px);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}
.streak-pill,
.power-pill {
  min-height: 52px;
  border-radius: 18px;
  padding: 10px 14px;
}
.streak-pill {
  justify-content: space-between;
}
.streak-pill strong {
  font-size: 24px;
  line-height: 1;
  letter-spacing: -0.04em;
}
.power-pill {
  min-width: 110px;
  justify-content: center;
}
.power-pill strong {
  font-size: 11px;
  line-height: 1.2;
  letter-spacing: 0.08em;
  text-align: center;
}
.hidden-pill {
  opacity: 0;
  transform: translateY(6px) scale(0.96);
}

.audio-button {
  top: 14px;
  right: 14px;
  bottom: auto;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(
    180deg,
    rgba(7, 42, 50, 0.92),
    rgba(5, 29, 36, 0.78)
  );
  box-shadow: 0 12px 24px rgba(0, 20, 26, 0.18);
}
.event-banner {
  top: 102px;
  width: min(78%, 292px);
  border-radius: 15px;
  padding: 8px 11px;
}
.zone-banner {
  top: 126px;
  width: min(86%, 334px);
}
.pristine-banner {
  top: 184px;
  padding: 11px 15px;
}
.pristine-banner strong {
  font-size: 13px;
}

.result-panel {
  max-height: 94vh;
}
.result-panel .stats {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.result-panel .stats div {
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.055);
}

@media (max-width: 430px) {
  .hud {
    inset: max(8px, env(safe-area-inset-top)) 10px 8px;
  }
  .hud-top-row {
    gap: 8px;
  }
  .score-block {
    min-width: 96px;
    padding: 7px 9px;
  }
  #scoreText {
    font-size: 27px;
  }
  .zone-pill {
    min-height: 52px;
    grid-template-columns: 30px 1fr;
    gap: 7px;
    padding: 7px 9px;
  }
  .zone-pill > span {
    width: 30px;
    height: 30px;
    font-size: 17px;
  }
  .zone-pill strong {
    font-size: 11px;
  }
  .quality-block {
    margin-top: 6px;
    padding: 8px 10px 9px;
  }
  .quality-copy strong {
    font-size: 16px;
  }
  .hud-bottom-row {
    width: calc(100% - 12px);
    bottom: 0;
    gap: 8px;
  }
  .streak-pill,
  .power-pill {
    min-height: 48px;
    padding: 9px 12px;
  }
  .streak-pill strong {
    font-size: 22px;
  }
  .power-pill {
    min-width: 98px;
  }
  .audio-button {
    width: 38px;
    height: 38px;
    right: 10px;
    top: 10px;
  }
  .event-banner {
    top: 94px;
  }
  .zone-banner {
    top: 118px;
  }
  .pristine-banner {
    top: 174px;
  }
}

@media (max-height: 760px) {
  .hud-bottom-row {
    bottom: 0;
  }
  .streak-pill,
  .power-pill {
    min-height: 44px;
  }
  .streak-pill strong {
    font-size: 20px;
  }
  .event-banner {
    top: 88px;
  }
  .zone-banner {
    top: 112px;
  }
  .pristine-banner {
    top: 166px;
  }
}


/* ============================================================
   D.14.7 — PIXEL HUD OVERHAUL
   Keeps all existing HUD IDs/JS behavior; presentation only.
   ============================================================ */

:root {
  --pixel-ink: #0a1720;
  --pixel-panel: #132836;
  --pixel-panel-light: #1d3b4a;
  --pixel-edge: #d4a56c;
  --pixel-edge-light: #f1d5a6;
  --pixel-cyan: #58d8e8;
  --pixel-mint: #74d69b;
  --pixel-gold: #f3c951;
  --pixel-danger: #ef6a45;
  --pixel-text: #f4fbf7;
  --pixel-muted: #a7c7ca;
}

/* Eliminate the glass/web-app appearance during gameplay. */
.hud,
.hud * {
  -webkit-font-smoothing: none;
}

.hud {
  inset: max(10px, env(safe-area-inset-top)) 12px 10px;
  font-family: "Courier New", ui-monospace, SFMono-Regular, Menlo, Consolas,
    monospace;
  text-transform: uppercase;
  pointer-events: none;
}

.hud-game-label {
  width: max-content;
  margin: 0 0 7px 3px;
  color: var(--pixel-text);
  text-shadow:
    2px 0 0 var(--pixel-ink),
    0 2px 0 var(--pixel-ink);
}

.hud-game-label span {
  display: block;
  font-size: 12px;
  line-height: 1;
  letter-spacing: 0.08em;
  font-weight: 900;
}

.hud-game-label small {
  display: block;
  margin-top: 3px;
  color: var(--pixel-cyan);
  font-size: 7px;
  line-height: 1;
  letter-spacing: 0.12em;
  font-weight: 900;
}

.hud-card {
  position: relative;
  border: 0;
  border-radius: 0;
  background: var(--pixel-panel);
  backdrop-filter: none;
  box-shadow:
    inset 0 0 0 2px #273e49,
    inset 0 0 0 4px var(--pixel-ink),
    0 0 0 2px var(--pixel-edge),
    0 0 0 4px var(--pixel-ink),
    4px 5px 0 rgba(0, 0, 0, 0.28);
}

/* Tiny square highlights create a hand-built game-panel feel. */
.hud-card::before,
.hud-card::after {
  content: "";
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--pixel-edge-light);
  pointer-events: none;
}

.hud-card::before {
  left: 3px;
  top: 3px;
}

.hud-card::after {
  right: 3px;
  bottom: 3px;
  background: #71563d;
}

.hud-top-row {
  gap: 10px;
}

.score-block,
.zone-pill,
.quality-block,
.streak-pill,
.power-pill {
  border-radius: 0;
}

.score-block {
  min-width: 100px;
  padding: 9px 10px 8px;
}

.score-block span,
.quality-copy span,
.pill-copy small,
.streak-pill span,
.power-pill span {
  color: var(--pixel-muted);
  font-family: inherit;
  font-size: 8px;
  line-height: 1;
  letter-spacing: 0.08em;
  font-weight: 900;
  text-shadow: 1px 1px 0 #09151b;
}

#scoreText {
  margin-top: 5px;
  color: var(--pixel-gold);
  font-family: inherit;
  font-size: 24px;
  line-height: 1;
  letter-spacing: 0;
  text-shadow:
    2px 0 0 #5c4522,
    0 2px 0 #5c4522;
}

.zone-pill {
  min-height: 54px;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  padding: 8px 10px;
}

.zone-pill > span {
  width: 26px;
  height: 26px;
  border-radius: 0;
  background: #1a4650;
  box-shadow:
    inset 0 0 0 2px #0a2028,
    0 0 0 2px #4e9fa5;
  font-size: 15px;
}

.pill-copy {
  gap: 4px;
}

.zone-pill strong {
  overflow: hidden;
  color: var(--pixel-text);
  font-family: inherit;
  font-size: 11px;
  line-height: 1.05;
  letter-spacing: 0.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 1px 1px 0 #09151b;
}

.quality-block {
  margin-top: 10px;
  padding: 9px 11px 11px;
}

.quality-copy {
  align-items: baseline;
}

.quality-copy strong {
  color: var(--pixel-cyan);
  font-family: inherit;
  font-size: 15px;
  line-height: 1;
  letter-spacing: 0;
  text-shadow: 1px 1px 0 #123f49;
}

.quality-track {
  position: relative;
  height: 12px;
  margin-top: 8px;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #07171e;
  box-shadow:
    inset 0 0 0 2px #09151b,
    0 0 0 2px #38505a;
}

/* Segment separators make the health bar look like a sprite HUD. */
.quality-track::after {
  content: "";
  position: absolute;
  inset: 2px;
  z-index: 2;
  pointer-events: none;
  background: repeating-linear-gradient(
    90deg,
    transparent 0 22px,
    rgba(6, 20, 25, 0.92) 22px 25px
  );
}

.quality-fill {
  height: 100%;
  border-radius: 0;
  background: linear-gradient(
    90deg,
    #39a8d0 0%,
    #55d8e4 44%,
    #75d195 70%,
    #b4ce55 100%
  );
  box-shadow: none;
}

.hud-bottom-row {
  bottom: 8px;
  width: min(100%, 326px);
  gap: 12px;
}

.streak-pill,
.power-pill {
  min-height: 48px;
  padding: 9px 12px;
}

.streak-pill {
  background: #142f3c;
}

.streak-pill strong {
  color: var(--pixel-cyan);
  font-family: inherit;
  font-size: 21px;
  line-height: 1;
  letter-spacing: 0;
  text-shadow:
    2px 0 0 #164652,
    0 2px 0 #164652;
}

.streak-pill.hot strong {
  color: var(--pixel-gold);
  text-shadow:
    2px 0 0 #6d4d20,
    0 2px 0 #6d4d20;
}

.power-pill {
  min-width: 106px;
  background: #293248;
}

.power-pill strong {
  color: #fff1a0;
  font-family: inherit;
  font-size: 9px;
  line-height: 1.1;
  letter-spacing: 0.03em;
  text-shadow: 1px 1px 0 #5e491b;
}

.hidden-pill {
  opacity: 0;
  transform: translateY(4px);
}

/* Pixel-style sound control. */
.audio-button {
  top: max(12px, env(safe-area-inset-top));
  right: 12px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 0;
  background: var(--pixel-panel);
  box-shadow:
    inset 0 0 0 2px #273e49,
    inset 0 0 0 4px var(--pixel-ink),
    0 0 0 2px var(--pixel-edge),
    0 0 0 4px var(--pixel-ink),
    4px 5px 0 rgba(0, 0, 0, 0.25);
  font-size: 17px;
}

/* Gameplay banners now match the HUD instead of glass cards. */
.event-banner,
.zone-banner,
.pristine-banner {
  border: 0;
  border-radius: 0;
  font-family: "Courier New", ui-monospace, SFMono-Regular, Menlo, Consolas,
    monospace;
  background: var(--pixel-panel);
  backdrop-filter: none;
  box-shadow:
    inset 0 0 0 2px #273e49,
    inset 0 0 0 4px var(--pixel-ink),
    0 0 0 2px var(--pixel-edge),
    0 0 0 4px var(--pixel-ink),
    4px 5px 0 rgba(0, 0, 0, 0.28);
}

.event-banner {
  top: 128px;
}

.zone-banner {
  top: 150px;
}

.pristine-banner {
  top: 205px;
}

.event-banner strong,
.zone-banner strong,
.pristine-banner strong {
  font-family: inherit;
  letter-spacing: 0.03em;
  text-shadow: 1px 1px 0 var(--pixel-ink);
}

/* No blur or rounded-glass treatment during pristine state. */
.game-shell.pristine .hud-card {
  box-shadow:
    inset 0 0 0 2px #35535a,
    inset 0 0 0 4px var(--pixel-ink),
    0 0 0 2px #f0d267,
    0 0 0 4px var(--pixel-ink),
    4px 5px 0 rgba(0, 0, 0, 0.28);
}

@media (max-width: 430px) {
  .hud {
    inset: max(9px, env(safe-area-inset-top)) 10px 8px;
  }

  .hud-game-label {
    margin-bottom: 6px;
  }

  .hud-game-label span {
    font-size: 11px;
  }

  .hud-game-label small {
    font-size: 6px;
  }

  .hud-top-row {
    gap: 9px;
  }

  .score-block {
    min-width: 86px;
    padding: 8px 8px 7px;
  }

  #scoreText {
    font-size: 21px;
  }

  .zone-pill {
    min-height: 50px;
    grid-template-columns: 25px minmax(0, 1fr);
    padding: 7px 8px;
  }

  .zone-pill > span {
    width: 24px;
    height: 24px;
    font-size: 14px;
  }

  .zone-pill strong {
    font-size: 10px;
  }

  .quality-block {
    margin-top: 9px;
    padding: 8px 10px 10px;
  }

  .quality-track {
    height: 11px;
  }

  .quality-track::after {
    background: repeating-linear-gradient(
      90deg,
      transparent 0 19px,
      rgba(6, 20, 25, 0.92) 19px 22px
    );
  }

  .hud-bottom-row {
    width: calc(100% - 14px);
    bottom: 4px;
    gap: 10px;
  }

  .streak-pill,
  .power-pill {
    min-height: 44px;
    padding: 8px 10px;
  }

  .streak-pill strong {
    font-size: 19px;
  }

  .power-pill {
    min-width: 96px;
  }

  .audio-button {
    width: 34px;
    height: 34px;
    right: 10px;
  }

  .event-banner {
    top: 120px;
  }

  .zone-banner {
    top: 142px;
  }

  .pristine-banner {
    top: 196px;
  }
}

@media (max-height: 760px) {
  .hud-game-label {
    display: none;
  }

  .quality-block {
    margin-top: 8px;
  }

  .hud-bottom-row {
    bottom: 3px;
  }

  .event-banner {
    top: 104px;
  }

  .zone-banner {
    top: 128px;
  }

  .pristine-banner {
    top: 180px;
  }
}


/* ============================================================
   D.15.1 — PAUSE SYSTEM
   ============================================================ */

.pause-button {
  position: absolute;
  z-index: 12;
  top: max(12px, env(safe-area-inset-top));
  right: 60px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 0;
  color: var(--pixel-text, #f4fbf7);
  background: var(--pixel-panel, #132836);
  box-shadow:
    inset 0 0 0 2px #273e49,
    inset 0 0 0 4px var(--pixel-ink, #0a1720),
    0 0 0 2px var(--pixel-edge, #d4a56c),
    0 0 0 4px var(--pixel-ink, #0a1720),
    4px 5px 0 rgba(0, 0, 0, 0.25);
  font-family: "Courier New", ui-monospace, SFMono-Regular, Menlo, Consolas,
    monospace;
  font-size: 13px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: -2px;
  cursor: pointer;
  transition:
    opacity 0.12s ease,
    transform 0.12s ease;
}

.pause-button:hover {
  transform: translateY(-1px);
}

.pause-button:active {
  transform: translate(2px, 2px);
  box-shadow:
    inset 0 0 0 2px #273e49,
    inset 0 0 0 4px var(--pixel-ink, #0a1720),
    0 0 0 2px var(--pixel-edge, #d4a56c),
    0 0 0 4px var(--pixel-ink, #0a1720),
    2px 3px 0 rgba(0, 0, 0, 0.25);
}

.pause-button.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.pause-overlay {
  z-index: 30;
  background: rgba(3, 18, 24, 0.82);
  transition: opacity 0.1s linear;
}

.pause-panel {
  width: min(88%, 330px);
  padding: 25px 22px 22px;
  border: 0;
  border-radius: 0;
  background: var(--pixel-panel, #132836);
  backdrop-filter: none;
  box-shadow:
    inset 0 0 0 2px #273e49,
    inset 0 0 0 5px var(--pixel-ink, #0a1720),
    0 0 0 2px var(--pixel-edge, #d4a56c),
    0 0 0 5px var(--pixel-ink, #0a1720),
    7px 8px 0 rgba(0, 0, 0, 0.35);
  font-family: "Courier New", ui-monospace, SFMono-Regular, Menlo, Consolas,
    monospace;
}

.pause-panel h2 {
  margin: 7px auto 11px;
  max-width: 260px;
  color: var(--pixel-text, #f4fbf7);
  font-family: inherit;
  font-size: 20px;
  line-height: 1.15;
  text-transform: uppercase;
  text-shadow: 2px 2px 0 #071217;
}

.pause-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  color: #10262f;
  background: var(--pixel-gold, #f3c951);
  box-shadow:
    inset 0 0 0 4px #f8de7d,
    0 0 0 4px #0a1720,
    4px 4px 0 #73552b;
  font-size: 19px;
  font-weight: 900;
  letter-spacing: -3px;
}

.pause-copy {
  margin: 0 auto 18px;
  max-width: 270px;
  color: var(--pixel-muted, #a7c7ca);
  font-family: inherit;
  font-size: 9px;
  line-height: 1.6;
  text-transform: uppercase;
}

.pause-primary,
.pause-secondary {
  width: 100%;
  min-height: 46px;
  border-radius: 0;
  font-family: inherit;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.pause-primary {
  margin-top: 2px;
}

.pause-secondary {
  margin-top: 10px;
  color: #d8eeee;
  background: #213744;
  border: 0;
  box-shadow:
    inset 0 0 0 2px #314e59,
    0 0 0 2px #0a1720,
    3px 4px 0 rgba(0, 0, 0, 0.25);
}

.pause-hint {
  display: block;
  margin-top: 17px;
  color: #78aeb5;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

@media (max-width: 430px) {
  .pause-button {
    top: max(12px, env(safe-area-inset-top));
    right: 54px;
    width: 34px;
    height: 34px;
    font-size: 12px;
  }

  .pause-panel {
    width: min(90%, 310px);
    padding: 23px 19px 20px;
  }

  .pause-panel h2 {
    font-size: 18px;
  }
}


/* ============================================================
   D.15.3 — PIXEL MENU + VISIBLE BACKDROPS
   ============================================================ */

.start-overlay {
  backdrop-filter: none;
  background:
    radial-gradient(circle at top center, rgba(74, 158, 189, 0.18), transparent 42%),
    rgba(3, 18, 24, 0.74);
}

.redesigned-menu {
  width: min(92%, 392px);
  padding: 18px 18px 16px;
  border: 0;
  border-radius: 0;
  background:
    linear-gradient(180deg, rgba(19, 43, 57, 0.97), rgba(9, 25, 34, 0.98));
  box-shadow:
    inset 0 0 0 2px #264350,
    inset 0 0 0 6px #0a1720,
    0 0 0 2px #7dd9ef,
    0 0 0 6px #071217,
    8px 10px 0 rgba(0, 0, 0, 0.32);
  font-family: "Courier New", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.redesigned-menu .eyebrow,
.redesigned-menu .tagline,
.redesigned-menu strong,
.redesigned-menu span,
.redesigned-menu small,
.redesigned-menu button {
  font-family: inherit;
}

.menu-topbar {
  margin-bottom: 10px;
}

.creator-chip,
.drops-chip {
  padding: 7px 10px;
  border-radius: 0;
  background: #203846;
  border: 0;
  color: #e7f7f5;
  box-shadow:
    inset 0 0 0 2px #2d4c5c,
    inset 0 0 0 4px #0a1720,
    0 0 0 2px #0a1720;
  letter-spacing: 0.1em;
}

.hero-mark {
  width: 96px;
  height: 96px;
  margin: 8px auto 2px;
  background: rgba(15, 42, 53, 0.72);
  box-shadow:
    inset 0 0 0 2px #1f4855,
    inset 0 0 0 6px #0a1720,
    0 0 0 2px #0a1720;
}

.menu-character-icon {
  font-size: 56px;
  filter: none;
  text-shadow: 3px 4px 0 rgba(0, 0, 0, 0.35);
  image-rendering: pixelated;
}

.hero-ripple {
  border: 2px solid rgba(122, 233, 240, 0.22);
  border-radius: 0;
  inset: 18px;
  animation: pixelRipplePulse 2s steps(4, end) infinite;
}

.ripple-two {
  inset: 6px;
  animation-delay: 0.6s;
}

@keyframes pixelRipplePulse {
  0% {
    transform: scale(0.78);
    opacity: 0.78;
  }
  100% {
    transform: scale(1.1);
    opacity: 0;
  }
}

.redesigned-menu h1 {
  font-size: clamp(44px, 11vw, 62px);
  line-height: 0.84;
  margin: 6px 0 8px;
  letter-spacing: -0.07em;
  text-transform: uppercase;
  text-shadow: 3px 3px 0 #071217;
}

.redesigned-menu h1 em {
  color: #7cf1df;
  text-shadow: 3px 3px 0 #082128;
}

.redesigned-menu .tagline {
  margin: 0 auto 14px;
  max-width: 285px;
  color: #bfe0df;
  font-size: 11px;
  line-height: 1.5;
  text-transform: uppercase;
}

.selected-runner {
  padding: 10px 11px;
  margin: 0 0 12px;
  border-radius: 0;
  border: 0;
  background: #133340;
  box-shadow:
    inset 0 0 0 2px #234a56,
    inset 0 0 0 4px #0a1720,
    0 0 0 2px #0a1720;
}

.selected-runner span,
.menu-stat-row span,
.feature-button small,
.footer-controls {
  text-transform: uppercase;
}

.change-runner {
  border: 0;
  border-radius: 0;
  padding: 6px 10px;
  background: #315567;
  color: #dbf8f0;
  box-shadow:
    inset 0 0 0 2px #456d80,
    0 0 0 2px #0a1720,
    2px 3px 0 rgba(0,0,0,.25);
}

.play-hero {
  min-height: 52px;
  border-radius: 0;
  font-size: 14px;
  text-transform: uppercase;
  box-shadow:
    inset 0 0 0 2px #b1fff1,
    0 0 0 2px #0a1720,
    4px 5px 0 rgba(0,0,0,.28);
}

.menu-stat-row > div,
.feature-button {
  border-radius: 0;
  border: 0;
  background: #173240;
  box-shadow:
    inset 0 0 0 2px #284d5b,
    inset 0 0 0 4px #0a1720,
    0 0 0 2px #0a1720;
}

.menu-stat-row strong {
  margin-top: 3px;
  font-size: 18px;
  color: #f4fbf7;
  text-shadow: 2px 2px 0 #071217;
}

.feature-grid {
  gap: 9px;
}

.feature-button {
  min-height: 64px;
  padding: 9px;
  transition: transform 0.08s steps(2, end);
}

.feature-button:hover,
.feature-button:active {
  transform: translate(-1px, -1px);
  background: #1b3948;
}

.feature-icon {
  border-radius: 0;
  background: #244858;
  box-shadow:
    inset 0 0 0 2px #356376,
    0 0 0 2px #0a1720;
}

.feature-button strong {
  font-size: 10px;
  text-transform: uppercase;
}

.footer-controls {
  color: #8db8bc;
  opacity: 1;
}

@media (max-width: 430px) {
  .redesigned-menu {
    width: min(92%, 364px);
    padding: 16px 15px 14px;
  }

  .redesigned-menu h1 {
    font-size: clamp(40px, 11vw, 56px);
  }
}


/* ============================================================
   D.15.4 — SPRITE REFRESH + PIXEL VESSEL SELECTION
   ============================================================ */
.pixel-selection-overlay {
  backdrop-filter: none;
  background:
    radial-gradient(circle at center top, rgba(80, 165, 191, 0.12), transparent 34%),
    rgba(3, 18, 24, 0.78);
}
.character-panel {
  width: min(92%, 395px);
  max-height: 92%;
  border-radius: 0;
  border: 0;
  background: linear-gradient(180deg, rgba(18,43,57,.98), rgba(8,24,33,.98));
  box-shadow: inset 0 0 0 2px #264350, inset 0 0 0 6px #0a1720, 0 0 0 2px #7dd9ef, 0 0 0 6px #071217, 8px 10px 0 rgba(0,0,0,.32);
  font-family: "Courier New", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.character-panel .eyebrow,
.character-panel h2,
.character-panel p,
.character-panel span,
.character-panel strong,
.character-panel button,
.character-panel small { font-family: inherit; }
.character-panel .section-heading { align-items: flex-start; margin-bottom: 6px; }
.character-panel h2 { text-transform: uppercase; letter-spacing: -0.03em; text-shadow: 2px 2px 0 #071217; }
.collection-count {
  border-radius: 0;
  background: #203846;
  color: #e7f7f5;
  box-shadow: inset 0 0 0 2px #2d4c5c, inset 0 0 0 4px #0a1720, 0 0 0 2px #0a1720;
}
.character-list { grid-template-columns: 1fr; gap: 9px; margin: 14px 0 12px; padding: 2px; }
.character-card {
  position: relative; min-height: 0; padding: 12px 12px 12px 110px; border-radius: 0; border: 0; background: #173240; color: #efffff; overflow: hidden;
  box-shadow: inset 0 0 0 2px #284d5b, inset 0 0 0 4px #0a1720, 0 0 0 2px #0a1720;
  transition: transform 0.08s steps(2,end), background 0.08s steps(2,end);
}
.character-card:hover,
.character-card:active { transform: translate(-1px,-1px); background: #1b3948; }
.character-card.selected { box-shadow: inset 0 0 0 2px #82f6e4, inset 0 0 0 4px #1f4957, 0 0 0 2px #0a1720, 4px 5px 0 rgba(0,0,0,.26); }
.character-card.locked { filter: none; opacity: 0.82; }
.character-card.locked::after { background: rgba(3,21,27,.26); }
.character-avatar {
  position: absolute; left: 14px; top: 12px; width: 82px; height: 82px; margin: 0; border-radius: 0; font-size: 42px; background: #244858; border: 0;
  box-shadow: inset 0 0 0 2px #356376, inset 0 0 0 4px #0a1720, 0 0 0 2px #0a1720;
}
.character-meta { display: flex; flex-direction: column; gap: 2px; text-align: left; }
.character-name-row { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.character-card strong { margin: 0; text-align: left; font-size: 15px; letter-spacing: 0.02em; }
.char-type-chip {
  display: inline-flex; align-items: center; padding: 3px 6px; background: #274756; color: #a8f4e7;
  box-shadow: inset 0 0 0 1px #356376, 0 0 0 1px #0a1720; font-size: 8px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.1em;
}
.character-card .char-title { margin: 0 0 6px; text-align: left; color: #8ee6d8; font-size: 8px; letter-spacing: 0.11em; }
.character-card p { margin: 0 0 7px; text-align: left; color: #b7d4d7; font-size: 9px; line-height: 1.45; }
.character-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.character-select {
  display: inline-flex; align-items: center; gap: 4px; padding: 5px 8px; background: #2e5667; color: #f0fffb;
  box-shadow: inset 0 0 0 1px #467688, 0 0 0 1px #0a1720; font-size: 8px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.1em;
}
.character-card.selected .character-select { background: #69e4d2; color: #0b2931; box-shadow: inset 0 0 0 1px #b1fff3, 0 0 0 1px #0a1720; }
.character-lock {
  position: static; inset: auto; border-radius: 0; padding: 5px 7px; text-align: left; background: #2a313f; color: #f2e6d7;
  box-shadow: inset 0 0 0 1px #514f5e, 0 0 0 1px #0a1720; font-size: 8px; font-weight: 800;
}
.selected-badge {
  position: absolute; right: 10px; top: 10px; padding: 4px 7px; border-radius: 0; background: #72ead8; color: #07323a; font-size: 7px; font-weight: 1000; box-shadow: 0 0 0 1px #0a1720;
}
.unlock-note { border-radius: 0; background: #2a2f2f; color: #e6d6a8; box-shadow: inset 0 0 0 2px #4f5247, 0 0 0 2px #0a1720; }
@media (max-height: 760px) {
  .character-avatar { width: 72px; height: 72px; font-size: 38px; }
  .character-card { padding-left: 98px; }
}


/* ============================================================
   D.15.4.1 — PIXEL FEATURE CARDS + OVERLAY POLISH
   ============================================================ */
.feature-button {
  grid-template-columns: 34px 1fr 14px;
  align-items: center;
  gap: 9px;
}
.feature-copy {
  display: grid;
  gap: 2px;
}
.feature-kicker {
  color: #7ce8d9 !important;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 7px !important;
}
.feature-chevron {
  justify-self: end;
  font-size: 16px;
  line-height: 1;
  color: #91f3e6;
  opacity: 0.92;
  text-shadow: 1px 1px 0 #071217;
}
.feature-daily .feature-icon { box-shadow: inset 0 0 0 2px #6b7496, 0 0 0 2px #0a1720; }
.feature-watershed .feature-icon { box-shadow: inset 0 0 0 2px #427e59, 0 0 0 2px #0a1720; }
.feature-achievements .feature-icon { box-shadow: inset 0 0 0 2px #8a6f32, 0 0 0 2px #0a1720; }
.feature-guide .feature-icon { box-shadow: inset 0 0 0 2px #466b86, 0 0 0 2px #0a1720; }

.pixel-modal {
  border-radius: 0;
  border: 0;
  background: linear-gradient(180deg, rgba(18,43,57,.98), rgba(8,24,33,.98));
  box-shadow:
    inset 0 0 0 2px #264350,
    inset 0 0 0 6px #0a1720,
    0 0 0 2px #7dd9ef,
    0 0 0 6px #071217,
    10px 12px 0 rgba(0,0,0,.34);
  font-family: "Courier New", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.pixel-modal .eyebrow,
.pixel-modal h2,
.pixel-modal p,
.pixel-modal span,
.pixel-modal strong,
.pixel-modal button,
.pixel-modal b,
.pixel-modal small,
.pixel-modal em { font-family: inherit; }
.pixel-modal h2 {
  text-transform: uppercase;
  letter-spacing: -0.03em;
  text-shadow: 2px 2px 0 #071217;
}
.pixel-modal .intro-copy {
  color: #bcd7d7;
}
.pixel-summary {
  display: grid;
  gap: 10px;
  margin: 14px 0 10px;
}
.pixel-summary.two-up {
  grid-template-columns: 1fr 1fr;
}
.pixel-summary > div {
  padding: 10px 11px;
  background: #173240;
  box-shadow: inset 0 0 0 2px #284d5b, inset 0 0 0 4px #0a1720, 0 0 0 2px #0a1720;
}
.pixel-summary.compact { grid-template-columns: 1fr; }
.pixel-summary span {
  display: block;
  color: #8ee6d8;
  font-size: 8px;
  letter-spacing: 0.12em;
  margin-bottom: 3px;
}
.pixel-summary strong {
  display: block;
  font-size: 16px;
  color: #f4fbf7;
  text-shadow: 2px 2px 0 #071217;
}
.helper-note {
  background: #152d3a;
  box-shadow: inset 0 0 0 2px #244555, inset 0 0 0 4px #0a1720;
  padding: 10px 11px;
  margin-top: 4px;
}
.how-list {
  gap: 10px;
}
.how-list p {
  border-radius: 0;
  background: #173240;
  box-shadow: inset 0 0 0 2px #284d5b, inset 0 0 0 4px #0a1720, 0 0 0 2px #0a1720;
  padding: 12px;
}
.how-list b {
  color: #8af5e5;
  min-width: 68px;
}
.restoration-list,
.achievement-list {
  gap: 10px;
}
.restore-card,
.achievement-card {
  border-radius: 0;
  border: 0;
  background: #173240;
  box-shadow: inset 0 0 0 2px #284d5b, inset 0 0 0 4px #0a1720, 0 0 0 2px #0a1720;
}
.restore-head strong,
.achievement-head strong {
  font-size: 12px;
  text-transform: uppercase;
}
.restore-head span,
.achievement-head span {
  color: #8ee6d8;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.12em;
}
.restore-card p,
.achievement-card p {
  color: #c5dcdd;
  font-size: 10px;
}
.mini-track {
  border-radius: 0;
  background: #0e2028;
  box-shadow: inset 0 0 0 1px #2c4a59;
}
.restore-meta,
.achievement-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 7px;
  color: #9ac8c8;
  font-size: 8px;
  letter-spacing: 0.06em;
}
.restore-button {
  border-radius: 0;
  padding: 10px 9px;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.18), 0 0 0 2px #0a1720;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.restore-button:disabled {
  opacity: 0.45;
  color: #c9d7d8;
  background: #34515c;
}
.achievement-card.unlocked {
  box-shadow: inset 0 0 0 2px #7ce8d9, inset 0 0 0 4px #1c4654, 0 0 0 2px #0a1720;
}
.achievement-card.locked {
  opacity: 1;
}
.achievement-card.locked .achievement-head span {
  color: #d9b78c;
}
.daily-goal,
.daily-reward-box {
  margin: 0;
  border-radius: 0;
  background: #173240;
  box-shadow: inset 0 0 0 2px #284d5b, inset 0 0 0 4px #0a1720, 0 0 0 2px #0a1720;
  padding: 12px;
}
.daily-reward-box em {
  font-style: normal;
  color: #9fffe0;
}
.daily-status {
  min-height: 20px;
  margin: 12px 0 14px;
  padding: 10px 11px;
  background: #152d3a;
  box-shadow: inset 0 0 0 2px #244555, inset 0 0 0 4px #0a1720;
  color: #d1ece7;
}
.daily-status.ready {
  color: #9fffe0;
}
.daily-status.claimed {
  color: #f0d5a4;
}
@media (max-width: 430px) {
  .pixel-summary.two-up {
    grid-template-columns: 1fr;
  }
}


/* ============================================================
   D.15.5 — Pixel Countdown + Art Upgrade
   ============================================================ */
.countdown-overlay {
  background: rgba(3, 18, 24, 0.26);
}
.countdown-overlay span {
  font-family: "Courier New", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 72px;
  line-height: 1;
  letter-spacing: 0.05em;
  padding: 18px 22px 14px;
  color: #f2fffb;
  background: linear-gradient(180deg, rgba(22,59,72,.96), rgba(9,24,32,.96));
  box-shadow:
    inset 0 0 0 2px #2c5564,
    inset 0 0 0 6px #08161d,
    0 0 0 2px #8fe6ea,
    0 0 0 6px #061116,
    10px 10px 0 rgba(0,0,0,.30);
  border-radius: 0;
  text-shadow: 3px 3px 0 #071217;
}


/* ============================================================
   D.15.6.1 — PIXEL RESULT PANEL
   ============================================================ */
.result-panel.pixel-modal {
  max-width: min(92vw, 380px);
  max-height: 94vh;
  overflow: auto;
}
.pixel-result-top {
  margin-top: 10px;
  padding: 12px 14px;
  background: #173240;
  box-shadow: inset 0 0 0 2px #284d5b, inset 0 0 0 4px #0a1720, 0 0 0 2px #0a1720;
}
.result-panel.pixel-modal h2 {
  font-size: 27px;
  margin: 0;
}
.result-panel .final-score {
  margin-top: 0;
  font-size: 52px;
  color: #9fffe0;
  text-shadow: 3px 3px 0 #071217;
}
.result-panel .best {
  margin: 8px 0 0;
  opacity: 1;
  color: #cfeae3;
  letter-spacing: 0.12em;
}
.result-summary {
  margin-top: 12px;
}
.pixel-insight-card {
  margin: 12px 0 16px;
  border-radius: 0;
  border: 0;
  background: #152d3a;
  box-shadow: inset 0 0 0 2px #244555, inset 0 0 0 4px #0a1720, 0 0 0 2px #0a1720;
}
.pixel-insight-card span {
  color: #8ee6d8;
  opacity: 1;
}
.pixel-insight-card strong {
  color: #f2fffb;
  text-shadow: 2px 2px 0 #071217;
}
.pixel-insight-card p {
  color: #c5dcdd;
}
.pixel-stats-grid {
  gap: 8px;
  margin: 14px 0;
}
.result-panel .pixel-stats-grid div {
  border-radius: 0;
  border: 0;
  padding: 11px 12px;
  background: #173240;
  box-shadow: inset 0 0 0 2px #284d5b, inset 0 0 0 4px #0a1720, 0 0 0 2px #0a1720;
}
.result-panel .pixel-stats-grid span {
  color: #8ee6d8;
  font-size: 8px;
  letter-spacing: 0.12em;
  opacity: 1;
}
.result-panel .pixel-stats-grid strong {
  color: #f4fbf7;
  font-size: 15px;
  text-shadow: 2px 2px 0 #071217;
}
.pixel-achievement-toast {
  border-radius: 0;
  border: 0;
  background: #152d3a;
  box-shadow: inset 0 0 0 2px #244555, inset 0 0 0 4px #0a1720, 0 0 0 2px #0a1720;
  color: #d9f4ef;
}
.result-actions {
  margin-top: 4px;
}
.result-actions .primary,
.result-actions .secondary {
  margin-top: 0;
}


/* ============================================================
   D.15.6.2 — RESPONSIVE DESKTOP + PIXEL INTRO PASS
   ============================================================ */
.game-shell[data-layout="desktop"] {
  width: min(96vw, 1180px);
  height: min(92vh, 760px);
  max-height: 760px;
}
.game-shell[data-layout="desktop"] .overlay {
  padding: 20px 28px;
}
.game-shell[data-layout="desktop"] .start-panel,
.game-shell[data-layout="desktop"] .progression-panel,
.game-shell[data-layout="desktop"] .result-panel.pixel-modal,
.game-shell[data-layout="desktop"] .intro-panel.pixel-modal {
  max-width: min(92vw, 880px);
}
.game-shell[data-layout="desktop"] .redesigned-menu {
  max-width: min(92vw, 920px);
}
.game-shell[data-layout="desktop"] .menu-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.game-shell[data-layout="desktop"] .hud {
  inset: 18px 22px auto;
}
.game-shell[data-layout="desktop"] .panel {
  padding: 28px 30px;
}

.hud-bottom-row {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 10px;
}
.streak-pill {
  width: 100%;
  justify-content: space-between;
  text-align: left;
}
.streak-pill strong {
  margin-left: auto;
}
.power-pill {
  min-width: 108px;
  justify-content: center;
}

.intro-story-panel {
  max-width: min(92vw, 440px);
}
.intro-story-panel .intro-icon {
  border-radius: 0;
  box-shadow: inset 0 0 0 2px #244555, inset 0 0 0 4px #0a1720, 0 0 0 2px #0a1720;
  background: #16313f;
}
.intro-story-panel .watershed-path {
  margin: 18px auto 16px;
  gap: 8px;
  padding: 12px 10px;
  border-radius: 0;
  background: #173240;
  box-shadow: inset 0 0 0 2px #284d5b, inset 0 0 0 4px #0a1720, 0 0 0 2px #0a1720;
  color: #e3fbf2;
}
.intro-story-panel .watershed-path span {
  color: #8fe6ea;
}
.intro-story-panel .text-button {
  color: #9fe8ee;
}

@media (min-width: 900px) and (min-height: 680px) {
  .page-shell {
    padding: 14px;
  }
  .game-shell {
    width: min(96vw, 1180px);
    height: min(92vh, 760px);
    max-height: 760px;
  }
}


/* D.15.6.3 — True Desktop World Layout */

.game-shell[data-layout="desktop"] {
  width: min(1280px, calc(100vw - 48px));
  min-height: min(820px, calc(100vh - 48px));
}

.game-shell[data-layout="desktop"] #gameCanvas {
  aspect-ratio: 4 / 3;
  width: 100%;
  height: auto;
  max-height: min(820px, calc(100vh - 48px));
}

.game-shell[data-layout="desktop"] .hud {
  left: 18px;
  right: 18px;
  top: 14px;
  gap: 8px;
}

.game-shell[data-layout="desktop"] .hud-game-label {
  font-size: 13px;
  margin-bottom: 2px;
}

.game-shell[data-layout="desktop"] .hud-top-row {
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 8px;
}

.game-shell[data-layout="desktop"] .hud-card,
.game-shell[data-layout="desktop"] .quality-block {
  padding-top: 10px;
  padding-bottom: 10px;
}

.game-shell[data-layout="desktop"] .quality-block {
  margin-top: 0;
}

.game-shell[data-layout="desktop"] .hud-bottom-row {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18px;
  margin: 0;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
}

.game-shell[data-layout="desktop"] .streak-pill {
  width: 100%;
  justify-content: space-between;
  min-height: 56px;
}

.game-shell[data-layout="desktop"] .power-pill.hidden-pill {
  display: none;
}

.game-shell[data-layout="desktop"] .countdown-box {
  min-width: 150px;
  min-height: 150px;
}


/* ============================================================
   D.15.6.3 HOTFIX — Desktop FLOW placement + game-over crash
   ============================================================ */

/* The desktop HUD must span from the top HUD to the bottom edge so the
   absolutely-positioned FLOW row is anchored to the game shell instead
   of the top HUD content box. */
.game-shell[data-layout="desktop"] .hud {
  top: 14px;
  right: 18px;
  bottom: 18px;
  left: 18px;
}

/* FLOW is always the full-width bottom gameplay bar on desktop. */
.game-shell[data-layout="desktop"] .hud-bottom-row {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  display: block;
  margin: 0;
}

.game-shell[data-layout="desktop"] .streak-pill {
  width: 100%;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Keep an active power-up visible without reducing the width of FLOW. */
.game-shell[data-layout="desktop"] .hud-bottom-row .power-pill {
  position: absolute;
  right: 10px;
  bottom: calc(100% + 8px);
  min-width: 108px;
  width: auto;
}

.game-shell[data-layout="desktop"] .hud-bottom-row .power-pill.hidden-pill {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}


/* ============================================================
   D.15.6.4 — Desktop Hazard Legend
   ============================================================ */
.hazard-legend {
  display: none;
}

.hazard-legend-heading {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 8px;
}

.hazard-legend-heading span {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--pixel-text);
}

.hazard-legend-heading small {
  font-size: 8px;
  letter-spacing: 0.14em;
  color: var(--pixel-cyan);
}

.hazard-legend-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.legend-item img {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  image-rendering: pixelated;
}

.legend-item span {
  font-size: 8px;
  line-height: 1.2;
  color: var(--pixel-text);
  letter-spacing: 0.08em;
}

.game-shell[data-layout="desktop"] .hazard-legend {
  display: block;
  position: absolute;
  right: 18px;
  top: 178px;
  width: 208px;
  z-index: 4;
  padding: 12px 12px 10px;
}

.game-shell[data-layout="desktop"] .hazard-legend-grid {
  grid-template-columns: 1fr;
}

.game-shell[data-layout="desktop"] .legend-item {
  gap: 8px;
}

.game-shell[data-layout="desktop"] .legend-item img {
  width: 22px;
  height: 22px;
  flex-basis: 22px;
}

.game-shell[data-layout="desktop"] .legend-item span {
  font-size: 9px;
}

@media (min-width: 1200px) {
  .game-shell[data-layout="desktop"] .hazard-legend {
    width: 222px;
  }
}


/* ============================================================
   D.15.6.5 — Mobile Mini Legend
   ============================================================ */
.mini-legend-button {
  position: absolute;
  top: 92px;
  right: 14px;
  z-index: 6;
  width: 38px;
  height: 38px;
  border: none;
  cursor: pointer;
  color: var(--pixel-text, #f4fbf7);
  background: var(--pixel-panel, #132836);
  font-size: 18px;
  line-height: 1;
  padding: 0;
  box-shadow:
    inset 0 0 0 4px var(--pixel-ink, #0a1720),
    0 0 0 2px var(--pixel-edge, #d4a56c),
    0 0 0 4px var(--pixel-ink, #0a1720),
    0 6px 0 rgba(0, 0, 0, 0.18);
}

.mini-legend-button.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

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

.mini-legend-panel {
  max-width: 320px;
}

.mini-legend-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
  width: 100%;
  margin: 8px 0 14px;
}

.mini-legend-grid .legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.mini-legend-grid .legend-item img {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  image-rendering: pixelated;
}

.mini-legend-grid .legend-item span {
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--pixel-text, #f4fbf7);
  line-height: 1.25;
}

.game-shell[data-layout="desktop"] .mini-legend-button,
.game-shell[data-layout="desktop"] #miniLegendOverlay {
  display: none !important;
}

@media (max-width: 430px) {
  .mini-legend-panel {
    width: min(90vw, 336px);
  }

  .mini-legend-grid {
    grid-template-columns: 1fr;
  }
}


/* ============================================================
   D.15.6.6 — Mobile Browser Viewport Fit
   Prevents the bottom of the game from sitting behind mobile browser chrome.
   ============================================================ */

:root {
  --app-height: 100dvh;
}

html,
body {
  width: 100%;
  height: var(--app-height, 100dvh);
  min-height: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  min-height: var(--app-height, 100dvh);
}

.page-shell {
  width: 100%;
  height: var(--app-height, 100dvh);
  min-height: 0;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Phone/tablet mode must fit inside the currently VISIBLE viewport rather
   than the layout viewport reported by legacy 100vh. */
.game-shell:not([data-layout="desktop"]) {
  width: min(100vw, 430px);
  height: calc(
    var(--app-height, 100dvh) - env(safe-area-inset-top, 0px) -
      env(safe-area-inset-bottom, 0px)
  );
  max-height: calc(
    var(--app-height, 100dvh) - env(safe-area-inset-top, 0px) -
      env(safe-area-inset-bottom, 0px)
  );
  min-height: 0;
}

.game-shell:not([data-layout="desktop"]) #gameCanvas {
  width: 100%;
  height: 100%;
}

/* Keep bottom gameplay controls clear of the rounded shell edge while still
   allowing the whole game to shrink when browser controls are visible. */
.game-shell:not([data-layout="desktop"]) .hud {
  bottom: 10px;
}

.game-shell:not([data-layout="desktop"]) .hud-bottom-row {
  bottom: 0;
}

/* Modal screens also use the currently visible height, so BACK / PLAY buttons
   cannot be pushed underneath the phone browser toolbar. */
.game-shell:not([data-layout="desktop"]) .panel,
.game-shell:not([data-layout="desktop"]) .result-panel.pixel-modal,
.game-shell:not([data-layout="desktop"]) .character-panel {
  max-height: calc(
    var(--app-height, 100dvh) - env(safe-area-inset-top, 0px) -
      env(safe-area-inset-bottom, 0px) - 20px
  );
  overflow-y: auto;
  overscroll-behavior: contain;
}

@supports (height: 100svh) {
  :root {
    --mobile-fallback-height: 100svh;
  }
}


/* ============================================================
   D.15.6.8 — Online Leaderboard
   ============================================================ */
.feature-leaderboard {
  grid-column: 1 / -1;
}
.feature-leaderboard .feature-icon {
  box-shadow: inset 0 0 0 2px #8c7434, 0 0 0 2px #0a1720;
}

.leaderboard-panel {
  width: min(92%, 430px);
  max-height: 92%;
  overflow-y: auto;
}

.leaderboard-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.pixel-mini-button {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border: 0;
  border-radius: 0;
  cursor: pointer;
  color: #f4fbf7;
  background: #274756;
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 18px;
  font-weight: 900;
  box-shadow: inset 0 0 0 2px #356376, 0 0 0 2px #0a1720;
}

.leaderboard-copy {
  margin-top: 8px;
}

.leaderboard-summary {
  margin-bottom: 14px;
}

.leaderboard-table-head,
.leaderboard-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 88px;
  align-items: center;
  gap: 8px;
}

.leaderboard-table-head {
  padding: 7px 9px;
  color: #80dcd2;
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.leaderboard-table-head span:last-child,
.leaderboard-row .leaderboard-score {
  text-align: right;
}

.leaderboard-list {
  display: grid;
  gap: 7px;
  min-height: 118px;
}

.leaderboard-row {
  padding: 10px 9px;
  background: #173240;
  color: #f4fbf7;
  box-shadow: inset 0 0 0 2px #284d5b, inset 0 0 0 4px #0a1720, 0 0 0 2px #0a1720;
  font-family: "Courier New", ui-monospace, monospace;
}

.leaderboard-row.is-me {
  box-shadow: inset 0 0 0 2px #8df4e3, inset 0 0 0 4px #1e4d56, 0 0 0 2px #0a1720;
}

.leaderboard-rank {
  color: #f0c95f;
  font-size: 11px;
  font-weight: 900;
}

.leaderboard-player {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.03em;
}

.leaderboard-score {
  color: #a5fae6;
  font-size: 11px;
  font-weight: 900;
}

.leaderboard-status {
  margin: 12px 0 14px;
  color: #91b9bd;
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 9px;
  line-height: 1.45;
  text-align: center;
}

.leaderboard-status.error,
.leaderboard-submit-status.error {
  color: #ffb59d;
}

.leaderboard-status.success,
.leaderboard-submit-status.success {
  color: #9fffe0;
}

.leaderboard-submit-card {
  margin: 13px 0;
  padding: 12px;
  background: #152d3a;
  box-shadow: inset 0 0 0 2px #244555, inset 0 0 0 4px #0a1720, 0 0 0 2px #0a1720;
  font-family: "Courier New", ui-monospace, monospace;
}

.leaderboard-submit-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.leaderboard-submit-heading span {
  color: #f0c95f;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.leaderboard-submit-heading small {
  color: #8eb5ba;
  font-size: 8px;
}

.leaderboard-name-label {
  display: block;
  margin-bottom: 5px;
  color: #86ded4;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.leaderboard-submit-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.leaderboard-name-input {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 8px 10px;
  border: 0;
  border-radius: 0;
  outline: none;
  color: #f4fbf7;
  background: #0e222c;
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 11px;
  font-weight: 900;
  box-shadow: inset 0 0 0 2px #2b505c, 0 0 0 2px #0a1720;
}

.leaderboard-name-input:focus {
  box-shadow: inset 0 0 0 2px #8df4e3, 0 0 0 2px #0a1720;
}

.leaderboard-submit-button {
  min-height: 40px;
  padding: 8px 10px;
  border: 0;
  border-radius: 0;
  cursor: pointer;
  color: #092a31;
  background: #72ead8;
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 9px;
  font-weight: 1000;
  box-shadow: inset 0 0 0 2px #b6fff4, 0 0 0 2px #0a1720, 3px 3px 0 rgba(0,0,0,.25);
}

.leaderboard-submit-button:disabled {
  opacity: 0.48;
  cursor: wait;
}

.leaderboard-submit-status {
  margin: 9px 0 3px;
  min-height: 13px;
  color: #94babe;
  font-size: 8px;
  line-height: 1.4;
}

.leaderboard-view-button {
  margin-top: 5px;
  color: #9aece2;
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.game-shell[data-layout="desktop"] .leaderboard-panel {
  width: min(92%, 640px);
  max-width: 640px;
}

@media (max-width: 430px) {
  .leaderboard-submit-row {
    grid-template-columns: 1fr;
  }
  .leaderboard-submit-button {
    width: 100%;
  }
  .leaderboard-table-head,
  .leaderboard-row {
    grid-template-columns: 42px minmax(0, 1fr) 76px;
  }
}


/* ============================================================
   D.15.6.8.2 — Pause / Audio Control Spacing
   Keep the top-right controls out of the score card.
   ============================================================ */

/* Reserve a dedicated control rail at the right side of the top HUD row. */
.game-shell[data-layout="desktop"] .hud-top-row {
  margin-right: 108px;
}

.game-shell[data-layout="desktop"] .pause-button {
  top: 18px;
  right: 62px;
}

.game-shell[data-layout="desktop"] .audio-button {
  top: 18px;
  right: 16px;
}

/* On phones the score card is narrower, so reserve just enough room for
   the two compact controls instead of letting them cover the score. */
.game-shell[data-layout="mobile"] .hud-top-row {
  margin-right: 92px;
}

.game-shell[data-layout="mobile"] .pause-button {
  top: max(12px, env(safe-area-inset-top));
  right: 54px;
  width: 34px;
  height: 34px;
}

.game-shell[data-layout="mobile"] .audio-button {
  top: max(12px, env(safe-area-inset-top));
  right: 10px;
  width: 34px;
  height: 34px;
}

/* Prevent the right control rail from squeezing the zone label too tightly. */
.game-shell[data-layout="mobile"] .zone-pill {
  min-width: 0;
}

.game-shell[data-layout="mobile"] .zone-pill .pill-copy {
  min-width: 0;
}

.game-shell[data-layout="mobile"] .zone-pill strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
