@font-face {
  font-family: "Pixelify Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("./assets/fonts/pixelify-sans-variable.ttf") format("truetype");
}

:root {
  color: #f7f8ff;
  background: #080a12;
  font-family:
    Inter, ui-rounded, "SF Pro Rounded", "SF Pro Display", system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  --panel: rgba(25, 29, 48, 0.86);
  --panel-border: rgba(255, 255, 255, 0.09);
  --muted: #9da4bc;
  --board-gap: clamp(4px, 1.5vw, 8px);
}

:root[data-theme="disco"] {
  --panel: rgba(12, 15, 22, 0.9);
  --panel-border: rgba(218, 239, 244, 0.13);
  --muted: #a8afb9;
}

:root[data-theme="light"] {
  color: #17263b;
  background: #dff4ff;
  --panel: rgba(255, 255, 255, 0.93);
  --panel-border: rgba(80, 122, 153, 0.2);
  --muted: #5e7187;
  --board-gap: clamp(5px, 1.65vw, 9px);
}

:root[data-theme="pixel"] {
  color: #f7f5ff;
  background: #101022;
  font-family: "Pixelify Sans", "SFMono-Regular", "Roboto Mono", "Courier New", monospace;
  --panel: rgba(20, 20, 43, 0.96);
  --panel-border: rgba(113, 238, 255, 0.38);
  --muted: #b0aed0;
  --board-gap: clamp(3px, 1.1vw, 6px);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overscroll-behavior: none;
}

body {
  min-height: 100dvh;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  background:
    radial-gradient(circle at 50% -10%, rgba(102, 81, 214, 0.3), transparent 42%),
    linear-gradient(180deg, #101326 0%, #080a12 75%);
}

:root[data-theme="disco"] body {
  background-color: #030404;
  background-image:
    linear-gradient(180deg, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.2)),
    url("./assets/disco-concrete-lights.png");
  background-position: center, center;
  background-repeat: no-repeat;
  background-size: auto, cover;
}

:root[data-theme="light"] body {
  background-color: #dff4ff;
  background-image:
    radial-gradient(ellipse 34% 2.2% at 25% 18%, rgba(255, 255, 255, 0.96) 0 64%, transparent 68%),
    radial-gradient(ellipse 27% 1.8% at 79% 31%, rgba(255, 255, 255, 0.88) 0 64%, transparent 68%),
    linear-gradient(180deg, #bce9ff 0%, #eaf8ff 72%, #dff4ff 100%);
  background-repeat: no-repeat;
}

:root[data-theme="pixel"] body {
  background-color: #101022;
  background-image:
    linear-gradient(rgba(95, 229, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(95, 229, 255, 0.07) 1px, transparent 1px),
    linear-gradient(180deg, #1a1635 0%, #0c0c1d 100%);
  background-size: 16px 16px, 16px 16px, auto;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  margin: -1px;
  padding: 0;
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

button {
  font: inherit;
}

#app {
  width: min(100%, 760px);
  min-height: 100dvh;
  margin: 0 auto;
  padding:
    max(22px, calc(env(safe-area-inset-top) + 12px))
    max(12px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom))
    max(12px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
}

.game-header {
  min-width: 0;
  flex: 0 0 auto;
}

.game-utility {
  min-width: 0;
  min-height: 44px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.game-utility[hidden] {
  display: none;
}

.game-utility__actions {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
}

.game-utility__button {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: var(--panel);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.06),
    0 6px 18px rgba(0, 0, 0, 0.22);
  color: #f2f4ff;
  cursor: pointer;
  touch-action: manipulation;
  backdrop-filter: blur(16px);
  display: grid;
  place-items: center;
}

.game-utility__button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.game-utility__button:active {
  transform: translateY(1px);
}

.game-utility__button:focus-visible {
  outline: 3px solid white;
  outline-offset: 2px;
}

.game-end-run-button {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid rgba(255, 216, 77, 0.34);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(255, 216, 77, 0.14), rgba(255, 111, 200, 0.1)),
    var(--panel);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.08),
    0 6px 18px rgba(0, 0, 0, 0.22);
  color: #fff4bd;
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.015em;
  touch-action: manipulation;
}

.game-utility__button[hidden],
.game-end-run-button[hidden],
.result-navigation[hidden] {
  display: none;
}

.game-end-run-button:active {
  transform: translateY(1px);
}

.game-end-run-button:focus-visible {
  outline: 3px solid white;
  outline-offset: 2px;
}

.dialog-utility {
  min-width: 0;
  min-height: 48px;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialog-utility[hidden] {
  display: none;
}

.dialog-utility .brand-logo {
  min-width: 0;
  margin: 0;
  padding: 0 2px 2px 0;
  font-size: clamp(1.05rem, 4.7vw, 1.45rem);
  line-height: 1.08;
}

.dialog-utility__actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pet-scene,
.pet-preview-scene {
  --pet-facing-frame: 0%;
  position: relative;
  width: 64px;
  height: 64px;
  pointer-events: none;
}

.pet-scene[hidden] {
  display: none;
}

.pet-scene--menu {
  position: absolute;
  z-index: 3;
  top: calc(clamp(22px, 6vw, 32px) + 50px);
  right: calc(clamp(22px, 6vw, 32px) - 10px);
}

.pet-scene--menu[data-habitat="true"] {
  height: 144px;
}

.pet-scene--menu > .pet-sprite {
  top: -4px;
}

.pet-scene--menu[data-pet="foka"] > .pet-sprite,
.pet-scene--menu[data-pet="kesha"] > .pet-sprite {
  top: -6px;
}

.pet-sprite {
  position: absolute;
  z-index: 2;
  top: 0;
  right: 0;
  width: 64px;
  height: 64px;
  background-position: var(--pet-facing-frame) 0;
  background-repeat: no-repeat;
  background-size: 1000% 100%;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.54));
  transform-origin: center;
}

[data-pet="foka"] > .pet-sprite {
  background-image: url("./assets/pets/foka-sprite.png");
}

[data-pet="kesha"] > .pet-sprite {
  background-image: url("./assets/pets/kesha-sprite.png");
}

[data-pet="tauta"] > .pet-sprite {
  background-image: url("./assets/pets/tauta-sprite.png");
}

[data-pet="misha"] > .pet-sprite {
  background-image: url("./assets/pets/misha-sprite.png");
  z-index: 4;
}

[data-pet="pancake"] > .pet-sprite {
  background-image: url("./assets/pets/pancake-sprite.png");
}

[data-pet="pancake"] > .pet-sprite::before {
  content: "";
  position: absolute;
  top: 32px;
  left: 25px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #140905;
  box-shadow: 10px 0 #140905;
  pointer-events: none;
}

[data-facing="half-left"] {
  --pet-facing-frame: 22.222%;
}

[data-facing="left"] {
  --pet-facing-frame: 33.333%;
}

[data-facing="half-right"] {
  --pet-facing-frame: 66.667%;
}

[data-facing="right"] {
  --pet-facing-frame: 77.778%;
}

.pet-habitat {
  position: absolute;
  z-index: 1;
  top: 48px;
  right: 0;
  width: 64px;
  height: 96px;
  background-position: 0 0;
  background-repeat: no-repeat;
  background-size: 200% 100%;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

.pet-habitat--front {
  z-index: 3;
  background-position: 100% 0;
}

[data-pet="foka"] > .pet-habitat {
  background-image: url("./assets/pets/foka-ice-floe.png");
}

[data-pet="kesha"] > .pet-habitat {
  background-image: url("./assets/pets/kesha-perch.png");
}

[data-pet="tauta"] > .pet-habitat {
  background-image: url("./assets/pets/tauta-bed.png");
}

[data-pet="misha"] > .pet-habitat {
  background-image: url("./assets/pets/misha-climber.png");
}

[data-habitat="false"] > .pet-habitat,
[data-pet="kesha"][data-pose="sleeping"] > .pet-habitat,
[data-pet="kesha"][data-pose="waking"] > .pet-habitat {
  display: none;
}

[data-pet="kesha"][data-pose="settling"] > .pet-habitat {
  animation: kesha-perch-settle 450ms steps(1, end) forwards;
}

[data-pose="turning"][data-facing="half-left"] > .pet-sprite {
  animation: pet-turn-half-left 300ms steps(1, end) forwards;
}

[data-pose="turning"][data-facing="left"] > .pet-sprite {
  animation: pet-turn-left 300ms steps(1, end) forwards;
}

[data-pose="turning"][data-facing="half-right"] > .pet-sprite {
  animation: pet-turn-half-right 300ms steps(1, end) forwards;
}

[data-pose="turning"][data-facing="right"] > .pet-sprite {
  animation: pet-turn-right 300ms steps(1, end) forwards;
}

[data-pose="settling"] > .pet-sprite {
  animation: pet-settle 450ms steps(1, end) forwards;
}

[data-pose="sleeping"] > .pet-sprite,
[data-pose="stopped"] > .pet-sprite {
  animation: none;
  background-position: 100% 0;
}

[data-pose="waking"] > .pet-sprite {
  animation: pet-wake 450ms steps(1, end) forwards;
}

[data-pet="pancake"][data-facing="left"] > .pet-sprite {
  transform: scaleX(-1);
}

[data-pet="pancake"][data-facing="right"] > .pet-sprite {
  transform: scaleX(1);
}

[data-pet="pancake"][data-pose="dancing"] > .pet-sprite,
.pet-preview-scene[data-pet="pancake"].is-animating > .pet-sprite {
  animation: pancake-dance 1440ms steps(1, end) infinite;
}

[data-pet="pancake"][data-pose="dancing"] > .pet-sprite::before,
.pet-preview-scene[data-pet="pancake"].is-animating > .pet-sprite::before {
  animation: pancake-eye-dance 1440ms steps(1, end) infinite;
}

.pet-preview-scene[data-pet="pancake"]:not(.is-animating) > .pet-sprite {
  background-position: 100% 0;
}

[data-pet="pancake"] > .pet-habitat--back {
  display: block;
  top: 59px;
  right: 4px;
  width: 56px;
  height: 2px;
  border-radius: 999px;
  background: rgba(107, 221, 255, 0.54);
  box-shadow:
    0 0 5px rgba(82, 224, 255, 0.82),
    0 0 12px rgba(161, 91, 255, 0.46);
}

[data-pet="pancake"] > .pet-habitat--front {
  display: none;
}

[data-pet="pancake"][data-pose="dancing"] > .pet-habitat--back,
.pet-preview-scene[data-pet="pancake"].is-animating > .pet-habitat--back {
  animation: pancake-line-glow 1440ms steps(2, end) infinite;
}

.coin-balance {
  position: relative;
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(255, 216, 77, 0.3);
  border-radius: 12px;
  background:
    radial-gradient(circle at 22% 20%, rgba(255, 238, 128, 0.16), transparent 45%),
    var(--panel);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.06),
    0 6px 18px rgba(0, 0, 0, 0.22);
  color: #ffd84d;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
  font-family: inherit;
  cursor: pointer;
  touch-action: manipulation;
  appearance: none;
  backdrop-filter: blur(16px);
}

