:root {
  --ink: #20304f;
  --ink-soft: #4b6389;
  --white: #fffdf9;
  --cyan: #54d7ff;
  --blue: #3179ff;
  --mint: #55e6a5;
  --lime: #d9fb65;
  --yellow: #ffd84f;
  --coral: #ff6f79;
  --rose: #ff9bb3;
  --violet: #8f6cff;
  --shadow: 0 22px 56px rgba(28, 54, 101, 0.24);
  --tight-shadow: 0 10px 26px rgba(28, 54, 101, 0.18);
  --card-border: rgba(255, 255, 255, 0.72);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

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

body {
  overflow: hidden;
  color: var(--ink);
  background: #a7ecff;
  font-family: "Trebuchet MS", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.95), transparent 18rem),
    linear-gradient(145deg, #78dcff 0%, #baf7f2 42%, #ffe27a 100%);
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  min-height: 100svh;
  overflow-x: hidden;
  overflow-y: auto;
  padding: calc(18px + var(--safe-top)) 18px calc(18px + var(--safe-bottom));
}

.screen.is-active {
  display: flex;
}

.corner-credit-links {
  position: fixed;
  left: max(12px, env(safe-area-inset-left, 0px));
  right: max(12px, env(safe-area-inset-right, 0px));
  bottom: calc(10px + var(--safe-bottom));
  z-index: 12;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.corner-links-left {
  display: grid;
  gap: 6px;
  justify-items: start;
}

.corner-credit-links a {
  pointer-events: auto;
  max-width: min(420px, 46vw);
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 8px 18px rgba(28, 54, 101, 0.14);
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1.2;
  text-decoration: none;
  text-wrap: balance;
  backdrop-filter: blur(12px);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.corner-credit-links a:hover,
.corner-credit-links a:focus-visible {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 26px rgba(28, 54, 101, 0.22), 0 0 0 3px rgba(255, 216, 79, 0.28);
  outline: none;
}

.corner-nft-link {
  justify-self: end;
  text-align: right;
}

.loading-screen,
.intro-screen,
.menu-screen,
.select-screen,
.game-over-screen {
  align-items: center;
  justify-content: center;
}

.menu-screen {
  align-items: flex-start;
  justify-content: flex-start;
}

.menu-screen,
.intro-screen,
.select-screen,
.game-over-screen {
  isolation: isolate;
}

.intro-screen {
  position: relative;
  overflow: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 243, 153, 0.55), transparent 18rem),
    radial-gradient(circle at 18% 18%, rgba(84, 215, 255, 0.16), transparent 16rem),
    radial-gradient(circle at 86% 16%, rgba(255, 155, 179, 0.2), transparent 14rem),
    linear-gradient(180deg, #fffdf9 0%, #f8ffff 46%, #fff8dc 100%);
  text-align: center;
}

.intro-screen.is-fading {
  pointer-events: none;
  animation: introFadeOut 560ms ease forwards;
}

.intro-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.intro-cloud {
  position: absolute;
  display: block;
  width: clamp(120px, 24vw, 280px);
  height: clamp(42px, 7vw, 88px);
  border-radius: 999px;
  background: rgba(201, 245, 255, 0.46);
  filter: blur(0.2px);
  animation: introCloudDrift 12s ease-in-out infinite alternate;
}

.intro-cloud::before,
.intro-cloud::after {
  position: absolute;
  content: "";
  border-radius: 50%;
  background: inherit;
}

.intro-cloud::before {
  left: 18%;
  bottom: 20%;
  width: 42%;
  aspect-ratio: 1;
}

.intro-cloud::after {
  right: 14%;
  bottom: 26%;
  width: 46%;
  aspect-ratio: 1;
}

.cloud-a {
  left: -4%;
  top: 18%;
}

.cloud-b {
  right: -5%;
  top: 13%;
  width: clamp(130px, 28vw, 300px);
  animation-delay: -5s;
}

.cloud-c {
  left: 22%;
  bottom: 12%;
  width: clamp(100px, 18vw, 210px);
  opacity: 0.72;
  animation-delay: -8s;
}

.cloud-d {
  right: 18%;
  bottom: 20%;
  width: clamp(90px, 16vw, 190px);
  opacity: 0.58;
  animation-delay: -3s;
}

.intro-spark {
  position: absolute;
  display: block;
  width: 12px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.82);
  animation: introSparkFloat 5.6s ease-in-out infinite;
}

.spark-a {
  left: 12%;
  top: 30%;
  background: rgba(255, 216, 79, 0.88);
}

.spark-b {
  left: 24%;
  bottom: 22%;
  width: 9px;
  animation-delay: -2s;
}

.spark-c {
  left: 68%;
  top: 24%;
  width: 15px;
  background: rgba(85, 230, 165, 0.78);
  animation-delay: -3.2s;
}

.spark-d {
  right: 16%;
  bottom: 28%;
  width: 10px;
  background: rgba(255, 155, 179, 0.82);
  animation-delay: -1.5s;
}

.spark-e {
  left: 48%;
  top: 15%;
  width: 8px;
  animation-delay: -4.5s;
}

.spark-f {
  right: 36%;
  bottom: 15%;
  width: 13px;
  background: rgba(84, 215, 255, 0.84);
  animation-delay: -2.7s;
}

.spark-g {
  left: 55%;
  top: 35%;
  width: 9px;
  background: rgba(255, 216, 79, 0.9);
  animation-delay: -0.8s;
}

.spark-h {
  right: 24%;
  top: 50%;
  width: 8px;
  background: rgba(217, 251, 101, 0.88);
  animation-delay: -3.8s;
}

