:root {
  --ink-900: #0f2a5e;
  --ink-700: #173a7a;
  --ink-500: #3d63a8;
  --sky-50: #f5fbff;
  --sky-100: #e6f5ff;
  --sky-500: #3fa2ff;
  --sky-lip: #1f6fd1;
  --sun-400: #ffc21a;
  --sun-600: #ff9f0a;
  --sun-lip: #d26f00;
  --grape-500: #9a63ff;
  --grape-lip: #6a3bcb;
  --leaf-500: #3ccb6e;
  --leaf-lip: #1f9a4e;
  --coral-500: #ff5a5f;
  --gold-400: #ffc928;
  --card-lip: #bfd9f2;
  --rarity-common: #cfefff;
  --rarity-rare: #c9f5e6;
  --rarity-epic: #e6d9ff;
  --rarity-legendary: #ffe9a8;
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --radius-pill: 999px;
  --font-display: "Fredoka", "Trebuchet MS", sans-serif;
  --font-body: "DM Sans", Arial, sans-serif;
  --ambient: 0 10px 18px rgb(15 42 94 / 0.18);
  --top-highlight: inset 0 3px 0 rgb(255 255 255 / 0.45);
  --release-ease: cubic-bezier(0.34, 1.56, 0.64, 1);
  --panel-entry: panel-enter;
  --dialog-entry: dialog-pop;
  --list-entry: panel-enter;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 500;
  color: var(--ink-900);
  color-scheme: light;
  font-synthesis: none;
  -webkit-tap-highlight-color: transparent;
}
* {
  box-sizing: border-box;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
html,
body,
#app {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}
body {
  background: var(--sky-500);
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
  touch-action: manipulation;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.02em;
}
button:disabled {
  opacity: 0.55;
  cursor: default;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid var(--ink-700);
  outline-offset: 4px;
}
input,
textarea,
[contenteditable="true"] {
  -webkit-user-select: text;
  user-select: text;
}
img,
canvas {
  -webkit-user-drag: none;
}
.icon {
  display: inline-block;
  width: 24px;
  height: 24px;
  vertical-align: middle;
  flex: none;
}
#world {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}
#ui {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
#ui button,
#ui .panel {
  pointer-events: auto;
}

