:root {
  --bg: #f7f4ed;
  --ink: #151515;
  --soft: rgba(21, 21, 21, 0.08);
  --line: rgba(21, 21, 21, 0.16);
  --lane: rgba(21, 21, 21, 0.04);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

button {
  font: inherit;
}

.shell {
  width: min(1500px, 100%);
  display: grid;
  place-items: center;
}

.layout {
  display: grid;
  width: 100%;
  max-width: 1420px;
  grid-template-columns: minmax(220px, 280px) minmax(680px, 1fr) minmax(220px, 280px);
  gap: 18px;
  align-items: stretch;
}

.game-column {
  display: grid;
  gap: 14px;
  width: 100%;
}

.scoreboard,
.upgrades {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.22);
  box-shadow: 0 12px 30px rgba(21, 21, 21, 0.04);
  justify-self: center;
}

.scoreboard-head {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
}

.scoreboard-head-copy {
  display: grid;
  gap: 4px;
}

.scoreboard-body,
.upgrades-body {
  display: grid;
  gap: 10px;
}

.mobile-panel-toggle {
  display: none;
}

.scoreboard-sub {
  font-size: 0.88rem;
  opacity: 0.62;
}

.scoreboard-status {
  min-height: 1.2rem;
  margin-bottom: 10px;
  font-size: 0.84rem;
  opacity: 0.62;
}

.scoreboard-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.upgrades {
  display: grid;
  align-content: start;
}

.upgrades-head {
  margin-bottom: 8px;
}

.upgrade-points {
  font-size: 0.86rem;
  opacity: 0.74;
  margin-bottom: 10px;
}

.upgrade-list {
  display: grid;
  gap: 8px;
  max-height: min(56vh, 30rem);
  overflow-y: auto;
  scrollbar-width: thin;
  padding-right: 3px;
}

.upgrade-item {
  border: 1px solid rgba(21, 21, 21, 0.1);
  border-radius: 14px;
  padding: 8px 9px 9px;
  background: rgba(255, 255, 255, 0.25);
}

.upgrade-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-weight: 600;
}

.upgrade-level {
  font-size: 0.82rem;
  opacity: 0.68;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.upgrade-item p {
  margin: 6px 0 8px;
  font-size: 0.8rem;
  opacity: 0.7;
  line-height: 1.35;
}

.upgrade-button {
  margin-top: 0;
  min-width: 0;
  width: 100%;
  border-radius: 12px;
  padding: 0.48rem 0.68rem;
  font-size: 0.9rem;
}

.upgrade-status {
  min-height: 1.2rem;
  margin-top: 10px;
  font-size: 0.82rem;
  opacity: 0.68;
}

.score-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(21, 21, 21, 0.08);
}

.score-row:last-child {
  border-bottom: 0;
}

.score-name {
  font-weight: 600;
}

.score-value {
  opacity: 0.72;
}

.hud {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  padding: 0 4px;
}

.hud-group {
  display: flex;
  align-items: flex-end;
}

.hud-group-primary {
  min-width: 0;
  display: grid;
  align-items: end;
  justify-items: start;
}

.hud-group-progression {
  margin-left: auto;
  display: grid;
  grid-template-columns: repeat(5, auto);
  gap: 10px;
  text-align: right;
}

.hud-item {
  min-width: 72px;
}

.hud-item-perk {
  min-width: 132px;
}

.label {
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.6;
  line-height: 1;
}

.value {
  margin-top: 4px;
  font-size: clamp(1.3rem, 3vw, 1.9rem);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.value-compact {
  font-size: clamp(0.94rem, 1.5vw, 1.2rem);
}

.game-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 700px;
  max-height: 92vh;
  border: 1px solid var(--line);
  border-radius: 28px;
  overflow: hidden;
  background: linear-gradient(to bottom, rgba(255,255,255,0.35), rgba(21,21,21,0.01));
  box-shadow: 0 20px 60px rgba(21, 21, 21, 0.06);
}

.game-frame::before,
.game-frame::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 180ms ease;
}