.intro-bubble {
  position: absolute;
  bottom: -40px;
  display: block;
  width: 18px;
  aspect-ratio: 1;
  border: 2px solid rgba(84, 215, 255, 0.5);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.36);
  animation: introBubbleRise 5.5s ease-in infinite;
}

.bubble-a {
  left: 12%;
  animation-delay: 0.2s;
}

.bubble-b {
  left: 28%;
  width: 12px;
  animation-delay: 1.4s;
}

.bubble-c {
  right: 20%;
  width: 22px;
  animation-delay: 0.7s;
}

.bubble-d {
  right: 9%;
  width: 13px;
  animation-delay: 2.1s;
}

.bubble-e {
  left: 58%;
  width: 16px;
  animation-delay: 3s;
}

.intro-confetti {
  position: absolute;
  top: 54%;
  display: block;
  width: 12px;
  height: 22px;
  border-radius: 4px;
  background: var(--coral);
  opacity: 0;
  animation: introConfettiBurst 1700ms ease-out 1050ms both;
}

.confetti-a {
  left: 4%;
  background: var(--coral);
  --tx: 170px;
  --ty: -140px;
  --rot: 260deg;
}

.confetti-b {
  left: 8%;
  top: 44%;
  background: var(--yellow);
  --tx: 150px;
  --ty: 70px;
  --rot: 180deg;
  animation-delay: 1220ms;
}

.confetti-c {
  left: 3%;
  top: 63%;
  background: var(--mint);
  --tx: 220px;
  --ty: -20px;
  --rot: 320deg;
  animation-delay: 1360ms;
}

.confetti-d {
  right: 4%;
  background: var(--cyan);
  --tx: -175px;
  --ty: -130px;
  --rot: -240deg;
}

.confetti-e {
  right: 8%;
  top: 45%;
  background: var(--rose);
  --tx: -160px;
  --ty: 75px;
  --rot: -180deg;
  animation-delay: 1220ms;
}

.confetti-f {
  right: 3%;
  top: 64%;
  background: var(--lime);
  --tx: -220px;
  --ty: -10px;
  --rot: -320deg;
  animation-delay: 1360ms;
}

.intro-stage {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  width: min(1120px, 100%);
  min-height: 100%;
  padding: 56px 14px 92px;
}

.intro-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(78vw, 760px);
  height: min(42vw, 340px);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 216, 79, 0.36), rgba(84, 215, 255, 0.22) 42%, transparent 68%);
  filter: blur(4px);
  transform: translate(-50%, -58%);
  animation: introGlowPulse 1600ms ease-in-out infinite;
}

.intro-logo-wrap {
  position: relative;
  width: min(86vw, 980px);
  border-radius: 8px;
  overflow: hidden;
  transform-origin: 50% 62%;
  animation: introLogoPop 920ms cubic-bezier(0.18, 1.45, 0.36, 1) 210ms both, introLogoWiggle 520ms ease-in-out 1040ms both;
}

.intro-cover {
  display: block;
  width: 100%;
  max-height: min(38svh, 360px);
  object-fit: contain;
  filter: drop-shadow(0 20px 24px rgba(32, 48, 79, 0.16));
}

.intro-cover-fallback {
  display: grid;
  place-items: center;
  min-height: min(32svh, 300px);
  padding: 22px;
  color: #05070d;
  font-size: clamp(3rem, 13vw, 8rem);
  font-weight: 1000;
  line-height: 0.88;
  text-shadow: 0 5px 0 rgba(255, 111, 121, 0.62), 0 12px 24px rgba(32, 48, 79, 0.16);
}

.intro-cover-fallback[hidden] {
  display: none;
}

.intro-shine {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 18%, rgba(255, 255, 255, 0.92) 46%, transparent 72%);
  mix-blend-mode: screen;
  transform: translateX(-130%) skewX(-14deg);
  animation: introShineSweep 950ms ease 1300ms both;
}

.intro-orbit {
  position: absolute;
  top: calc(50% - min(22vw, 180px));
  left: 50%;
  z-index: 3;
  width: min(84vw, 840px);
  aspect-ratio: 2.8;
  margin-left: calc(min(84vw, 840px) / -2);
  border-radius: 50%;
  pointer-events: none;
  animation: introOrbitFloat 2600ms ease-in-out infinite;
}

.orbit-b {
  top: calc(50% - min(14vw, 110px));
  width: min(62vw, 620px);
  animation-delay: -1.1s;
}