/* Shared tactile tile: one lip, one ambient shadow and one top highlight. */
.round-button,
.play-button,
.primary,
.secondary,
.home-nav button,
.daily-badge,
.box-badge,
.item-button,
.tabs button,
.panel-nav button,
.mission-claim.ready {
  --button-fill: var(--sky-500);
  --button-lip: var(--sky-lip);
  --lip-depth: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border: 3px solid white;
  border-radius: var(--radius-md);
  color: white;
  background: var(--button-fill);
  box-shadow:
    0 var(--lip-depth) 0 var(--button-lip),
    var(--ambient),
    var(--top-highlight);
  transition:
    transform 160ms var(--release-ease),
    box-shadow 160ms var(--release-ease);
}
.round-button:active:not(:disabled),
.play-button:active:not(:disabled),
.primary:active:not(:disabled),
.secondary:active:not(:disabled),
.home-nav button:active:not(:disabled),
.daily-badge:active:not(:disabled),
.box-badge:active:not(:disabled),
.item-button:active:not(:disabled),
.tabs button:active:not(:disabled),
.panel-nav button:active:not(:disabled),
.mission-claim.ready:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow:
    0 2px 0 var(--button-lip),
    var(--ambient),
    var(--top-highlight);
  transition-duration: 90ms;
  transition-timing-function: ease-out;
}
.primary,
.play-button {
  --button-fill: var(--sun-400);
  --button-lip: var(--sun-lip);
  --lip-depth: 6px;
  min-height: 68px;
  padding: 14px 20px;
  border-radius: var(--radius-lg);
  background: linear-gradient(var(--sun-400), var(--sun-600));
  font-size: 28px;
  -webkit-text-stroke: 3px var(--sun-lip);
  paint-order: stroke fill;
}
.primary .icon,
.play-button .icon {
  width: 30px;
  height: 30px;
}
.secondary {
  min-height: 48px;
  font-size: 17px;
}
.round-button {
  width: 48px;
  height: 48px;
  padding: 9px;
  border-radius: var(--radius-pill);
  flex: none;
}
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-700);
  font-size: 16px;
}
.text-button:active:not(:disabled) {
  background: var(--sky-100);
}
.text-button .icon {
  width: 22px;
  height: 22px;
}
.wide {
  width: 100%;
  margin-top: 16px;
}
.button-row {
  display: flex;
  gap: 12px;
}
.button-row > * {
  flex: 1;
  min-width: 0;
}
.eyebrow {
  color: var(--ink-700);
  font-size: 12px;
  line-height: 1.35;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.muted {
  color: var(--ink-500);
}

/* Home reserves a clear middle for the shared 3D diorama. */
.home-screen {
  position: relative;
  height: 100%;
}
.topbar {
  position: absolute;
  top: max(24px, env(safe-area-inset-top));
  left: 36px;
  right: 36px;
  z-index: 2;
}
.wallets {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
}
.best-pill {
  margin-right: auto;
}
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 7px 12px;
  border: 3px solid white;
  border-radius: var(--radius-pill);
  background: rgb(29 74 154 / 0.9);
  color: white;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.1;
  box-shadow:
    0 5px 0 var(--ink-700),
    var(--ambient),
    var(--top-highlight);
}
.pill > .icon {
  width: 28px;
  height: 28px;
  margin-left: 0;
  flex-shrink: 0;
}
.pill b {
  font-size: 20px;
  font-weight: 700;
  margin-left: 3px;
}
.home-title {
  position: absolute;
  top: 98px;
  left: 16px;
  right: 16px;
  text-align: center;
}
.home-title .eyebrow {
  display: block;
}
.game-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.005em;
  margin: 4px 0 28px;
  font-family: var(--font-display);
  font-size: clamp(100px, 10vw, 132px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.025em;
  color: white;
  -webkit-text-stroke: 6px var(--ink-700);
  paint-order: stroke fill;
  text-shadow:
    0 2px 0 var(--ink-900),
    0 4px 0 var(--ink-900),
    0 6px 0 var(--ink-900),
    0 8px 0 var(--ink-900);
}
.logo-letter,
.logo-coin {
  --letter-angle: -3deg;
  display: inline-block;
  transform: rotate(var(--letter-angle));
  animation: logo-bounce 700ms var(--release-ease) both;
}
.game-logo > :nth-child(even) {
  --letter-angle: 3deg;
}
.game-logo > :nth-child(2) {
  animation-delay: 30ms;
}
.game-logo > :nth-child(3) {
  animation-delay: 60ms;
}
.game-logo > :nth-child(4) {
  animation-delay: 90ms;
  margin-left: 0.05em;
}
.game-logo > :nth-child(5) {
  animation-delay: 120ms;
}
.game-logo > :nth-child(6) {
  animation-delay: 150ms;
}
.logo-it {
  color: var(--sun-400);
}
.logo-coin {
  width: 0.67em;
  height: 0.7em;
  margin: 0.07em 0.025em 0;
  filter: drop-shadow(0 6px 0 var(--ink-900));
}
.logo-coin .icon {
  width: 100%;
  height: 100%;
  vertical-align: top;
}
.home-title p {
  margin: 0;
  color: var(--ink-700);
  font-size: 15px;
  line-height: 1.35;
  font-weight: 700;
}
.home-actions {
  position: absolute;
  top: calc(83.333dvh - 93px);
  left: 50%;
  transform: translateX(-50%);
  width: min(340px, calc(100% - 48px));
  text-align: center;
}
.play-button {
  display: flex;
  width: 100%;
  gap: 12px;
}
.control-caption {
  margin: 14px -8px 0;
  color: var(--ink-700);
  font-size: 12px;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: 0.025em;
}
.control-caption span {
  margin: 0 5px;
}
.home-nav {
  position: absolute;
  bottom: max(36px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: stretch;
  gap: 16px;
  width: min(360px, calc(100% - 32px));
}
.home-nav button {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 80px;
  padding: 8px 10px;
  flex-direction: column;
  gap: 4px;
  border-radius: var(--radius-lg);
}
.home-nav button:first-child {
  --button-fill: var(--grape-500);
  --button-lip: var(--grape-lip);
}
.home-nav button .icon {
  width: 34px;
  height: 34px;
}
.home-nav button span {
  font-size: 14px;
  line-height: 1.05;
}
.daily-badge,
.box-badge {
  position: absolute;
  top: max(88px, calc(env(safe-area-inset-top) + 64px));
  min-height: 44px;
  padding: 8px 12px;
  gap: 8px;
  font-size: 14px;
  text-align: left;
}
.daily-badge {
  left: 36px;
  --button-fill: var(--sky-50);
  --button-lip: var(--card-lip);
  color: var(--ink-700);
}
.daily-badge > .icon,
.box-badge > .icon {
  width: 28px;
  height: 28px;
}
.daily-badge small {
  display: block;
  margin-top: 3px;
  font-family: var(--font-body);
  font-size: 12px;
  line-height: 1.25;
  font-weight: 500;
  letter-spacing: 0;
}
.box-badge {
  right: 36px;
  --button-fill: var(--sun-400);
  --button-lip: var(--sun-lip);
  color: var(--ink-900);
}
.notification-dot {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 14px;
  height: 14px;
  border: 2px solid white;
  border-radius: var(--radius-pill);
  background: var(--coral-500);
  animation: badge-pulse 2s ease-in-out 1;
}
.home-footer {
  position: absolute;
  bottom: 10px;
  left: 36px;
  right: 36px;
  display: flex;
  justify-content: space-between;
  color: var(--ink-700);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.025em;
}
.footer-input .icon {
  width: 18px;
  height: 18px;
  margin-right: 5px;
}

/* Gameplay information stays outside the landing corridor. */
.run-hud {
  position: absolute;
  inset: 0;
}
#app:has(> .scene-transition) .run-hud {
  animation: hud-wipe-reveal 900ms linear both;
}
.pause-button {
  position: absolute;
  left: 24px;
  top: max(24px, env(safe-area-inset-top));
}
.run-score {
  position: absolute;
  top: max(20px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  flex-direction: column;
}
.run-score > span {
  font-family: var(--font-display);
  font-size: 64px;
  line-height: 1;
  font-weight: 700;
  color: white;
  -webkit-text-stroke: 5px var(--ink-700);
  paint-order: stroke fill;
  text-shadow: 0 5px 0 var(--ink-900);
}
.run-score small {
  margin-top: 10px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: white;
  color: var(--ink-700);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
}
.run-coins {
  position: absolute;
  right: 24px;
  top: max(24px, env(safe-area-inset-top));
}
.tutorial-hint {
  position: absolute;
  bottom: 17%;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  width: max-content;
  max-width: min(380px, 85vw);
  padding: 12px 18px;
  border: 3px solid white;
  border-radius: var(--radius-md);
  background: white;
  color: var(--ink-900);
  box-shadow:
    0 5px 0 var(--card-lip),
    var(--ambient);
  text-align: center;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  opacity: 0;
  transition:
    opacity 200ms,
    transform 200ms var(--release-ease);
}
.tutorial-hint::after {
  content: "";
  position: absolute;
  bottom: -9px;
  left: calc(50% - 7px);
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: white;
  transform: rotate(45deg);
}
.tutorial-hint.visible {
  opacity: 1;
  transform: translateX(-50%);
}

/* Modal surfaces share the panel palette; only their scrim blurs. */
.scrim {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 16px
    max(16px, env(safe-area-inset-bottom));
  background: rgb(15 42 94 / 0.35);
  backdrop-filter: blur(6px);
  animation: fade-in 200ms ease-out;
}
.dialog {
  width: 440px;
  max-width: 100%;
  max-height: calc(
    100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom)
  );
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  scrollbar-width: thin;
  scrollbar-color: var(--sky-lip) var(--sky-100);
  padding: 24px;
  border: 4px solid white;
  border-radius: 28px;
  background: var(--sky-50);
  box-shadow:
    0 5px 0 var(--card-lip),
    var(--ambient),
    var(--top-highlight);
  animation: var(--dialog-entry) 240ms ease-out both;
}
.dialog header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.dialog h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.12;
}
.dialog header .round-button {
  width: 44px;
  height: 44px;
}
.dialog-subtitle {
  margin: 16px 0 20px;
  color: var(--ink-500);
  font-size: 15px;
  line-height: 1.5;
}
.result-score {
  display: flex;
  align-items: center;
  flex-direction: column;
  text-align: center;
}
.result-score small,
.result-score span {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.result-score b {
  font-family: var(--font-display);
  font-size: 88px;
  font-weight: 700;
  line-height: 1.05;
  color: var(--ink-700);
}
.result-score span {
  color: var(--ink-500);
}
.run-stats {
  display: flex;
  justify-content: space-around;
  gap: 8px;
  margin: 20px 0;
  padding: 16px 8px;
  border-radius: var(--radius-md);
  background: var(--sky-100);
}
.run-stats > span {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 5px;
  color: var(--ink-500);
  font-size: 12px;
  line-height: 1.2;
  text-align: center;
}
.run-stats b {
  font-family: var(--font-display);
  color: var(--ink-700);
  font-size: 24px;
  font-weight: 700;
}
.settings-list {
  margin: 16px 0;
}
.setting {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-height: 60px;
  padding: 12px 0;
  border: 0;
  border-bottom: 2px solid var(--sky-100);
  background: transparent;
  color: var(--ink-900);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0;
  text-align: left;
}
.toggle {
  position: relative;
  width: 48px;
  height: 28px;
  flex: none;
  border-radius: var(--radius-pill);
  background: var(--card-lip);
  box-shadow: inset 0 2px 0 rgb(15 42 94 / 0.12);
}
.toggle::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-pill);
  background: white;
  transition: transform 160ms ease-out;
}
.toggle.on {
  background: var(--leaf-500);
}
.toggle.on::before {
  transform: translateX(20px);
}
#toast {
  position: absolute;
  top: max(90px, calc(env(safe-area-inset-top) + 64px));
  left: 50%;
  z-index: 30;
  transform: translateX(-50%) translateY(-8px);
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border: 3px solid white;
  border-radius: var(--radius-md);
  background: var(--ink-700);
  color: white;
  box-shadow:
    0 5px 0 var(--ink-900),
    var(--ambient),
    var(--top-highlight);
  font-size: 14px;
  line-height: 1.35;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition:
    opacity 200ms,
    transform 200ms ease-out;
}
#toast.visible {
  opacity: 1;
  transform: translateX(-50%);
}
/* Home feedback uses the clear pocket beside, or below, the diorama. */
#app:has(#ui > .home-screen):not(:has(.panel, .dialog)) #toast {
  top: 150px;
  left: auto;
  right: 36px;
  transform: translateY(-8px);
}
#app:has(#ui > .home-screen):not(:has(.panel, .dialog)) #toast.visible {
  transform: none;
}
/* Panel feedback temporarily occupies the small header label's slot. */
#app:has(.panel):not(:has(.dialog)) #toast {
  top: max(48px, calc(50dvh - 426px));
  bottom: auto;
  max-width: min(440px, calc(100% - 176px));
  padding: 6px 12px;
  transform: translateX(-50%);
}
#app:has(.panel):has(#toast.visible):not(:has(.dialog))
  .panel-header
  > .eyebrow {
  visibility: hidden;
}
#app:has(.dialog) #toast {
  top: auto;
  bottom: max(24px, env(safe-area-inset-bottom));
}
.pop {
  animation: score-pop 180ms ease-out;
}