.game-frame::before {
  z-index: 1;
  background:
    radial-gradient(circle at 14% 50%, rgba(255, 255, 255, 0.28) 0%, rgba(255, 255, 255, 0) 56%),
    repeating-linear-gradient(104deg, rgba(255, 255, 255, 0) 0 11px, rgba(232, 247, 255, 0.9) 12px 13px, rgba(255, 255, 255, 0) 14px 28px);
  background-size: 120% 100%, 260% 100%;
  background-position: 0 0, 0 0;
  mix-blend-mode: screen;
}

.game-frame::after {
  z-index: 1;
  background: linear-gradient(110deg, rgba(6, 10, 16, 0.06), rgba(2, 6, 12, 0.52) 58%, rgba(10, 18, 28, 0.18));
}

.game-frame.is-hyperdrive {
  filter: contrast(1.34) saturate(0.8) brightness(0.84);
}

.game-frame.is-hyperdrive::before,
.game-frame.is-hyperdrive::after {
  opacity: 1;
}

.game-frame.is-hyperdrive::before {
  animation: hyperdrive-streaks 150ms linear infinite;
}

@keyframes hyperdrive-streaks {
  0% {
    background-position: 0 0, 0 0;
  }
  100% {
    background-position: 0 0, -220% 0;
  }
}

.lane {
  position: absolute;
  left: 0;
  width: 100%;
  height: 50%;
  background: var(--lane);
}

.lane-top {
  top: 0;
  border-bottom: 1px solid var(--line);
}

.lane-bottom {
  bottom: 0;
}

.feedback {
  position: absolute;
  top: 22px;
  left: 50%;
  z-index: 2;
  transform: translateX(-50%);
  min-height: 1.2rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(21, 21, 21, 0.08);
  font-size: 0.86rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 140ms ease, transform 140ms ease, background 140ms ease;
  pointer-events: none;
}

.feedback.is-visible {
  opacity: 0.92;
  transform: translateX(-50%) translateY(-4px);
}

.pause-toggle {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 4;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(21, 21, 21, 0.32);
  background: rgba(247, 244, 237, 0.88);
  color: var(--ink);
  font-size: 0.92rem;
  letter-spacing: 0.06em;
  font-weight: 600;
  line-height: 1;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.pause-toggle:hover {
  transform: translateY(-1px);
  border-color: rgba(21, 21, 21, 0.5);
}

.pause-toggle:active {
  transform: translateY(0);
}

.pause-toggle:focus-visible {
  outline: 2px solid rgba(21, 21, 21, 0.2);
  outline-offset: 3px;
}

.player,
.obstacle {
  position: absolute;
  left: 12%;
  width: clamp(14px, 1.9vw, 20px);
  height: clamp(14px, 1.9vw, 20px);
  background: var(--ink);
  border-radius: 999px;
  transform: translate(-50%, -50%);
}

.player {
  transition: top 120ms cubic-bezier(0.22, 1, 0.36, 1), transform 120ms ease;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
  z-index: 3;
}

.player::before {
  content: '';
  position: absolute;
  top: 50%;
  left: -2px;
  width: clamp(28px, 3.8vw, 44px);
  height: clamp(9px, 1.2vw, 14px);
  border-radius: 999px;
  opacity: 0;
  transform: translate(-100%, -50%) scaleX(0.46);
  transform-origin: right center;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(255, 247, 178, 0), rgba(143, 216, 255, 0.84) 44%, rgba(255, 255, 255, 0.94));
  filter: blur(1px);
}

.player::after {
  content: '';
  position: absolute;
  inset: -9px;
  border-radius: 999px;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.86);
  box-shadow:
    0 0 0 1px rgba(124, 214, 255, 0),
    0 0 14px rgba(124, 214, 255, 0),
    0 0 30px rgba(66, 188, 255, 0);
}

.player.is-paradox-charged::after {
  opacity: 0.98;
  animation: paradox-corona 760ms ease-in-out infinite;
}

.player.is-hyperdrive::before {
  opacity: 1;
  animation: hyperdrive-tail 120ms linear infinite;
}