.intro-coin {
  position: absolute;
  width: clamp(26px, 5vw, 46px);
  aspect-ratio: 1;
  border: 4px solid #172038;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 30%, rgba(255, 255, 255, 0.95), transparent 24%),
    linear-gradient(145deg, #fff170, #ffb84f);
  box-shadow: 0 8px 18px rgba(32, 48, 79, 0.18);
  animation: introCoinFlip 720ms ease-in-out infinite, introCoinBob 1500ms ease-in-out infinite;
}

.coin-a {
  left: 4%;
  top: 44%;
}

.coin-b {
  right: 4%;
  top: 10%;
  animation-delay: -340ms;
}

.coin-c {
  right: 14%;
  bottom: 3%;
  animation-delay: -620ms;
}

.intro-coin::before {
  position: absolute;
  inset: 25%;
  clip-path: polygon(50% 0, 61% 34%, 98% 34%, 68% 55%, 79% 91%, 50% 69%, 21% 91%, 32% 55%, 2% 34%, 39% 34%);
  content: "";
  background: #fffdf9;
}

.burst {
  position: absolute;
  z-index: 5;
  width: 12px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #fffdf9;
  box-shadow:
    0 -28px 0 var(--yellow),
    24px -14px 0 var(--rose),
    24px 14px 0 var(--mint),
    0 28px 0 var(--cyan),
    -24px 14px 0 var(--lime),
    -24px -14px 0 var(--coral);
  opacity: 0;
  animation: introFinalBurst 850ms ease-out 3500ms both;
}

.burst-a {
  left: 28%;
  top: 34%;
}

.burst-b {
  right: 24%;
  top: 28%;
  animation-delay: 3650ms;
}

.burst-c {
  left: 52%;
  top: 44%;
  animation-delay: 3800ms;
}

.intro-stage h1 {
  margin: 20px 0 0;
  color: var(--white);
  font-size: clamp(2.8rem, 9vw, 6.4rem);
  font-weight: 1000;
  line-height: 0.9;
  letter-spacing: 0;
  text-shadow:
    0 5px 0 #197cdf,
    0 10px 0 rgba(255, 111, 121, 0.92),
    0 0 28px rgba(255, 216, 79, 0.62),
    0 22px 36px rgba(25, 124, 223, 0.22);
  animation: introTextPop 620ms cubic-bezier(0.2, 1.5, 0.42, 1) 1050ms both, introTextGlow 1500ms ease-in-out 1700ms infinite;
}

.intro-stage p {
  margin: 12px 0 0;
  color: #153052;
  font-size: clamp(1rem, 3.6vw, 1.35rem);
  font-weight: 1000;
  animation: introTextPop 520ms cubic-bezier(0.2, 1.5, 0.42, 1) 1380ms both;
}

/* The old CSS blob is retained as an unused fallback building block for easy reskinning. */
.intro-gloob {
  position: relative;
  width: clamp(118px, 26vw, 176px);
  aspect-ratio: 0.9;
  border: 7px solid #172038;
  border-radius: 45% 45% 38% 38% / 44% 44% 34% 34%;
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.95), transparent 23%),
    linear-gradient(145deg, #fffdf9 0%, #f7ffe6 52%, #e0fff5 100%);
  box-shadow: 0 26px 40px rgba(32, 48, 79, 0.18);
  transform-origin: 50% 90%;
  animation: introBlobBounce 1200ms cubic-bezier(0.34, 1.56, 0.64, 1) 120ms both, introBlobSquish 1100ms ease-in-out 1150ms infinite;
}

.intro-gloob::before,
.intro-gloob::after {
  position: absolute;
  bottom: -8px;
  width: 34%;
  height: 20%;
  border: 7px solid #172038;
  border-top: 0;
  border-radius: 0 0 999px 999px;
  content: "";
  background: #fffdf9;
}

.intro-gloob::before {
  left: 10%;
}

.intro-gloob::after {
  right: 10%;
}

.intro-eye {
  position: absolute;
  top: 38%;
  width: 11%;
  height: 17%;
  border-radius: 50%;
  background: #05070d;
  animation: introBlink 3400ms ease-in-out 1400ms infinite;
}

.eye-left {
  left: 33%;
}

.eye-right {
  right: 33%;
}

.intro-cheek {
  position: absolute;
  top: 54%;
  width: 18%;
  height: 12%;
  border-radius: 50%;
  background: rgba(255, 155, 179, 0.72);
}

.cheek-left {
  left: 15%;
}

.cheek-right {
  right: 15%;
}

.intro-mouth {
  position: absolute;
  left: 35%;
  top: 62%;
  width: 30%;
  height: 12%;
  border-bottom: 5px solid #172038;
  border-radius: 0 0 999px 999px;
}

.intro-skip {
  position: absolute;
  left: 50%;
  bottom: calc(18px + var(--safe-bottom));
  min-width: min(230px, calc(100% - 36px));
  min-height: 52px;
  padding: 0 22px;
  border: 3px solid rgba(32, 48, 79, 0.82);
  border-radius: 999px;
  color: #153052;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 12px 26px rgba(28, 54, 101, 0.2);
  font-size: 0.96rem;
  font-weight: 1000;
  transform: translateX(-50%);
  transition: transform 160ms ease, box-shadow 160ms ease;
  backdrop-filter: blur(14px);
}

.intro-skip:hover,
.intro-skip:focus-visible {
  transform: translateX(-50%) translateY(-2px) scale(1.03);
  box-shadow: 0 17px 34px rgba(28, 54, 101, 0.24), 0 0 0 5px rgba(255, 216, 79, 0.28);
  outline: none;
}

/* Replace assets/backgrounds/menu-bg.png with your own menu art. */
.menu-screen::before,
.select-screen::before,
.game-over-screen::before {
  position: fixed;
  inset: -4%;
  z-index: -3;
  content: "";
  background:
    linear-gradient(180deg, rgba(85, 215, 255, 0.72), rgba(255, 245, 170, 0.58)),
    url("assets/backgrounds/menu-bg.png") center / cover no-repeat;
  animation: skyDrift 18s ease-in-out infinite alternate;
  transform: scale(1.04);
}

.menu-screen::after,
.select-screen::after,
.game-over-screen::after {
  position: fixed;
  inset: 0;
  z-index: -2;
  content: "";
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.22) 0 1px, transparent 1px 92px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.18) 0 1px, transparent 1px 86px);
  mask-image: linear-gradient(180deg, transparent, #000 18%, #000 78%, transparent);
  opacity: 0.34;
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.ambient span {
  position: absolute;
  display: block;
  width: 14px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.75);
  animation: floatParticle 8s linear infinite;
}

.ambient span:nth-child(1) {
  left: 9%;
  top: 82%;
  width: 18px;
  background: rgba(255, 216, 79, 0.72);
  animation-duration: 11s;
}

.ambient span:nth-child(2) {
  left: 26%;
  top: 18%;
  width: 11px;
  background: rgba(85, 230, 165, 0.72);
  animation-duration: 9s;
  animation-delay: -4s;
}