.coin-balance:focus-visible,
.is-auth-gated:focus-visible {
  outline: 3px solid white;
  outline-offset: 2px;
}

.coin-balance.is-auth-gated,
.settings-toggle.is-auth-gated {
  opacity: 0.5;
  filter: saturate(0.45);
}

.settings-toggle.is-auth-gated .settings-toggle__value {
  color: #9ca3b8;
}

.pixel-coin {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  overflow: visible;
  filter: drop-shadow(0 2px 0 rgba(83, 48, 0, 0.72)) drop-shadow(0 0 5px rgba(255, 216, 77, 0.34));
  image-rendering: pixelated;
}

.pixel-coin--price {
  width: 18px;
  height: 18px;
}

.pixel-coin__edge {
  fill: #8d5100;
}

.pixel-coin__face {
  fill: #ffc629;
}

.pixel-coin__shine {
  fill: #fff09a;
}

.pixel-coin__shade {
  fill: #e18b00;
}

.coin-balance strong {
  position: absolute;
  right: -5px;
  bottom: -6px;
  overflow: hidden;
  min-width: 21px;
  max-width: 6ch;
  height: 18px;
  padding: 0 5px;
  border: 2px solid #111426;
  border-radius: 999px;
  background: #ffd84d;
  color: #291e00;
  display: grid;
  place-items: center;
  font-size: 0.56rem;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-gate-info {
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid rgba(255, 216, 77, 0.32);
  border-radius: 14px;
  background: rgba(255, 216, 77, 0.085);
  color: #f5f0d2;
}

.auth-gate-info[hidden] {
  display: none;
}

.auth-gate-info p {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.45;
}

.auth-gate-info button {
  min-height: 40px;
  margin-top: 9px;
}

.leaderboard-shortcut {
  position: relative;
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: var(--panel);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.06),
    0 6px 18px rgba(0, 0, 0, 0.22);
  color: #f2f4ff;
  cursor: pointer;
  touch-action: manipulation;
  backdrop-filter: blur(16px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.leaderboard-shortcut svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.leaderboard-shortcut:active {
  transform: translateY(1px);
}

.leaderboard-shortcut:focus-visible {
  outline: 3px solid white;
  outline-offset: 2px;
}

.utility-rank {
  position: absolute;
  top: -7px;
  right: -6px;
  min-width: 25px;
  height: 20px;
  padding: 0 5px;
  border: 2px solid #111426;
  border-radius: 999px;
  background: #63fff2;
  box-shadow: 0 0 12px rgba(99, 255, 242, 0.46);
  color: #061e1c;
  display: grid;
  place-items: center;
  font-size: 0.6rem;
  font-variant-numeric: tabular-nums;
  font-weight: 950;
}

.utility-rank[hidden] {
  display: none;
}

.hud {
  display: grid;
  grid-template-columns: minmax(64px, 0.78fr) minmax(140px, 1.65fr) minmax(64px, 0.78fr);
  gap: 7px;
  align-items: stretch;
}

.hud-side {
  min-width: 0;
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.stat {
  min-width: 0;
  padding: 6px 5px 5px;
  border: 1px solid var(--panel-border);
  border-radius: 11px;
  background: var(--panel);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.04);
  text-align: center;
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.stat__label {
  display: block;
  overflow: hidden;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: clamp(0.5rem, 2vw, 0.64rem);
  font-weight: 700;
  letter-spacing: 0.045em;
  line-height: 1;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.stat__value {
  display: flex;
  min-height: 1.35em;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: clamp(0.82rem, 3.5vw, 1.12rem);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat__value--small {
  font-size: clamp(0.7rem, 2.8vw, 0.9rem);
}

.color-hero {
  --player-color: #35e6df;
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: 9px 8px 10px;
  border: 2px solid color-mix(in srgb, var(--player-color) 72%, white 28%);
  border-radius: 17px;
  background:
    radial-gradient(circle at 50% 120%, color-mix(in srgb, var(--player-color) 24%, transparent), transparent 64%),
    rgba(20, 23, 40, 0.94);
  box-shadow:
    0 0 23px color-mix(in srgb, var(--player-color) 22%, transparent),
    inset 0 1px rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition:
    border-color 120ms ease,
    box-shadow 120ms ease;
}

.response-progress {
  position: absolute;
  right: 10px;
  bottom: 3px;
  left: 10px;
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  pointer-events: none;
}

.response-progress[hidden] {
  display: none;
}

.response-progress__fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 9px rgba(255, 255, 255, 0.28);
  transform: scaleX(0);
  transform-origin: left;
  will-change: transform;
}

.color-hero__label {
  margin-bottom: 5px;
  color: #e8eaff;
  font-size: clamp(0.6rem, 2.3vw, 0.72rem);
  font-weight: 900;
  letter-spacing: 0.13em;
  line-height: 1;
  text-transform: uppercase;
}

.color-value {
  min-width: 0;
  width: max-content;
  display: grid;
  grid-template-columns: clamp(38px, 11vw, 48px) 7ch;
  align-items: center;
  justify-content: center;
  gap: clamp(7px, 2vw, 11px);
  font-size: clamp(1rem, 4.6vw, 1.45rem);
  line-height: 1;
  white-space: nowrap;
}

#color-name {
  width: 7ch;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
}

.color-swatch {
  width: clamp(38px, 11vw, 48px);
  height: clamp(38px, 11vw, 48px);
  flex: 0 0 auto;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  background: #656b7d;
  box-shadow: 0 0 17px var(--player-color);
  display: grid;
  place-items: center;
  font-size: clamp(1rem, 4vw, 1.35rem);
  line-height: 1;
}

.lives {
  color: #ff5370;
  letter-spacing: 0.08em;
  text-shadow: 0 0 12px rgba(255, 83, 112, 0.45);
}

.lives .lost {
  color: #4f5364;
  text-shadow: none;
}

.game {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding-top: clamp(6px, 1.2dvh, 10px);
}

.board-shell {
  position: relative;
  width: min(calc(100vw - 24px), calc(100dvh - 252px), 680px);
  aspect-ratio: 1;
  flex: 0 0 auto;
  padding: clamp(7px, 2vw, 11px);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: clamp(18px, 5vw, 28px);
  background: rgba(5, 7, 14, 0.72);
  box-shadow:
    0 22px 70px rgba(0, 0, 0, 0.46),
    inset 0 1px rgba(255, 255, 255, 0.06);
}

.streak-meter {
  --streak-progress: 0;
  --streak-tier-color: #d6daea;
  --streak-tier-glow: rgba(214, 218, 234, 0.24);
  --streak-track-background: rgba(255, 255, 255, 0.075);
  position: relative;
  width: min(calc(100vw - 24px), calc(100dvh - 252px), 680px);
  min-height: 50px;
  padding: 6px 9px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: rgba(10, 13, 24, 0.8);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.05),
    0 8px 20px rgba(0, 0, 0, 0.2);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  backdrop-filter: blur(14px);
}

.streak-meter--with-pet {
  margin-top: 30px;
}

.pet-scene--game {
  position: absolute;
  z-index: 2;
  bottom: calc(100% - 4px);
  left: 42%;
  transform: translateX(-50%);
}

.streak-meter[data-multiplier="2"] {
  --streak-tier-color: #72e995;
  --streak-tier-glow: rgba(114, 233, 149, 0.52);
  --streak-track-background: rgba(114, 233, 149, 0.5);
}

.streak-meter[data-multiplier="3"] {
  --streak-tier-color: #67adff;
  --streak-tier-glow: rgba(103, 173, 255, 0.52);
  --streak-track-background: rgba(103, 173, 255, 0.5);
}

.streak-meter[data-multiplier="4"] {
  --streak-tier-color: #c68cff;
  --streak-tier-glow: rgba(198, 140, 255, 0.52);
  --streak-track-background: rgba(198, 140, 255, 0.5);
}

.streak-meter[data-multiplier="5"] {
  --streak-tier-color: #ffd84d;
  --streak-tier-glow: rgba(255, 216, 77, 0.56);
  --streak-track-background: rgba(255, 216, 77, 0.5);
}

:root[data-theme="disco"] .streak-meter {
  border-color: rgba(181, 205, 210, 0.17);
  background-color: rgba(7, 8, 8, 0.9);
  background-image:
    linear-gradient(145deg, rgba(255, 255, 255, 0.025), rgba(0, 0, 0, 0.15)),
    url("./assets/disco-concrete.png");
  background-size: auto, 340px 340px;
}

.streak-meter__track {
  position: relative;
  min-width: 0;
  height: 36px;
  overflow: hidden;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  background: var(--streak-track-background);
  box-shadow:
    inset 0 1px 4px rgba(0, 0, 0, 0.46),
    0 0 0 rgba(177, 104, 255, 0);
  transition: background-color 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.streak-meter__fill {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  background: linear-gradient(100deg, #7657ff 0%, #c658ff 48%, #ffd84d 100%);
  display: block;
  transform: scaleX(var(--streak-progress));
  transform-origin: left;
  transition: transform 110ms ease-out;
  will-change: transform;
}

.streak-meter__fill::after {
  position: absolute;
  inset: -30% auto -30% -42%;
  width: 42%;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.56), transparent);
  filter: blur(1px);
  transform: skewX(-18deg);
  animation: streak-fill-sheen 1.45s ease-in-out infinite;
}

.streak-meter__label {
  position: absolute;
  inset: 0;
  z-index: 1;
  padding: 0 13px;
  display: flex;
  align-items: center;
  color: #f8f9ff;
  font-size: 0.67rem;
  font-weight: 950;
  letter-spacing: 0.09em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
  text-transform: uppercase;
  white-space: nowrap;
}

.streak-meter__multiplier {
  min-width: 46px;
  color: var(--streak-tier-color);
  font-size: 1.3rem;
  font-variant-numeric: tabular-nums;
  font-weight: 1000;
  line-height: 1;
  text-align: center;
  text-shadow: 0 0 15px var(--streak-tier-glow);
  transition: color 180ms ease, text-shadow 180ms ease;
  white-space: nowrap;
}

.streak-meter--full .streak-meter__track {
  border-color: rgba(255, 226, 100, 0.72);
  animation: streak-full-glow 850ms ease-in-out infinite alternate;
}

@keyframes streak-fill-sheen {
  0%, 18% {
    transform: translateX(0) skewX(-18deg);
  }

  78%, 100% {
    transform: translateX(340%) skewX(-18deg);
  }
}

@keyframes streak-full-glow {
  from {
    box-shadow:
      inset 0 1px 4px rgba(0, 0, 0, 0.34),
      0 0 12px rgba(182, 87, 255, 0.58),
      0 0 22px rgba(255, 216, 77, 0.22);
  }

  to {
    box-shadow:
      inset 0 1px 4px rgba(0, 0, 0, 0.22),
      0 0 20px rgba(182, 87, 255, 0.82),
      0 0 34px rgba(255, 216, 77, 0.48);
  }
}

@keyframes pet-turn-half-left {
  0% {
    background-position: 0 0;
  }

  50% {
    background-position: 11.111% 0;
  }

  100% {
    background-position: 22.222% 0;
  }
}

@keyframes pet-turn-left {
  0% {
    background-position: 0 0;
  }

  34% {
    background-position: 11.111% 0;
  }

  67% {
    background-position: 22.222% 0;
  }

  100% {
    background-position: 33.333% 0;
  }
}

@keyframes pet-turn-half-right {
  0% {
    background-position: 0 0;
  }

  34% {
    background-position: 44.444% 0;
  }

  67% {
    background-position: 55.556% 0;
  }

  100% {
    background-position: 66.667% 0;
  }
}

@keyframes pet-turn-right {
  0% {
    background-position: 0 0;
  }

  25% {
    background-position: 44.444% 0;
  }

  50% {
    background-position: 55.556% 0;
  }

  75% {
    background-position: 66.667% 0;
  }

  100% {
    background-position: 77.778% 0;
  }
}

@keyframes pet-settle {
  0% {
    background-position: var(--pet-facing-frame) 0;
  }

  58% {
    background-position: 88.889% 0;
  }

  100% {
    background-position: 100% 0;
  }
}

@keyframes pet-wake {
  0% {
    background-position: 100% 0;
  }

  42% {
    background-position: 88.889% 0;
  }

  100% {
    background-position: var(--pet-facing-frame) 0;
  }
}

@keyframes kesha-perch-settle {
  0%, 57% {
    opacity: 1;
  }

  58%, 100% {
    opacity: 0;
  }
}

@keyframes kesha-perch-preview {
  0%, 76% {
    opacity: 1;
  }

  77%, 99% {
    opacity: 0;
  }

  100% {
    opacity: 1;
  }
}

@keyframes pet-preview {
  0%, 100% {
    background-position: 0 0;
  }

  12% {
    background-position: 22.222% 0;
  }

  24% {
    background-position: 33.333% 0;
  }

  38% {
    background-position: 0 0;
  }

  52% {
    background-position: 66.667% 0;
  }

  64% {
    background-position: 77.778% 0;
  }

  77% {
    background-position: 88.889% 0;
  }

  88% {
    background-position: 100% 0;
  }
}

@keyframes pancake-dance {
  0% {
    background-position: 0 0;
  }

  11.111% {
    background-position: 11.111% 0;
  }

  22.222% {
    background-position: 22.222% 0;
  }

  33.333% {
    background-position: 33.333% 0;
  }

  44.444% {
    background-position: 44.444% 0;
  }

  55.556% {
    background-position: 55.556% 0;
  }

  66.667% {
    background-position: 66.667% 0;
  }

  77.778% {
    background-position: 77.778% 0;
  }

  88.889%, 100% {
    background-position: 88.889% 0;
  }
}

@keyframes pancake-eye-dance {
  0%, 22.222%, 44.444%, 66.667%, 88.889%, 100% {
    transform: translateY(-8px);
  }

  11.111%, 33.333%, 55.556%, 77.778% {
    transform: translateY(0);
  }
}

@keyframes pancake-line-glow {
  0%, 100% {
    opacity: 0.62;
    box-shadow:
      0 0 4px rgba(82, 224, 255, 0.7),
      0 0 9px rgba(161, 91, 255, 0.38);
  }

  50% {
    opacity: 1;
    box-shadow:
      0 0 7px rgba(82, 224, 255, 0.96),
      0 0 16px rgba(161, 91, 255, 0.68);
  }
}

:root[data-theme="disco"] .board-shell {
  border-color: rgba(181, 205, 210, 0.2);
  background-color: #070808;
  background-image:
    linear-gradient(145deg, rgba(255, 255, 255, 0.025), rgba(0, 0, 0, 0.18)),
    url("./assets/disco-concrete-lights.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: auto, cover;
  box-shadow:
    0 24px 78px rgba(0, 0, 0, 0.68),
    inset 0 1px rgba(255, 255, 255, 0.08),
    inset 0 0 38px rgba(0, 0, 0, 0.5);
}

:root[data-theme="light"] .board-shell {
  border-color: rgba(255, 255, 255, 0.98);
  background: #ffffff;
  box-shadow:
    0 20px 60px rgba(72, 137, 177, 0.2),
    inset 0 0 0 1px rgba(91, 143, 174, 0.09);
}

:root[data-theme="pixel"] .board-shell {
  border: 2px solid #7aeaff;
  border-radius: 0;
  background: #09091a;
  box-shadow: 7px 7px 0 #05050e;
}

.board {
  --grid-size: 1;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(var(--grid-size), minmax(0, 1fr));
  grid-template-rows: repeat(var(--grid-size), minmax(0, 1fr));
  gap: var(--board-gap);
  touch-action: manipulation;
}

.tile {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: clamp(11px, calc(30px / var(--grid-size)), 22px);
  outline: 0;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.035), transparent 48%),
    #181b2c;
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.04),
    inset 0 -12px 30px rgba(0, 0, 0, 0.16);
  color: transparent;
  cursor: pointer;
  font-size: clamp(1.1rem, calc(14vw / var(--grid-size) + 0.7rem), 4.6rem);
  font-weight: 900;
  line-height: 1;
  touch-action: manipulation;
  transition:
    border-color 65ms linear,
    box-shadow 65ms linear,
    transform 65ms ease-out;
}