.player.is-hyperdrive::after {
  opacity: 1;
  inset: -12px;
  animation: hyperdrive-corona 160ms ease-out infinite;
  box-shadow:
    0 0 0 1px rgba(142, 224, 255, 0.8),
    0 0 20px rgba(142, 224, 255, 0.78),
    0 0 44px rgba(122, 186, 255, 0.62);
}

.player.is-switching {
  transform: translate(-50%, -50%) scale(0.92);
}

.player.is-near-miss {
  transform: translate(-50%, -50%) scale(1.14);
}

@keyframes paradox-corona {
  0% {
    transform: scale(0.82);
    box-shadow:
      0 0 0 1px rgba(124, 214, 255, 0.7),
      0 0 10px rgba(124, 214, 255, 0.58),
      0 0 18px rgba(66, 188, 255, 0.26);
  }
  60% {
    transform: scale(1.22);
    box-shadow:
      0 0 0 1px rgba(124, 214, 255, 0.34),
      0 0 22px rgba(124, 214, 255, 0.82),
      0 0 42px rgba(66, 188, 255, 0.5);
  }
  100% {
    transform: scale(1.06);
    box-shadow:
      0 0 0 1px rgba(124, 214, 255, 0.5),
      0 0 16px rgba(124, 214, 255, 0.68),
      0 0 28px rgba(66, 188, 255, 0.34);
  }
}

@keyframes hyperdrive-tail {
  0% {
    transform: translate(-100%, -50%) scaleX(0.44);
    opacity: 0.86;
    filter: blur(1px);
  }
  60% {
    transform: translate(-100%, -50%) scaleX(1.22);
    opacity: 1;
    filter: blur(1.8px);
  }
  100% {
    transform: translate(-100%, -50%) scaleX(0.72);
    opacity: 0.9;
    filter: blur(1.2px);
  }
}

@keyframes hyperdrive-corona {
  0% {
    transform: scale(0.84);
  }
  65% {
    transform: scale(1.34);
  }
  100% {
    transform: scale(1.02);
  }
}

@media (prefers-reduced-motion: reduce) {
  .game-frame.is-hyperdrive::before {
    animation: none;
  }

  .player.is-hyperdrive::before,
  .player.is-hyperdrive::after {
    animation: none;
  }

  .player.is-paradox-charged::after {
    animation: none;
    transform: scale(1.08);
    box-shadow:
      0 0 0 1px rgba(124, 214, 255, 0.62),
      0 0 16px rgba(124, 214, 255, 0.6),
      0 0 30px rgba(66, 188, 255, 0.38);
  }

  .obstacle.is-paradox-blast {
    animation: none;
    opacity: 0.28;
    transform: translate(-50%, -50%) scale(1.08);
    box-shadow:
      0 0 0 1px rgba(132, 223, 255, 0.62),
      0 0 14px rgba(132, 223, 255, 0.58);
  }
}

