:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ink: #f5f2e9;
  --muted: #aeb3b4;
  --charcoal: #25282b;
  --panel: rgba(26, 28, 30, 0.82);
  --gold: #f5b82e;
  --gold-deep: #d88912;
  --game-frame-inset: 0.85rem;
  --game-frame-border: 3px;
  --game-frame-radius: 1.25rem;
  --poster-background:
    linear-gradient(180deg, rgba(8, 18, 34, 0.62), rgba(8, 18, 34, 0.68) 55%, rgba(8, 18, 34, 0.82)),
    url("../assets/images/disclaimer-background.webp") center / cover no-repeat,
    #101e32;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: #151719;
}

body {
  display: grid;
  place-items: center;
  user-select: none;
  -webkit-user-select: none;
}

button {
  font: inherit;
}

.game-shell {
  --game-fit: cover;
  position: relative;
  isolation: isolate;
  width: 100vw;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  overflow: hidden;
  background: radial-gradient(circle at 50% 35%, #3c4042, #151719 68%);
}

.game-shell::after {
  content: "";
  position: absolute;
  inset: var(--game-frame-inset);
  z-index: 6;
  border: var(--game-frame-border) solid rgba(255, 255, 255, 0.22);
  border-radius: var(--game-frame-radius);
  pointer-events: none;
}

#game-canvas {
  position: absolute;
  left: calc(var(--game-frame-inset) + var(--game-frame-border));
  top: calc(var(--game-frame-inset) + var(--game-frame-border));
  display: block;
  width: calc(100% - 2 * (var(--game-frame-inset) + var(--game-frame-border)));
  height: calc(100% - 2 * (var(--game-frame-inset) + var(--game-frame-border)));
  border-radius: calc(var(--game-frame-radius) - var(--game-frame-border));
  touch-action: none;
}