.tile__glyph {
  position: relative;
  z-index: 1;
  display: inline-block;
  pointer-events: none;
}

:root[data-theme="disco"] .tile {
  isolation: isolate;
  border-color: rgba(217, 232, 234, 0.12);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.075), transparent 36%, rgba(0, 0, 0, 0.28)),
    #101214;
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.08),
    inset 0 -16px 34px rgba(0, 0, 0, 0.42),
    0 7px 14px rgba(0, 0, 0, 0.34);
}

:root[data-theme="light"] .tile {
  border-color: #ffffff;
  background: #f5fbff;
  box-shadow:
    inset 0 0 0 1px rgba(84, 135, 166, 0.1),
    inset 0 -7px 18px rgba(103, 163, 198, 0.07);
}

:root[data-theme="pixel"] .tile {
  border: 2px solid #3f4168;
  border-radius: 0;
  background: #17172e;
  box-shadow: inset -4px -4px 0 rgba(0, 0, 0, 0.28);
  transition: none;
}

:root[data-theme="disco"] .tile::before {
  position: absolute;
  z-index: 0;
  inset: 0;
  border-radius: inherit;
  background-image: url("./assets/disco-tile-overlay.png");
  background-position: center;
  background-size: 200% 200%;
  content: "";
  filter: contrast(1.55) brightness(0.72);
  mix-blend-mode: screen;
  opacity: 0.16;
  pointer-events: none;
}

:root[data-theme="disco"] .tile:nth-child(3n + 2)::before {
  background-position: 65% 35%;
}

:root[data-theme="disco"] .tile:nth-child(3n)::before {
  background-position: 35% 68%;
}

.tile:focus-visible {
  outline: 3px solid white;
  outline-offset: -5px;
}

.tile--lit {
  border-color: color-mix(in srgb, var(--tile-color) 78%, white 22%);
  background: var(--tile-color);
  box-shadow:
    0 0 25px color-mix(in srgb, var(--tile-color) 62%, transparent),
    inset 0 1px rgba(255, 255, 255, 0.4),
    inset 0 -18px 35px rgba(0, 0, 0, 0.14);
  color: var(--tile-ink);
  text-shadow: 0 1px rgba(255, 255, 255, 0.2);
  animation: cell-on 90ms ease-out both;
}

:root[data-theme="disco"] .tile--lit {
  border-color: color-mix(in srgb, var(--tile-color) 62%, white 38%);
  background:
    radial-gradient(circle at 50% 48%, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0.11) 34%, transparent 64%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.23), transparent 35%, rgba(0, 0, 0, 0.18)),
    var(--tile-color);
  box-shadow:
    0 0 13px color-mix(in srgb, var(--tile-color) 68%, transparent),
    0 0 30px color-mix(in srgb, var(--tile-color) 34%, transparent),
    inset 0 0 0 1px rgba(255, 255, 255, 0.34),
    inset 0 0 28px rgba(255, 255, 255, 0.2),
    inset 0 0 34px 7px rgba(22, 17, 21, 0.42);
  animation-name: disco-cell-on;
}

:root[data-theme="light"] .tile--lit {
  border-color: #ffffff;
  background: var(--tile-color);
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.9),
    0 7px 18px color-mix(in srgb, var(--tile-color) 30%, transparent),
    inset 0 1px rgba(255, 255, 255, 0.58),
    inset 0 -12px 24px rgba(24, 67, 91, 0.1);
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(21, 56, 76, 0.32);
}

:root[data-theme="pixel"] .tile--lit {
  border-color: color-mix(in srgb, var(--tile-color) 58%, white 42%);
  background: var(--tile-color);
  box-shadow:
    4px 4px 0 color-mix(in srgb, var(--tile-color) 44%, #09091a 56%),
    inset -4px -4px 0 rgba(0, 0, 0, 0.2),
    inset 3px 3px 0 rgba(255, 255, 255, 0.32);
  animation: none;
}

:root[data-theme="disco"] .tile--lit::before {
  filter: contrast(1.45) brightness(0.9);
  opacity: 0.34;
}

.tile:active {
  transform: scale(0.96);
}

@keyframes cell-on {
  from {
    transform: scale(0.93);
  }
  to {
    transform: scale(1);
  }
}

@keyframes disco-cell-on {
  from {
    filter: brightness(1.14);
    transform: scale(0.93);
  }
  to {
    filter: brightness(1);
    transform: scale(1);
  }
}

.feedback {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  padding: 8px 13px;
  border-radius: 999px;
  opacity: 0;
  background: rgba(5, 7, 14, 0.84);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.38);
  color: white;
  font-size: clamp(0.95rem, 4vw, 1.25rem);
  font-weight: 850;
  pointer-events: none;
  transform: translate(-50%, -35%);
}

.feedback--show {
  animation: feedback-pop 520ms ease-out both;
}

.feedback--bad {
  color: #ff8ca0;
}

.speed-rating-overlay {
  --speed-rating-tilt: 0deg;
  position: fixed;
  z-index: 4;
  top: max(142px, calc(env(safe-area-inset-top) + 124px));
  max-width: 44vw;
  padding: 8px 12px;
  border: 2px solid currentColor;
  border-radius: 11px;
  opacity: 0;
  background: rgba(4, 6, 12, 0.84);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.35);
  font-size: clamp(1.2rem, 6vw, 1.7rem);
  font-style: italic;
  font-weight: 1000;
  letter-spacing: -0.045em;
  line-height: 1;
  pointer-events: none;
  text-transform: uppercase;
}