.obstacles {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.obstacle {
  left: auto;
  right: 0;
  border-radius: 6px;
  opacity: 0.92;
}

.obstacle.is-heavy {
  width: clamp(24px, 3.1vw, 30px);
  height: clamp(18px, 2.3vw, 24px);
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(247, 244, 237, 0.28);
}

.obstacle.is-heavy.is-telegraph {
  opacity: 0.62;
  box-shadow: 0 0 0 6px rgba(21, 21, 21, 0.12), inset 0 0 0 1px rgba(247, 244, 237, 0.44);
}

.obstacle.is-entering {
  opacity: 0.45;
  transform: translate(-50%, -50%) scale(0.88);
}

.obstacle.is-paradox-blast {
  animation: paradox-blast-hit 140ms cubic-bezier(0.16, 0.84, 0.44, 1) forwards;
}

@keyframes paradox-blast-hit {
  0% {
    opacity: 1;
    background: var(--ink);
    transform: translate(-50%, -50%) scale(1);
    box-shadow:
      0 0 0 1px rgba(132, 223, 255, 0.35),
      0 0 8px rgba(132, 223, 255, 0.22);
  }
  42% {
    opacity: 1;
    background: rgba(132, 223, 255, 0.94);
    transform: translate(-50%, -50%) scale(1.2);
    box-shadow:
      0 0 0 2px rgba(132, 223, 255, 0.9),
      0 0 18px rgba(132, 223, 255, 0.78),
      0 0 32px rgba(86, 190, 255, 0.48);
  }
  100% {
    opacity: 0;
    background: rgba(132, 223, 255, 0.1);
    transform: translate(-50%, -50%) scale(1.48);
    box-shadow:
      0 0 0 1px rgba(132, 223, 255, 0.24),
      0 0 24px rgba(132, 223, 255, 0.42);
  }
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  max-height: 100%;
  gap: 14px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  padding: 30px 28px 34px;
  background: rgba(247, 244, 237, 0.74);
  backdrop-filter: blur(1px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease, transform 220ms ease;
  transform: translateY(8px);
  z-index: 5;
}

.overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.overlay h1,
.overlay h2 {
  margin: 0;
  font-size: clamp(2.4rem, 6vw, 4.8rem);
  letter-spacing: -0.05em;
}

.overlay p {
  margin: 14px 0 0;
  max-width: 24rem;
  font-size: 1rem;
  line-height: 1.6;
  opacity: 0.78;
}

.overlay h2 + p {
  margin-bottom: 4px;
}

.button {
  margin-top: 22px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--bg);
  border-radius: 999px;
  padding: 0.9rem 1.4rem;
  min-width: 9.5rem;
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease, background 120ms ease;
}

.button:focus-visible {
  outline: 2px solid rgba(21, 21, 21, 0.18);
  outline-offset: 3px;
}

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

.button:active {
  transform: translateY(0);
  opacity: 0.92;
}

.button-secondary {
  background: transparent;
  color: var(--ink);
  margin-top: 10px;
}

.overlay-actions {
  width: min(100%, 20rem);
  margin-top: 4px;
  display: grid;
  gap: 8px;
}

.overlay-actions .button {
  width: 100%;
  margin-top: 0;
}

#overlay-over {
  width: min(100%, 34rem);
  margin: 0 auto;
  gap: 10px;
  display: grid;
  align-content: start;
  justify-items: center;
  padding-top: 16px;
  padding-bottom: 24px;
}

.panel-stack {
  width: min(100%, 34rem);
  display: grid;
  gap: 8px;
  margin-top: 8px;
  flex: 0 0 auto;
  min-height: auto;
  overflow: visible;
}

.panel-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.46);
  text-align: left;
  padding: 12px 14px;
}