.ambient span:nth-child(3) {
  left: 49%;
  top: 74%;
  width: 22px;
  background: rgba(255, 155, 179, 0.68);
  animation-duration: 13s;
  animation-delay: -7s;
}

.ambient span:nth-child(4) {
  left: 72%;
  top: 26%;
  width: 16px;
  background: rgba(84, 215, 255, 0.8);
  animation-duration: 10s;
  animation-delay: -2s;
}

.ambient span:nth-child(5) {
  left: 86%;
  top: 72%;
  width: 13px;
  background: rgba(143, 108, 255, 0.58);
  animation-duration: 12s;
  animation-delay: -5s;
}

.ambient span:nth-child(6) {
  left: 38%;
  top: 48%;
  width: 9px;
  background: rgba(255, 255, 255, 0.92);
  animation-duration: 7s;
  animation-delay: -3s;
}

.top-row,
.screen-header,
.game-hud {
  position: fixed;
  left: 16px;
  right: 16px;
  top: calc(14px + var(--safe-top));
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.top-row > *,
.screen-header > *,
.game-hud > * {
  pointer-events: auto;
}

.top-actions,
.hud-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.screen-header {
  position: sticky;
  top: 0;
  left: auto;
  right: auto;
  width: min(1100px, 100%);
  margin: 0 auto 18px;
  padding-top: var(--safe-top);
}

.screen-header h2,
.settings-heading h2,
.pause-panel h2,
.game-over-panel h2 {
  margin: 0;
  font-size: 2rem;
  line-height: 1;
}

.eyebrow {
  margin: 0 0 6px;
  color: #006f91;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.score-badge,
.hud-pill {
  min-width: 86px;
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: var(--tight-shadow);
  text-align: center;
  backdrop-filter: blur(14px);
}

.score-badge small,
.hud-pill small,
.result-grid small {
  display: block;
  color: var(--ink-soft);
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.score-badge strong,
.hud-pill strong,
.result-grid strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 1.35rem;
  line-height: 1;
}

.icon-button,
.back-button {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.58)),
    radial-gradient(circle at 30% 20%, rgba(255, 216, 79, 0.7), transparent 58%);
  box-shadow: var(--tight-shadow);
  transition: transform 160ms ease, box-shadow 160ms ease;
  backdrop-filter: blur(14px);
}

.icon-button:hover,
.back-button:hover,
.icon-button:focus-visible,
.back-button:focus-visible {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 14px 34px rgba(28, 54, 101, 0.24), 0 0 0 4px rgba(255, 255, 255, 0.34);
  outline: none;
}

.icon-button svg,
.back-button svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.sound-toggle {
  overflow: hidden;
  color: #21324f;
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.95), transparent 38%),
    linear-gradient(180deg, rgba(217, 251, 101, 0.92), rgba(84, 215, 255, 0.64));
}

.sound-toggle .sound-off-icon {
  display: none;
}

.sound-emoji {
  display: block;
  font-size: 1.28rem;
  line-height: 1;
  filter: drop-shadow(0 3px 4px rgba(32, 48, 79, 0.16));
}

body.sound-muted .sound-toggle {
  color: #ffffff;
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.28), transparent 40%),
    linear-gradient(180deg, rgba(255, 111, 121, 0.88), rgba(143, 108, 255, 0.66));
}

body.sound-muted .sound-toggle .sound-on-icon {
  display: none;
}

body.sound-muted .sound-toggle .sound-off-icon {
  display: block;
}

.image-icon-button img {
  width: 25px;
  height: 25px;
  object-fit: contain;
  filter: drop-shadow(0 3px 4px rgba(32, 48, 79, 0.16));
}

.image-icon-button img:not([hidden]) + svg {
  display: none;
}

.menu-content {
  width: min(1040px, 100%);
  margin: 66px auto 0;
  text-align: center;
}

.game-title {
  margin: 0 auto 18px;
  color: var(--white);
  font-size: 4rem;
  font-weight: 1000;
  line-height: 0.82;
  text-shadow:
    0 5px 0 #197cdf,
    0 10px 0 rgba(255, 111, 121, 0.92),
    0 20px 34px rgba(25, 124, 223, 0.34);
}

.tagline {
  margin: -6px auto 16px;
  color: #153052;
  font-size: 1rem;
  font-weight: 1000;
  text-shadow: 0 2px 12px rgba(255, 255, 255, 0.62);
}

.selected-hero {
  width: min(520px, 100%);
  margin: 0 auto 18px;
  padding: 12px;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0.44));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-card {
  display: grid;
  grid-template-columns: 98px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  text-align: left;
}

.hero-image {
  position: relative;
  display: grid;
  place-items: center;
  width: 98px;
  aspect-ratio: 1;
  border-radius: 8px;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.96), transparent 36%),
    linear-gradient(145deg, rgba(84, 215, 255, 0.85), rgba(255, 216, 79, 0.74));
  overflow: hidden;
}

.hero-image img,
.character-art img,
.mini-art img {
  width: 86%;
  height: 86%;
  object-fit: contain;
  filter: drop-shadow(0 9px 10px rgba(32, 48, 79, 0.22));
  image-rendering: auto;
}

.image-fallback {
  display: grid;
  place-items: center;
  width: 86%;
  height: 86%;
  padding: 8px;
  border: 3px solid rgba(32, 48, 79, 0.72);
  border-radius: 50%;
  color: #20304f;
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.72rem;
  font-weight: 1000;
  line-height: 1.05;
  text-align: center;
}

.image-fallback[hidden] {
  display: none;
}

.hero-copy h2,
.character-card h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1.42rem;
  line-height: 1;
}

.hero-copy p,
.trait {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
  font-weight: 800;
}