.speed-rating-overlay--left {
  --speed-rating-tilt: -6deg;
  left: max(12px, env(safe-area-inset-left));
}

.speed-rating-overlay--right {
  --speed-rating-tilt: 6deg;
  right: max(12px, env(safe-area-inset-right));
}

.speed-rating-overlay--visible {
  animation: speed-rating-pop 620ms ease-out both;
}

.speed-rating-overlay--godlike {
  color: #ffd84d;
  text-shadow: 0 0 15px rgba(255, 216, 77, 0.55);
}

.speed-rating-overlay--perfect {
  color: #c68cff;
  text-shadow: 0 0 15px rgba(198, 140, 255, 0.5);
}

.speed-rating-overlay--great {
  color: #67adff;
  text-shadow: 0 0 15px rgba(103, 173, 255, 0.5);
}

.speed-rating-overlay--good {
  color: #72e995;
  text-shadow: 0 0 15px rgba(114, 233, 149, 0.45);
}

@keyframes speed-rating-pop {
  0% {
    opacity: 0;
    transform: translateY(7px) rotate(var(--speed-rating-tilt)) scale(0.88);
  }
  14%,
  68% {
    opacity: 1;
    transform: translateY(0) rotate(var(--speed-rating-tilt)) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-8px) rotate(var(--speed-rating-tilt)) scale(0.98);
  }
}

@keyframes feedback-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -20%) scale(0.85);
  }
  16% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  78% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -82%) scale(0.98);
  }
}

.overlay {
  position: fixed;
  z-index: 10;
  inset: 0;
  display: grid;
  place-items: center;
  padding:
    max(18px, env(safe-area-inset-top))
    max(10px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom))
    max(10px, env(safe-area-inset-left));
  background: rgba(5, 6, 12, 0.78);
  backdrop-filter: blur(18px);
  transition: opacity 160ms ease;
}

:root[data-theme="disco"] .overlay {
  background-color: rgba(0, 0, 0, 0.18);
  background-image:
    linear-gradient(180deg, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.3)),
    url("./assets/disco-concrete-lights.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: auto, cover;
  backdrop-filter: blur(0.5px);
}

:root[data-theme="light"] .overlay {
  background-color: #dff4ff;
  background-image:
    radial-gradient(ellipse 34% 2.2% at 25% 18%, rgba(255, 255, 255, 0.96) 0 64%, transparent 68%),
    radial-gradient(ellipse 27% 1.8% at 79% 31%, rgba(255, 255, 255, 0.88) 0 64%, transparent 68%),
    linear-gradient(180deg, rgba(188, 233, 255, 0.96), rgba(234, 248, 255, 0.96));
  backdrop-filter: none;
}