.panel-card.is-scrap {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.panel-card.is-scrap h3 {
  text-align: center;
  margin: 0;
}

.panel-card h3 {
  margin: 0;
  font-size: 0.83rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  opacity: 0.64;
}

.panel-value {
  margin: 8px 0 0;
  font-size: 1.4rem;
  font-weight: 600;
}

.panel-card.is-scrap .panel-value {
  display: block;
  width: 100%;
  text-align: center;
  margin: 0;
}

.panel-copy {
  margin: 8px 0 0;
  font-size: 0.96rem;
  opacity: 0.8;
  line-height: 1.5;
}

.perk-choices {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.panel-card.is-perks {
  min-height: 154px;
}

.panel-card.is-perks .perk-choices {
  max-width: 24rem;
}

.perk-choice {
  width: 100%;
  margin-top: 0;
  border-radius: 12px;
  text-align: left;
  padding: 0.7rem 0.85rem;
}

.perk-choice strong {
  display: block;
  font-size: 0.92rem;
}

.perk-choice span {
  display: block;
  margin-top: 2px;
  font-size: 0.82rem;
  opacity: 0.74;
}

.hud-item-perk .value {
  cursor: help;
}

.countdown {
  min-height: 1.4em;
  margin-top: 14px;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.84;
  font-variant-numeric: tabular-nums;
  transform: scale(0.9);
}

.countdown.is-pop {
  animation: countdown-pop 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.countdown.is-go {
  opacity: 1;
  transform: scale(1.1);
}

@keyframes countdown-pop {
  0% {
    transform: scale(0.72);
    opacity: 0.42;
  }
  65% {
    transform: scale(1.14);
    opacity: 1;
  }
  100% {
    transform: scale(0.98);
    opacity: 0.9;
  }
}

.value.is-flashing {
  opacity: 1;
  transform: translateY(-1px) scale(1.06);
}

.name-field {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  margin-bottom: 12px;
  width: min(100%, 18rem);
  text-align: left;
}

.name-field span {
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.65;
}

.name-field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  color: var(--ink);
  padding: 0.85rem 1rem;
  outline: none;
}

.name-field input:focus {
  border-color: rgba(21, 21, 21, 0.38);
}

.name-field input:focus-visible {
  outline: 2px solid rgba(21, 21, 21, 0.12);
  outline-offset: 2px;
}

.save-status {
  margin: 4px 0 0;
  min-height: 1.2rem;
  font-size: 0.92rem;
  opacity: 0.8;
}

.hint {
  margin-top: 14px;
  font-size: 0.88rem;
  opacity: 0.6;
}

.overlay.is-saved .name-field,
.overlay.is-saved #save-score-button {
  display: none;
}

@media (min-width: 901px) {
  .overlay {
    align-items: center;
    justify-content: flex-start;
    padding: 18px 22px 20px;
    overflow: hidden;
  }

  #overlay-over {
    width: min(100%, 46rem);
    max-height: 100%;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "title title"
      "summary summary"
      "panels panels"
      "name name"
      "actions actions";
    align-content: start;
  }

  #overlay-over > h2 {
    grid-area: title;
    margin: 0;
    font-size: clamp(2.8rem, 5.2vw, 4.2rem);
    line-height: 0.96;
  }

  #overlay-over > p:not(.save-status) {
    grid-area: summary;
    margin: 0;
    font-size: 0.98rem;
  }

  .panel-stack {
    grid-area: panels;
    width: 100%;
    margin-top: 4px;
    gap: 8px;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "scrap"
      "perks";
  }

  .panel-card {
    padding: 10px 12px;
  }

  .panel-card h3 {
    font-size: 0.76rem;
    letter-spacing: 0.14em;
    margin-bottom: 4px;
  }

  .panel-card p {
    font-size: 0.92rem;
    line-height: 1.35;
  }

  .panel-card.is-scrap {
    grid-area: scrap;
  }

  .panel-card.is-perks {
    grid-area: perks;
    min-height: 132px;
  }

  .perk-choices {
    margin-top: 8px;
    gap: 6px;
  }

  .perk-choice {
    padding: 0.58rem 0.75rem;
  }

  .name-field {
    grid-area: name;
    width: min(100%, 20rem);
    margin-top: 2px;
    margin-bottom: 4px;
    gap: 6px;
  }

  .overlay-actions {
    grid-area: actions;
    width: min(100%, 20rem);
    justify-self: center;
    margin-top: 0;
    gap: 6px;
  }

  .overlay-actions .button {
    min-height: 2.2rem;
    padding: 0.68rem 1.1rem;
  }

  .save-status {
    grid-area: name;
    align-self: center;
    justify-self: center;
    margin: 0;
  }
}



@media (max-width: 1180px) {
  .layout {
    grid-template-columns: 1fr;
    max-width: 920px;
    gap: 16px;
  }

  .scoreboard,
  .upgrades {
    max-width: 100%;
  }
}

@media (max-height: 800px) {
  #overlay-over {
    gap: 8px;
    padding-top: 22px;
    padding-bottom: 14px;
  }

  .panel-stack {
    gap: 8px;
    margin-top: 10px;
  }

  .name-field {
    margin-top: 10px;
  }

  .overlay-actions {
    padding-top: 10px;
    gap: 8px;
  }
}