.stat-strip,
.card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.stat-chip {
  padding: 6px 8px;
  border-radius: 8px;
  color: #20415f;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: inset 0 -2px 0 rgba(32, 48, 79, 0.08);
  font-size: 0.76rem;
  font-weight: 900;
}

.menu-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 210px));
  gap: 12px;
  justify-content: center;
  margin: 18px auto;
}

.game-button {
  position: relative;
  min-height: 54px;
  padding: 0 22px;
  border-radius: 18px;
  color: #153052;
  font-size: 1rem;
  font-weight: 1000;
  letter-spacing: 0;
  overflow: hidden;
  box-shadow: 0 12px 0 rgba(30, 77, 146, 0.2), 0 18px 34px rgba(28, 54, 101, 0.24);
  transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease;
}

.game-button span {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  white-space: nowrap;
}

.game-button::after {
  position: absolute;
  inset: 4px 8px auto;
  height: 35%;
  border-radius: 16px;
  content: "";
  background: rgba(255, 255, 255, 0.45);
}

/* Replace assets/ui/select-button.png with your own button texture if desired. */
.game-button.primary {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent 45%),
    url("assets/ui/select-button.png") center / cover no-repeat,
    linear-gradient(135deg, var(--yellow), var(--mint) 48%, var(--cyan));
}

.game-button.secondary {
  color: #20304f;
  background: linear-gradient(135deg, #fffdf9, #d7f7ff 48%, #ffd7e1);
}

.game-button.tertiary {
  color: #20304f;
  background: linear-gradient(135deg, #ff9bb3, #fff1a7 48%, #d9fb65);
}

.game-button:hover,
.game-button:focus-visible {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 15px 0 rgba(30, 77, 146, 0.18), 0 24px 44px rgba(28, 54, 101, 0.28);
  filter: saturate(1.08);
  outline: none;
}

.game-button:active {
  transform: translateY(2px) scale(0.99);
  box-shadow: 0 7px 0 rgba(30, 77, 146, 0.2), 0 12px 24px rgba(28, 54, 101, 0.22);
}

.mini-roster {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  width: min(660px, 100%);
  margin: 0 auto 18px;
}

.mini-card,
.character-card {
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 8px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.42));
  box-shadow: var(--tight-shadow);
  backdrop-filter: blur(16px);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.mini-card {
  display: grid;
  gap: 7px;
  justify-items: center;
  padding: 9px 8px;
  color: var(--ink);
}

.mini-card:hover,
.mini-card:focus-visible,
.character-card:hover,
.character-card:focus-visible {
  transform: translateY(-5px);
  border-color: rgba(255, 255, 255, 0.95);
  box-shadow: 0 18px 40px rgba(28, 54, 101, 0.25), 0 0 0 4px rgba(255, 216, 79, 0.25);
  outline: none;
}

.mini-card.is-selected,
.character-card.is-selected {
  transform: scale(1.035);
  border-color: #fff9ad;
  box-shadow:
    0 18px 44px rgba(28, 54, 101, 0.24),
    0 0 0 3px rgba(255, 216, 79, 0.7),
    0 0 30px rgba(84, 215, 255, 0.72);
}

.mini-art {
  display: grid;
  place-items: center;
  width: 58px;
  aspect-ratio: 1;
  border-radius: 8px;
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.9), transparent 38%),
    linear-gradient(145deg, rgba(255, 216, 79, 0.72), rgba(84, 215, 255, 0.75));
}

.mini-card strong {
  max-width: 100%;
  overflow: hidden;
  font-size: 0.76rem;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-preview {
  width: min(660px, 100%);
  margin: 12px auto 18px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 8px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.74), rgba(255, 255, 255, 0.46));
  box-shadow: var(--tight-shadow);
  text-align: left;
  backdrop-filter: blur(16px);
}

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

.leaderboard-heading h2,
.leaderboard-heading h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1.15rem;
  line-height: 1;
}

.leaderboard-note {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.leaderboard-heading img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  filter: drop-shadow(0 5px 7px rgba(32, 48, 79, 0.18));
}

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

.leaderboard-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) minmax(46px, auto) minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.64);
  box-shadow: inset 0 -2px 0 rgba(32, 48, 79, 0.07);
}

.leaderboard-rank {
  color: #197cdf;
  font-size: 0.95rem;
  line-height: 1;
}

.leaderboard-name,
.leaderboard-character {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 900;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-score {
  justify-self: center;
  padding: 5px 8px;
  border-radius: 8px;
  color: #153052;
  background: rgba(255, 216, 79, 0.76);
  font-size: 0.86rem;
  font-weight: 1000;
}

.leaderboard-date {
  grid-column: 2 / -1;
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 800;
}

.empty-leaderboard {
  margin: 0;
  padding: 12px;
  border-radius: 8px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.58);
  font-size: 0.86rem;
  font-weight: 900;
  text-align: center;
}

.select-screen {
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: calc(18px + var(--safe-top));
}

.select-screen.is-active {
  display: block;
}

.character-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  width: min(1100px, 100%);
  margin: 0 auto 90px;
}

.character-card {
  display: grid;
  gap: 12px;
  padding: 12px;
  color: var(--ink);
  text-align: left;
}

.character-art {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1.12;
  border-radius: 8px;
  background:
    radial-gradient(circle at 34% 25%, rgba(255, 255, 255, 0.96), transparent 34%),
    linear-gradient(135deg, rgba(85, 230, 165, 0.76), rgba(84, 215, 255, 0.72) 52%, rgba(255, 155, 179, 0.62));
  overflow: hidden;
}

.character-card h3 {
  font-size: 1.25rem;
}