:root[data-theme="pixel"] .overlay {
  background-color: #101022;
  background-image:
    linear-gradient(rgba(95, 229, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(95, 229, 255, 0.07) 1px, transparent 1px),
    linear-gradient(180deg, rgba(26, 22, 53, 0.98), rgba(12, 12, 29, 0.98));
  background-size: 16px 16px, 16px 16px, auto;
  backdrop-filter: none;
}

.overlay[hidden] {
  display: none;
}

.dialog {
  position: relative;
  width: min(100%, 460px);
  max-height: 100%;
  overflow: auto;
  padding: clamp(22px, 6vw, 32px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  background: linear-gradient(155deg, rgba(34, 38, 65, 0.98), rgba(14, 16, 29, 0.98));
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.55);
}

.dialog--with-pet > h1,
.dialog--with-pet > .dialog__lead {
  padding-right: 76px;
}

:root[data-theme="disco"] .dialog {
  border-color: rgba(185, 211, 217, 0.22);
  background-color: rgba(5, 7, 11, 0.9);
  background-image:
    linear-gradient(155deg, rgba(10, 15, 24, 0.8), rgba(5, 7, 11, 0.9)),
    url("./assets/disco-concrete-lights.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: auto, cover;
  box-shadow:
    0 30px 95px rgba(0, 0, 0, 0.76),
    0 0 30px rgba(63, 232, 241, 0.055);
}

:root[data-theme="light"] .dialog {
  border-color: rgba(255, 255, 255, 0.98);
  background: rgba(255, 255, 255, 0.94);
  color: #17263b;
  box-shadow:
    0 26px 72px rgba(67, 129, 166, 0.25),
    inset 0 0 0 1px rgba(81, 130, 159, 0.08);
}

:root[data-theme="pixel"] .dialog {
  border: 2px solid #7aeaff;
  border-radius: 0;
  background: rgba(18, 18, 40, 0.98);
  box-shadow: 8px 8px 0 rgba(3, 3, 12, 0.9);
}

:root[data-theme="disco"] .stat,
:root[data-theme="disco"] .color-hero {
  background-color: rgba(8, 11, 15, 0.91);
}

:root[data-theme="light"] .stat,
:root[data-theme="light"] .color-hero {
  border-color: rgba(71, 118, 148, 0.18);
  background: rgba(255, 255, 255, 0.88);
  color: #17263b;
}

:root[data-theme="pixel"] .stat,
:root[data-theme="pixel"] .color-hero {
  border: 2px solid rgba(122, 234, 255, 0.35);
  border-radius: 0;
  background: #17172e;
}

.brand-logo {
  position: relative;
  width: max-content;
  max-width: 100%;
  margin: 0 0 13px;
  display: inline-flex;
  align-items: center;
  font-size: clamp(1.55rem, 7vw, 2.15rem);
  font-style: italic;
  font-weight: 950;
  letter-spacing: -0.075em;
  line-height: 1;
  filter: drop-shadow(0 0 15px rgba(67, 244, 255, 0.26));
  transform: skewX(-3deg);
}

.brand-logo__speedy {
  background: linear-gradient(105deg, #58fff3 8%, #84ff83 58%, #ffe659 100%);
  background-clip: text;
  color: transparent;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-logo__tapper {
  background: linear-gradient(105deg, #ffe659 0%, #ff6fc8 48%, #a58aff 100%);
  background-clip: text;
  color: transparent;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-logo__pulse {
  width: 9px;
  height: 9px;
  margin: -18px 0 0 7px;
  border: 2px solid #63fff2;
  border-radius: 50%;
  box-shadow:
    0 0 0 4px rgba(99, 255, 242, 0.13),
    0 0 14px #63fff2;
}

.brand-logo--game {
  margin: 0;
  font-size: clamp(1.1rem, 5vw, 1.45rem);
  filter: drop-shadow(0 0 11px rgba(67, 244, 255, 0.24));
}

.brand-logo--game .brand-logo__pulse {
  width: 7px;
  height: 7px;
  margin: -12px 0 0 5px;
  border-width: 1.5px;
  box-shadow:
    0 0 0 3px rgba(99, 255, 242, 0.11),
    0 0 10px #63fff2;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 9vw, 3.1rem);
  letter-spacing: -0.055em;
  line-height: 0.96;
}

.dialog__lead {
  margin: 18px 0 14px;
  color: #d6daea;
  font-size: 0.98rem;
  line-height: 1.5;
}

.result-content[hidden],
.main-menu-content[hidden],
.overlay-view[hidden] {
  display: none;
}

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

.overlay-view {
  display: grid;
  gap: 12px;
}

.view-back-button {
  width: auto;
  min-height: 44px;
  padding: 0 16px;
  justify-self: start;
}

.leaderboard-utility {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

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

.result-score {
  margin: -2px 0 12px;
  padding: 12px 14px 13px;
  border: 1px solid rgba(255, 216, 77, 0.3);
  border-radius: 16px;
  background:
    radial-gradient(circle at 50% 130%, rgba(255, 216, 77, 0.17), transparent 62%),
    linear-gradient(135deg, rgba(87, 255, 243, 0.075), rgba(255, 91, 168, 0.075)),
    rgba(7, 9, 19, 0.5);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.06),
    0 10px 30px rgba(0, 0, 0, 0.18);
  text-align: center;
  display: grid;
  place-items: center;
}

.result-score span,
.result-score small {
  color: #9ca5bc;
  font-size: 0.64rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.result-score strong {
  margin: 2px 0;
  background: linear-gradient(105deg, #58fff3 5%, #ffe659 48%, #ff6fc8 95%);
  background-clip: text;
  color: transparent;
  font-size: clamp(2.35rem, 12vw, 3.35rem);
  font-variant-numeric: tabular-nums;
  font-weight: 1000;
  letter-spacing: -0.055em;
  line-height: 0.95;
  text-shadow: 0 0 28px rgba(99, 255, 242, 0.12);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.result-stats[hidden] {
  display: none;
}

.result-stat {
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid rgba(85, 245, 238, 0.28);
  border-radius: 13px;
  background:
    radial-gradient(circle at 90% 10%, rgba(255, 94, 190, 0.12), transparent 48%),
    rgba(34, 223, 216, 0.065);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.result-stat span {
  overflow: hidden;
  color: #9fa8c1;
  font-size: 0.63rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.result-stat strong {
  overflow: hidden;
  color: #68fff2;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  text-shadow: 0 0 14px rgba(74, 255, 239, 0.32);
  white-space: nowrap;
}

.speed-summary,
.result-save-panel,
.profile-panel {
  margin: 0 0 16px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  background: rgba(7, 9, 19, 0.42);
}

.speed-summary__bar {
  width: 100%;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.075);
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.3);
  display: flex;
}

.speed-summary__segment {
  flex: 0 0 0%;
  min-width: 0;
  transition: flex-basis 220ms ease;
}

.speed-summary__segment--godlike {
  background: #ffd84d;
}

.speed-summary__segment--perfect {
  background: #b77bff;
}

.speed-summary__segment--great {
  background: #5b9fff;
}

.speed-summary__segment--good {
  background: #5fd583;
}

.speed-summary__legend {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 10px;
}

.speed-summary__item {
  min-width: 0;
  color: #a5acc1;
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
}

.speed-summary__label {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.speed-summary__dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
}

.speed-summary__item--godlike {
  color: #ffd84d;
}

.speed-summary__item--perfect {
  color: #c68cff;
}

.speed-summary__item--great {
  color: #67adff;
}

.speed-summary__item--good {
  color: #72e995;
}

.google-signin {
  min-height: 44px;
  max-width: 100%;
  overflow: hidden;
  border-radius: 999px;
  background: transparent !important;
  display: grid;
  place-items: center;
  isolation: isolate;
}

.google-signin > div,
.google-signin iframe {
  max-width: 100% !important;
  border-radius: 999px !important;
  background: transparent !important;
  color-scheme: light;
}

.google-signin[hidden] {
  display: none;
}

.score-form,
.leaderboard-panel {
  margin: 0 0 16px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  background: rgba(7, 9, 19, 0.42);
}

.score-form[hidden],
.leaderboard-panel[hidden] {
  display: none;
}

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

.section-heading h2 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: -0.015em;
}

.section-heading span {
  color: #858da8;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.score-form label {
  display: block;
  margin-bottom: 6px;
  color: #b9bfd4;
  font-size: 0.76rem;
  font-weight: 750;
}

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

.score-form input {
  min-width: 0;
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 13px;
  outline: 0;
  background: rgba(255, 255, 255, 0.07);
  color: white;
  font: inherit;
  font-size: 16px;
  user-select: text;
}

.score-form input:focus {
  border-color: #9ba5ff;
  box-shadow: 0 0 0 3px rgba(142, 154, 255, 0.16);
}

.score-submit {
  width: auto;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 13px;
}

.result-navigation {
  margin: -5px 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.score-submit:disabled,
.leaderboard-tab:disabled,
.result-navigation button:disabled,
.game-end-run-button:disabled {
  cursor: default;
  opacity: 0.58;
}

.form-status,
.leaderboard-status {
  min-height: 1.25em;
  margin: 8px 0 0;
  color: #9da5bf;
  font-size: 0.74rem;
  line-height: 1.35;
}

.form-status.is-error,
.leaderboard-status.is-error {
  color: #ff94a6;
}

.action-stack {
  display: grid;
  gap: 9px;
}

.menu-feature-actions {
  width: 100%;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
}

.menu-feature-button {
  width: 45%;
  flex: 0 0 45%;
  padding: 8px 10px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-align: center;
}

.menu-spacer {
  height: 9px;
}

.mode-group {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.mode-group legend {
  margin-bottom: 7px;
  padding: 0;
  color: #929ab3;
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

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

.mode-actions button {
  min-width: 0;
  min-height: 56px;
  font-size: 0.9rem;
}

.mode-button {
  display: grid;
  place-content: center;
  gap: 2px;
  line-height: 1.05;
}

.mode-button > span {
  font-size: 1.2rem;
  font-weight: 950;
  letter-spacing: -0.015em;
}

.primary-button.mode-button--arcade {
  border: 1px solid rgba(255, 158, 202, 0.92);
  background:
    radial-gradient(circle at 50% 0, rgba(255, 226, 238, 0.45), transparent 62%),
    linear-gradient(145deg, #f45198, #c92d70);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.28),
    0 0 20px rgba(255, 73, 155, 0.58),
    0 8px 24px rgba(121, 15, 62, 0.32);
  color: #fff7f8;
  text-shadow: 0 1px 2px rgba(60, 0, 12, 0.5);
}

.secondary-button.mode-button--zen {
  border-color: rgba(201, 255, 164, 0.9);
  background:
    radial-gradient(circle at 50% 0, rgba(239, 255, 211, 0.44), transparent 64%),
    linear-gradient(145deg, #93dc63, #3d9b58);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.25),
    0 0 20px rgba(145, 236, 102, 0.42),
    0 8px 24px rgba(22, 91, 43, 0.28);
  color: #0b2d17;
  text-shadow: 0 1px rgba(255, 255, 255, 0.24);
}

.mode-button small {
  margin-top: 5px;
  color: #aeb5ca;
  font-size: 0.58rem;
  font-weight: 750;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.mode-button--zen small {
  color: rgba(9, 55, 26, 0.84);
}

.mode-button--zen:hover small,
.mode-button--zen:focus-visible small {
  color: #173e23;
}

.settings-toggle {
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  text-align: left;
}

.settings-toggle.menu-feature-button {
  min-height: 48px;
  padding: 5px 8px;
  justify-content: center;
  gap: 2px;
  line-height: 1.05;
}

.settings-toggle.menu-feature-button .settings-toggle__value {
  line-height: 1.05;
}

.settings-toggle[aria-expanded="true"] {
  border-color: rgba(92, 238, 242, 0.42);
  background: rgba(71, 221, 228, 0.085);
}

.settings-toggle__value {
  color: #aab2c9;
  font-size: 0.76rem;
  font-weight: 800;
}

.achievements-toggle {
  position: relative;
}

.achievements-alert {
  position: absolute;
  z-index: 2;
  top: -9px;
  right: -6px;
  color: #ffd84d;
  font-size: 1.65rem;
  font-weight: 1000;
  line-height: 1;
  text-shadow:
    0 0 8px rgba(255, 216, 77, 0.88),
    0 2px 2px rgba(0, 0, 0, 0.72);
  transform: rotate(9deg);
}

.pet-shop-panel {
  min-width: 0;
}

.pet-shop-heading {
  margin: 0 2px;
}

.pet-shop-balance-control {
  flex: 0 0 44px;
  cursor: default;
  pointer-events: none;
}

.pet-shop-status {
  min-height: 1.25rem;
  margin: 0 2px 6px;
}

.pet-shop-list {
  display: grid;
  gap: 8px;
}

.pet-card {
  min-width: 0;
  min-height: 98px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(92, 238, 242, 0.04), rgba(177, 104, 255, 0.04)),
    rgba(5, 7, 14, 0.54);
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr) auto;
  grid-template-rows: minmax(44px, auto) 44px;
  gap: 4px 9px;
  align-items: center;
}

.pet-card.is-selected {
  border-color: rgba(92, 238, 242, 0.42);
  box-shadow: inset 0 0 22px rgba(72, 226, 234, 0.055);
}

.pet-card.is-hidden-pet {
  border-color: rgba(255, 216, 77, 0.34);
}

.pet-preview-button {
  grid-row: 1 / span 2;
  width: 80px;
  height: 80px;
  overflow: hidden;
  margin: 0;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 13px;
  outline: 0;
  background:
    radial-gradient(circle at 50% 85%, rgba(109, 96, 255, 0.16), transparent 62%),
    rgba(7, 9, 18, 0.7);
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
  display: grid;
  place-items: center;
}

.pet-preview-button:focus-visible {
  outline: 3px solid white;
  outline-offset: 2px;
}

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

.pet-preview-scene {
  display: block;
}

.pet-preview-scene > .pet-sprite {
  top: -8px;
}

.pet-preview-scene[data-pet="foka"] > .pet-sprite,
.pet-preview-scene[data-pet="kesha"] > .pet-sprite {
  top: -13px;
}

.pet-preview-scene > .pet-habitat {
  top: 40px;
  height: 64px;
}

.pet-preview-scene[data-pet="pancake"] > .pet-habitat--back {
  top: 59px;
  height: 2px;
}

.pet-preview-scene.is-animating:not([data-pet="pancake"]) > .pet-sprite {
  animation: pet-preview 1.45s steps(1, end) 1;
}

.pet-preview-scene[data-pet="kesha"].is-animating > .pet-habitat {
  animation: kesha-perch-preview 1.45s steps(1, end) 1;
}

.pet-card__copy {
  min-width: 0;
  align-self: center;
  grid-column: 2;
  grid-row: 1 / span 2;
  display: grid;
  gap: 2px;
}

.pet-card__copy strong {
  overflow: hidden;
  font-size: 0.98rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pet-card__copy small {
  color: #9ea6bd;
  font-size: 0.7rem;
  line-height: 1.25;
  white-space: normal;
}

.pet-card__price {
  min-width: 64px;
  align-self: stretch;
  color: #ffd84d;
  font-size: 1.08rem;
  font-variant-numeric: tabular-nums;
  font-weight: 950;
  white-space: nowrap;
  grid-column: 3;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.pet-card.is-owned .pet-card__price {
  color: #858ca0;
  filter: grayscale(1);
  opacity: 0.54;
  text-shadow: none;
}

.primary-button.pet-card__action {
  width: auto;
  min-width: 64px;
  min-height: 34px;
  padding: 0 10px;
  grid-column: 3;
  grid-row: 2;
  justify-self: end;
  font-size: 0.74rem;
}

.pet-card__action[hidden] {
  display: none;
}

.pet-card__action:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

:root[data-theme="disco"] .pet-card,
:root[data-theme="disco"] .pet-preview-button {
  border-color: rgba(188, 222, 226, 0.18);
  background-color: rgba(5, 7, 9, 0.72);
  background-image:
    linear-gradient(145deg, rgba(255, 255, 255, 0.026), rgba(0, 0, 0, 0.14)),
    url("./assets/disco-concrete.png");
  background-size: auto, 260px 260px;
}

.settings-panel {
  min-width: 0;
  margin: 0;
  padding: 9px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 16px;
  background: rgba(5, 7, 14, 0.54);
  display: grid;
  gap: 9px;
}

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

.achievements-panel {
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  background: rgba(7, 9, 19, 0.42);
}

.achievements-list {
  display: grid;
  gap: 8px;
}

.achievement-card {
  width: 100%;
  min-width: 0;
  min-height: 76px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  appearance: none;
  background: rgba(255, 255, 255, 0.045);
  color: white;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  font: inherit;
  text-align: left;
  touch-action: manipulation;
  transition:
    border-color 130ms ease,
    background-color 130ms ease,
    opacity 130ms ease,
    transform 80ms ease;
}

.achievement-card__check {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 11px;
  color: #687087;
  display: grid;
  place-items: center;
}

.achievement-card__check svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.achievement-card__copy {
  min-width: 0;
}

.achievement-card__copy strong,
.achievement-card__copy small,
.achievement-card__action strong,
.achievement-card__action small {
  display: block;
}

.achievement-card__copy strong {
  color: #eef0ff;
  font-size: 0.84rem;
  line-height: 1.2;
}

.achievement-card__copy small {
  margin-top: 3px;
  color: #969eb6;
  font-size: 0.75rem;
  line-height: 1.3;
}

.achievement-card__action {
  min-width: 64px;
  text-align: right;
}

.achievement-card__action strong {
  color: #aeb5ca;
  font-size: 0.75rem;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.pixel-coin--achievement {
  width: 16px;
  height: 16px;
}

.achievement-card__action small {
  margin-top: 3px;
  color: #7f879d;
  font-size: 0.7rem;
  font-weight: 800;
  white-space: nowrap;
}

.achievement-card--locked {
  cursor: default;
  opacity: 0.9;
}

.achievement-card--claimable {
  border-color: rgba(99, 232, 139, 0.56);
  background: rgba(63, 204, 108, 0.12);
  box-shadow: inset 0 0 0 1px rgba(112, 242, 153, 0.06);
  cursor: pointer;
}

.achievement-card--claimable .achievement-card__check {
  border-color: #72e995;
  background: #72e995;
  box-shadow: 0 0 18px rgba(78, 223, 124, 0.24);
  color: #0a2a17;
}

.achievement-card--claimable .achievement-card__action strong,
.achievement-card--claimable .achievement-card__action small {
  color: #8ff5ae;
}

.achievement-card--claimable:not(:disabled):active {
  transform: scale(0.985);
}

.achievement-card--claimed {
  border-color: rgba(174, 180, 195, 0.12);
  background: rgba(128, 135, 151, 0.08);
  cursor: default;
  opacity: 0.76;
}

.achievement-card--claimed .achievement-card__check {
  border-color: #8d94a5;
  background: #8d94a5;
  color: #262a34;
}

.achievement-card:focus-visible {
  outline: 3px solid white;
  outline-offset: 2px;
}

.achievement-card:disabled {
  -webkit-text-fill-color: currentColor;
}

.achievements-status {
  margin-top: 10px;
}

.achievements-profile-button {
  min-height: 44px;
  margin-top: 8px;
}

.achievements-profile-button[hidden] {
  display: none;
}

.profile-panel {
  margin: 0;
}

.profile-signed-out h2 {
  margin: 0;
  font-size: 1.15rem;
}

.profile-signed-out p {
  color: #adb4c9;
  font-size: 0.82rem;
  line-height: 1.45;
}

.profile-signed-out .profile-login-benefits {
  padding: 10px 11px;
  border: 1px solid rgba(255, 216, 77, 0.24);
  border-radius: 12px;
  background: rgba(255, 216, 77, 0.07);
  color: #e8e1bd;
}

.profile-signed-in[hidden],
.profile-signed-out[hidden] {
  display: none;
}

.leaderboard-admin-toggle,
.profile-logout {
  min-height: 44px;
  margin-top: 10px;
}

.leaderboard-admin-toggle[hidden] {
  display: none;
}

.profile-form label {
  display: block;
  margin-bottom: 6px;
  color: #b9bfd4;
  font-size: 0.76rem;
  font-weight: 750;
}

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

.profile-form input {
  min-width: 0;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 13px;
  outline: 0;
  background: rgba(255, 255, 255, 0.07);
  color: white;
  font: inherit;
  font-size: 16px;
  user-select: text;
}

.profile-form input:focus {
  border-color: #9ba5ff;
  box-shadow: 0 0 0 3px rgba(142, 154, 255, 0.16);
}

.profile-form button {
  width: auto;
  min-height: 46px;
  padding: 0 15px;
  border-radius: 13px;
}

.profile-mode-tabs {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.profile-rank-card {
  min-height: 70px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid rgba(104, 255, 242, 0.22);
  border-radius: 13px;
  background: rgba(104, 255, 242, 0.07);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.profile-rank-card__metric span {
  display: block;
  color: #8e97b0;
  font-size: 0.62rem;
  font-weight: 850;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.profile-rank-card__metric strong {
  display: block;
  margin-top: 3px;
  color: #68fff2;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

.profile-neighbors {
  max-height: 230px;
}

.profile-logout {
  margin-top: 8px;
}

.settings-section {
  min-width: 0;
}

.settings-section__label {
  display: block;
  margin: 0 4px 7px;
  color: #929ab3;
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.settings-switches {
  display: grid;
  gap: 8px;
}

.audio-setting {
  min-width: 0;
  display: grid;
}

.audio-setting .setting-row {
  border-radius: 15px 15px 8px 8px;
}

.volume-setting {
  min-width: 0;
  min-height: 46px;
  margin-top: -1px;
  padding: 5px 10px 5px 13px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px 8px 15px 15px;
  background: rgba(255, 255, 255, 0.027);
  color: #aeb5ca;
  display: grid;
  grid-template-columns: auto minmax(68px, 1fr) 42px;
  align-items: center;
  gap: 9px;
  font-size: 0.66rem;
  font-weight: 800;
}

.volume-slider {
  width: 100%;
  min-width: 0;
  height: 32px;
  margin: 0;
  accent-color: #43e5df;
  cursor: pointer;
}

.volume-slider:focus-visible {
  outline: 3px solid white;
  outline-offset: 2px;
}

.volume-slider:disabled {
  cursor: default;
  opacity: 0.4;
}

.volume-setting output {
  color: #f2f4ff;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  text-align: right;
}

.volume-setting:has(.volume-slider:disabled) {
  opacity: 0.58;
}

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

.themes-heading {
  margin-bottom: 2px;
}

.themes-balance-control {
  cursor: default;
}

.themes-status {
  min-height: 1.2em;
  margin: 1px 0 8px;
}

.theme-card {
  min-width: 0;
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.035);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  color: #e8eaff;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.theme-card.is-selected {
  border-color: #50e9ef;
  box-shadow:
    0 0 0 1px rgba(80, 233, 239, 0.22),
    0 0 17px rgba(80, 233, 239, 0.13);
}

.theme-card__copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  text-align: left;
}

.theme-card__copy strong {
  overflow: hidden;
  font-size: 0.78rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-card__copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 700;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-card__price {
  min-width: 30px;
  color: #ffd84d;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  font-size: 0.72rem;
  font-weight: 950;
}

.theme-card.is-owned .theme-card__price {
  color: var(--muted);
  filter: grayscale(1);
  opacity: 0.58;
}

.theme-card__action {
  min-height: 32px;
  padding: 6px 8px;
  grid-column: 1 / -1;
  border-radius: 9px;
  font-size: 0.7rem;
}

.theme-card__action:disabled {
  cursor: default;
  opacity: 0.5;
}

.theme-card.is-selected .theme-card__action:disabled {
  border-color: rgba(80, 233, 239, 0.48);
  background: rgba(80, 233, 239, 0.13);
  color: #bafcff;
  opacity: 1;
}

.theme-card .theme-preview {
  grid-column: 1 / -1;
}

:root[data-theme="light"] .theme-card {
  border-color: rgba(73, 119, 147, 0.18);
  background: rgba(255, 255, 255, 0.72);
  color: #17263b;
}

:root[data-theme="light"] .theme-card.is-selected {
  border-color: #159dc7;
  box-shadow: 0 0 0 2px rgba(21, 157, 199, 0.12);
}

:root[data-theme="light"] .theme-card.is-selected .theme-card__action:disabled {
  border-color: #159dc7;
  background: #d7f5ff;
  color: #125a72;
}

:root[data-theme="pixel"] .theme-card {
  border: 2px solid #45456c;
  border-radius: 0;
  background: #17172e;
  color: #f7f5ff;
}

:root[data-theme="pixel"] .theme-card.is-selected {
  border-color: #7aeaff;
  box-shadow: 4px 4px 0 #080815;
}

:root[data-theme="pixel"] .theme-card__action {
  border-radius: 0;
  box-shadow: 3px 3px 0 #070713;
}

.theme-preview {
  width: 100%;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  background: #101425;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
}

.theme-preview[data-theme-preview="light"] {
  border-color: #ffffff;
  background:
    radial-gradient(ellipse 42% 4% at 24% 22%, white 0 64%, transparent 68%),
    linear-gradient(180deg, #bdeaff, #f4fbff);
  gap: 5px;
}

.theme-preview[data-theme-preview="pixel"] {
  border: 2px solid #69e8ff;
  border-radius: 0;
  background:
    linear-gradient(rgba(105, 232, 255, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(105, 232, 255, 0.1) 1px, transparent 1px),
    #111126;
  background-size: 8px 8px;
  gap: 3px;
}

/* Retained transitions apply to the compact action rather than an invisible radio. */
.theme-card__action {
  transition:
    border-color 120ms ease,
    box-shadow 120ms ease,
    transform 120ms ease;
}

.theme-preview[data-theme-preview="disco"] {
  border-color: rgba(207, 230, 234, 0.24);
  background-color: #080909;
  background-image: url("./assets/disco-concrete-lights.png");
  background-position: center;
  background-size: cover;
}

.theme-preview__tile {
  --preview-color: #35e6df;
  --preview-ink: #11151a;
  position: relative;
  isolation: isolate;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--preview-color) 70%, white 30%);
  border-radius: 6px;
  background: var(--preview-color);
  box-shadow:
    0 0 8px color-mix(in srgb, var(--preview-color) 46%, transparent),
    inset 0 1px rgba(255, 255, 255, 0.4),
    inset 0 -6px 11px rgba(0, 0, 0, 0.17);
  color: var(--preview-ink);
  display: grid;
  place-items: center;
  font-size: clamp(0.56rem, 2.8vw, 0.78rem);
  font-weight: 950;
}

.theme-preview__tile:nth-child(1) {
  --preview-color: #35e6df;
}

.theme-preview__tile:nth-child(2) {
  --preview-color: #ffd84d;
}

.theme-preview__tile:nth-child(3) {
  --preview-color: #ff5ba8;
}

.theme-preview__tile:nth-child(4) {
  --preview-color: #8ee85a;
}

.theme-preview__tile:nth-child(5) {
  --preview-color: #ff914d;
}

.theme-preview__tile:nth-child(6) {
  --preview-color: #a987ff;
}

[data-theme-preview="disco"] .theme-preview__tile:nth-child(1) {
  --preview-color: #65e9f1;
}

[data-theme-preview="disco"] .theme-preview__tile:nth-child(2) {
  --preview-color: #ffe681;
}

[data-theme-preview="disco"] .theme-preview__tile:nth-child(3) {
  --preview-color: #ff86bc;
}

[data-theme-preview="disco"] .theme-preview__tile:nth-child(4) {
  --preview-color: #b2ee7c;
}

[data-theme-preview="disco"] .theme-preview__tile:nth-child(5) {
  --preview-color: #ffb06f;
}

[data-theme-preview="disco"] .theme-preview__tile:nth-child(6) {
  --preview-color: #c3a8ff;
}

[data-theme-preview="light"] .theme-preview__tile:nth-child(1) {
  --preview-color: #00b8d9;
}

[data-theme-preview="light"] .theme-preview__tile:nth-child(2) {
  --preview-color: #f2bd14;
}

[data-theme-preview="light"] .theme-preview__tile:nth-child(3) {
  --preview-color: #ee3d8f;
}

[data-theme-preview="light"] .theme-preview__tile:nth-child(4) {
  --preview-color: #73c43d;
}

[data-theme-preview="light"] .theme-preview__tile:nth-child(5) {
  --preview-color: #f47b2a;
}

[data-theme-preview="light"] .theme-preview__tile:nth-child(6) {
  --preview-color: #a18ff0;
}

[data-theme-preview="pixel"] .theme-preview__tile:nth-child(1) {
  --preview-color: #18d7d0;
}

[data-theme-preview="pixel"] .theme-preview__tile:nth-child(2) {
  --preview-color: #ffd13d;
}

[data-theme-preview="pixel"] .theme-preview__tile:nth-child(3) {
  --preview-color: #ff4f9f;
}

[data-theme-preview="pixel"] .theme-preview__tile:nth-child(4) {
  --preview-color: #82dd48;
}

[data-theme-preview="pixel"] .theme-preview__tile:nth-child(5) {
  --preview-color: #ff7c35;
}

[data-theme-preview="pixel"] .theme-preview__tile:nth-child(6) {
  --preview-color: #9875ff;
}

[data-theme-preview="light"] .theme-preview__tile {
  border: 2px solid white;
  background: var(--preview-color);
  box-shadow: 0 3px 7px color-mix(in srgb, var(--preview-color) 24%, transparent);
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(21, 56, 76, 0.32);
}

[data-theme-preview="pixel"] .theme-preview__tile {
  border: 2px solid color-mix(in srgb, var(--preview-color) 62%, white 38%);
  border-radius: 0;
  background: var(--preview-color);
  box-shadow: 2px 2px 0 color-mix(in srgb, var(--preview-color) 35%, #080815 65%);
}

[data-theme-preview="disco"] .theme-preview__tile {
  border-color: color-mix(in srgb, var(--preview-color) 55%, white 45%);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.2), transparent 36%, rgba(0, 0, 0, 0.18)),
    var(--preview-color);
  box-shadow:
    0 0 8px color-mix(in srgb, var(--preview-color) 44%, transparent),
    inset 0 0 0 1px rgba(255, 255, 255, 0.3),
    inset 0 0 9px 2px rgba(25, 19, 22, 0.36);
}

[data-theme-preview="disco"] .theme-preview__tile::before {
  position: absolute;
  z-index: 0;
  inset: 0;
  background-image: url("./assets/disco-tile-overlay.png");
  background-position: center;
  background-size: 180% 180%;
  content: "";
  filter: contrast(1.45) brightness(0.88);
  mix-blend-mode: screen;
  opacity: 0.32;
}

.theme-preview__glyph {
  position: relative;
  z-index: 1;
}

:root[data-glyphs="off"] .theme-preview__glyph {
  visibility: hidden;
}

.setting-row {
  min-height: 61px;
  padding: 9px 13px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.045);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  cursor: pointer;
}

.setting-row__copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.setting-row__copy strong {
  color: white;
  font-size: 0.87rem;
  line-height: 1.15;
}

.setting-row__title {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.setting-badge {
  flex: 0 0 auto;
  padding: 2px 5px;
  border: 1px solid rgba(102, 245, 238, 0.42);
  border-radius: 999px;
  background: rgba(61, 224, 218, 0.1);
  color: #7ff9f1;
  font-size: 0.52rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1.1;
  text-transform: uppercase;
  white-space: nowrap;
}

.setting-row__copy small {
  color: #9ca4ba;
  font-size: 0.68rem;
  line-height: 1.25;
}

.setting-toggle {
  position: relative;
  width: 50px;
  height: 29px;
  flex: 0 0 auto;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  appearance: none;
  background: #353b4c;
  cursor: pointer;
  transition:
    background-color 130ms ease,
    border-color 130ms ease;
}

.setting-toggle::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: #f7f8ff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  content: "";
  transition: transform 130ms ease;
}

.setting-toggle:checked {
  border-color: rgba(118, 245, 248, 0.68);
  background: #29dbe2;
}

.setting-toggle:checked::after {
  transform: translateX(21px);
}

.setting-toggle:focus-visible {
  outline: 3px solid white;
  outline-offset: 3px;
}

.primary-button,
.secondary-button,
.install-button,
.leaderboard-toggle {
  width: 100%;
  min-height: 51px;
  border-radius: 15px;
  font-weight: 850;
  cursor: pointer;
  touch-action: manipulation;
}

.primary-button {
  border: 0;
  background: #f4f5ff;
  box-shadow: 0 8px 25px rgba(204, 208, 255, 0.17);
  color: #111322;
}

.secondary-button {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: white;
}

.install-button {
  margin-top: 9px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  background: transparent;
  color: #c5cadb;
}

.leaderboard-toggle {
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: white;
}

.leaderboard-panel {
  margin-top: 9px;
  margin-bottom: 0;
}

.overlay-view .leaderboard-panel {
  margin-top: 0;
}

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

.leaderboard-tab {
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.04);
  color: #aeb5cb;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.leaderboard-tab.is-active {
  border-color: rgba(155, 165, 255, 0.58);
  background: rgba(137, 148, 255, 0.17);
  color: white;
}

.leaderboard-player-position {
  margin: 8px 0 0;
  padding: 7px 10px;
  border: 1px solid rgba(104, 255, 242, 0.18);
  border-radius: 10px;
  background: rgba(104, 255, 242, 0.07);
  color: #a7fff8;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  font-weight: 850;
  line-height: 1.3;
  text-align: center;
}

.leaderboard-list {
  max-height: min(320px, 42dvh);
  margin: 10px 0 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
  overscroll-behavior: contain;
}

.leaderboard-entry {
  display: grid;
  grid-template-columns: 28px 44px minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  min-height: 62px;
  padding: 8px 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.075);
}

.leaderboard-entry.is-current {
  margin: 2px 0;
  padding-right: 7px;
  padding-left: 7px;
  border: 1px solid rgba(104, 255, 242, 0.32);
  border-radius: 11px;
  background: rgba(104, 255, 242, 0.08);
}

.leaderboard-entry__rank {
  color: #858da8;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.leaderboard-entry__avatar {
  position: relative;
  width: 44px;
  height: 44px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 10px;
  background:
    radial-gradient(circle at 50% 70%, rgba(126, 108, 255, 0.18), transparent 66%),
    rgba(5, 7, 14, 0.6);
  display: grid;
  place-items: center;
}

.leaderboard-entry__avatar[data-pet="none"]::before {
  width: 13px;
  height: 13px;
  border: 2px solid rgba(157, 165, 188, 0.42);
  border-radius: 50%;
  content: "";
  box-shadow: 0 13px 0 -1px rgba(157, 165, 188, 0.26);
  transform: translateY(-5px);
}

.leaderboard-entry__avatar > .pet-sprite {
  top: 1px;
  right: 4px;
  width: 36px;
  height: 36px;
  background-position: 0 0;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.5));
}

.leaderboard-entry__avatar > .pet-habitat {
  top: 27px;
  right: 4px;
  width: 36px;
  height: 54px;
}

.leaderboard-entry__avatar[data-pet="pancake"] > .pet-habitat--back {
  top: 36px;
  right: 6px;
  width: 32px;
  height: 2px;
}

.leaderboard-entry__avatar[data-pet="pancake"] > .pet-sprite::before {
  top: 14px;
  left: 15px;
  width: 2px;
  height: 2px;
  box-shadow: 6px 0 #140905;
}

.leaderboard-entry__player {
  min-width: 0;
}

.leaderboard-entry__name-line {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.leaderboard-entry__name {
  overflow: hidden;
  color: #e8eaff;
  font-size: 0.82rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-entry__current {
  flex: 0 0 auto;
  padding: 2px 5px;
  border-radius: 999px;
  background: rgba(104, 255, 242, 0.14);
  color: #8efff6;
  font-size: 0.55rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.leaderboard-entry__verification {
  flex: 0 0 auto;
  padding: 2px 5px;
  border: 1px solid rgba(255, 207, 92, 0.28);
  border-radius: 999px;
  color: #d4b76a;
  font-size: 0.52rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.leaderboard-entry__meta {
  margin-top: 2px;
  color: #777f99;
  font-size: 0.66rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.leaderboard-entry__speed-bar {
  width: min(100%, 150px);
  height: 5px;
  margin-top: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.075);
  display: flex;
}

.leaderboard-entry__speed-segment {
  min-width: 0;
  flex: 0 0 0%;
}

.leaderboard-entry__speed-segment--godlike {
  background: #ffd84d;
}

.leaderboard-entry__speed-segment--perfect {
  background: #b77bff;
}

.leaderboard-entry__speed-segment--great {
  background: #5b9fff;
}

.leaderboard-entry__speed-segment--good {
  background: #5fd583;
}

.leaderboard-entry__score {
  color: #f4f5ff;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  white-space: nowrap;
}

.leaderboard-empty {
  padding: 18px 4px 6px;
  color: #858da8;
  font-size: 0.78rem;
  text-align: center;
}

.leaderboard-gap {
  padding: 2px 0 4px 38px;
  color: #69718a;
  font-size: 1rem;
  letter-spacing: 0.12em;
}

.leaderboard-note {
  margin: 10px 0 0;
  color: #707890;
  font-size: 0.64rem;
  line-height: 1.35;
  text-align: center;
}

.leaderboard-admin-panel {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  background: rgba(7, 9, 19, 0.48);
}

.admin-source-tabs {
  margin-bottom: 10px;
}

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

.admin-filters[hidden] {
  display: none;
}

.admin-filters label {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.admin-filters label > span,
.admin-moderation-form > label:first-child {
  color: #aab1c5;
  font-size: 0.66rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.admin-filters select,
.admin-moderation-form textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 11px;
  outline: 0;
  background: rgba(255, 255, 255, 0.065);
  color: white;
  font: inherit;
  font-size: 0.78rem;
}

.admin-filters select {
  min-height: 42px;
  padding: 0 9px;
}

.admin-refresh-button {
  min-height: 42px;
  grid-column: 1 / -1;
}

.admin-results-list {
  max-height: min(390px, 48dvh);
  margin: 8px 0 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
  overscroll-behavior: contain;
}

.admin-results-list[hidden] {
  display: none;
}

.admin-result-row {
  min-width: 0;
  padding: 9px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.075);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.admin-result-row__copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.admin-result-row__copy strong {
  overflow: hidden;
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-result-row__copy span {
  color: #a7aec3;
  font-size: 0.7rem;
}

.admin-result-row__copy small {
  overflow: hidden;
  color: #6f7790;
  font-size: 0.58rem;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-review-button {
  width: auto;
  min-height: 38px;
  padding: 0 11px;
}

.admin-load-more {
  min-height: 42px;
  margin-top: 9px;
}

.admin-review[hidden] {
  display: none;
}

.admin-review-back {
  width: auto;
  min-height: 40px;
  margin-bottom: 10px;
  padding: 0 12px;
}

.admin-review h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.admin-review__details {
  display: grid;
  gap: 6px;
}

.admin-detail-row {
  min-width: 0;
  padding: 7px 9px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.045);
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.admin-detail-row span {
  color: #929ab1;
  font-size: 0.7rem;
}

.admin-detail-row strong {
  overflow-wrap: anywhere;
  font-size: 0.72rem;
  text-align: right;
}

.admin-flag-list {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 5px;
}

.admin-flag-list li {
  padding: 7px 9px;
  border-left: 3px solid #8a93aa;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: #bec4d5;
  font-size: 0.69rem;
  line-height: 1.35;
}

.admin-flag-list li[data-severity="medium"] {
  border-left-color: #ffba52;
}

.admin-flag-list li[data-severity="high"] {
  border-left-color: #ff6278;
}

.admin-moderation-form {
  margin-top: 12px;
  display: grid;
  gap: 7px;
}

.admin-moderation-form[hidden] {
  display: none;
}

.admin-moderation-form textarea {
  min-height: 84px;
  padding: 9px 10px;
  resize: vertical;
}

.admin-moderation-form textarea:focus,
.admin-filters select:focus {
  border-color: #9ba5ff;
  box-shadow: 0 0 0 3px rgba(142, 154, 255, 0.15);
}

.admin-reset-confirm {
  padding: 9px;
  border: 1px solid rgba(255, 98, 120, 0.35);
  border-radius: 10px;
  background: rgba(255, 72, 103, 0.08);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  color: #ffd4da;
  font-size: 0.7rem;
  line-height: 1.4;
}

.admin-reset-confirm[hidden] {
  display: none;
}

.admin-reset-confirm input {
  width: 20px;
  height: 20px;
  margin: 0;
}

.admin-moderation-actions {
  display: grid;
  gap: 8px;
}

.admin-moderation-actions button {
  min-height: 44px;
}

.danger-button {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(255, 100, 123, 0.62);
  border-radius: 13px;
  background: linear-gradient(135deg, #aa2941, #6f1e32);
  color: white;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 900;
  cursor: pointer;
  touch-action: manipulation;
}

.danger-button:focus-visible {
  outline: 3px solid white;
  outline-offset: 2px;
}

.danger-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.primary-button:active,
.secondary-button:active,
.install-button:active,
.leaderboard-toggle:active {
  transform: translateY(1px);
}

.install-note {
  margin: 14px 4px 0;
  color: #848ba3;
  font-size: 0.74rem;
  line-height: 1.4;
  text-align: center;
}

.copyright-footer {
  margin: 16px 0 -4px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.075);
  color: #69718a;
  font-size: 0.62rem;
  letter-spacing: 0.025em;
  line-height: 1.35;
  text-align: center;
}

/* Light keeps every functional panel nearly white while preserving dark text. */
:root[data-theme="light"] .dialog__lead,
:root[data-theme="light"] .mode-group legend,
:root[data-theme="light"] .settings-toggle__value,
:root[data-theme="light"] .install-note,
:root[data-theme="light"] .copyright-footer,
:root[data-theme="light"] .form-status,
:root[data-theme="light"] .leaderboard-status,
:root[data-theme="light"] .result-stat span,
:root[data-theme="light"] .result-score span,
:root[data-theme="light"] .result-score small,
:root[data-theme="light"] .pet-card__copy small,
:root[data-theme="light"] .leaderboard-note,
:root[data-theme="light"] .leaderboard-empty {
  color: #5e7187;
}

:root[data-theme="light"] .secondary-button,
:root[data-theme="light"] .leaderboard-toggle,
:root[data-theme="light"] .settings-toggle,
:root[data-theme="light"] .leaderboard-tab,
:root[data-theme="light"] .setting-row {
  border-color: rgba(62, 108, 139, 0.2);
  background: rgba(255, 255, 255, 0.82);
  color: #17263b;
  box-shadow: 0 6px 18px rgba(63, 121, 157, 0.09);
}

:root[data-theme="light"] .settings-toggle[aria-expanded="true"],
:root[data-theme="light"] .leaderboard-tab.is-active {
  border-color: #159dc7;
  background: #d8f5ff;
  color: #123e55;
}

:root[data-theme="light"] .settings-panel,
:root[data-theme="light"] .pet-card,
:root[data-theme="light"] .pet-preview-button,
:root[data-theme="light"] .achievements-panel,
:root[data-theme="light"] .speed-summary,
:root[data-theme="light"] .result-save-panel,
:root[data-theme="light"] .profile-panel,
:root[data-theme="light"] .score-form,
:root[data-theme="light"] .leaderboard-panel,
:root[data-theme="light"] .leaderboard-admin-panel,
:root[data-theme="light"] .result-stat,
:root[data-theme="light"] .result-score {
  border-color: rgba(65, 111, 140, 0.17);
  background: rgba(255, 255, 255, 0.8);
  color: #17263b;
  box-shadow: 0 8px 24px rgba(61, 117, 151, 0.08);
}

:root[data-theme="light"] .result-stat strong,
:root[data-theme="light"] .leaderboard-player-position {
  color: #087d9f;
  text-shadow: none;
}

:root[data-theme="light"] .leaderboard-entry {
  border-color: rgba(66, 111, 140, 0.13);
  color: #17263b;
}

:root[data-theme="light"] .leaderboard-entry.is-current {
  background: rgba(198, 241, 255, 0.66);
}

:root[data-theme="light"] .leaderboard-entry__score,
:root[data-theme="light"] .leaderboard-entry__name {
  color: #17263b;
}

:root[data-theme="light"] .score-form input,
:root[data-theme="light"] .admin-filters select,
:root[data-theme="light"] .admin-moderation-form textarea {
  border-color: rgba(63, 108, 138, 0.22);
  background: white;
  color: #17263b;
}

:root[data-theme="light"] .copyright-footer {
  border-color: rgba(64, 111, 140, 0.14);
}

/* Pixel uses hard edges, one-pixel lines, and stepped shadows throughout. */
:root[data-theme="pixel"] .dialog,
:root[data-theme="pixel"] .board-shell,
:root[data-theme="pixel"] .tile,
:root[data-theme="pixel"] .primary-button,
:root[data-theme="pixel"] .secondary-button,
:root[data-theme="pixel"] .install-button,
:root[data-theme="pixel"] .leaderboard-toggle,
:root[data-theme="pixel"] .settings-toggle,
:root[data-theme="pixel"] .setting-row,
:root[data-theme="pixel"] .settings-panel,
:root[data-theme="pixel"] .pet-card,
:root[data-theme="pixel"] .pet-preview-button,
:root[data-theme="pixel"] .achievements-panel,
:root[data-theme="pixel"] .speed-summary,
:root[data-theme="pixel"] .result-save-panel,
:root[data-theme="pixel"] .profile-panel,
:root[data-theme="pixel"] .score-form,
:root[data-theme="pixel"] .leaderboard-panel,
:root[data-theme="pixel"] .leaderboard-admin-panel,
:root[data-theme="pixel"] .leaderboard-tab,
:root[data-theme="pixel"] .leaderboard-player-position,
:root[data-theme="pixel"] .result-score,
:root[data-theme="pixel"] .result-stat,
:root[data-theme="pixel"] .coin-balance {
  border-radius: 0;
}

:root[data-theme="pixel"] .secondary-button,
:root[data-theme="pixel"] .leaderboard-toggle,
:root[data-theme="pixel"] .settings-toggle,
:root[data-theme="pixel"] .setting-row,
:root[data-theme="pixel"] .settings-panel,
:root[data-theme="pixel"] .pet-card,
:root[data-theme="pixel"] .achievements-panel,
:root[data-theme="pixel"] .leaderboard-panel,
:root[data-theme="pixel"] .result-score,
:root[data-theme="pixel"] .result-stat {
  border-width: 2px;
  box-shadow: 4px 4px 0 rgba(4, 4, 13, 0.78);
}

:root[data-theme="pixel"] .brand-logo {
  font-style: normal;
  letter-spacing: -0.055em;
  filter: drop-shadow(3px 3px 0 #080815);
  transform: none;
}

:root[data-theme="pixel"] .primary-button,
:root[data-theme="pixel"] .secondary-button {
  box-shadow: 4px 4px 0 #070713;
}

:root[data-theme="pixel"] .tile:active,
:root[data-theme="pixel"] .primary-button:active,
:root[data-theme="pixel"] .secondary-button:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 #070713;
}

@media (max-height: 650px) {
  .board-shell,
  .streak-meter {
    width: min(calc(100vw - 24px), calc(100dvh - 225px), 680px);
  }

  .game--with-pet .board-shell,
  .game--with-pet .streak-meter {
    width: min(calc(100vw - 24px), calc(100dvh - 255px), 680px);
  }
}

@media (max-height: 650px), (max-width: 350px) {
  .pet-scene--menu {
    right: calc(clamp(22px, 6vw, 32px) - 4px);
  }

  .dialog--with-pet > h1,
  .dialog--with-pet > .dialog__lead {
    padding-right: 76px;
  }

  .streak-meter--with-pet {
    margin-top: 20px;
  }
}

@media (max-width: 350px) {
  .overlay {
    padding-right: max(10px, env(safe-area-inset-right));
    padding-left: max(10px, env(safe-area-inset-left));
  }

  .dialog {
    padding-right: 16px;
    padding-left: 16px;
  }

  .dialog-utility {
    gap: 6px;
  }

  .dialog-utility .brand-logo {
    font-size: 1rem;
  }

  .dialog-utility__actions {
    gap: 6px;
  }

  .settings-toggle {
    padding-right: 12px;
    padding-left: 12px;
    gap: 8px;
  }

  .settings-toggle__value {
    min-width: 0;
    font-size: 0.68rem;
    white-space: nowrap;
  }

  .achievements-panel {
    padding: 9px;
  }

  .achievement-card {
    min-height: 72px;
    padding: 8px;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    gap: 7px;
  }

  .achievement-card__check {
    width: 32px;
    height: 32px;
  }

  .achievement-card__copy strong {
    font-size: 0.8rem;
  }

  .achievement-card__copy small {
    font-size: 0.72rem;
  }

  .achievement-card__action {
    min-width: 56px;
  }

  .achievement-card__action strong {
    font-size: 0.7rem;
  }

  .achievement-card__action small {
    font-size: 0.68rem;
  }

  .hud {
    grid-template-columns: minmax(58px, 0.72fr) minmax(138px, 1.72fr) minmax(58px, 0.72fr);
    gap: 6px;
  }

  .hud-side {
    gap: 6px;
  }

  .stat__label {
    font-size: 0.5rem;
  }

  .stat__value {
    font-size: 0.86rem;
  }

  .color-value {
    gap: 6px;
    font-size: 1rem;
  }

  .color-swatch {
    width: 38px;
    height: 38px;
  }

  .pet-card {
    grid-template-columns: 72px minmax(0, 1fr) auto;
    column-gap: 7px;
  }

  .pet-preview-button {
    width: 72px;
  }

}

@media (orientation: landscape) and (max-height: 560px) {
  #app {
    width: 100%;
    padding-top: max(8px, env(safe-area-inset-top));
    display: grid;
    grid-template-columns: minmax(250px, 0.62fr) 1fr;
    grid-template-rows: 1fr;
    gap: 14px;
  }

  .game {
    min-width: 0;
    padding-top: 0;
  }

  .board-shell,
  .streak-meter {
    width: min(calc(100dvh - 84px), calc(100vw - 290px), 680px);
  }

  .game--with-pet .board-shell,
  .game--with-pet .streak-meter {
    width: min(calc(100dvh - 108px), calc(100vw - 290px), 680px);
  }
}

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

  .speed-rating-overlay--visible {
    animation: none !important;
    opacity: 1;
    transform: rotate(var(--speed-rating-tilt));
  }

  .pet-sprite,
  .pet-habitat {
    animation: none !important;
  }

  [data-pose="sleeping"] > .pet-sprite,
  [data-pose="stopped"] > .pet-sprite {
    background-position: 100% 0;
  }
}