.css-parallax {
  position: absolute;
  overflow: hidden;
  pointer-events: none;
  border-radius: calc(var(--game-frame-radius) - var(--game-frame-border));
}
.css-parallax-world {
  position: absolute;
  width: 393px;
  height: 852px;
  overflow: hidden;
  transform-origin: 0 0;
  background: linear-gradient(to bottom, #c7cbca 0%, #aeb4b5 55%, #858c8e 100%);
}
.css-parallax-ground { position: absolute; inset: 0; background: #2f3436; }
.css-parallax-track {
  position: absolute;
  left: 0;
  width: 393px;
}
.css-parallax-cycle {
  position: absolute; left: 0; top: 0;
  display: flex; height: 100%;
  will-change: transform;
  animation: css-city-scroll linear infinite;
  animation-play-state: paused;
}
.css-parallax-cycle img { display: block; flex: none; }
@keyframes css-city-scroll {
  from { transform: translateX(var(--start-offset)); }
  to { transform: translateX(calc(var(--start-offset) - var(--travel-width))); }
}

.css-pickups, .css-npc-canvas {
  position: absolute;
  pointer-events: none;
  overflow: hidden;
  border-radius: calc(var(--game-frame-radius) - var(--game-frame-border));
}
.css-pickups-world { position: absolute; width: 393px; height: 852px; overflow: hidden; transform-origin: 0 0; }
.css-pickup-motion, .css-pickup-bob, .css-pickup-pulse { position: absolute; left: 0; will-change: transform; }
.css-pickup-bob, .css-pickup-pulse { top: 0; }
.css-pickup-pulse img { position: absolute; max-width: none; }

.world-ui {
  position: absolute;
  left: var(--world-left, 0px);
  top: var(--world-top, 0px);
  width: var(--world-width, 100%);
  height: var(--world-height, 100%);
  pointer-events: none;
}

.ui-viewport {
  position: fixed;
  z-index: 10;
  top: var(--ui-viewport-top, 0px);
  left: 0;
  width: 100%;
  height: 100vh;
  height: var(--ui-viewport-height, 100dvh);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.ui-viewport:has(.screen:not([hidden])) {
  pointer-events: auto;
}

.ui-shell {
  position: relative;
  width: min(100%, 430px);
  height: 100%;
  min-width: 0;
  container-type: inline-size;
  --ui-content-width: 20rem;
  --ui-padding-inline: clamp(1rem, 6.1cqw, 1.5rem);
  --ui-padding-block: clamp(1rem, 8.1cqw, 2rem);
  --ui-gap: clamp(0.65rem, calc(0.35rem + 2.2cqw), 0.9rem);
  --ui-button-height: clamp(3.5rem, 15.5cqw, 3.8rem);
  --ui-button-padding: clamp(0.85rem, 4.9cqw, 1.2rem);
  --ui-button-radius: clamp(0.7rem, 3.5cqw, 0.85rem);
}

.hud {
  position: absolute;
  z-index: 5;
  bottom: max(0.7rem, calc(env(safe-area-inset-bottom) - var(--world-top, 0px)));
  left: max(0.7rem, calc(env(safe-area-inset-left) - var(--world-left, 0px)));
  right: max(0.7rem, calc(env(safe-area-inset-right) - var(--world-left, 0px)));
  container: hud / inline-size;
  pointer-events: none;
}

.hud-content {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr);
  align-items: stretch;
  gap: 0.4rem;
}

.hud-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.7rem;
  min-width: 0;
  padding: 0 clamp(0.3rem, 3cqw, 0.7rem);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 0.85rem;
  background: rgba(30, 32, 34, 0.78);
  box-shadow: 0 0.3rem 0.85rem rgba(0, 0, 0, 0.16);
  color: var(--ink);
  font-size: clamp(0.875rem, 4.5cqw, 0.95rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  overflow: visible;
}

.hud-beer,
.hud-coffee {
  justify-content: center;
  flex-wrap: wrap;
  padding-block: 0.4rem;
}

.hud-block strong {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.hud-block > .beer-icon,
.hud-block > .coffee-icon {
  flex-shrink: 0;
}

@container hud (max-width: 15rem) {
  .hud-content { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hud-health { grid-column: 1 / -1; min-height: 2.7rem; }
}

.hud-health {
  gap: 0.18rem;
  padding: 0 0.5rem;
}

.hud[hidden],
.screen[hidden],
.touch-prompt[hidden] {
  display: none;
}

.poop-indicator {
  display: flex;
  align-items: center;
  gap: .14rem;
  min-height: 3.25rem;
  padding: 0 .45rem;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: .9rem;
  background: rgba(30,32,34,.78);
}
.poop-indicator svg { width: 1.1rem; height: 1.1rem; fill: #8f705a; opacity: .35; transition: fill 200ms ease, opacity 200ms ease; }
.poop-indicator svg.charged { fill: #5d321d; opacity: 1; }
#coffee-boost { color: #f5b82e; font-size: .7rem; font-weight: 800; white-space: nowrap; }

.hud-score,
.hud-pill {
  min-height: 3.25rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 0.9rem;
  background: rgba(30, 32, 34, 0.78);
  box-shadow: 0 0.35rem 1rem rgba(0, 0, 0, 0.16);
}

.hud-score {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 7.5rem;
  padding: 0.48rem 0.72rem;
}

.hud-score span,
.results span {
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.hud-score strong {
  color: var(--ink);
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.hud-distance strong {
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.hud-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.42rem;
  min-width: 3.65rem;
  padding: 0 0.7rem;
  color: var(--ink);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

.hud-health {
  display: flex;
  gap: 0.2rem;
  align-items: center;
  min-height: 3.25rem;
  padding: 0 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 0.9rem;
  background: rgba(30, 32, 34, 0.78);
}

.health-heart {
  width: 1.05rem;
  height: 1.05rem;
  fill: #f06b62;
  stroke: #ffd6c9;
  stroke-width: 1.5;
  transition: opacity 200ms ease, transform 200ms ease;
}

.health-heart.lost {
  opacity: 0.12;
  transform: scale(0.72);
}

.beer-icon {
  position: relative;
  display: inline-block;
  width: 1.2rem;
  height: 1.5rem;
  border: 0.16rem solid #fff0bd;
  border-bottom: 0.16rem solid #fff0bd;
  border-radius: 0.16rem 0.16rem 0.22rem 0.22rem;
  background: linear-gradient(180deg, #ffd76b 0%, #f5b82e 60%, #d88912 100%);
  box-shadow: inset 0 0.22rem 0 rgba(255, 255, 255, 0.45),
              0 0 0.55rem rgba(245, 184, 46, 0.55);
}
.beer-icon::before {
  content: "";
  position: absolute;
  top: -0.14rem;
  left: -0.06rem;
  right: -0.06rem;
  height: 0.4rem;
  background: #fff7da;
  border-radius: 0.7rem 0.7rem 0.25rem 0.25rem / 0.7rem 0.7rem 0.25rem 0.25rem;
}
.beer-icon::after {
  content: "";
  position: absolute;
  top: 0.36rem;
  right: -0.52rem;
  width: 0.4rem;
  height: 0.62rem;
  border: 0.16rem solid #fff0bd;
  border-left: 0;
  border-radius: 0 0.32rem 0.32rem 0;
}

.coffee-icon {
  position: relative;
  display: inline-block;
  width: 1.2rem;
  height: 1.5rem;
  border: 0.14rem solid #ffffff;
  border-radius: 0.22rem 0.22rem 0.32rem 0.32rem;
  background: #ffffff;
  box-shadow: 0 0 0.55rem rgba(245, 184, 46, 0.55);
  margin-top: 0.55rem;
}

.coffee-icon::after {
  content: "";
  position: absolute;
  top: 0.5rem;
  right: -0.34rem;
  width: 0.28rem;
  height: 0.5rem;
  border: 0.14rem solid #ffffff;
  border-left: 0;
  border-radius: 0 0.28rem 0.28rem 0;
  background: transparent;
}

.coffee-steam {
  position: absolute;
  left: 50%;
  top: -0.55rem;
  width: 1rem;
  height: 0.6rem;
  margin-left: -0.5rem;
  pointer-events: none;
}
.coffee-steam::before,
.coffee-steam::after {
  content: "";
  position: absolute;
  top: 0;
  width: 0.16rem;
  height: 0.55rem;
  border-radius: 0.16rem 0.16rem 0 0;
  border: 0.1rem solid #ffffff;
  border-bottom: 0;
  background: transparent;
}
.coffee-steam::before {
  left: 0.2rem;
  height: 0.55rem;
}
.coffee-steam::after {
  right: 0.2rem;
  height: 0.45rem;
  top: 0.05rem;
}

.screen {
  position: absolute;
  z-index: 10;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding:
    max(var(--ui-padding-block), env(safe-area-inset-top))
    max(var(--ui-padding-inline), env(safe-area-inset-right))
    max(var(--ui-padding-block), env(safe-area-inset-bottom))
    max(var(--ui-padding-inline), env(safe-area-inset-left));
  min-width: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  pointer-events: auto;
  scrollbar-width: thin;
  scroll-padding-block: 1rem;
  overflow-wrap: anywhere;
  color: var(--ink);
  text-align: center;
  background:
    linear-gradient(180deg, rgba(24, 26, 28, 0.2), rgba(24, 26, 28, 0.78)),
    repeating-linear-gradient(90deg, transparent 0 46px, rgba(255, 255, 255, 0.022) 47px 48px);
  backdrop-filter: grayscale(0.8) contrast(1.04);
}

.screen-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 0 auto;
  width: 100%;
  min-width: 0;
  margin-block: auto;
}

.screen-content > * { flex-shrink: 0; max-width: 100%; }

.screen::before {
  content: "";
  position: absolute;
  inset: var(--game-frame-inset);
  z-index: -1;
  border: var(--game-frame-border) solid rgba(255, 255, 255, 0.22);
  border-radius: var(--game-frame-radius);
  pointer-events: none;
}

.screen-start {
  padding-top: max(var(--ui-padding-inline), env(safe-area-inset-top));
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
}

.screen-loading {
  z-index: 20;
  isolation: isolate;
  overflow: hidden;
  padding: 0;
  background: #101e32;
  backdrop-filter: none;
}

.screen-loading::before {
  inset: 0;
  z-index: -1;
  border: 0;
  border-radius: 0;
  background: var(--poster-background);
  transform-origin: center;
  animation: loading-background-zoom 24s linear infinite alternate;
}

.screen-loading.is-tap::before { animation-play-state: paused; }

.screen-loading .screen-content {
  position: absolute;
  inset: 0;
  height: 100%;
  margin: 0;
}

.loading-logo {
  position: absolute;
  top: 44%;
  left: 50%;
  width: 68cqw;
  height: auto;
  transform: translate(-50%, -50%);
  opacity: 0;
}

.screen-loading.is-logo-ready .loading-logo {
  animation: loading-logo-reveal 2.6s ease-out both;
}

@keyframes loading-background-zoom {
  from { transform: scale(1); }
  to { transform: scale(1.12); }
}

@keyframes loading-logo-reveal {
  from { opacity: 0; }
  to { opacity: 1; }
}

.loading-line {
  position: absolute;
  bottom: 14%;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 84%;
  margin: 0;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: center;
}

.screen-loading.is-tap .loading-line:not(.loading-tap) {
  display: none;
}

.screen-loading.is-tap .loading-tap {
  display: block;
  color: var(--gold);
  font-size: 1.05rem;
  padding: 0.6rem 1.2rem;
}

.screen-loading.is-tap .loading-tap::before,
.screen-loading.is-tap .loading-tap::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.5rem;
  height: 0.5rem;
  border: 2px solid var(--gold);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: tap-ripple 1.4s ease-out infinite;
  opacity: 0;
}

.screen-loading.is-tap .loading-tap::after {
  animation-delay: 0.7s;
}

@keyframes tap-ripple {
  0%   { width: 0.5rem; height: 0.5rem; opacity: 0.8; }
  100% { width: 5rem;   height: 5rem;   opacity: 0;   }
}

.screen-loading.is-leaving {
  pointer-events: none;
  opacity: 0;
  transition: opacity 320ms ease;
}

.offline-toast {
  position: absolute;
  z-index: 30;
  bottom: max(1.2rem, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(0.6rem);
  padding: 0.7rem 1.1rem;
  width: max-content;
  max-width: calc(100% - 2rem);
  border: 1px solid rgba(245, 184, 46, 0.45);
  border-radius: 0.7rem;
  color: var(--ink);
  background: rgba(31, 33, 35, 0.92);
  box-shadow: 0 0.6rem 1.6rem rgba(0, 0, 0, 0.32);
  font-size: 0.85rem;
  font-weight: 750;
  letter-spacing: 0.02em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 260ms ease, transform 260ms ease;
  text-align: center;
  overflow-wrap: anywhere;
}
.offline-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.brand-mark {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 7.2rem;
  height: 4.5rem;
  margin-bottom: 1.1rem;
}

.mug {
  position: relative;
  z-index: 2;
  width: 2.5rem;
  height: 3.25rem;
  border: 0.24rem solid #fff1c8;
  border-radius: 0.35rem 0.35rem 0.6rem 0.6rem;
  background: linear-gradient(90deg, #e99f16, #ffc846 55%, #e99f16);
  box-shadow: 0 0.7rem 1.8rem rgba(245, 184, 46, 0.22);
}

.mug::before {
  content: "";
  position: absolute;
  top: -0.2rem;
  left: -0.18rem;
  width: 2.35rem;
  height: 0.72rem;
  border-radius: 0.3rem;
  background: #fff7da;
  box-shadow: 0.45rem -0.23rem 0 -0.08rem #fff7da;
}

.mug::after {
  content: "";
  position: absolute;
  top: 0.54rem;
  right: -1.12rem;
  width: 0.8rem;
  height: 1.55rem;
  border: 0.24rem solid #fff1c8;
  border-left: 0;
  border-radius: 0 0.6rem 0.6rem 0;
}

.wing {
  width: 2.6rem;
  height: 1.45rem;
  border-top: 0.32rem solid #d3d5d2;
  border-radius: 50%;
}

.wing-left {
  transform: rotate(20deg) translateX(0.3rem);
}

.wing-right {
  transform: rotate(-20deg) translateX(-0.3rem);
}

.eyebrow {
  margin: 0 0 0.65rem;
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.22em;
}

h1,
h2 {
  margin: 0;
  color: var(--ink);
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(4.2rem, 22cqw, 6.5rem);
  font-weight: 900;
  letter-spacing: -0.035em;
  line-height: 0.78;
  text-shadow: 0 0.35rem 0 rgba(0, 0, 0, 0.15);
}

.screen-copy {
  margin: 1.35rem 0 1.45rem;
  color: #d2d5d4;
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.45;
}

.start-error {
  margin: 0 0 0.9rem;
  color: #ff8a76;
  font-size: 0.92rem;
  font-weight: 650;
  line-height: 1.4;
  min-height: 1.2em;
  text-align: center;
  text-shadow: 0 0.18rem 0 rgba(0, 0, 0, 0.25);
}
.start-error[hidden] {
  display: none;
}

.primary-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100%, var(--ui-content-width));
  min-height: var(--ui-button-height);
  gap: 0.5rem;
  padding: 0.65rem var(--ui-button-padding);
  border: 0;
  border-radius: var(--ui-button-radius);
  color: #211d12;
  background: var(--gold);
  box-shadow: 0 0.45rem 0 var(--gold-deep), 0 0.8rem 1.8rem rgba(0, 0, 0, 0.28);
  font-size: clamp(0.95rem, 4.1cqw, 1rem);
  font-weight: 950;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
}

.primary-button:hover {
  filter: brightness(1.06);
}

.primary-button:active {
  transform: translateY(0.22rem);
  box-shadow: 0 0.23rem 0 var(--gold-deep), 0 0.5rem 1.2rem rgba(0, 0, 0, 0.25);
}

.primary-button:focus-visible {
  outline: 0.22rem solid var(--ink);
  outline-offset: 0.2rem;
}

.secondary-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(100%, var(--ui-content-width));
  min-height: var(--ui-button-height);
  gap: 0.5rem;
  padding: 0.65rem var(--ui-button-padding);
  border: 0.16rem solid rgba(255, 255, 255, 0.35);
  border-radius: var(--ui-button-radius);
  color: var(--ink);
  background: rgba(30, 32, 34, 0.55);
  box-shadow: 0 0.45rem 0 rgba(0, 0, 0, 0.25);
  font-size: clamp(0.95rem, 4.1cqw, 1rem);
  font-weight: 950;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}
.secondary-button:hover { background: rgba(40, 42, 44, 0.75); border-color: rgba(255, 255, 255, 0.55); }
.secondary-button:active { transform: translateY(0.22rem); box-shadow: 0 0.23rem 0 rgba(0, 0, 0, 0.25); }
.secondary-button:focus-visible { outline: 0.22rem solid var(--ink); outline-offset: 0.2rem; }
.secondary-button:disabled { opacity: 0.4; cursor: not-allowed; }
.secondary-button:disabled:hover { background: rgba(30, 32, 34, 0.55); border-color: rgba(255, 255, 255, 0.35); }

.primary-button > span:first-child,
.secondary-button > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.primary-button > span[aria-hidden] { flex-shrink: 0; }

.button-stack {
  display: flex;
  flex-direction: column;
  gap: clamp(0.6rem, 2.85cqw, 0.7rem);
  width: 100%;
  max-width: var(--ui-content-width);
}

.screen-over .screen-content {
  gap: var(--ui-gap);
}
.screen-over .eyebrow { margin-bottom: 0; }
.screen-over .finish-form {
  display: flex;
  flex-direction: column;
  gap: var(--ui-gap);
}

.control-hint {
  margin: 1.05rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
}

.control-hint span,
.control-hint kbd {
  color: var(--ink);
}

.control-hint kbd {
  padding: 0.18rem 0.4rem;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 0.3rem;
  font-family: inherit;
  font-size: 0.72rem;
}

.screen-over h2 {
  font-size: clamp(3.8rem, 19cqw, 5.8rem);
}

.results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(0.45rem, 2.25cqw, 0.55rem);
  width: min(100%, var(--ui-content-width));
  margin: 0;
}

.results > div {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  min-height: clamp(4.1rem, 18.7cqw, 4.6rem);
  padding: clamp(0.6rem, 3cqw, 0.75rem) clamp(0.65rem, 3.5cqw, 0.85rem);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.75rem;
  background: var(--panel);
  text-align: left;
}

.results .result-main {
  grid-column: 1 / -1;
  min-height: clamp(5.2rem, 23.2cqw, 5.7rem);
  background: linear-gradient(135deg, rgba(245, 184, 46, 0.18), var(--panel) 70%);
}

.results strong {
  margin-top: 0.14rem;
  color: var(--ink);
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: clamp(1.35rem, 6.3cqw, 1.55rem);
  font-variant-numeric: tabular-nums;
}

.results .result-main strong {
  color: var(--gold);
  font-size: clamp(2rem, 9.6cqw, 2.35rem);
}

.results span { font-size: clamp(0.65rem, 2.7cqw, 0.72rem); }

.touch-prompt {
  position: absolute;
  z-index: 6;
  left: 50%;
  bottom: calc(100% + 0.75rem);
  width: max-content;
  max-width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: 99px;
  color: #f1f0eb;
  background: rgba(31, 33, 35, 0.7);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.13em;
  transform: translateX(-50%);
  animation: prompt-pulse 1.4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes prompt-pulse {
  0%, 100% { opacity: 0.48; transform: translateX(-50%) scale(0.97); }
  50% { opacity: 1; transform: translateX(-50%) scale(1); }
}

.screen-leaderboard {
  overflow: hidden;
}

.screen-leaderboard .screen-content {
  height: 100%;
  min-height: 0;
  gap: var(--ui-gap);
  margin: 0;
}

.screen-leaderboard .eyebrow { margin: 0; }
.screen-leaderboard h2 { font-size: clamp(1.8rem, 11cqw, 3rem); }

.screen-content > .leaderboard-body {
  flex: 1 1 auto;
  min-height: 0;
  width: min(100%, 22rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.leaderboard-table {
  width: min(100%, 22rem);
  margin: 0 0 var(--ui-gap);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 0.9rem;
  background: var(--panel);
  overflow: hidden;
}

.leaderboard-header,
.leaderboard-entry {
  display: grid;
  grid-template-columns: 1.6rem minmax(0, 1fr) clamp(3.5rem, 18.4cqw, 4.5rem);
  align-items: center;
  padding: 0.6rem clamp(0.55rem, 3.6cqw, 0.9rem);
  gap: 0.4rem;
}

.leaderboard-header {
  background: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.leaderboard-entry {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--ink);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.leaderboard-entry:last-child { border-bottom: 0; }
.leaderboard-entry .col-rank { color: var(--gold); font-weight: 800; }
.leaderboard-entry .col-name { text-align: left; font-weight: 700; }
.leaderboard-entry .col-score { text-align: right; font-weight: 800; }
.col-rank, .col-score { text-align: right; }
.col-name { text-align: left; }

.leaderboard-entry > span { min-width: 0; overflow-wrap: anywhere; }

.ui-viewport:has(#disclaimer-screen:not([hidden]), #loading-screen:not([hidden])) {
  background: #101925;
}

.ui-shell:has(#disclaimer-screen:not([hidden]), #loading-screen:not([hidden])) {
  --disclaimer-available-height: var(--ui-viewport-height, 100dvh);
  width: min(100%, calc(var(--disclaimer-available-height) * 9 / 16));
  height: auto;
  aspect-ratio: 9 / 16;
  max-height: 100%;
}

.screen-disclaimer {
  padding: 5.175cqw 9.2cqw;
  overflow: hidden;
  background: var(--poster-background);
  backdrop-filter: none;
}

.screen-disclaimer::before { display: none; }

.screen-disclaimer .screen-content {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  justify-items: center;
  height: 100%;
  min-height: 0;
  gap: 1.5cqw;
  margin: 0;
}

.disclaimer-heading { width: 100%; }

.screen-disclaimer h2 {
  font-size: 13cqw;
  line-height: 1;
  white-space: nowrap;
}

.screen-disclaimer .eyebrow {
  display: flex;
  align-items: center;
  gap: 2.5cqw;
  margin: 1.5cqw 2cqw 0;
  color: var(--ink);
  font-size: 3cqw;
  letter-spacing: 0.36em;
  line-height: 1.2;
}

.screen-disclaimer .eyebrow::before,
.screen-disclaimer .eyebrow::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(245, 184, 46, 0.65);
}

.screen-content > .disclaimer-body {
  height: 100%;
  min-height: 0;
  width: 78%;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--gold) transparent;
  text-align: left;
}

.disclaimer-body:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.disclaimer-cast {
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  min-height: 100%;
  margin: 0;
}

.disclaimer-cast > div {
  flex-shrink: 0;
  padding-block: 1.1cqw;
  border-bottom: 1px solid rgba(245, 184, 46, 0.55);
}

.disclaimer-cast > div:last-child { border-bottom: 0; }

.disclaimer-cast dt {
  margin-bottom: 0.5cqw;
  color: var(--gold);
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: 5.3cqw;
  font-weight: 900;
  line-height: 1.05;
}

.disclaimer-cast dd {
  margin: 0;
  font-size: 3.15cqw;
  font-weight: 500;
  line-height: 1.22;
}

.disclaimer-note {
  width: 92%;
  margin: 0;
  padding-block: 1.5cqw;
  border-top: 1px solid rgba(245, 184, 46, 0.35);
  font-size: 2.45cqw;
  font-weight: 500;
  line-height: 1.3;
  text-align: center;
}

.screen-disclaimer .primary-button {
  width: 78%;
  min-height: max(2.75rem, 8.5cqw);
  padding: 1.5cqw 4cqw;
  font-size: 3cqw;
  border-radius: 2cqw;
  box-shadow: 0 0.6cqw 0 var(--gold-deep);
}

@media (min-width: 700px) {
  :root {
    --desktop-game-width: calc(min(852px, calc(100svh - 3rem)) * 393 / 852);
    --desktop-frame-padding: calc(2 * (var(--game-frame-inset) + var(--game-frame-border)));
    --desktop-game-height: calc((var(--desktop-game-width) - var(--desktop-frame-padding)) * 16 / 9 + var(--desktop-frame-padding));
  }

  body {
    background:
      radial-gradient(circle at 50% 35%, #3c4042, #151719 68%);
  }

  .game-shell {
    --game-fit: cover;
    width: var(--desktop-game-width);
    height: var(--desktop-game-height);
    border-radius: 1.8rem;
    outline: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 2rem 6rem rgba(0, 0, 0, 0.48);
  }

  .ui-viewport { padding: 1.5rem; }
  .ui-shell {
    width: max(20rem, var(--desktop-game-width));
    max-width: 100%;
    height: var(--desktop-game-height);
    max-height: 100%;
  }
  .ui-shell:has(#disclaimer-screen:not([hidden]), #loading-screen:not([hidden])) {
    --disclaimer-available-height: min(852px, calc(var(--ui-viewport-height, 100dvh) - 3rem));
  }
  .ui-shell:not(:has(#disclaimer-screen:not([hidden]), #loading-screen:not([hidden]))) {
    flex: 0 0 auto;
    width: 360px;
    height: 640px;
    max-width: none;
    max-height: none;
    transform: scale(var(--desktop-ui-scale, 1));
    --ui-padding-inline: 1.25rem;
    --ui-padding-block: 1.25rem;
    --ui-gap: 0.65rem;
    --ui-button-height: 3rem;
  }
  .screen {
    border-radius: calc((var(--game-frame-radius) - var(--game-frame-border)) / var(--desktop-ui-scale, 1));
  }
  .screen:not(.screen-loading)::before { display: none; }
  .screen-start h1 { font-size: 5rem; }
  .screen-start .eyebrow { display: none; }
  .screen-start .brand-mark { margin-bottom: 0.75rem; }
  .screen-start .screen-copy { margin: 1rem 0 1.25rem; }
  .screen-over h2 { font-size: 3.6rem; }
  .screen-over .results > div { min-height: 3.5rem; padding: 0.5rem 0.75rem; }
  .screen-over .results .result-main { min-height: 4.5rem; }

  .hud {
    width: 336px;
    left: calc(12px * var(--desktop-ui-scale, 1));
    right: auto;
    bottom: calc(12px * var(--desktop-ui-scale, 1));
    transform: scale(var(--desktop-ui-scale, 1));
    transform-origin: bottom left;
  }
}

@media (max-height: 660px) {
  .brand-mark { margin-bottom: 0.55rem; transform: scale(0.8); }
  .screen-copy { margin: 0.8rem 0 1rem; }
  .control-hint { margin-top: 0.7rem; }
}

@media (max-height: 480px) {
  .disclaimer-cast > div { padding-block: 0.35cqw; }
}

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

.screen-over .finish-pane[hidden] { display: none; }
.screen-over .finish-form { width: min(100%, var(--ui-content-width)); margin: 0; }

.finish-pane-name {
  display: flex;
  flex-direction: column;
  gap: var(--ui-gap);
}

.finish-label {
  display: block;
  margin: 0;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-align: left;
}

.finish-input {
  display: block;
  width: 100%;
  min-height: clamp(3.2rem, 13cqw, 3.5rem);
  padding: 0 1rem;
  border: 0.16rem solid rgba(255, 255, 255, 0.22);
  border-radius: 0.7rem;
  background: rgba(20, 22, 24, 0.7);
  color: var(--ink);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
  user-select: text;
  -webkit-user-select: text;
}
.finish-input::placeholder { color: var(--muted); font-weight: 600; }
.finish-input:focus-visible {
  border-color: var(--gold);
  box-shadow: 0 0 0 0.18rem rgba(245, 184, 46, 0.28);
}
.finish-input[aria-invalid="true"] { border-color: #ff8a76; }

.finish-error {
  margin: 0;
  color: #ff8a76;
  font-size: 0.86rem;
  font-weight: 650;
  line-height: 1.35;
  min-height: 1.1em;
  text-align: left;
}
.finish-error[hidden] { display: none; }

.finish-submit {
  width: 100%;
  margin-top: 0;
}
.finish-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: none;
}

.finish-loading-text {
  margin: 0.4rem 0 0.4rem;
  color: var(--gold);
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-align: center;
}

.finish-result-label {
  margin: 0 0 0.3rem;
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.22em;
  text-align: center;
}

.finish-result-line {
  margin: 0 0 0.9rem;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 800;
  text-align: center;
}

.finish-bonus {
  margin: 0.2rem 0 0;
  color: var(--gold);
  font-size: 1.1rem;
  font-weight: 900;
  text-align: center;
}

.claim-code-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  margin: 0.4rem 0 0.5rem;
}

.claim-code-label {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.22em;
}

.claim-code {
  display: inline-block;
  min-width: min(11.5rem, 100%);
  max-width: 100%;
  min-height: 3rem;
  padding: 0.7rem clamp(0.65rem, 4.5cqw, 1.1rem);
  border: 0.16rem solid rgba(245, 184, 46, 0.55);
  border-radius: 0.6rem;
  background: rgba(20, 22, 24, 0.85);
  color: var(--gold);
  font-family: ui-monospace, SFMono-Regular, "Menlo", "Consolas", monospace;
  font-size: clamp(1.15rem, 5.9cqw, 1.45rem);
  font-weight: 900;
  letter-spacing: 0.22em;
  cursor: pointer;
  text-align: center;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}
.claim-code:hover { background: rgba(30, 32, 34, 0.95); border-color: var(--gold); }
.claim-code:active { transform: translateY(0.1rem); }
.claim-code:focus-visible {
  outline: 0.22rem solid var(--ink);
  outline-offset: 0.2rem;
}
.claim-code.is-copied {
  background: rgba(245, 184, 46, 0.22);
  border-color: var(--gold);
}

.claim-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
  text-align: center;
}

.leaderboard-totals {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.45rem;
  width: min(100%, 22rem);
  margin: 0 0 1.1rem;
  padding: 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 0.7rem;
  background: var(--panel);
  font-variant-numeric: tabular-nums;
}
.leaderboard-totals[hidden] { display: none; }
.leaderboard-totals > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 2.2rem;
  min-width: 0;
}
.leaderboard-totals span {
  min-width: 0;
  text-align: left;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.14em;
}
.leaderboard-totals strong {
  max-width: 50%;
  overflow-wrap: anywhere;
  text-align: right;
  color: var(--ink);
  font-size: 1.1rem;
  font-weight: 800;
}

.leaderboard-error {
  margin: 0 0 var(--ui-gap);
  color: #ff8a76;
  font-size: 0.78rem;
  font-weight: 650;
  text-align: center;
}
.leaderboard-error[hidden] { display: none; }

.board-message-host { overflow: hidden; }
.board-message-host:not(.screen) { position: relative; }
.board-message {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 30;
  max-width: min(60%, 16rem);
  padding: 0.35rem 0.6rem;
  border-radius: 0.5rem;
  background: rgba(24, 26, 28, 0.78);
  box-shadow: 0 0 0 1px rgba(245, 184, 46, 0.35);
  color: var(--gold);
  font-size: clamp(0.85rem, 4cqw, 1.05rem);
  font-weight: 900;
  line-height: 1.25;
  letter-spacing: 0.02em;
  text-align: center;
  text-shadow: 0 0.18rem 0 rgba(0, 0, 0, 0.35);
  overflow-wrap: anywhere;
  white-space: normal;
  pointer-events: none;
  user-select: none;
  will-change: transform;
}
.board-message[hidden] { display: none; }
.board-message.is-still {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