.skill-pill {
  display: inline-flex;
  width: fit-content;
  padding: 7px 9px;
  border-radius: 8px;
  color: #193b5f;
  background: rgba(217, 251, 101, 0.76);
  font-size: 0.78rem;
  font-weight: 1000;
}

.card-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card-stats .stat-chip {
  display: grid;
  gap: 3px;
}

.card-stats .stat-chip small {
  color: var(--ink-soft);
  font-size: 0.6rem;
  text-transform: uppercase;
}

.card-stats .stat-chip strong {
  font-size: 0.78rem;
  line-height: 1.1;
}

.trait {
  min-height: 2.4em;
  font-size: 0.82rem;
  line-height: 1.25;
}

.sticky-actions {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9;
  display: flex;
  justify-content: center;
  padding: 12px 18px calc(12px + var(--safe-bottom));
  background: linear-gradient(180deg, transparent, rgba(92, 216, 255, 0.78) 36%, rgba(255, 255, 255, 0.64));
  pointer-events: none;
}

.sticky-actions .game-button {
  width: min(360px, 100%);
  pointer-events: auto;
}

.game-screen {
  padding: 0;
  overflow: hidden;
  background: #9be8ff;
  touch-action: none;
}

.game-screen.is-active {
  display: block;
}

#gameCanvas {
  display: block;
  width: 100vw;
  height: 100svh;
  background: #8fe6ff;
}

.game-hud {
  left: max(12px, env(safe-area-inset-left, 0px));
  right: max(12px, env(safe-area-inset-right, 0px));
  align-items: flex-start;
}

.pause-button {
  width: 50px;
  height: 50px;
}

.pause-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(51, 122, 173, 0.24);
  backdrop-filter: blur(10px);
}

.pause-overlay.is-active {
  display: flex;
}

.pause-panel,
.game-over-panel,
.settings-panel,
.name-panel,
.leaderboard-panel,
.confirm-panel,
.loading-card {
  width: min(390px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.62));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.pause-panel,
.game-over-panel,
.name-panel,
.confirm-panel {
  display: grid;
  gap: 14px;
  justify-items: stretch;
  padding: 20px;
  text-align: center;
  animation: panelPop 260ms cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.game-screen.is-shaking {
  animation: screenShake 380ms ease-in-out both;
}

.game-over-screen {
  text-align: center;
}

.game-over-panel {
  width: min(440px, 100%);
  max-height: calc(100svh - 36px);
  overflow-y: auto;
}

.game-over-panel h2 {
  color: #fffdf9;
  font-size: 3rem;
  text-shadow:
    0 4px 0 #197cdf,
    0 8px 0 rgba(255, 111, 121, 0.95),
    0 18px 30px rgba(25, 124, 223, 0.32);
}

.player-result {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: inset 0 -2px 0 rgba(32, 48, 79, 0.08);
}

.player-result small {
  color: var(--ink-soft);
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.player-result strong {
  color: var(--ink);
  font-size: 1.24rem;
  line-height: 1;
}

.player-result span {
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 900;
}

.game-over-board {
  width: 100%;
  margin: 0;
}

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

.result-grid > div {
  padding: 13px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: inset 0 -2px 0 rgba(32, 48, 79, 0.08);
}

.loading-card {
  display: grid;
  gap: 16px;
  justify-items: center;
  padding: 28px 22px;
  text-align: center;
}

.loading-card h1 {
  margin: 0;
  color: #fffdf9;
  font-size: 3rem;
  line-height: 0.92;
  text-shadow: 0 4px 0 #197cdf, 0 9px 0 rgba(255, 111, 121, 0.92);
}

.loading-orbit {
  width: 74px;
  aspect-ratio: 1;
  border: 8px solid rgba(255, 255, 255, 0.7);
  border-top-color: var(--coral);
  border-right-color: var(--yellow);
  border-bottom-color: var(--cyan);
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}

.loading-bar {
  width: min(280px, 100%);
  height: 16px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(32, 48, 79, 0.12);
  box-shadow: inset 0 2px 4px rgba(32, 48, 79, 0.15);
}

.loading-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--coral), var(--yellow), var(--mint), var(--cyan));
  transition: width 180ms ease;
}

.loading-card p {
  margin: 0;
  color: var(--ink-soft);
  font-weight: 900;
}

.settings-modal,
.name-modal,
.leaderboard-modal,
.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(40, 86, 140, 0.26);
  backdrop-filter: blur(12px);
}

.name-modal,
.leaderboard-modal,
.confirm-modal {
  z-index: 60;
}

.confirm-modal {
  z-index: 70;
}

.settings-modal.is-active,
.name-modal.is-active,
.leaderboard-modal.is-active,
.confirm-modal.is-active {
  display: flex;
}

.settings-panel,
.name-panel,
.leaderboard-panel,
.confirm-panel {
  padding: 18px;
}

.name-panel h2,
.leaderboard-panel h2,
.confirm-panel h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.72rem;
  line-height: 1;
}

.name-panel {
  width: min(430px, 100%);
}