/* This presentation layer never intercepts a pointer, including its cloned UI. */
.scene-transition,
.scene-transition * {
  pointer-events: none !important;
}
.scene-transition {
  position: absolute;
  inset: 0;
  z-index: 20;
  overflow: hidden;
  animation: transition-life 900ms linear both;
}
.home-transition-copy {
  position: absolute;
  inset: 0;
  animation: home-exit 360ms ease-in both;
}
.home-transition-world {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: home-world-hold 900ms linear both;
}
.home-transition-copy * {
  animation: none !important;
  transition: none !important;
}
.transition-clouds {
  position: absolute;
  inset: 0;
}
.transition-clouds i {
  position: absolute;
  left: -15%;
  top: -30%;
  display: block;
  width: 130%;
  height: 58%;
  border-radius: 48%;
  background: var(--sky-50);
  box-shadow: inset 0 -12px 0 var(--sky-100);
  animation: cloud-wipe 900ms ease-in-out both;
}
.transition-clouds i:nth-child(2) {
  top: -9%;
  left: -25%;
  animation-name: cloud-wipe-back;
}
.transition-clouds i:nth-child(3) {
  top: 13%;
  left: -6%;
}
.transition-clouds i:nth-child(4) {
  top: 35%;
  left: -20%;
  animation-name: cloud-wipe-back;
}
.transition-clouds i:nth-child(5) {
  top: 57%;
  left: -5%;
}
.transition-clouds i:nth-child(6) {
  top: 79%;
  left: -25%;
  animation-name: cloud-wipe-back;
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes panel-enter {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes dialog-pop {
  0% {
    opacity: 0;
    transform: scale(0.94);
  }
  65% {
    opacity: 1;
    transform: scale(1.02);
  }
  100% {
    transform: scale(1);
  }
}
@keyframes logo-bounce {
  from {
    opacity: 0;
    transform: translateY(12px) rotate(0deg);
  }
  65% {
    opacity: 1;
    transform: translateY(-3px) rotate(var(--letter-angle));
  }
  to {
    transform: translateY(0) rotate(var(--letter-angle));
  }
}
@keyframes badge-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.15);
  }
}
@keyframes score-pop {
  50% {
    transform: scale(1.1);
  }
}
@keyframes home-exit {
  to {
    opacity: 0;
    transform: translateY(12px);
  }
}
@keyframes cloud-wipe {
  0% {
    transform: translateX(-120%);
  }
  44%,
  54% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(120%);
  }
}
@keyframes cloud-wipe-back {
  0% {
    transform: translateX(120%);
  }
  44%,
  54% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-120%);
  }
}
@keyframes transition-fade {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}
@keyframes home-world-hold {
  0%,
  44% {
    opacity: 1;
    visibility: visible;
  }
  45%,
  100% {
    opacity: 0;
    visibility: hidden;
  }
}
@keyframes hud-wipe-reveal {
  0%,
  54% {
    opacity: 0;
    visibility: hidden;
  }
  55% {
    opacity: 0;
    visibility: visible;
  }
  100% {
    opacity: 1;
    visibility: visible;
  }
}
@keyframes hud-reduced-reveal {
  from {
    opacity: 0;
    visibility: hidden;
  }
  to {
    opacity: 1;
    visibility: visible;
  }
}
@keyframes transition-life {
  0%,
  98% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    visibility: hidden;
  }
}
@media (max-width: 640px) {
  #app:has(#ui > .home-screen):not(:has(.panel, .dialog)) #toast,
  #app:has(#ui > .home-screen):not(:has(.panel, .dialog)) #toast.visible {
    top: calc(83.333dvh - 135px);
    left: 50%;
    right: auto;
    padding: 3px 14px;
    transform: translateX(-50%);
  }
  #app:has(.panel):not(:has(.dialog)) #toast {
    top: max(16px, env(safe-area-inset-top));
    left: calc(50% - 22px);
    max-width: calc(100% - 184px);
    padding: 4px 6px;
    font-size: 12px;
  }
  .topbar {
    top: max(20px, env(safe-area-inset-top));
    left: 20px;
    right: 20px;
  }
  .wallets {
    gap: 12px;
  }
  .pill {
    padding-right: 12px;
  }
  .home-title {
    top: 140px;
  }
  .game-logo {
    font-size: clamp(84px, 24vw, 108px);
    line-height: 0.96;
  }
  .home-title p {
    font-size: 14px;
  }
  .home-nav {
    bottom: max(28px, env(safe-area-inset-bottom));
    width: min(340px, calc(100% - 32px));
    gap: 12px;
  }
  .daily-badge,
  .box-badge {
    top: max(80px, calc(env(safe-area-inset-top) + 60px));
    font-size: 12px;
    padding: 7px 9px;
    gap: 5px;
  }
  .daily-badge {
    left: 16px;
  }
  .box-badge {
    right: 16px;
  }
  .daily-badge small {
    display: none;
  }
  .daily-badge > .icon,
  .box-badge > .icon {
    width: 24px;
    height: 24px;
  }
  .home-footer {
    display: none;
  }
  .pause-button {
    left: 16px;
  }
  .run-coins {
    right: 16px;
  }
  .dialog {
    padding: 20px;
  }
}
@media (max-width: 640px) and (max-height: 700px) {
  .home-title {
    top: 118px;
  }
  .home-title .eyebrow,
  .home-title p {
    display: none;
  }
  .game-logo {
    font-size: 84px;
    line-height: 0.92;
    margin: 4px 0 0;
  }
  .home-actions {
    width: min(320px, calc(100% - 40px));
  }
  .play-button {
    min-height: 64px;
    padding: 12px 16px;
    font-size: 26px;
  }
  .control-caption {
    margin-top: 12px;
  }
  .home-nav {
    bottom: max(16px, env(safe-area-inset-bottom));
  }
  .home-nav button {
    min-height: 76px;
    padding: 6px 10px;
  }
  .daily-badge,
  .box-badge {
    top: max(76px, calc(env(safe-area-inset-top) + 56px));
  }
  .result-score b {
    font-size: 64px;
  }
  .dialog-subtitle {
    margin: 12px 0;
  }
  .run-stats {
    margin: 14px 0;
    padding: 12px 6px;
  }
}
@media (min-width: 641px) and (max-height: 700px) {
  #app:has(.panel):not(:has(.dialog)) #toast {
    top: 36px;
  }
  .home-title {
    top: 105px;
  }
  .game-logo {
    font-size: 94px;
  }
  .home-actions {
    top: calc(100% - 224px);
  }
  .home-nav {
    bottom: 20px;
  }
  .home-footer {
    display: none;
  }
  .daily-badge,
  .box-badge {
    top: 82px;
  }
}
html.reduced-motion {
  --release-ease: ease-out;
  --panel-entry: fade-in;
  --dialog-entry: fade-in;
  --list-entry: fade-in;
}
html.reduced-motion .logo-letter,
html.reduced-motion .logo-coin {
  animation: none;
  transform: none;
}
html.reduced-motion .notification-dot,
html.reduced-motion .pop {
  animation: none;
}
html.reduced-motion .scene-transition {
  background: transparent;
  animation: transition-fade 150ms linear both;
}
html.reduced-motion .transition-clouds {
  display: none;
}
html.reduced-motion .home-transition-world,
html.reduced-motion .home-transition-copy {
  animation: none;
  opacity: 1;
  visibility: visible;
  transform: none;
}
html.reduced-motion #app:has(> .scene-transition) .run-hud {
  animation: hud-reduced-reveal 150ms steps(1, end) both;
}
@media (prefers-reduced-motion: reduce) {
  :root {
    --release-ease: ease-out;
    --panel-entry: fade-in;
    --dialog-entry: fade-in;
    --list-entry: fade-in;
  }
  .logo-letter,
  .logo-coin {
    animation: none;
    transform: none;
  }
  .notification-dot,
  .pop {
    animation: none;
  }
  .scene-transition {
    background: transparent;
    animation: transition-fade 150ms linear both;
  }
  .transition-clouds {
    display: none;
  }
  .home-transition-world,
  .home-transition-copy {
    animation: none;
    opacity: 1;
    visibility: visible;
    transform: none;
  }
  #app:has(> .scene-transition) .run-hud {
    animation: hud-reduced-reveal 150ms steps(1, end) both;
  }
}