@media (max-width: 760px) {
  body {
    min-height: 100dvh;
    padding: 12px;
    touch-action: manipulation;
  }

  .pause-toggle {
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    width: 42px;
    height: 42px;
  }

  .layout {
    gap: 12px;
  }

  .game-column {
    order: 1;
    gap: 12px;
  }

  .scoreboard {
    order: 2;
  }

  .upgrades {
    order: 3;
  }

  .scoreboard,
  .upgrades {
    padding: 14px;
    border-radius: 18px;
  }

  .scoreboard-head {
    margin-bottom: 10px;
  }

  .scoreboard-status {
    margin-bottom: 8px;
  }

  .scoreboard-list,
  .upgrade-list {
    gap: 8px;
  }

  .upgrade-list {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .scoreboard-head,
  .upgrades-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
  }

  .scoreboard-head-copy {
    gap: 2px;
  }

  .mobile-panel-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
    min-width: 5.8rem;
    padding: 0.42rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.34);
    color: var(--ink);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }

  .mobile-collapsible:not(.is-open) .scoreboard-body,
  .mobile-collapsible:not(.is-open) .upgrades-body {
    display: none;
  }

  .upgrade-item {
    padding: 9px 10px 10px;
  }

  .hud {
    padding: 0 2px;
    align-items: start;
    flex-direction: column;
    gap: 8px;
  }

  .hud-group-progression {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    text-align: left;
    gap: 8px 12px;
  }

  .hud-item {
    min-width: 0;
  }

  .game-frame {
    aspect-ratio: auto;
    min-height: 58svh;
    border-radius: 22px;
  }

  .overlay {
    padding: 12px 12px 14px;
    justify-content: flex-start;
    align-items: stretch;
    overflow: hidden;
  }

  #overlay-over {
    height: 100%;
    min-height: 0;
    gap: 8px;
    padding-top: 10px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    overflow-x: hidden;
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: rgba(21, 21, 21, 0.34) rgba(255, 255, 255, 0.08);
    display: grid;
    grid-auto-rows: min-content;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "title title"
      "summary summary"
      "panels panels"
      "name name"
      "actions actions";
    align-content: start;
  }

  #overlay-over::-webkit-scrollbar {
    width: 7px;
  }

  #overlay-over::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
  }

  #overlay-over::-webkit-scrollbar-thumb {
    background: rgba(21, 21, 21, 0.34);
    border-radius: 999px;
  }

  #overlay-over > h2 {
    grid-area: title;
    margin: 0;
    font-size: clamp(1.9rem, 10vw, 2.8rem);
    line-height: 1;
  }

  #overlay-over > p:not(.save-status) {
    grid-area: summary;
    margin: 0;
    max-width: none;
    font-size: 0.9rem;
  }

  .panel-stack {
    grid-area: panels;
    width: 100%;
    min-height: 0;
    margin-top: 0;
    gap: 8px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "scrap"
      "perks";
    overflow: visible;
  }

  .panel-card {
    padding: 9px 10px 10px;
    border-radius: 14px;
    min-height: 0;
  }

  .panel-card h3 {
    margin-bottom: 6px;
    font-size: 0.76rem;
    letter-spacing: 0.16em;
  }

  .panel-card p {
    margin: 0;
    font-size: 0.84rem;
    line-height: 1.25;
  }

  .panel-card.is-scrap {
    grid-area: scrap;
  }

  .panel-card.is-perks {
    grid-area: perks;
    min-height: 0;
    height: auto;
  }

  .panel-card.is-perks .perk-choices {
    max-height: none;
    overflow: visible;
  }

  .perk-list {
    gap: 6px;
    margin: 0;
  }

  .perk-choice {
    padding: 7px 10px;
    border-radius: 12px;
  }

  .perk-choice strong {
    font-size: 0.78rem;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .perk-choice span {
    margin-top: 1px;
    font-size: 0.72rem;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .name-field {
    grid-area: name;
    width: 100%;
    margin: 0;
    gap: 5px;
  }

  .name-field span {
    font-size: 0.72rem;
  }

  .name-field input {
    padding: 0.66rem 0.9rem;
  }

  .save-status {
    grid-area: name;
    margin: 0;
    font-size: 0.84rem;
    align-self: center;
  }

  .overlay-actions {
    grid-area: actions;
    width: 100%;
    margin-top: 2px;
    gap: 6px;
    padding-top: 0;
  }

  .overlay-actions .button {
    width: 100%;
    max-width: none;
    min-height: 2.25rem;
    margin: 0;
    font-size: 0.92rem;
  }

  .button {
    min-width: 0;
  }

  .feedback {
    top: 14px;
    font-size: 0.76rem;
    letter-spacing: 0.12em;
  }
}