.gloob-input {
  width: 100%;
  min-height: 58px;
  padding: 0 16px;
  border: 4px solid #18243f;
  border-radius: 18px;
  color: var(--ink);
  background: linear-gradient(135deg, #fffdf9, #e0fbff 54%, #ffe0ea);
  box-shadow: inset 0 -4px 0 rgba(32, 48, 79, 0.12), 0 0 0 0 rgba(84, 215, 255, 0);
  font-size: 1.16rem;
  font-weight: 1000;
  outline: none;
  transition: box-shadow 160ms ease, transform 160ms ease, border-color 160ms ease;
}

.gloob-input:focus {
  border-color: #111a2f;
  box-shadow:
    inset 0 -4px 0 rgba(32, 48, 79, 0.1),
    0 0 0 5px rgba(255, 216, 79, 0.42),
    0 0 32px rgba(84, 215, 255, 0.74);
  transform: translateY(-1px);
}

.gloob-input.is-invalid {
  border-color: #ff4b63;
  box-shadow:
    inset 0 -4px 0 rgba(32, 48, 79, 0.1),
    0 0 0 5px rgba(255, 111, 121, 0.26);
}

.name-warning {
  min-height: 1.35em;
  margin: -4px 0 0;
  color: #a61534;
  font-size: 0.92rem;
  font-weight: 1000;
  text-align: center;
}

.modal-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.name-panel .modal-actions {
  grid-template-columns: 1fr;
}

.leaderboard-panel {
  display: grid;
  gap: 12px;
  width: min(560px, 100%);
  max-height: calc(100svh - 36px);
  overflow: hidden;
  animation: panelPop 260ms cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.leaderboard-panel .leaderboard-heading {
  margin-bottom: 0;
}

.leaderboard-list.full {
  max-height: min(56svh, 520px);
  overflow-y: auto;
  padding-right: 3px;
}

.confirm-panel {
  width: min(390px, 100%);
}

.confirm-panel p {
  margin: 0;
  color: var(--ink-soft);
  font-weight: 900;
  line-height: 1.35;
}

.settings-heading,
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.toggle-row {
  margin-top: 18px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink);
  font-weight: 900;
}

.toggle-row input {
  width: 24px;
  height: 24px;
  accent-color: var(--blue);
}

.settings-sound-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  border: 0;
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.62);
  box-shadow: inset 0 -2px 0 rgba(32, 48, 79, 0.08);
  font: inherit;
  font-weight: 900;
  text-align: left;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.settings-sound-row strong {
  min-width: 48px;
  padding: 7px 10px;
  border: 2px solid rgba(32, 48, 79, 0.9);
  border-radius: 999px;
  color: var(--ink);
  background: linear-gradient(180deg, #d9fb65, #54d7ff);
  text-align: center;
  line-height: 1;
}

.settings-sound-row:hover,
.settings-sound-row:focus-visible {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 10px 24px rgba(32, 48, 79, 0.14);
  outline: none;
}

body.sound-muted .settings-sound-row strong {
  color: #ffffff;
  background: linear-gradient(180deg, #ff6f79, #8f6cff);
}

@keyframes skyDrift {
  from {
    transform: translate3d(-1.5%, -1%, 0) scale(1.04);
  }
  to {
    transform: translate3d(1.5%, 1%, 0) scale(1.07);
  }
}

@keyframes floatParticle {
  from {
    transform: translate3d(0, 80px, 0) scale(0.85) rotate(0deg);
    opacity: 0;
  }
  18%,
  82% {
    opacity: 0.95;
  }
  to {
    transform: translate3d(36px, -160px, 0) scale(1.15) rotate(180deg);
    opacity: 0;
  }
}

@keyframes introFadeOut {
  to {
    opacity: 0;
    transform: scale(1.015);
  }
}

@keyframes introCloudDrift {
  from {
    transform: translate3d(-18px, 0, 0);
  }
  to {
    transform: translate3d(28px, -10px, 0);
  }
}

@keyframes introSparkFloat {
  0%,
  100% {
    transform: translate3d(0, 18px, 0) scale(0.8) rotate(0deg);
    opacity: 0.18;
  }
  50% {
    transform: translate3d(20px, -22px, 0) scale(1.15) rotate(95deg);
    opacity: 0.95;
  }
}

@keyframes introBubbleRise {
  0% {
    transform: translate3d(0, 0, 0) scale(0.72);
    opacity: 0;
  }
  16% {
    opacity: 0.62;
  }
  100% {
    transform: translate3d(24px, -108svh, 0) scale(1.15);
    opacity: 0;
  }
}

@keyframes introConfettiBurst {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg) scale(0.55);
    opacity: 0;
  }
  18% {
    opacity: 1;
  }
  100% {
    transform: translate3d(var(--tx), var(--ty), 0) rotate(var(--rot)) scale(1);
    opacity: 0;
  }
}

@keyframes introLogoPop {
  0% {
    transform: translate3d(0, 36px, 0) scale(0.72);
    opacity: 0;
  }
  58% {
    transform: translate3d(0, -10px, 0) scale(1.08);
    opacity: 1;
  }
  76% {
    transform: translate3d(0, 5px, 0) scale(0.97);
  }
  100% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 1;
  }
}

@keyframes introLogoWiggle {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
  22% {
    transform: translate3d(-4px, 0, 0) rotate(-1.2deg);
  }
  48% {
    transform: translate3d(4px, -1px, 0) rotate(1deg);
  }
  72% {
    transform: translate3d(-2px, 1px, 0) rotate(-0.45deg);
  }
}

@keyframes introGlowPulse {
  0%,
  100% {
    opacity: 0.6;
    transform: translate(-50%, -58%) scale(0.95);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -58%) scale(1.08);
  }
}

@keyframes introShineSweep {
  0% {
    transform: translateX(-130%) skewX(-14deg);
    opacity: 0;
  }
  18%,
  70% {
    opacity: 0.72;
  }
  100% {
    transform: translateX(130%) skewX(-14deg);
    opacity: 0;
  }
}

@keyframes introOrbitFloat {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(-2deg);
  }
  50% {
    transform: translate3d(0, -10px, 0) rotate(2deg);
  }
}

@keyframes introCoinBob {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -10px;
  }
}

@keyframes introFinalBurst {
  0% {
    transform: scale(0.2) rotate(0deg);
    opacity: 0;
  }
  34% {
    opacity: 1;
  }
  100% {
    transform: scale(1.65) rotate(120deg);
    opacity: 0;
  }
}