/* Keep gift actions together, with room for both above the mobile logo. */
.box-badge { left: 36px; right: auto; top: max(160px, calc(env(safe-area-inset-top) + 136px)); }
.box-badge:disabled { opacity: .75; }
@media (max-width: 640px) {
  .box-badge { left: 16px; top: max(130px, calc(env(safe-area-inset-top) + 110px)); }
  .home-title { top: 186px; }
  .home-title .eyebrow { display: none; }
}
@media (max-width: 640px) and (max-height: 700px) {
  .box-badge { top: max(126px, calc(env(safe-area-inset-top) + 106px)); }
  .home-title { top: 176px; }
  .game-logo { font-size: 52px; }
}
@media (min-width: 641px) and (max-height: 700px) { .box-badge { top: 154px; } }

.pill { white-space: nowrap; flex-shrink: 0; }
@media (max-width: 640px) { .wallets { gap: 8px; } .pill { gap: 6px; padding-inline: 9px; } .pill > .icon { width: 24px; height: 24px; } }
/* Short embedded and landscape windows reserve the middle for the character. */
@media (max-height: 700px) and (min-aspect-ratio: 6/5) {
  .home-title { top: 18px; }
  .home-title .eyebrow { display: none; }
  .game-logo { font-size: clamp(42px, 12dvh, 72px); }
  .home-actions { top: auto; bottom: 86px; width: min(280px, 44vw); }
  .play-button { min-height: 44px; padding: 8px 14px; font-size: 20px; }
  .play-button .icon { width: 22px; height: 22px; }
  .control-caption { margin-top: 9px; font-size: 9px; }
  .home-nav { bottom: 12px; width: min(300px, 48vw); gap: 10px; }
  .home-nav button { min-height: 48px; padding: 5px 8px; flex-direction: row; border-radius: 16px; }
  .home-nav button .icon { width: 22px; height: 22px; flex-shrink: 0; }
  .home-nav button span { font-size: 10px; }
  .home-footer { display: none; }
  .topbar { top: 12px; left: 12px; right: 12px; }
  .wallets { gap: 8px; }
  .pill { min-height: 34px; padding: 5px 8px; gap: 5px; font-size: 10px; }
  .pill b { font-size: 15px; }
  .pill > .icon { width: 20px; height: 20px; }
  .wallets .round-button { width: 36px; height: 36px; min-height: 36px; }
  .daily-badge, .box-badge { left: 12px; right: auto; min-height: 34px; padding: 5px 8px; font-size: 10px; }
  .daily-badge { top: 60px; }
  .box-badge { top: 104px; }
  .daily-badge small { display: none; }
  .daily-badge > .icon, .box-badge > .icon { width: 20px; height: 20px; }
  .pause-button { top: 12px; width: 38px; height: 38px; min-height: 38px; }
  .run-coins { top: 12px; }
}
@media (max-height: 700px) and (min-aspect-ratio: 6/5) {
  .run-score { top: 10px; }
  .run-score > span { font-size: 40px; -webkit-text-stroke-width: 3px; }
  .run-score small { margin-top: 5px; padding: 3px 8px; font-size: 10px; }
}
/* Progression surfaces share the existing toy-like buttons and dialog shell. */
.mode-link { display:block; margin:10px auto 0; border:0; background:transparent; color:var(--ink-700); font-family:inherit; font-size:11px; font-weight:800; line-height:1.4; padding:8px; cursor:pointer; }
.mode-cards { display:grid; gap:10px; padding:8px 0; }
.mode-cards button { display:block; text-align:left; white-space:normal; padding:14px 18px; }
.mode-cards small { display:block; font-size:12px; font-weight:500; margin-top:5px; line-height:1.4; }
.result-option { border-top:1px solid #ccc8b5; padding:10px 0; font-size:13px; text-align:center; }
.result-option .button-row { justify-content:center; gap:8px; margin-top:6px; }
.result-option button { padding:10px; min-height:44px; }
.token-wallet { padding:14px; background:#eef3dc; border-radius:16px; margin-bottom:16px; }
.dialog { max-height:calc(100dvh - 32px); overflow-y:auto; }
button:disabled { cursor:default; }

/* Results fit the viewport; optional ad actions share one compact row. */
.dialog.results-dialog { overflow: hidden; padding: 18px; touch-action: manipulation; }
.results-dialog .dialog-subtitle { margin: 10px 0; line-height: 1.3; }
.results-dialog .result-score b { font-size: clamp(48px, 10dvh, 76px); }
.results-dialog .run-stats { margin: 12px 0; padding: 10px 6px; }
.result-actions { display: grid; gap: 12px; }
.result-ads, .result-links { display: flex; gap: 10px; }
.result-ads:empty { display: none; }
.result-ads > button, .result-links > button { flex: 1; min-width: 0; }
.results-dialog .continue-ad { padding: 12px 5px; font-size: 15px; gap: 5px; }
.results-dialog .continue-ad .icon { width: 18px; height: 18px; }
.results-dialog .continue-ad-caption { font-size: 11px; }
.results-dialog .text-button { padding: 8px; }
@media (max-height: 600px) {
  .dialog.results-dialog { padding: 12px; }
  .results-dialog h2 { font-size: 23px; }
  .results-dialog .result-score b { font-size: 46px; }
  .results-dialog .run-stats { margin: 8px 0; padding: 6px; }
  .result-actions { gap: 8px; }
  .results-dialog .primary { min-height: 44px; padding: 10px; }
}
@media (max-height: 460px) and (min-width: 560px) {
  .dialog.results-dialog { width: 700px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; }
  .results-dialog header { grid-column: 1 / -1; }
  .results-dialog .result-actions { align-content: center; }
}
.results-dialog .result-actions { grid-template-columns: minmax(0, 1fr); min-width: 0; }
.results-dialog .primary { font-size: 22px; }
.results-dialog .continue-ad-title { gap: 4px; font-size: 13px; white-space: nowrap; }
.results-dialog .continue-ad-title > .icon { display: none; }
.results-dialog .continue-ad-badge { font-size: 10px; padding: 2px 3px; }