@keyframes introTextGlow {
  0%,
  100% {
    filter: drop-shadow(0 0 0 rgba(255, 216, 79, 0));
  }
  50% {
    filter: drop-shadow(0 0 12px rgba(255, 216, 79, 0.8));
  }
}

@keyframes introBlobBounce {
  0% {
    transform: translate3d(0, -220px, 0) scale(0.8, 1.12);
    opacity: 0;
  }
  62% {
    transform: translate3d(0, 18px, 0) scale(1.12, 0.84);
    opacity: 1;
  }
  82% {
    transform: translate3d(0, -8px, 0) scale(0.94, 1.06);
  }
  100% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 1;
  }
}

@keyframes introBlobSquish {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(0, 4px, 0) scale(1.04, 0.96);
  }
}

@keyframes introBlink {
  0%,
  8%,
  100% {
    transform: scaleY(1);
  }
  4% {
    transform: scaleY(0.08);
  }
}

@keyframes introOrbitSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes introCoinFlip {
  0%,
  100% {
    transform: scaleX(1);
  }
  50% {
    transform: scaleX(0.28);
  }
}

@keyframes introTextPop {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.86);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes panelPop {
  from {
    transform: translateY(22px) scale(0.94);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes screenShake {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  18% {
    transform: translate3d(-7px, 4px, 0);
  }
  36% {
    transform: translate3d(6px, -3px, 0);
  }
  54% {
    transform: translate3d(-4px, 3px, 0);
  }
  72% {
    transform: translate3d(4px, 2px, 0);
  }
}

@media (min-width: 760px) {
  .screen {
    padding: calc(24px + var(--safe-top)) 28px calc(24px + var(--safe-bottom));
  }

  .game-title {
    font-size: 6rem;
  }

  .menu-content {
    margin-top: 58px;
  }
}

@media (max-width: 900px) {
  .character-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: min(640px, 100%);
  }
}

@media (max-width: 620px) {
  .top-row,
  .game-hud {
    left: max(10px, env(safe-area-inset-left, 0px));
    right: max(10px, env(safe-area-inset-right, 0px));
  }

  .corner-credit-links {
    left: max(8px, env(safe-area-inset-left, 0px));
    right: max(8px, env(safe-area-inset-right, 0px));
    bottom: calc(7px + var(--safe-bottom));
    gap: 6px;
  }

  .corner-links-left {
    gap: 4px;
  }

  .corner-credit-links a {
    max-width: calc(50vw - 14px);
    padding: 6px 7px;
    font-size: 0.62rem;
    line-height: 1.15;
  }

  .screen-header {
    align-items: flex-start;
    gap: 9px;
  }

  .screen-header h2 {
    font-size: 1.42rem;
  }

  .game-title {
    font-size: 4.2rem;
  }

  .intro-stage {
    padding: 52px 10px 86px;
  }

  .intro-orbit {
    top: calc(50% - 116px);
    width: min(92vw, 390px);
    margin-left: calc(min(92vw, 390px) / -2);
  }

  .orbit-b {
    top: calc(50% - 78px);
    width: min(72vw, 310px);
  }

  .intro-logo-wrap {
    width: min(96vw, 390px);
  }

  .intro-cover {
    max-height: 31svh;
  }

  .intro-stage h1 {
    max-width: 330px;
    font-size: clamp(2.7rem, 12vw, 4.2rem);
  }

  .hero-card {
    grid-template-columns: 78px minmax(0, 1fr);
  }

  .hero-image {
    width: 78px;
  }

  .hero-copy h2 {
    font-size: 1.18rem;
  }

  .menu-actions {
    grid-template-columns: 1fr;
    width: min(360px, 100%);
  }

  .leaderboard-preview {
    width: min(360px, 100%);
  }

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

  .leaderboard-character {
    grid-column: 2 / -1;
    font-size: 0.74rem;
  }

  .leaderboard-date {
    grid-column: 2 / -1;
  }

  .leaderboard-name,
  .leaderboard-score {
    font-size: 0.82rem;
  }

  .leaderboard-panel {
    max-height: calc(100svh - 24px);
  }

  .leaderboard-list.full {
    max-height: 52svh;
  }

  .modal-actions {
    grid-template-columns: 1fr;
  }

  .gloob-input {
    min-height: 62px;
    font-size: 1.12rem;
  }

  .mini-roster {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: min(360px, 100%);
  }

  .character-grid {
    gap: 10px;
    margin-bottom: 88px;
  }

  .character-card {
    padding: 10px;
  }

  .character-card h3 {
    font-size: 1rem;
  }

  .skill-pill,
  .trait {
    font-size: 0.72rem;
  }

  .card-stats {
    grid-template-columns: 1fr;
  }

  .hud-pill {
    min-width: 76px;
    padding: 8px 10px;
  }

  .hud-pill strong {
    font-size: 1.12rem;
  }

  .pause-button {
    width: 48px;
    height: 48px;
  }
}

@media (max-width: 390px) {
  .game-title {
    font-size: 3.45rem;
  }

  .intro-stage h1 {
    font-size: 3rem;
  }

  .character-grid {
    grid-template-columns: 1fr;
    width: min(310px, 100%);
  }

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

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

  .intro-confetti,
  .intro-bubble,
  .intro-spark,
  .burst,
  .intro-shine {
    display: none;
  }

  .intro-logo-wrap,
  .intro-stage h1,
  .intro-stage p {
    opacity: 1;
    transform: none;
  }
}

body.reduce-motion *,
body.reduce-motion *::before,
body.reduce-motion *::after {
  animation-duration: 1ms !important;
  animation-iteration-count: 1 !important;
  scroll-behavior: auto !important;
  transition-duration: 1ms !important;
}
