/* ============================================================================
   SLINKY STAIRS — UI STYLES
   Candy-casual DOM interface floating over the WebGL canvas.
   (owned by the UI artist — css/style.css)
   ========================================================================== */

@import url("../assets/fonts/fontface.css");

/* ─────────────────────────────── design tokens ─────────────────────────── */
:root {
  --font: 'Baloo2', 'Trebuchet MS', 'Segoe UI', system-ui, -apple-system, sans-serif;

  --plum: #521F3A;
  --plum-2: #7A2A4F;
  --rose: #B0365F;
  --pink: #FF5C8A;
  --pink-dark: #C9305C;
  --pink-light: #FFB3C9;
  --gold: #FFCB3D;
  --gold-2: #FFE066;
  --gold-dark: #C98600;
  --mint: #2FD9B9;
  --mint-dark: #0E9E86;
  --sky: #4FA8FF;
  --sky-2: #8FCBFF;
  --sky-dark: #2C6FD1;
  --grape: #A87CFF;
  --grape-dark: #7550D6;
  --orange: #FF8E3D;
  --orange-dark: #C95F14;
  --cream: #FFF8F0;

  --hard-shadow: 0 0.22em 0 rgba(122, 42, 79, 0.22);
  --soft-shadow: 0 0.7em 1.4em rgba(58, 18, 52, 0.22);
}

/* ──────────────────────────────── base ─────────────────────────────────── */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0c1830;
}

body {
  font-family: var(--font);
  font-weight: 700;
  color: var(--plum);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

button { font-family: inherit; }
svg { display: block; }

.hidden { display: none !important; }
.is-hidden { display: none !important; }

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

#webgl-root {
  position: fixed;
  inset: 0;
  z-index: 0;
  touch-action: none;
}
#webgl-root canvas { display: block; width: 100%; height: 100%; touch-action: none; }

#ui-root {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.ui-screen { position: absolute; inset: 0; }

#fatal-error {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  font-family: var(--font);
  font-size: clamp(16px, 2vw, 22px);
  color: #fff;
  background: linear-gradient(160deg, #2a1240, #120a20);
}
#fatal-error[style*="display: block"],
#fatal-error[style*="display:block"],
#fatal-error[style*="display: flex"],
#fatal-error[style*="display:flex"] { display: flex !important; }

/* ──────────────────────────────── icons ────────────────────────────────── */
.icon {
  width: 1em;
  height: 1em;
  display: inline-block;
  flex: none;
}

/* ─────────────────────────────── logo type ─────────────────────────────── */
.logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 0.84;
  letter-spacing: 0.012em;
  font-weight: 800;
  position: relative;
  z-index: 2;
}
.logo-line {
  display: flex;
  justify-content: center;
  white-space: nowrap;
}
.logo-line--1 { margin-top: -0.045em; }

.logo-letter {
  display: inline-block;
  color: var(--lc);
  -webkit-text-stroke: 0.062em #FFFDF7;
  filter: drop-shadow(0 0.055em 0 var(--ld)) drop-shadow(0 0.12em 0.1em rgba(70, 20, 50, 0.35));
  transform: rotate(var(--lr)) translateY(var(--ly));
  animation:
    letterPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both,
    letterBob 3.6s ease-in-out infinite;
  animation-delay:
    calc(var(--i) * 55ms),
    calc(1.1s + var(--i) * 120ms);
}

.logo--menu { font-size: clamp(44px, min(9.4vw, 13vh), 128px); }
.logo--boot { font-size: clamp(32px, min(6.4vw, 8.4vh), 74px); }

@keyframes letterPop {
  0%   { opacity: 0; transform: rotate(var(--lr)) translateY(0.42em) scale(0.35); }
  60%  { opacity: 1; transform: rotate(var(--lr)) translateY(-0.07em) scale(1.09); }
  100% { opacity: 1; transform: rotate(var(--lr)) translateY(var(--ly)) scale(1); }
}
@keyframes letterBob {
  0%, 100% { transform: rotate(var(--lr)) translateY(var(--ly)); }
  50%      { transform: rotate(calc(var(--lr) * -1)) translateY(calc(var(--ly) - 0.06em)); }
}

/* ───────────────────────────── toy coil (rainbow) ──────────────────────── */
.toy-coil {
  --ring-w: 5.6em;
  --ring-h: 1.62em;
  --ring-gap: 0.4em;
  --ring-bw: 0.44em;
  --n: 10;
  position: relative;
  display: block;
  width: var(--ring-w);
  height: calc(var(--n) * var(--ring-gap) + var(--ring-h) + 0.7em);
  font-size: clamp(10px, 1vw, 14px);
  animation: toyBob 3.4s ease-in-out infinite;
}
.toy-coil--menu { font-size: clamp(11px, 1.15vw + 4px, 16px); }
.toy-coil--boot { font-size: clamp(9px, 0.9vw + 3px, 13px); }
.toy-coil--deco { --ring-w: 5em; --ring-h: 1.4em; --ring-gap: 0.34em; --ring-bw: 0.36em; }
.toy-coil--complete { font-size: clamp(9px, 1vw + 3px, 13px); }

.toy-ring-stack { position: absolute; inset: 0; }
.toy-ring {
  --tx: calc((var(--k) - 2) * 0.05em);
  --tr: calc((var(--k) - 2) * 0.7deg);
  position: absolute;
  left: 50%;
  top: calc(var(--k) * var(--ring-gap));
  width: var(--ring-w);
  height: var(--ring-h);
  margin-left: calc(var(--ring-w) / -2);
  border-radius: 50%;
  border: var(--ring-bw) solid var(--rc);
  border-top-color: var(--rc-light);
  border-bottom-color: var(--rc-dark);
  box-shadow: inset 0 0.07em 0.06em rgba(255, 255, 255, 0.35);
  transform: translateX(var(--tx)) rotate(var(--tr));
  animation: ringSway 2.6s ease-in-out infinite alternate;
  animation-delay: calc(var(--k) * -0.22s);
}
.toy-cap {
  position: absolute;
  left: 50%;
  top: -0.3em;
  width: 82%;
  height: 0.8em;
  transform: translateX(-50%);
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0));
  opacity: 0.75;
  pointer-events: none;
}
.toy-base {
  position: absolute;
  left: 50%;
  bottom: -0.35em;
  width: 125%;
  height: 1.3em;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(70, 25, 55, 0.26), transparent 68%);
  filter: blur(2px);
}
@keyframes toyBob {
  0%, 100% { transform: translateY(0) rotate(-1.6deg); }
  50%      { transform: translateY(-0.38em) rotate(1.6deg); }
}
@keyframes ringSway {
  from { transform: translateX(var(--tx)) rotate(var(--tr)) scaleX(1); }
  to   { transform: translateX(var(--tx)) rotate(var(--tr)) scaleX(0.93) translateY(0.05em); }
}

/* ─────────────────────────────── buttons ───────────────────────────────── */
.btn {
  --g1: #FF9CC1;
  --g2: #FF5C8A;
  --edge: #C9305C;
  --txt: #FFFDF7;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 800;
  font-size: clamp(15px, 1.2vw + 3px, 21px);
  line-height: 1.06;
  letter-spacing: 0.015em;
  color: var(--txt);
  background: linear-gradient(180deg, var(--g1) 0%, var(--g2) 62%, var(--g2) 100%);
  padding: 0.62em 1.2em;
  text-shadow: 0 0.1em 0 rgba(90, 25, 55, 0.32);
  box-shadow:
    0 0.22em 0 var(--edge),
    0 0.55em 1.1em rgba(70, 20, 55, 0.28),
    inset 0 0.12em 0 rgba(255, 255, 255, 0.55),
    inset 0 -0.16em 0 rgba(0, 0, 0, 0.08);
  transition: transform 0.14s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.14s, filter 0.14s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  white-space: nowrap;
}
.btn::before {
  content: '';
  position: absolute;
  inset: 0.1em 0.35em auto;
  height: 38%;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0));
  pointer-events: none;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 0.1em rgba(255, 255, 255, 0.28);
  pointer-events: none;
}
.btn:hover { transform: translateY(-0.08em) scale(1.02); filter: brightness(1.04); }
.btn:active {
  transform: translateY(0.14em) scale(0.988);
  box-shadow:
    0 0.06em 0 var(--edge),
    0 0.18em 0.45em rgba(70, 20, 55, 0.24),
    inset 0 0.1em 0 rgba(255, 255, 255, 0.4);
}
.btn:focus-visible {
  outline: 3px solid #FFF3B0;
  outline-offset: 3px;
}

.btn .icon { width: 1.15em; height: 1.15em; }
.btn-icon { display: inline-flex; align-items: center; justify-content: center; flex: none; }
.btn-stack { display: flex; flex-direction: column; align-items: flex-start; gap: 0.16em; line-height: 1; }
.btn-note {
  font-size: 0.4em;
  font-weight: 800;
  letter-spacing: 0.1em;
  opacity: 0.85;
  text-shadow: none;
  max-width: 20em;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn--gold  { --g1: #FFE066; --g2: #FFC12E; --edge: #C98600; --txt: #6B3500; text-shadow: 0 0.08em 0 rgba(255, 255, 255, 0.35); }
.btn--pink  { --g1: #FF9CC1; --g2: #FF5C8A; --edge: #C9305C; --txt: #FFFFFF; }
.btn--sky   { --g1: #9BD4FF; --g2: #4FA8FF; --edge: #2C6FD1; --txt: #FFFFFF; }
.btn--mint  { --g1: #9FF6E7; --g2: #2FD9B9; --edge: #0E9E86; --txt: #084F44; text-shadow: 0 0.08em 0 rgba(255, 255, 255, 0.3); }
.btn--grape { --g1: #D3BDFF; --g2: #A87CFF; --edge: #7550D6; --txt: #FFFFFF; }
.btn--white {
  --g1: #FFFFFF;
  --g2: #FFF1F7;
  --edge: #E4C0D2;
  --txt: #7A2A4F;
  text-shadow: none;
  box-shadow:
    0 0.2em 0 var(--edge),
    0 0.5em 1em rgba(70, 20, 55, 0.18),
    inset 0 0.12em 0 rgba(255, 255, 255, 0.9);
}

.btn--xl {
  font-size: clamp(24px, 2.4vw + 7px, 40px);
  padding: 0.4em 1.05em;
  border-radius: 0.9em;
}
.btn--xl::before { inset: 0.12em 0.6em auto; height: 36%; }
.btn--md { font-size: clamp(14px, 0.95vw + 3px, 19px); padding: 0.62em 0.9em; border-radius: 999px; }
.btn--block { display: flex; width: 100%; }

/* ─────────────────────────────── tools ─────────────────────────────────── */
.tool {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.42em;
  width: clamp(38px, 2.8vw + 14px, 52px);
  height: clamp(38px, 2.8vw + 14px, 52px);
  padding: 0;
  border: 2.5px solid #FFFFFF;
  border-radius: clamp(12px, 1vw, 17px);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 240, 248, 0.88));
  color: var(--plum-2);
  cursor: pointer;
  font-size: 1rem;
  box-shadow:
    0 0.2em 0 rgba(122, 42, 79, 0.24),
    0 0.45em 0.9em rgba(60, 20, 50, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: transform 0.13s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.13s, box-shadow 0.13s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.tool .icon { width: 1.35em; height: 1.35em; }
.tool:hover { transform: translateY(-0.1em); filter: brightness(1.05); }
.tool:active { transform: translateY(0.08em) scale(0.97); }
.tool:focus-visible { outline: 3px solid #FFF3B0; outline-offset: 3px; }

.tool--hint {
  width: auto;
  padding: 0 0.9em;
  gap: 0.4em;
  color: #6B3500;
  background: linear-gradient(180deg, #FFE066, #FFC12E);
  box-shadow:
    0 0.2em 0 #C98600,
    0 0.45em 0.9em rgba(160, 100, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  font-weight: 800;
  font-size: clamp(11px, 0.85vw + 3px, 14px);
  letter-spacing: 0.07em;
}
.tool--menubtn { color: #7A2A4F; }
.tool.is-off {
  color: #A5798D;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(240, 228, 236, 0.66));
}
.tool.is-off .icon { opacity: 0.8; }
.tool.is-off::after {
  content: '';
  position: absolute;
  left: 22%;
  right: 22%;
  top: 50%;
  height: 2.5px;
  border-radius: 2px;
  background: currentColor;
  transform: rotate(-38deg);
  opacity: 0.35;
}
.tools-divider {
  width: 2px;
  height: 1.7em;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.35);
  margin: 0 1px;
}

/* ═════════════════════════════════ BOOT ════════════════════════════════ */
.boot-screen {
  z-index: 90;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(175deg, #7FE0FF 0%, #A8ECFF 34%, #D8F3FF 56%, #FFD9EC 82%, #FFF3C9 100%);
  transition: opacity 0.46s ease, transform 0.46s ease;
}
.boot-screen.is-out { opacity: 0; transform: scale(1.035); pointer-events: none; }
.boot-sky { position: absolute; inset: 0; overflow: hidden; }
.boot-inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(6px, 1.2vh, 14px);
  padding: 24px;
  text-align: center;
}
.boot-mascot { margin-bottom: clamp(2px, 1vh, 10px); }
.boot-tagline {
  margin: 0;
  font-size: clamp(12px, 1vw + 6px, 18px);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #FFFDF7;
  text-shadow: 0 2px 0 rgba(122, 42, 79, 0.32), 0 6px 14px rgba(70, 20, 55, 0.2);
}
.boot-loader {
  width: min(290px, 72vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: clamp(4px, 1.4vh, 12px);
}
.boot-loader-track {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: inset 0 2px 4px rgba(122, 42, 79, 0.16), 0 2px 0 rgba(255, 255, 255, 0.4);
}
.boot-loader-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #FF5C8A, #FFCB3D 55%, #2FD9B9);
  box-shadow: 0 0 10px rgba(255, 142, 61, 0.65);
  transition: width 0.35s ease;
}
.boot-loader-label {
  font-size: clamp(10px, 0.6vw + 7px, 13px);
  font-weight: 800;
  letter-spacing: 0.18em;
  color: #FFFDF7;
  text-shadow: 0 2px 0 rgba(122, 42, 79, 0.3);
}

/* boot scenery */
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(34px);
  opacity: 0.55;
  will-change: transform;
}
.blob--1 {
  width: 48vmax; height: 48vmax;
  left: -16vmax; top: -16vmax;
  background: radial-gradient(circle, #FFB3C9, transparent 70%);
  animation: blobDrift 12s ease-in-out infinite alternate;
}
.blob--2 {
  width: 42vmax; height: 42vmax;
  right: -14vmax; bottom: -14vmax;
  background: radial-gradient(circle, #FFE9A8, transparent 70%);
  animation: blobDrift 16s ease-in-out infinite alternate-reverse;
}
.blob--3 {
  width: 34vmax; height: 34vmax;
  right: 4vmax; top: -14vmax;
  background: radial-gradient(circle, #B4DBFF, transparent 70%);
  animation: blobDrift 20s ease-in-out infinite alternate;
}
.cloud {
  position: absolute;
  background: #FFFFFF;
  border-radius: 999px;
  opacity: 0.78;
  filter: blur(0.5px);
  box-shadow: 0 12px 30px rgba(120, 180, 220, 0.28);
}
.cloud::before, .cloud::after {
  content: '';
  position: absolute;
  background: #FFFFFF;
  border-radius: 50%;
}
.cloud--1 { width: 170px; height: 46px; left: 7%; top: 17%; animation: cloudDrift 26s ease-in-out infinite alternate; }
.cloud--1::before { width: 74px; height: 74px; left: 26px; top: -34px; }
.cloud--1::after  { width: 54px; height: 54px; right: 24px; top: -24px; }
.cloud--2 { width: 126px; height: 36px; right: 9%; top: 31%; animation: cloudDrift 34s ease-in-out infinite alternate-reverse; }
.cloud--2::before { width: 58px; height: 58px; left: 20px; top: -27px; }
.cloud--2::after  { width: 42px; height: 42px; right: 18px; top: -18px; }
.cloud--3 { width: 150px; height: 40px; left: 12%; bottom: 16%; animation: cloudDrift 30s ease-in-out infinite alternate; }
.cloud--3::before { width: 64px; height: 64px; left: 22px; top: -30px; }
.cloud--3::after  { width: 48px; height: 48px; right: 20px; top: -21px; }
.boot-spark {
  position: absolute;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 0 12px 4px rgba(255, 255, 255, 0.85);
  animation: twinkle 2.6s ease-in-out infinite;
}
.boot-spark--1 { left: 22%; top: 26%; }
.boot-spark--2 { right: 24%; top: 20%; animation-delay: 0.8s; width: 6px; height: 6px; }
.boot-spark--3 { right: 30%; bottom: 22%; animation-delay: 1.5s; }

@keyframes blobDrift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(4vw, 3vh, 0) scale(1.12); }
}
@keyframes cloudDrift {
  from { transform: translateX(-4vw); }
  to   { transform: translateX(4vw); }
}
@keyframes twinkle {
  0%, 100% { opacity: 0.25; transform: scale(0.7); }
  50%      { opacity: 1; transform: scale(1.15); }
}

/* ═════════════════════════════════ MENU ════════════════════════════════ */
.menu-screen {
  pointer-events: auto;
  background:
    radial-gradient(ellipse 70% 58% at 50% 44%, rgba(30, 10, 50, 0) 0%, rgba(30, 10, 45, 0.16) 100%);
}
/* soft scrim behind the hero/buttons: keeps copy readable over pale skies
   while staying transparent enough to show the 3D scene */
.menu-screen::after {
  content: '';
  position: absolute;
  inset: 16% 0 8%;
  background: radial-gradient(ellipse 86% 64% at 50% 54%, rgba(52, 16, 62, 0.2), rgba(52, 16, 62, 0.06) 56%, transparent 78%);
  pointer-events: none;
  z-index: 1;
}
.menu-deco {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.deco-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(44px);
  opacity: 0.5;
  mix-blend-mode: screen;
  will-change: transform;
}
.deco-blob--1 { width: 34vmax; height: 34vmax; left: -12vmax; top: -12vmax; background: radial-gradient(circle, #FF9CC1, transparent 70%); animation: blobDrift 16s ease-in-out infinite alternate; }
.deco-blob--2 { width: 30vmax; height: 30vmax; right: -10vmax; top: -8vmax; background: radial-gradient(circle, #B4DBFF, transparent 70%); animation: blobDrift 19s ease-in-out infinite alternate-reverse; }
.deco-blob--3 { width: 36vmax; height: 36vmax; left: -12vmax; bottom: -14vmax; background: radial-gradient(circle, #D9C8FF, transparent 70%); animation: blobDrift 22s ease-in-out infinite alternate; }
.deco-blob--4 { width: 28vmax; height: 28vmax; right: -8vmax; bottom: -12vmax; background: radial-gradient(circle, #FFE9A8, transparent 70%); animation: blobDrift 18s ease-in-out infinite alternate-reverse; }

.deco-coil {
  position: absolute;
  opacity: 0.85;
  filter: drop-shadow(0 14px 22px rgba(70, 25, 55, 0.25));
  animation: floatSoft 7s ease-in-out infinite;
}
.deco-coil--left  { left: -2vmin; top: 46%; transform: scale(0.62) rotate(-26deg); animation-delay: -1.5s; }
.deco-coil--right { right: -1vmin; top: 26%; transform: scale(0.46) rotate(22deg); animation-delay: -3.5s; }

.deco-confetti {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 7px;
  height: 12px;
  border-radius: 2px;
  background: var(--c);
  opacity: 0.4;
  animation: decoFloat var(--d) ease-in-out var(--dl) infinite alternate;
  will-change: transform;
}
.deco-star {
  position: absolute;
  color: rgba(255, 255, 255, 0.7);
  font-style: normal;
  text-shadow: 0 0 16px rgba(255, 203, 61, 0.8);
  animation: starFloat 9s ease-in-out infinite;
}
.deco-star--1 { left: 9%; top: 14%; font-size: clamp(22px, 3vw, 40px); }
.deco-star--2 { right: 12%; bottom: 20%; font-size: clamp(16px, 2.2vw, 28px); animation-delay: -2s; color: rgba(255, 233, 168, 0.8); }
.deco-star--3 { right: 22%; top: 8%; font-size: clamp(12px, 1.8vw, 22px); animation-delay: -4s; }

.menu-inner {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(2px, 0.8vh, 8px);
  padding: clamp(12px, 3vh, 34px) 16px clamp(46px, 7vh, 76px);
}
.menu-mascot {
  margin-bottom: clamp(0px, 0.8vh, 10px);
  filter: drop-shadow(0 16px 22px rgba(70, 25, 55, 0.28));
  transform: rotate(-5deg);
}
.tagline {
  margin: clamp(6px, 1.2vh, 12px) 0 0;
  font-size: clamp(13px, 0.9vw + 6px, 22px);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #FFFDF7;
  text-shadow: 0 2px 0 rgba(122, 42, 79, 0.4), 0 6px 14px rgba(70, 20, 50, 0.3);
  z-index: 2;
}
.tagline span {
  display: inline-block;
  padding: 0.34em 1.05em;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(84, 26, 62, 0.4), rgba(84, 26, 62, 0.24));
  border: 2px solid rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 12px rgba(60, 20, 50, 0.18);
}
.menu-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(10px, 1.7vh, 18px);
  width: min(570px, 94vw);
  margin-top: clamp(10px, 1.8vh, 22px);
  z-index: 2;
}
.btn--play { width: min(430px, 94%); }
.menu-row { display: flex; gap: clamp(8px, 1.2vw, 16px); width: min(430px, 94%); }
.menu-row .btn { flex: 1; padding-left: 0.4em; padding-right: 0.4em; }

.menu-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  margin-top: clamp(10px, 2vh, 22px);
  padding: 0.36em 0.95em;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(84, 26, 62, 0.34), rgba(84, 26, 62, 0.18));
  border: 2px solid rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(6px);
  color: #FFFFFF;
  font-size: clamp(10px, 0.55vw + 7px, 15px);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-shadow: 0 2px 0 rgba(90, 30, 70, 0.38);
  z-index: 2;
  max-width: 94vw;
  flex-wrap: wrap;
  row-gap: 0.2em;
}
.menu-progress-stars { display: inline-flex; align-items: center; gap: 0.25em; color: #FFE066; }
.menu-progress-stars .icon { width: 1.1em; height: 1.1em; filter: drop-shadow(0 2px 0 rgba(122, 42, 79, 0.4)); }
.menu-progress-stars b { color: #FFFDF7; font-size: 1.1em; }
.menu-progress-stars span { opacity: 0.85; font-size: 0.92em; }
.menu-progress-dot { width: 4px; height: 4px; border-radius: 50%; background: rgba(255, 255, 255, 0.65); flex: none; }
.menu-progress-label { color: #FFFDF7; white-space: nowrap; }

.menu-sound {
  position: absolute;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  display: flex;
  gap: 8px;
  z-index: 3;
}
.menu-tag {
  position: absolute;
  left: max(16px, env(safe-area-inset-left));
  bottom: max(16px, env(safe-area-inset-bottom));
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.24em;
  color: rgba(255, 255, 255, 0.72);
  text-shadow: 0 2px 0 rgba(90, 30, 70, 0.35);
  z-index: 2;
}

@keyframes floatSoft {
  0%, 100% { translate: 0 0; }
  50%      { translate: 0 -10px; }
}
@keyframes decoFloat {
  from { transform: translateY(-7px) rotate(var(--r)); }
  to   { transform: translateY(9px) rotate(calc(var(--r) + 24deg)); }
}
@keyframes starFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); opacity: 0.55; }
  50%      { transform: translateY(-10px) rotate(12deg); opacity: 0.95; }
}

/* ═════════════════════════════════ HUD ═════════════════════════════════ */
.hud-screen { pointer-events: none; }

.hud-top {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.hud-left { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; }

.level-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1em;
  max-width: min(46vw, 280px);
  padding: 0.4em 0.9em 0.5em 0.72em;
  border-radius: 1.15em;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 244, 250, 0.88));
  border: 2.5px solid #FFFFFF;
  box-shadow: 0 0.22em 0 rgba(122, 42, 79, 0.22), 0 0.5em 1em rgba(60, 20, 50, 0.18);
  color: var(--plum-2);
  font-size: clamp(12px, 0.85vw + 4px, 16px);
  pointer-events: none;
  animation: slideDownIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.level-card-top {
  display: flex;
  align-items: baseline;
  gap: 0.42em;
  line-height: 1;
  max-width: 100%;
}
.level-card-tag { font-size: 0.62em; font-weight: 800; letter-spacing: 0.16em; color: var(--rose); opacity: 0.9; }
.level-card-num { font-size: 1.7em; font-weight: 800; line-height: 0.9; color: var(--pink); text-shadow: 0 2px 0 #fff; }
.level-card-of { font-size: 0.6em; font-weight: 800; color: var(--rose); opacity: 0.62; }
.level-card-name {
  width: 100%;
  max-width: 100%;
  font-size: 0.82em;
  font-weight: 800;
  line-height: 1.08;
  color: var(--plum-2);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
}

.score-card {
  display: inline-flex;
  align-items: center;
  gap: 0.38em;
  padding: 0.24em 0.8em 0.26em 0.55em;
  border-radius: 999px;
  background: linear-gradient(180deg, #FFF6D6, #FFE08A);
  border: 2.5px solid #FFFFFF;
  box-shadow: 0 0.22em 0 rgba(201, 134, 0, 0.3), 0 0.5em 1em rgba(60, 20, 50, 0.16);
  color: #6B3500;
  font-size: clamp(13px, 0.9vw + 4px, 17px);
  font-weight: 800;
  pointer-events: none;
  animation: slideDownIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.06s both;
}
.score-icon { display: grid; place-items: center; width: 1.15em; height: 1.15em; }
.score-star-svg { width: 100%; height: 100%; color: #FFB020; filter: drop-shadow(0 0.08em 0 #C98600); }
.score-num { line-height: 1; letter-spacing: 0.02em; }
.score-unit { font-size: 0.55em; font-weight: 800; letter-spacing: 0.1em; color: #9A6300; opacity: 0.85; align-self: center; margin-left: -0.1em; }

.hud-tools {
  display: flex;
  align-items: center;
  gap: clamp(5px, 0.6vw, 9px);
  pointer-events: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  animation: slideDownIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s both;
}

/* goal card — FIXED height (never grows mid-game; the game fits its camera
   against this card, so any growth would push the 3D board under the HUD) */
.goal-card {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  width: min(340px, 30vw);
  height: 84px;
  padding: 8px 15px 11px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 241, 248, 0.86));
  border: 2.5px solid #FFFFFF;
  box-shadow: 0 0.28em 0 rgba(122, 42, 79, 0.2), 0 0.8em 1.6em rgba(60, 20, 50, 0.16);
  color: var(--plum-2);
  pointer-events: none;
  z-index: 2;
  animation: goalIn 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) 0.05s both;
}
.goal-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  line-height: 1;
}
.goal-pot { display: block; width: 1.45em; height: 1.45em; font-size: clamp(11px, 0.8vw + 4px, 14px); }
.goal-pot .pot-svg { width: 100%; height: 100%; filter: drop-shadow(0 2px 0 rgba(122, 42, 79, 0.18)); }
.goal-title {
  font-size: clamp(9px, 0.48vw + 7px, 11.5px);
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--rose);
  white-space: nowrap;
}
.goal-body { display: flex; align-items: flex-end; gap: 10px; }
.goal-count { display: flex; align-items: baseline; line-height: 1; color: var(--pink); font-weight: 800; }
.goal-num { font-size: clamp(24px, 1.7vw + 12px, 34px); letter-spacing: -0.02em; }
.goal-of { font-size: clamp(12px, 0.8vw + 6px, 16px); color: var(--rose); opacity: 0.85; margin-left: 1px; }
.goal-track-wrap { flex: 1; min-width: 0; position: relative; padding-bottom: 1px; }
.goal-pips { position: relative; height: clamp(16px, 1.05vw + 9px, 21px); margin-bottom: 2px; }
.pip {
  position: absolute;
  bottom: 1px;
  transform: translateX(-50%);
  width: clamp(15px, 0.95vw + 8px, 19px);
  height: clamp(15px, 0.95vw + 8px, 19px);
  display: grid;
  place-items: center;
  color: #C9A5B7;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  box-shadow: inset 0 1px 2px rgba(122, 42, 79, 0.16), 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: color 0.2s, background 0.2s;
}
.pip-star-svg { width: 76%; height: 76%; }
.pip.is-on {
  color: #FFB020;
  background: linear-gradient(180deg, #FFF3C9, #FFE08A);
  box-shadow: 0 1px 0 #C98600, 0 0 8px rgba(255, 193, 46, 0.7);
}
.pip.is-pop { animation: pipPop 0.62s cubic-bezier(0.34, 1.56, 0.64, 1); }
.pip-spark {
  position: absolute;
  bottom: 4px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--sc);
  pointer-events: none;
  animation: pipSpark var(--sd) ease-out forwards;
}
.goal-track {
  position: relative;
  height: clamp(10px, 0.7vw + 6px, 14px);
  border-radius: 999px;
  overflow: hidden;
  background: linear-gradient(180deg, #F3D9E5, #EACBD9);
  box-shadow: inset 0 2px 3px rgba(122, 42, 79, 0.18);
}
.goal-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #FF5C8A, #FF8E3D 38%, #FFCB3D 64%, #2FD9B9 100%);
  transition: width 0.45s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.goal-track-shine {
  position: absolute;
  inset: 2px 2px auto;
  height: 38%;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0));
  pointer-events: none;
}
.goal-card.is-bump { animation: goalGlow 0.55s ease-out; }
.goal-card.is-full .goal-track { box-shadow: inset 0 2px 3px rgba(122, 42, 79, 0.18), 0 0 14px rgba(255, 203, 61, 0.75); }
.goal-card.is-full .goal-fill { box-shadow: 0 0 12px rgba(255, 203, 61, 0.7); }
.goal-card.is-full .goal-title { color: #C98600; }

@keyframes goalGlow {
  0%   { filter: none; }
  35%  { filter: brightness(1.09) drop-shadow(0 0 14px rgba(255, 203, 61, 0.8)); }
  100% { filter: none; }
}
@keyframes pipPop {
  0%   { transform: translateX(-50%) scale(0.4); }
  45%  { transform: translateX(-50%) scale(1.55) rotate(12deg); }
  100% { transform: translateX(-50%) scale(1); }
}
@keyframes pipSpark {
  0%   { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--sx), var(--sy)) scale(0.2); }
}
@keyframes goalIn {
  from { opacity: 0; transform: translate(-50%, -20px) scale(0.94); }
  to   { opacity: 1; transform: translate(-50%, 0) scale(1); }
}
@keyframes slideDownIn {
  from { opacity: 0; transform: translateY(-18px) scale(0.94); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ───────────────────────────── hand tray ───────────────────────────────── */
.hand-zone {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(18px, env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  padding: 0 8px;
  pointer-events: none;
}
.hand-tray {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 15px 13px;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.1));
  border: 2px solid rgba(255, 255, 255, 0.46);
  box-shadow: 0 10px 28px rgba(40, 15, 60, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(6px) saturate(1.1);
  animation: trayUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  pointer-events: none;
  max-width: 100%;
}
.hand-tray-tag {
  font-size: clamp(8px, 0.42vw + 6px, 10px);
  font-weight: 800;
  letter-spacing: 0.16em;
  color: #FFFFFF;
  text-shadow: 0 1px 0 rgba(60, 20, 45, 0.5);
  white-space: nowrap;
  line-height: 1.2;
  padding: 0.18em 0.72em;
  border-radius: 999px;
  background: rgba(90, 30, 70, 0.34);
  border: 1px solid rgba(255, 255, 255, 0.26);
}
.hand-chips {
  display: flex;
  align-items: flex-end;
  gap: clamp(6px, 0.9vw, 12px);
  pointer-events: auto;
}
.hud-screen.is-locked .hand-chips { opacity: 0.6; filter: saturate(0.7); }
.hud-screen.is-locked .chip { pointer-events: none; cursor: default; }

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

/* ─────────────────────────────── chips ─────────────────────────────────── */
.chip {
  --c: #FF5C8A;
  --c-light: #FFB3C9;
  --c-dark: #C9305C;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: inherit;
  font-weight: 800;
  font-size: clamp(12.5px, 0.8vw + 5px, 16.5px);
  min-width: 5.1em;
  padding: 0.55em 0.6em 0.42em;
  border: 0;
  border-radius: 1.35em;
  cursor: grab;
  color: var(--c-dark);
  background:
    radial-gradient(120% 90% at 30% 0%, #FFFFFF 0%, rgba(255, 255, 255, 0) 58%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.95) 8%, rgba(255, 255, 255, 0.25) 100%),
    var(--c-light);
  box-shadow:
    0 0.28em 0 rgba(122, 42, 79, 0.22),
    0 0.6em 1.1em rgba(60, 20, 50, 0.22),
    inset 0 0.1em 0 rgba(255, 255, 255, 0.9),
    inset 0 0 0 0.14em rgba(255, 255, 255, 0.75);
  transition: transform 0.16s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.16s, filter 0.16s;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  animation: chipEnter 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
  animation-delay: calc(var(--ci) * 80ms);
  will-change: transform;
}
.chip:hover:not(.is-used) { transform: translateY(-0.18em) scale(1.02); }
.chip:active:not(.is-used) { cursor: grabbing; }
.chip:focus-visible {
  outline: 3px solid #FFF3B0;
  outline-offset: 3px;
  box-shadow:
    0 0.28em 0 rgba(122, 42, 79, 0.22),
    0 0.6em 1.1em rgba(60, 20, 50, 0.22),
    0 0 0 0.14em var(--c-dark),
    inset 0 0.1em 0 rgba(255, 255, 255, 0.9);
}
.chip-gloss {
  position: absolute;
  inset: 0.16em 0.5em auto;
  height: 34%;
  border-radius: 1em;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0));
  opacity: 0.8;
  pointer-events: none;
}
.chip-coil {
  position: relative;
  width: 3.55em;
  height: 3.5em;
  margin: 0.12em 0 0.06em;
  animation: chipBob 2.8s ease-in-out infinite;
  animation-delay: calc(var(--ci) * -0.7s);
  pointer-events: none;
}
.coil { position: absolute; inset: 0; }
.ring {
  --tx: calc((var(--k) - 2.5) * 0.045em);
  --tr: calc((var(--k) - 2.5) * 0.8deg);
  position: absolute;
  left: 50%;
  top: calc(var(--k) * 0.42em);
  width: 3.3em;
  height: 1.04em;
  margin-left: -1.65em;
  border-radius: 50%;
  border: 0.26em solid var(--c);
  border-top-color: var(--c-light);
  border-bottom-color: var(--c-dark);
  box-shadow: inset 0 0.07em 0.05em rgba(255, 255, 255, 0.35);
  transform: translateX(var(--tx)) rotate(var(--tr));
  animation: ringIdle 2.6s ease-in-out infinite alternate;
  animation-delay: calc(var(--k) * -0.25s);
}
.coil-shadow {
  position: absolute;
  left: 50%;
  bottom: -0.16em;
  width: 2.7em;
  height: 0.72em;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(70, 25, 55, 0.28), transparent 70%);
  filter: blur(2px);
  pointer-events: none;
}
.chip-sym {
  position: absolute;
  right: -0.18em;
  bottom: 0.12em;
  display: grid;
  place-items: center;
  width: 1.5em;
  height: 1.5em;
  font-size: 0.72em;
  border-radius: 50%;
  background: var(--c-dark);
  color: #FFFFFF;
  border: 0.12em solid #FFFFFF;
  box-shadow: 0 0.12em 0.2em rgba(70, 25, 55, 0.3);
  line-height: 1;
}
/* Rainbow wildcard chip: every coil ring shows a different hue */
.chip--rainbow .ring:nth-child(1) { border-color: #FF5C8A; border-top-color: #FFD1E0; border-bottom-color: #C9305C; }
.chip--rainbow .ring:nth-child(2) { border-color: #FFCB3D; border-top-color: #FFF3BF; border-bottom-color: #D19A0B; }
.chip--rainbow .ring:nth-child(3) { border-color: #2FD9B9; border-top-color: #C9FFF4; border-bottom-color: #0E9E86; }
.chip--rainbow .ring:nth-child(4) { border-color: #4FA8FF; border-top-color: #D6ECFF; border-bottom-color: #2C6FD1; }
.chip--rainbow .ring:nth-child(5) { border-color: #A87CFF; border-top-color: #E7DBFF; border-bottom-color: #7550D6; }
.chip--rainbow .ring:nth-child(6) { border-color: #FF8FD0; border-top-color: #FFE0F1; border-bottom-color: #B44BD6; }
.chip--rainbow .chip-sym { background: linear-gradient(135deg, #FF5C8A, #FFCB3D 30%, #2FD9B9 55%, #4FA8FF 78%, #A87CFF); }
.chip--rainbow .chip-coil { filter: saturate(1.12); }
.howto-tip--rainbow {
  border-color: rgba(255, 92, 138, 0.45);
  background: linear-gradient(90deg, rgba(255, 92, 138, 0.12), rgba(255, 203, 61, 0.12), rgba(47, 217, 185, 0.12), rgba(79, 168, 255, 0.12), rgba(168, 124, 255, 0.12));
}
.chip-check {
  position: absolute;
  inset: 0.1em;
  display: none;
  place-items: center;
  border-radius: 1em;
  background: rgba(80, 30, 70, 0.38);
  color: #FFFFFF;
}
.chip-check .icon { width: 1.5em; height: 1.5em; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.25)); }
.chip-name {
  font-size: 0.82em;
  letter-spacing: 0.02em;
  line-height: 1.1;
  color: var(--c-dark);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.65);
  pointer-events: none;
}
.chip-hint-tag {
  position: absolute;
  top: -1.85em;
  left: 50%;
  display: inline-flex;
  align-items: center;
  gap: 0.25em;
  padding: 0.26em 0.7em;
  border-radius: 999px;
  background: linear-gradient(180deg, #FFE066, #FFC12E);
  border: 2px solid #FFFFFF;
  box-shadow: 0 0.2em 0 #C98600, 0 0.4em 0.7em rgba(160, 100, 0, 0.3);
  color: #6B3500;
  font-size: 0.6em;
  font-weight: 800;
  letter-spacing: 0.08em;
  white-space: nowrap;
  transform: translate(-50%, 0.5em);
  opacity: 0;
  transition: opacity 0.2s, transform 0.24s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  z-index: 3;
}
.chip-hint-tag .icon { width: 0.9em; height: 0.9em; }

.chip.is-selected {
  transform: translateY(-0.55em) scale(1.04);
  box-shadow:
    0 0.35em 0 rgba(122, 42, 79, 0.22),
    0 0.9em 1.6em rgba(60, 20, 50, 0.3),
    0 0 0 0.14em #FFE066,
    inset 0 0.1em 0 rgba(255, 255, 255, 0.9);
  z-index: 2;
}
.chip.is-selected .chip-coil { animation: coilHop 0.65s cubic-bezier(0.34, 1.56, 0.64, 1); }
.chip.is-dragging {
  transform: translateY(-1em) scale(1.07) rotate(-3deg);
  opacity: 0.9;
  cursor: grabbing;
  z-index: 3;
}
.chip.is-dragging .chip-coil { animation: coilShake 0.5s ease-in-out infinite; }
.chip.is-used {
  cursor: default;
  opacity: 0.58;
  filter: grayscale(0.85) brightness(1.04);
  transform: translateY(0.34em) scale(0.94);
  box-shadow: 0 0.1em 0 rgba(122, 42, 79, 0.16);
  animation: none;
}
.chip.is-used .chip-check { display: grid; }
.chip.is-used .chip-coil { animation: none; }
.chip.is-hint {
  animation: hintBounce 1.15s ease-in-out infinite;
  box-shadow:
    0 0.28em 0 rgba(122, 42, 79, 0.2),
    0 0 0 0.16em #FFCB3D,
    0 0 26px rgba(255, 203, 61, 0.85),
    inset 0 0.1em 0 rgba(255, 255, 255, 0.9);
  z-index: 4;
}
.chip.is-hint .chip-hint-tag { opacity: 1; transform: translate(-50%, 0); }
.chip.is-bump { animation: chipBump 0.44s cubic-bezier(0.34, 1.56, 0.64, 1); }

@keyframes chipEnter {
  from { opacity: 0; transform: translateY(46%) scale(0.72); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes chipBump {
  0%   { transform: translateY(0) scale(1); }
  40%  { transform: translateY(-0.25em) scale(1.06); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes chipBob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-0.14em); }
}
@keyframes ringIdle {
  from { transform: translateX(var(--tx)) rotate(var(--tr)) scaleX(1); }
  to   { transform: translateX(var(--tx)) rotate(var(--tr)) scaleX(0.93) translateY(0.05em); }
}
@keyframes coilHop {
  0%   { transform: translateY(0) scale(1); }
  40%  { transform: translateY(-0.5em) scale(1.1); }
  70%  { transform: translateY(0.06em) scale(0.96); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes coilShake {
  0%, 100% { transform: rotate(-7deg); }
  50%      { transform: rotate(7deg); }
}
@keyframes hintBounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-0.42em); }
}

/* ═════════════════════════════ BANNER ══════════════════════════════════ */
.banner-layer {
  position: absolute;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  overflow: hidden;
}
.level-banner {
  position: absolute;
  left: 50%;
  top: 29%;
  width: min(640px, 92vw);
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 18px 34px rgba(70, 20, 55, 0.35));
}
.banner-layer.is-in .level-banner { animation: bannerIn 0.52s cubic-bezier(0.2, 1.45, 0.45, 1) both; }
.banner-layer.is-out .level-banner { animation: bannerOut 0.42s ease-in both; }

.banner-ribbon {
  position: absolute;
  left: -3%;
  right: -3%;
  top: 10%;
  height: 78%;
  border-radius: 24px;
  border: 4px solid rgba(255, 255, 255, 0.82);
  background: linear-gradient(100deg, #FF5C8A 0%, #FF8E3D 42%, #FFCB3D 72%, #FF5C8A 100%);
  box-shadow:
    0 14px 30px rgba(70, 20, 55, 0.32),
    inset 0 3px 0 rgba(255, 255, 255, 0.5),
    inset 0 -6px 0 rgba(122, 42, 79, 0.14);
  transform: skewY(-2.2deg);
  overflow: hidden;
}
.banner-ribbon::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.16) 0 18px, transparent 18px 38px);
  animation: bannerStripes 1.6s linear infinite;
}
.banner-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: clamp(16px, 2.2vh, 26px) 24px;
  text-align: center;
  z-index: 2;
}
.banner-eyebrow {
  display: inline-flex;
  align-items: baseline;
  gap: 0.44em;
  color: #FFFFFF;
  text-shadow: 0 2px 0 rgba(122, 42, 79, 0.5);
  line-height: 1;
}
.banner-nivel { font-size: clamp(11px, 1.1vw, 14px); font-weight: 800; letter-spacing: 0.28em; opacity: 0.95; }
.banner-num { font-size: clamp(20px, 2.2vw, 30px); font-weight: 800; line-height: 1; }
.banner-of { font-size: clamp(10px, 0.95vw, 12px); font-weight: 800; letter-spacing: 0.14em; opacity: 0.85; }
.banner-name {
  margin: 0;
  font-size: clamp(24px, 3.4vw, 44px);
  font-weight: 800;
  line-height: 1.04;
  color: #FFFFFF;
  letter-spacing: 0.01em;
  text-shadow: 0 3px 0 #C9305C, 0 8px 14px rgba(70, 20, 55, 0.4);
}
.banner-tip {
  margin: 3px 0 0;
  max-width: 46ch;
  font-size: clamp(12px, 1.3vw, 16px);
  font-weight: 700;
  line-height: 1.25;
  color: #FFF8E8;
  text-shadow: 0 2px 4px rgba(90, 30, 60, 0.45);
}
.banner-stars { display: flex; gap: 0.22em; margin-top: 4px; color: #FFF3B0; }
.banner-star {
  display: grid;
  place-items: center;
  width: clamp(14px, 1.5vw, 20px);
  height: clamp(14px, 1.5vw, 20px);
  filter: drop-shadow(0 2px 0 rgba(122, 42, 79, 0.4));
}
.banner-star-svg { width: 100%; height: 100%; }
.banner-layer.is-in .banner-star { animation: bannerStarPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both; animation-delay: calc(0.15s + var(--i) * 0.1s); }
.banner-spark {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #FFF3B0;
  box-shadow: 0 0 14px 3px #FFCB3D;
  animation: sparkFloat 1.7s ease-out infinite;
  z-index: 3;
}
.banner-spark--1 { left: -1%; top: 16%; }
.banner-spark--2 { right: 2%; top: 24%; animation-delay: 0.5s; width: 7px; height: 7px; }
.banner-spark--3 { left: 12%; bottom: 12%; animation-delay: 0.9s; width: 6px; height: 6px; }

@keyframes bannerIn {
  0%   { opacity: 0; transform: translate(-50%, -78%) scale(0.72) rotate(-2deg); }
  62%  { opacity: 1; transform: translate(-50%, -48%) scale(1.03) rotate(0.6deg); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0deg); }
}
@keyframes bannerOut {
  0%   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -170%) scale(0.88); }
}
@keyframes bannerStripes { to { transform: translateX(38px); } }
@keyframes bannerStarPop {
  0%   { opacity: 0; transform: scale(0.2) rotate(-40deg); }
  60%  { opacity: 1; transform: scale(1.3) rotate(8deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}
@keyframes sparkFloat {
  0%   { opacity: 0; transform: translateY(6px) scale(0.6); }
  35%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(-22px) scale(1.15); }
}

/* ═════════════════════════════ TOASTS ══════════════════════════════════ */
.toast-stack {
  position: absolute;
  left: 50%;
  bottom: clamp(178px, 23vh, 270px);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(92vw, 560px);
  z-index: 42;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 0.55em;
  max-width: 100%;
  padding: 0.48em 0.95em;
  border-radius: 999px;
  border: 2.5px solid #FFFFFF;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 242, 249, 0.94));
  color: var(--plum-2);
  font-weight: 800;
  font-size: clamp(12px, 0.7vw + 6px, 15px);
  line-height: 1.15;
  box-shadow: 0 0.3em 0 rgba(122, 42, 79, 0.18), 0 0.8em 1.4em rgba(60, 20, 50, 0.22);
  opacity: 0;
  transform: translateY(18px) scale(0.92);
  transition: opacity 0.3s, transform 0.34s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.toast.is-in { opacity: 1; transform: translateY(0) scale(1); }
.toast.is-out { opacity: 0; transform: translateY(-10px) scale(0.94); }
.toast-icon {
  display: grid;
  place-items: center;
  width: 1.55em;
  height: 1.55em;
  border-radius: 50%;
  background: linear-gradient(180deg, #BFE9FF, #8FD0FF);
  color: #1F5FA8;
  flex: none;
}
.toast-icon .icon { width: 0.95em; height: 0.95em; }
.toast--success .toast-icon { background: linear-gradient(180deg, #B6F7E9, #7FEFD8); color: #0E7A68; }
.toast--warn .toast-icon { background: linear-gradient(180deg, #FFD1A8, #FFB37A); color: #8A3E00; }
.toast--hint .toast-icon { background: linear-gradient(180deg, #FFE9A8, #FFD166); color: #8A5A00; }
.toast-text { min-width: 0; }

/* ═════════════════════════════ COMBOS ══════════════════════════════════ */
.combo-layer {
  position: absolute;
  inset: 0;
  z-index: 46;
  pointer-events: none;
  overflow: hidden;
}
.combo {
  position: absolute;
  left: 50%;
  top: 36%;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translate(-50%, -50%);
  opacity: 0;
}
.combo.is-in { animation: comboIn 1.5s cubic-bezier(0.2, 1.1, 0.4, 1) forwards; }
.combo-word {
  position: relative;
  z-index: 2;
  font-size: clamp(30px, 4.2vw + 8px, 64px);
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #FFFFFF;
  -webkit-text-stroke: 0.05em #7A2A4F;
  text-shadow:
    0 0.075em 0 #7A2A4F,
    0 0 0.55em rgba(255, 203, 61, 0.85),
    0 0.18em 0.4em rgba(60, 20, 50, 0.4);
  white-space: nowrap;
}
.combo--t3 .combo-word,
.combo--t4 .combo-word,
.combo--t5 .combo-word {
  color: #FFF3B0;
  -webkit-text-stroke: 0.05em #C9305C;
  text-shadow:
    0 0.075em 0 #C9305C,
    0 0 0.7em rgba(255, 203, 61, 0.95),
    0 0.18em 0.4em rgba(60, 20, 50, 0.4);
}
.combo--t5 .combo-word { font-size: clamp(34px, 5vw + 8px, 72px); }
.combo-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(48vw, 340px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 6px solid rgba(255, 203, 61, 0.85);
  transform: translate(-50%, -50%) scale(0.2);
  opacity: 0;
}
.combo.is-in .combo-ring { animation: comboRing 1.4s ease-out forwards; }
.combo-ring--2 { border-color: rgba(255, 255, 255, 0.7); border-width: 3px; }
.combo.is-in .combo-ring--2 { animation-delay: 0.1s; }
.combo-spark {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: var(--c);
  opacity: 0;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}
.combo.is-in .combo-spark { animation: comboSpark 1.2s ease-out forwards; animation-delay: var(--dl); }

@keyframes comboIn {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.35); }
  16%  { opacity: 1; transform: translate(-50%, -50%) scale(1.14); }
  28%  { transform: translate(-50%, -50%) scale(1); }
  70%  { opacity: 1; transform: translate(-50%, -56%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -80%) scale(0.9); }
}
@keyframes comboRing {
  0%   { opacity: 0.85; transform: translate(-50%, -50%) scale(0.2); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.4); }
}
@keyframes comboSpark {
  0%   { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0deg); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.25) rotate(180deg); }
}

/* ═════════════════════════════ MODALS ══════════════════════════════════ */
.modal-layer {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
  pointer-events: none;
}
.modal-layer.is-open { pointer-events: auto; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 38%, rgba(45, 15, 45, 0.46), rgba(28, 9, 38, 0.66));
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.28s ease;
}
.modal-layer.is-in .modal-backdrop { opacity: 1; }
.modal-layer.is-out .modal-backdrop { opacity: 0; }

.modal-card {
  position: relative;
  z-index: 2;
  width: min(480px, 94vw);
  max-height: min(90vh, 880px);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding: clamp(18px, 2.2vh, 26px) clamp(16px, 2vw, 26px) clamp(18px, 2.2vh, 24px);
  border-radius: 30px;
  border: 4px solid #FFFFFF;
  background: linear-gradient(180deg, #FFFDF9 0%, #FFF3F9 55%, #FFEAF4 100%);
  box-shadow:
    0 0.4em 0 rgba(122, 42, 79, 0.22),
    0 1.1em 2.4em rgba(35, 10, 40, 0.42),
    inset 0 2px 0 rgba(255, 255, 255, 0.9);
  color: var(--plum-2);
  opacity: 0;
  transform: translateY(26px) scale(0.9);
}
.modal-layer.is-in .modal-card { animation: modalIn 0.46s cubic-bezier(0.22, 1.45, 0.45, 1) forwards; }
.modal-layer.is-out .modal-card { animation: modalOut 0.24s ease-in forwards; }
.modal-card::-webkit-scrollbar { width: 8px; }
.modal-card::-webkit-scrollbar-thumb { background: rgba(255, 92, 138, 0.35); border-radius: 8px; }
.modal-card::-webkit-scrollbar-track { background: transparent; }

.modal-x {
  position: absolute;
  right: 10px;
  top: 10px;
  z-index: 6;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.88);
  color: var(--rose);
  box-shadow: 0 3px 0 rgba(122, 42, 79, 0.18);
  transition: transform 0.13s, background 0.13s;
}
.modal-x:hover { transform: scale(1.08) rotate(6deg); background: #FFFFFF; }
.modal-x:focus-visible { outline: 3px solid #FFF3B0; outline-offset: 2px; }
.modal-x { touch-action: manipulation; }
.modal-x .icon { width: 20px; height: 20px; }

@keyframes modalIn {
  0%   { opacity: 0; transform: translateY(34px) scale(0.86); }
  60%  { opacity: 1; transform: translateY(-5px) scale(1.015); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes modalOut {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(18px) scale(0.92); }
}

/* ───────────────────────── result / complete ───────────────────────────── */
.modal-card--result,
.modal-card--complete { padding: 0 0 clamp(16px, 2.2vh, 22px); overflow-x: hidden; }
.modal-card--result { width: min(450px, 94vw); }

.result-hero {
  position: relative;
  padding: clamp(18px, 2.4vh, 28px) 20px clamp(12px, 1.8vh, 18px);
  text-align: center;
  border-radius: 27px 27px 0 0;
  background: linear-gradient(180deg, #FFE066 0%, #FFB020 58%, #FF8A5C 100%);
  box-shadow: inset 0 -6px 0 rgba(122, 42, 79, 0.1);
  overflow: hidden;
}
.result-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.5) 0 3px, transparent 4px),
    radial-gradient(circle at 86% 26%, rgba(255, 255, 255, 0.45) 0 2.5px, transparent 3.5px),
    radial-gradient(circle at 24% 78%, rgba(255, 255, 255, 0.35) 0 2px, transparent 3px),
    radial-gradient(circle at 74% 82%, rgba(255, 255, 255, 0.4) 0 2.5px, transparent 3.5px);
  pointer-events: none;
}
.result-hero.is-fail { background: linear-gradient(180deg, #B7E4FF 0%, #8FCBFF 58%, #7FA9F5 100%); }

.result-ribbon {
  position: relative;
  display: inline-block;
  padding: 0.32em 1.2em;
  border-radius: 999px;
  background: linear-gradient(180deg, #FFFDF7, #FFF3E4);
  box-shadow: 0 0.22em 0 rgba(122, 42, 79, 0.22), 0 0.5em 1em rgba(122, 42, 79, 0.16);
  transform: rotate(-1.6deg);
}
.result-ribbon::before,
.result-ribbon::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  transform: translateY(-50%);
}
.result-ribbon::before { left: -12px; border-right: 12px solid #FFCB3D; }
.result-ribbon::after { right: -12px; border-left: 12px solid #FFCB3D; }
.result-ribbon-text {
  font-size: clamp(18px, 2vw + 6px, 27px);
  font-weight: 800;
  letter-spacing: 0.015em;
  color: var(--pink);
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.9);
}
.is-fail .result-ribbon-text { color: var(--pink-dark); }

.result-stars {
  display: flex;
  justify-content: center;
  gap: clamp(2px, 0.8vw, 8px);
  margin: clamp(4px, 1vh, 10px) 0 0;
}
.rv-star {
  width: clamp(46px, 6.4vw, 70px);
  height: clamp(46px, 6.4vw, 70px);
  color: #E7D2DD;
  opacity: 0;
  transform: scale(0.4) rotate(-25deg);
  animation: starIn 0.5s ease var(--d) both;
}
.rv-star-svg { width: 100%; height: 100%; }
.rv-star.is-on {
  color: #FFCB3D;
  filter: drop-shadow(0 0.07em 0 #C98600) drop-shadow(0 0.18em 0.28em rgba(160, 100, 0, 0.45));
  animation:
    starPop 0.75s cubic-bezier(0.3, 1.7, 0.5, 1) var(--d) both,
    starWobble 2.6s ease-in-out calc(var(--d) + 0.9s) infinite;
}
.complete-bigstars { position: relative; display: flex; justify-content: center; gap: 4px; margin-top: 2px; }
.complete-bigstars .rv-star { width: clamp(34px, 4.6vw, 48px); height: clamp(34px, 4.6vw, 48px); }
.complete-bigstars .rv-star.is-on { color: #FFCB3D; }
.result-message {
  margin: 0.18em 0 0;
  font-size: clamp(17px, 1.7vw + 6px, 24px);
  font-weight: 800;
  color: var(--plum-2);
  text-shadow: 0 1px 0 #FFFFFF;
}
.result-hint {
  margin: 0.35em 0 0;
  font-size: clamp(12px, 0.6vw + 7px, 14px);
  font-weight: 700;
  color: #8A4A6B;
}
.result-hint b { color: var(--pink-dark); }

.result-stats { display: flex; gap: 10px; padding: 14px 20px 0; }
.stat {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 9px 12px;
  border-radius: 18px;
  background: #FFFFFF;
  box-shadow: 0 3px 0 rgba(122, 42, 79, 0.12), inset 0 0 0 2px rgba(255, 255, 255, 0.9);
}
.stat-icon { display: grid; place-items: center; width: 34px; height: 34px; flex: none; }
.stat-icon--pot .pot-svg { width: 34px; height: 34px; }
.stat-icon--star { color: #FFC12E; filter: drop-shadow(0 2px 0 #C98600); }
.stat-star-svg { width: 32px; height: 32px; }
.stat-body { display: flex; flex-direction: column; line-height: 1; min-width: 0; }
.stat-value { font-size: clamp(19px, 1.6vw + 8px, 26px); font-weight: 800; color: var(--pink); }
.stat-label {
  margin-top: 2px;
  font-size: clamp(9px, 0.35vw + 7px, 11px);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rose);
  opacity: 0.85;
}
.result-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.7em;
  padding: 10px 20px 0;
  font-size: clamp(10px, 0.4vw + 7px, 12px);
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--rose);
}
.result-best { display: inline-flex; align-items: center; gap: 0.25em; color: #8A5A00; letter-spacing: 0.06em; }
.result-best .tiny-star { font-size: 1.2em; }
.tiny-star { color: #E2CBD6; font-size: 1em; line-height: 1; }
.tiny-star.is-on { color: #FFC12E; }

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 20px 0;
}
.result-row { display: flex; gap: 10px; }
.result-row .btn { flex: 1; }

@keyframes starIn {
  from { opacity: 0; transform: scale(0.4) rotate(-25deg); }
  to   { opacity: 0.55; transform: scale(1) rotate(0deg); }
}
@keyframes starPop {
  0%   { opacity: 0; transform: scale(0.2) rotate(-40deg); }
  55%  { opacity: 1; transform: scale(1.32) rotate(7deg); }
  76%  { transform: scale(0.93) rotate(-3deg); }
  100% { opacity: 1; transform: scale(1) rotate(-1deg); }
}
@keyframes starWobble {
  0%, 100% { transform: rotate(-2deg) translateY(0); }
  50%      { transform: rotate(2deg) translateY(-2px); }
}

/* ───────────────────────────── level select ────────────────────────────── */
.modal-card--levels { width: min(560px, 94vw); }
.levels-head { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-bottom: clamp(10px, 1.5vh, 16px); text-align: center; }
.levels-eyebrow { font-size: clamp(9px, 0.4vw + 7px, 11px); font-weight: 800; letter-spacing: 0.24em; color: var(--rose); }
.levels-title {
  margin: 0;
  font-size: clamp(26px, 2.6vw + 10px, 40px);
  font-weight: 800;
  color: var(--pink);
  letter-spacing: 0.02em;
  text-shadow: 0 3px 0 rgba(255, 255, 255, 0.9);
}
.levels-stars {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  color: #FFC12E;
  font-weight: 800;
  font-size: clamp(12px, 0.7vw + 8px, 15px);
}
.levels-stars .icon { width: 1.15em; height: 1.15em; filter: drop-shadow(0 2px 0 #C98600); }
.levels-stars b { color: var(--pink-dark); font-size: 1.1em; }
.levels-stars span { color: var(--rose); font-size: 0.76em; letter-spacing: 0.06em; opacity: 0.9; }

.level-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(8px, 1.2vw, 14px);
}
.lvl {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: clamp(10px, 1.5vh, 16px) 6px clamp(9px, 1.3vh, 13px);
  border: 3px solid #FFFFFF;
  border-radius: 20px;
  background: linear-gradient(180deg, #FFFFFF, #FFF1F7);
  box-shadow: 0 4px 0 rgba(122, 42, 79, 0.18), 0 8px 16px rgba(60, 20, 50, 0.12);
  color: var(--plum-2);
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.14s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.14s;
  touch-action: manipulation;
}
.lvl:hover { transform: translateY(-3px) scale(1.03); box-shadow: 0 6px 0 rgba(122, 42, 79, 0.18), 0 14px 22px rgba(60, 20, 50, 0.18); }
.lvl:active { transform: translateY(1px) scale(0.98); }
.lvl:focus-visible { outline: 3px solid #FFF3B0; outline-offset: 3px; }
.lvl-num { font-size: clamp(24px, 2vw + 12px, 36px); font-weight: 800; line-height: 1; color: var(--pink); text-shadow: 0 2px 0 #FFFFFF; }
.lvl-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: clamp(8px, 0.3vw + 7px, 10px);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--rose);
  opacity: 0.85;
}
.lvl-stars { display: flex; gap: 1px; font-size: clamp(12px, 0.8vw + 8px, 15px); }
.lvl-stars .tiny-star.is-on { color: #FFC12E; text-shadow: 0 1px 0 #C98600; }
.lvl.is-done { background: linear-gradient(180deg, #FFFDF2, #FFF3C9); }
.lvl.is-locked {
  cursor: default;
  filter: grayscale(0.65);
  opacity: 0.62;
  background: linear-gradient(180deg, #F3EAF0, #E9DDE6);
  box-shadow: 0 4px 0 rgba(122, 42, 79, 0.12);
}
.lvl.is-locked .lvl-num { color: #A98C99; }
.lvl-lock { position: absolute; top: 6px; right: 6px; color: #A98C99; display: grid; place-items: center; }
.lvl-lock .icon { width: 14px; height: 14px; }
.lvl.is-next {
  background: linear-gradient(180deg, #FFF7D6, #FFE9A8);
  box-shadow: 0 4px 0 #C98600, 0 0 0 3px #FFCB3D, 0 10px 20px rgba(160, 100, 0, 0.22);
  animation: nextPulse 1.8s ease-in-out infinite;
}
.lvl-next-tag {
  position: absolute;
  bottom: -9px;
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 8px;
  border-radius: 999px;
  border: 2px solid #FFFFFF;
  background: linear-gradient(180deg, #FF8FB8, #FF5C8A);
  color: #FFFFFF;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.1em;
  box-shadow: 0 2px 4px rgba(122, 42, 79, 0.25);
  white-space: nowrap;
}
.levels-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: clamp(14px, 2vh, 20px);
}
.levels-score { font-size: clamp(10px, 0.4vw + 7px, 12px); font-weight: 800; letter-spacing: 0.1em; color: var(--rose); }
.levels-score b { color: var(--pink); font-size: 1.25em; }
@keyframes nextPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.035); }
}

/* ───────────────────────────── how to play ─────────────────────────────── */
.modal-card--howto { width: min(620px, 94vw); }
.howto-head { padding: 0 8px; margin-bottom: clamp(10px, 1.6vh, 16px); text-align: center; }
.howto-eyebrow { font-size: clamp(9px, 0.4vw + 7px, 11px); font-weight: 800; letter-spacing: 0.24em; color: var(--rose); }
.howto-title {
  margin: 0;
  font-size: clamp(26px, 2.6vw + 10px, 40px);
  font-weight: 800;
  color: var(--pink);
  letter-spacing: 0.02em;
  text-shadow: 0 3px 0 rgba(255, 255, 255, 0.9);
}
.howto-sub { margin: 0.25em 0 0; font-size: clamp(12px, 0.55vw + 8px, 15px); font-weight: 700; line-height: 1.35; color: #8A4A6B; }
.howto-sub b { color: var(--pink); }
.howto-list { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(8px, 1.3vw, 14px); }
.howto-step {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: clamp(12px, 1.8vh, 16px) 10px clamp(8px, 1.2vh, 12px);
  border-radius: 20px;
  background: linear-gradient(180deg, #FFFFFF, #FFF6FB);
  box-shadow: 0 3px 0 rgba(122, 42, 79, 0.12), inset 0 0 0 2px rgba(255, 255, 255, 0.9);
}
.howto-num {
  position: absolute;
  top: 7px;
  left: 8px;
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: linear-gradient(180deg, #FF8FB8, #FF5C8A);
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 2px 0 #C9305C;
}
.howto-art { display: block; width: 100%; max-width: 150px; }
.howto-art svg { width: 100%; height: auto; display: block; }
.howto-text { margin: 0; font-size: clamp(11px, 0.4vw + 8px, 13.5px); line-height: 1.28; font-weight: 700; text-align: center; color: var(--plum-2); }
.howto-tip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 0;
  padding: 8px 12px;
  border-radius: 16px;
  border: 2px solid #FFE066;
  background: linear-gradient(180deg, #FFF7D6, #FFEFB8);
  color: #8A5A00;
  font-size: clamp(11px, 0.4vw + 8px, 13px);
  font-weight: 700;
  line-height: 1.25;
}
.howto-tip .icon { width: 18px; height: 18px; flex: none; }
.howto-tip b { color: #C98600; }

/* ─────────────────────────────── ending ───────────────────────────────── */
.modal-card--complete { width: min(520px, 94vw); }
.complete-hero {
  position: relative;
  padding: clamp(16px, 2.4vh, 28px) 18px clamp(12px, 1.8vh, 18px);
  border-radius: 27px 27px 0 0;
  overflow: hidden;
  text-align: center;
  background: linear-gradient(180deg, #9BE8FF 0%, #B9C7FF 48%, #FFC7E5 100%);
}
.complete-rays {
  position: absolute;
  inset: -45% -25%;
  background: repeating-conic-gradient(from 0deg at 50% 46%, rgba(255, 255, 255, 0.4) 0deg 7deg, transparent 7deg 22deg);
  opacity: 0.6;
  animation: raysSpin 22s linear infinite;
  pointer-events: none;
}
.complete-coil { position: relative; display: flex; justify-content: center; filter: drop-shadow(0 12px 18px rgba(70, 20, 55, 0.28)); }
.complete-coil .toy-coil { transform: scale(0.84); animation: completeBob 2.8s ease-in-out infinite; }
.complete-eyebrow {
  position: relative;
  margin: 0.15em 0 0;
  font-size: clamp(10px, 0.5vw + 8px, 13px);
  font-weight: 800;
  letter-spacing: 0.3em;
  color: #FFFFFF;
  text-shadow: 0 2px 0 rgba(122, 42, 79, 0.35);
}
.complete-title {
  position: relative;
  margin: 0.05em 0 0;
  font-size: clamp(24px, 2.4vw + 10px, 38px);
  font-weight: 800;
  line-height: 1.02;
  color: #FFFFFF;
  text-shadow: 0 3px 0 #C9305C, 0 8px 16px rgba(70, 20, 55, 0.32);
}
.complete-sub {
  position: relative;
  margin: 0.3em 0 0;
  font-size: clamp(12px, 0.5vw + 8px, 15px);
  font-weight: 700;
  color: #FFFFFF;
  text-shadow: 0 2px 0 rgba(122, 42, 79, 0.4);
}
.complete-total {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.55em;
  margin-top: 4px;
  color: #FFFFFF;
  font-weight: 800;
  text-shadow: 0 2px 0 rgba(122, 42, 79, 0.4);
}
.complete-total-item { display: inline-flex; align-items: baseline; gap: 0.28em; }
.complete-total-item b { font-size: clamp(20px, 1.8vw + 8px, 28px); }
.complete-total-item span { font-size: clamp(10px, 0.4vw + 7px, 12px); letter-spacing: 0.1em; opacity: 0.92; }
.complete-star-svg { width: 1em; height: 1em; color: #FFE066; filter: drop-shadow(0 2px 0 rgba(122, 42, 79, 0.35)); align-self: center; }
.complete-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 14px 18px 0;
}
.complete-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 12px;
  background: #FFFFFF;
  box-shadow: 0 2px 0 rgba(122, 42, 79, 0.1);
}
.complete-cell.is-done { background: linear-gradient(180deg, #FFFDF2, #FFF3C9); }
.complete-cell-num { font-size: 12px; font-weight: 800; color: var(--pink); }
.complete-cell-stars { font-size: 11px; letter-spacing: 0.02em; display: inline-flex; }
.complete-cell-stars .tiny-star { font-size: 11px; }
.modal-card--complete .result-actions { padding: 16px 18px 0; }
@keyframes raysSpin { to { transform: rotate(360deg); } }
@keyframes completeBob {
  0%, 100% { transform: scale(0.84) translateY(0); }
  50%      { transform: scale(0.84) translateY(-0.3em); }
}

/* ════════════════════════════ CONFETTI ═════════════════════════════════ */
.confetti-layer {
  position: absolute;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  overflow: hidden;
}
.confetti-piece {
  position: absolute;
  top: -14vh;
  left: var(--x);
  width: var(--w);
  height: var(--h);
  border-radius: 2px;
  background: var(--c);
  opacity: 0;
  animation: confettiFall var(--dur) cubic-bezier(0.2, 0.55, 0.4, 1) var(--delay) forwards;
  will-change: transform, opacity;
}
.confetti-piece.is-round { border-radius: 50%; }
@keyframes confettiFall {
  0%   { opacity: 0; transform: translate3d(0, -10vh, 0) rotate(0deg); }
  8%   { opacity: 1; }
  86%  { opacity: 1; }
  100% { opacity: 0; transform: translate3d(var(--dx), 118vh, 0) rotate(var(--rot)); }
}

/* ═════════════════════════════ RESPONSIVE ══════════════════════════════ */

/* tablets / small laptops */
@media (max-width: 1100px) {
  .goal-card { width: min(290px, 32vw); }
  .deco-coil--left { left: -4vmin; }
  .deco-coil--right { right: -3vmin; }
}

/* large screens: scale the HUD a touch so it stays readable at 1920+ */
@media (min-width: 1600px) {
  .goal-card { width: min(390px, 24vw); height: 88px; }
  .chip { font-size: clamp(14px, 0.62vw + 6px, 18.5px); }
  .hand-chips { gap: 14px; }
  .hud-tools { gap: 10px; }
}

/* medium desktops: keep comfortable gaps between goal card and tool cluster */
@media (max-width: 1300px) and (min-width: 641px) {
  .goal-card { width: min(310px, 30vw); }
}
@media (max-width: 1140px) and (min-width: 901px) {
  .goal-card { width: 290px; }
  .tool { width: 44px; height: 44px; }
  .tool--hint { width: auto; }
}

/* small tablets: goal strip goes under the top bar so nothing collides */
@media (max-width: 900px) and (min-width: 641px) {
  .goal-card {
    top: calc(max(12px, env(safe-area-inset-top)) + 58px);
    width: calc(100% - 24px);
    height: 74px;
    padding: 6px 14px 8px;
    border-radius: 18px;
  }
  .goal-pot { font-size: 12px; }
  .goal-title { font-size: 10px; }
  .goal-num { font-size: 27px; }
  .goal-of { font-size: 14px; }
}

/* phones & narrow */
@media (max-width: 640px) {
  .hud-top {
    top: max(8px, env(safe-area-inset-top));
    left: max(8px, env(safe-area-inset-left));
    right: max(8px, env(safe-area-inset-right));
    gap: 6px;
  }
  .hud-left { gap: 5px; }
  .level-card {
    max-width: calc(100vw - 258px);
    min-width: 92px;
    padding: 0.34em 0.68em 0.4em 0.58em;
    font-size: 11.5px;
    border-width: 2px;
    border-radius: 13px;
    gap: 0.06em;
  }
  .level-card-tag { font-size: 0.6em; letter-spacing: 0.12em; }
  .level-card-num { font-size: 1.65em; }
  .level-card-of { font-size: 0.58em; }
  .level-card-name { font-size: 0.78em; line-height: 1.06; -webkit-line-clamp: 1; }
  .score-card { padding: 0.16em 0.62em 0.18em 0.42em; font-size: 12.5px; border-width: 2px; }
  .score-unit { display: none; }
  .hud-tools { gap: 4px; }
  .tool { width: 44px; height: 44px; border-radius: 13px; border-width: 2px; }
  .tool .icon { width: 1.3em; height: 1.3em; }
  .tool--hint { width: 44px; height: 44px; padding: 0; font-size: 12px; }
  .tool--hint .tool-label { display: none; }
  .tools-divider { display: none; }
  .btn { min-height: 44px; }
  .modal-x { width: 44px; height: 44px; }

  .goal-card {
    top: calc(max(8px, env(safe-area-inset-top)) + 76px);
    width: calc(100% - 16px);
    height: 65px;
    padding: 5px 12px 8px;
    border-radius: 17px;
    border-width: 2px;
  }
  .goal-head { gap: 0.3em; }
  .goal-pot { width: 1.3em; height: 1.3em; font-size: 11px; }
  .goal-title { font-size: 9px; letter-spacing: 0.13em; }
  .goal-body { gap: 8px; }
  .goal-num { font-size: 25px; }
  .goal-of { font-size: 13px; }
  .goal-pips { height: 16px; margin-bottom: 2px; }
  .pip { width: 16px; height: 16px; }
  .goal-track { height: 11px; }

  .hand-zone { bottom: max(12px, env(safe-area-inset-bottom)); padding: 0 6px; }
  .hand-tray { padding: 5px 10px 10px; border-radius: 24px; gap: 2px; }
  .hand-tray-tag { font-size: 8px; letter-spacing: 0.12em; }
  .hand-chips { gap: 8px; }
  .chip { font-size: clamp(14px, 3.9vw, 16px); min-width: 5.05em; padding: 0.5em 0.5em 0.4em; border-radius: 1.25em; }
  .chip-coil { width: 3.5em; height: 3.45em; }
  .ring { width: 3.25em; margin-left: -1.625em; height: 1.03em; }
  .chip-sym { width: 1.55em; height: 1.55em; font-size: 0.7em; }
  .chip-name { font-size: 0.8em; }

  .toast-stack { bottom: calc(max(12px, env(safe-area-inset-bottom)) + 124px); width: 94vw; gap: 6px; }
  .toast { font-size: 12px; padding: 0.42em 0.8em; border-width: 2px; }

  .level-banner { top: 27%; width: 94vw; }
  .banner-card { padding: 16px 14px 18px; gap: 2px; }
  .banner-name { font-size: clamp(22px, 6.4vw, 32px); }
  .banner-tip { font-size: 12.5px; }
  .banner-ribbon { border-width: 3px; border-radius: 18px; }

  .combo { top: 33%; }
  .combo-word { font-size: clamp(26px, 8.4vw, 46px); }

  .menu-inner { padding: clamp(10px, 2.4vh, 22px) 12px clamp(46px, 7vh, 66px); gap: 2px; }
  .menu-mascot { margin-bottom: 0; }
  .menu-mascot .toy-coil { font-size: clamp(8px, 2.4vw, 12px); --ring-gap: 0.32em; }
  .logo--menu { font-size: clamp(38px, 12.6vw, 66px); }
  .tagline { font-size: 13.5px; }
  .tagline span { padding: 0.28em 0.8em; }
  .menu-actions { width: 94vw; gap: 10px; margin-top: 12px; }
  .btn--play { width: 96%; }
  .btn--xl { font-size: clamp(22px, 6vw, 30px); padding: 0.38em 0.9em; }
  .btn--md { font-size: clamp(12.5px, 3.4vw, 15px); padding: 0.58em 0.5em; }
  .menu-row { width: 96%; gap: 8px; }
  .menu-row .btn { min-height: 48px; }
  .menu-row .btn .icon { width: 1em; height: 1em; }
  .menu-progress { margin-top: 12px; font-size: 10px; padding: 0.32em 0.7em; gap: 0.45em; }
  .deco-coil { display: none; }
  .deco-star--1 { font-size: 22px; left: 4%; top: 8%; }
  .deco-star--2 { font-size: 16px; }
  .menu-tag { display: none; }

  .modal-layer { padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom)); }
  .modal-card { width: calc(100vw - 16px); max-height: 94vh; border-radius: 24px; border-width: 3px; padding: 18px 14px 18px; }
  .modal-card--result, .modal-card--complete { padding: 0 0 16px; }
  .modal-x { width: 44px; height: 44px; right: 6px; top: 6px; }
  .result-hero { border-radius: 21px 21px 0 0; padding: 20px 14px 12px; }
  .result-stars { gap: 2px; }
  .rv-star { width: 48px; height: 48px; }
  .result-stats { padding: 12px 12px 0; gap: 8px; }
  .stat { padding: 8px 10px; gap: 7px; }
  .stat-icon { width: 28px; height: 28px; }
  .stat-icon--pot .pot-svg { width: 28px; height: 28px; }
  .stat-star-svg { width: 26px; height: 26px; }
  .stat-value { font-size: 19px; }
  .stat-label { font-size: 9px; }
  .result-meta { padding: 9px 12px 0; }
  .result-actions { padding: 12px 12px 0; }
  .level-grid { gap: 7px; }
  .lvl { padding: 10px 4px 9px; border-radius: 16px; border-width: 2.5px; }
  .lvl-num { font-size: 24px; }
  .lvl-name { display: none; }
  .lvl-stars { font-size: 12px; }
  .levels-foot { margin-top: 12px; }
  .howto-list { gap: 7px; }
  .howto-step { padding: 14px 7px 8px; border-radius: 16px; }
  .howto-art { max-width: 100px; }
  .howto-text { font-size: 10.5px; }
  .howto-num { width: 20px; height: 20px; font-size: 11px; top: 5px; left: 5px; }
  .howto-sub { font-size: 12px; }
  .complete-coil .toy-coil { transform: scale(0.66); }
  .complete-hero { border-radius: 21px 21px 0 0; padding: 18px 12px 12px; }
  .complete-grid { padding: 12px 12px 0; gap: 5px; }
  .modal-card--complete .result-actions { padding: 14px 12px 0; }
}

/* small phones */
@media (max-width: 400px) {
  .chip { font-size: 13.5px; min-width: 5em; }
  .hand-tray { padding: 4px 9px 8px; }
  .hand-chips { gap: 7px; }
  .logo--menu { font-size: clamp(34px, 12vw, 52px); }
  .menu-mascot .toy-coil { font-size: 8px; }
  .banner-name { font-size: 22px; }
  .banner-tip { font-size: 11.5px; }
  .goal-num { font-size: 23px; }
  .toast { font-size: 11px; }
  .stat-value { font-size: 17px; }
  .result-ribbon-text { font-size: 17px; }
  .rv-star { width: 42px; height: 42px; }
  .lvl-num { font-size: 21px; }
  .howto-text { font-size: 10px; }
}

/* very narrow phones */
@media (max-width: 350px) {
  .tool { width: 40px; height: 40px; }
  .tool--hint { width: 40px; height: 40px; }
  .level-card { max-width: calc(100vw - 240px); }
  .chip { font-size: 13px; }
}

/* short viewports (landscape laptops, 1280x720 class) */
@media (max-height: 745px) and (min-width: 641px) {
  .menu-inner { gap: 0; padding-top: 10px; padding-bottom: 42px; }
  .menu-mascot { margin-bottom: 0; }
  .menu-mascot .toy-coil { font-size: clamp(8px, 0.7vw + 2px, 11px); }
  .logo--menu { font-size: clamp(40px, min(8.4vw, 11.5vh), 104px); }
  .tagline { margin-top: 4px; font-size: 15px; }
  .menu-actions { margin-top: 8px; gap: 9px; }
  .menu-progress { margin-top: 8px; }
  .btn--xl { font-size: clamp(22px, 2.2vw + 5px, 32px); }
  .deco-coil--left, .deco-coil--right { opacity: 0.6; }
  .hand-tray { padding: 4px 12px 8px; }
  .chip { font-size: clamp(11.5px, 0.7vw + 5px, 14.5px); }
  .goal-card { width: min(310px, 32vw); height: 80px; }
}

/* landscape phones */
@media (max-height: 500px) and (orientation: landscape) {
  .menu-mascot { display: none; }
  .logo--menu { font-size: clamp(28px, 5vh, 44px); }
  .menu-inner { flex-direction: row; flex-wrap: wrap; justify-content: center; align-content: center; gap: 10px 18px; padding: 8px 12px; }
  .logo { order: 1; }
  .tagline { order: 2; margin: 0; }
  .menu-actions { order: 3; width: auto; margin: 0; flex-direction: column; }
  .menu-progress { order: 4; margin: 0; }
  .goal-card { width: min(290px, 42vw); height: 64px; }
  .level-card-name { display: none; }
  .hand-tray-tag { display: none; }
  .hand-tray { padding: 4px 10px 6px; }
  .toast-stack { bottom: 110px; }
}

/* ═══════════════════════════ reduced motion ═════════════════════════════ */
/* ═══════════════════════ reduced motion (accessible) ═══════════════════
   Keep everything READABLE and FUNCTIONAL: only decorative loops and
   entrance motion are dropped, overlays keep their final visible state. */
@media (prefers-reduced-motion: reduce) {
  .logo-letter,
  .toy-coil, .toy-ring,
  .blob, .cloud, .boot-spark,
  .deco-confetti, .deco-star, .deco-blob, .deco-coil, .menu-mascot,
  .banner-ribbon::before, .banner-spark, .banner-star,
  .complete-rays, .complete-coil .toy-coil,
  .confetti-piece, .pip-spark,
  .combo-ring, .combo-spark,
  .chip.is-hint, .chip.is-bump, .lvl.is-next,
  .goal-card.is-bump, .pip.is-pop {
    animation: none !important;
  }
  .ui-screen, .chip, .goal-card, .level-card, .score-card, .hud-tools,
  .hand-tray, .level-banner, .modal-card, .toast {
    animation: none !important;
  }
  .chip, .toast, .btn, .tool, .lvl, .stat, .goal-fill, .goal-track, .pip,
  .score-card, .goal-card, .banner-layer, .modal-layer {
    transition: none !important;
  }
  .modal-card { opacity: 1; transform: none; }
  .modal-layer.is-out .modal-card { opacity: 0; }
  .level-banner { opacity: 1; transform: translate(-50%, -50%); }
  .banner-layer.is-out .level-banner { opacity: 0; }
  .rv-star { opacity: 0.55; transform: none; }
  .rv-star.is-on { opacity: 1; }
  .combo { opacity: 1; }
  .confetti-piece { display: none; }
  .toast { opacity: 1; transform: none; }
  .toast.is-out { opacity: 0; }
  .boot-screen { transition: opacity 0.001ms; }
}

/* ══════════════════════════════════════════════════════════════════════════
   CÁMARA 360° — giro directo de la cámara para ver los escalones
   (botón flotante durante la partida; también se puede arrastrar la escena)
   ══════════════════════════════════════════════════════════════════════════ */
.camera-360 {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: 210px;
  z-index: 36;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 62px;
  height: 62px;
  padding: 0;
  border: 3px solid rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  background: linear-gradient(180deg, #fffdf8 0%, #ffe6f3 100%);
  box-shadow: 0 6px 0 rgba(196, 86, 134, 0.35), 0 12px 22px rgba(70, 30, 60, 0.18);
  color: #a33a66;
  font-family: 'Baloo 2', 'Trebuchet MS', system-ui, sans-serif;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.22s ease;
}
.camera-360 .camera-360-icon {
  display: block;
  font-size: 26px;
  line-height: 1;
  margin-top: 3px;
  transform-origin: 50% 50%;
}
.camera-360 .camera-360-label {
  display: block;
  font-size: 10px;
  line-height: 1;
  letter-spacing: 0.04em;
  margin-top: 1px;
}
.camera-360:hover { transform: translateY(-2px) scale(1.05); }
.camera-360:active {
  transform: translateY(3px) scale(0.96);
  box-shadow: 0 2px 0 rgba(196, 86, 134, 0.3), 0 4px 10px rgba(70, 30, 60, 0.16);
}
.camera-360:focus-visible { outline: 3px solid #ffd84d; outline-offset: 3px; }
.camera-360.is-hidden { opacity: 0; pointer-events: none; transform: scale(0.7); }
.camera-360.is-spinning { pointer-events: none; }
.camera-360.is-spinning .camera-360-icon { animation: cameraTriSpin 1.15s linear infinite; }
@keyframes cameraTriSpin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- free-move button */
.move-btn {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: 290px;
  z-index: 36;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 62px;
  height: 62px;
  border: 0;
  border-radius: 50%;
  color: #244C6B;
  font-family: inherit;
  font-weight: 800;
  cursor: pointer;
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.95) 0 16%, rgba(255, 255, 255, 0) 48%),
    linear-gradient(160deg, #B6F2FF 0%, #7FD8FF 46%, #5CB8F5 100%);
  box-shadow: 0 5px 0 #2E86C9, 0 10px 22px rgba(40, 80, 120, 0.3);
  transition: opacity 0.24s ease, transform 0.24s cubic-bezier(0.34, 1.56, 0.64, 1);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.move-btn .move-btn-icon {
  display: block;
  font-size: 25px;
  line-height: 1;
  margin-top: 2px;
}
.move-btn .move-btn-label {
  display: block;
  font-size: 9.5px;
  line-height: 1;
  letter-spacing: 0.05em;
  margin-top: 2px;
}
.move-btn .move-btn-cost {
  display: block;
  font-size: 8.5px;
  line-height: 1;
  margin-top: 1px;
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(36, 76, 107, 0.14);
}
.move-btn:hover:not(:disabled) { transform: translateY(-2px) scale(1.05); }
.move-btn:active:not(:disabled) { transform: translateY(3px) scale(0.96); box-shadow: 0 2px 0 #2E86C9, 0 4px 10px rgba(40, 80, 120, 0.2); }
.move-btn:focus-visible { outline: 3px solid #ffd84d; outline-offset: 3px; }
.move-btn:disabled { opacity: 0.55; cursor: default; }
.move-btn.is-active {
  color: #5A2A00;
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.95) 0 16%, rgba(255, 255, 255, 0) 48%),
    linear-gradient(160deg, #FFE890 0%, #FFD84D 48%, #FFB43D 100%);
  box-shadow: 0 5px 0 #D18A0B, 0 10px 22px rgba(160, 90, 0, 0.32);
  animation: moveBtnPulse 1.1s ease-in-out infinite alternate;
}
.move-btn.is-hidden { opacity: 0; pointer-events: none; transform: scale(0.7); }
@keyframes moveBtnPulse {
  from { transform: translateY(0) scale(1); }
  to { transform: translateY(-2px) scale(1.04); }
}

@media (max-width: 760px), (max-height: 760px) {
  .move-btn {
    right: max(9px, env(safe-area-inset-right));
    bottom: 270px;
    width: 56px;
    height: 56px;
  }
  .move-btn .move-btn-icon { font-size: 22px; }
  .move-btn .move-btn-label { font-size: 8.5px; }
  .move-btn .move-btn-cost { font-size: 8px; }
}
@media (min-height: 980px) {
  .move-btn { bottom: 320px; }
}
@media (prefers-reduced-motion: reduce) {
  .move-btn, .move-btn .move-btn-icon { animation: none !important; transition: none !important; }
}

@media (max-width: 760px), (max-height: 760px) {
  .camera-360 {
    right: max(9px, env(safe-area-inset-right));
    bottom: 200px;
    width: 56px;
    height: 56px;
  }
  .camera-360 .camera-360-icon { font-size: 23px; }
  .camera-360 .camera-360-label { font-size: 9px; }
}
@media (min-height: 980px) {
  .camera-360 { bottom: 240px; }
}
@media (prefers-reduced-motion: reduce) {
  .camera-360,
  .camera-360 .camera-360-icon { animation: none !important; transition: none !important; }
}

/* ───────────── hand cards v4: the real 3D slinky on a mini platform ───────────── */
.chip--3d {
  min-width: 5.4em;
  padding: 0.35em 0.45em 0.45em;
  border-radius: 1.3em;
  background:
    radial-gradient(110% 70% at 50% 0%, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0) 70%),
    linear-gradient(180deg, color-mix(in srgb, var(--c-light) 55%, #FFFFFF) 0%, var(--c-light) 100%);
  box-shadow:
    0 0.3em 0 var(--c-dark),
    0 0.7em 1.2em rgba(60, 20, 50, 0.25),
    inset 0 0.12em 0 rgba(255, 255, 255, 0.95),
    inset 0 0 0 0.13em rgba(255, 255, 255, 0.7);
}
.chip--3d .chip-pad {
  position: absolute;
  left: 50%;
  top: 3.55em;
  width: 3.9em;
  height: 1.05em;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 35%, #FFFFFF 0%, #FFF4FA 45%, color-mix(in srgb, var(--c-light) 70%, #FFFFFF) 100%);
  box-shadow: 0 0.14em 0 rgba(0, 0, 0, 0.08), inset 0 -0.08em 0 rgba(0, 0, 0, 0.06);
  pointer-events: none;
}
.chip--3d .chip-coil {
  width: 4.4em;
  height: 4.4em;
  margin: -0.35em 0 -0.1em;
  z-index: 1;
}
.chip--3d .chip-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0.08em 0.05em rgba(60, 20, 50, 0.25));
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
.chip--3d .coil-shadow { bottom: 0.35em; width: 2.6em; z-index: -1; }
.chip--3d .chip-sym {
  top: 0.32em;
  right: 0.32em;
  bottom: auto;
  width: 1.45em;
  height: 1.45em;
  font-size: 0.68em;
  z-index: 2;
}
.chip--3d .chip-name {
  position: relative;
  z-index: 2;
  margin-top: 0.1em;
  padding: 0.16em 0.7em 0.2em;
  border-radius: 999px;
  background: var(--c-dark);
  color: #FFFFFF;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.18);
  font-size: 0.74em;
  letter-spacing: 0.04em;
  box-shadow: inset 0 0.1em 0 rgba(255, 255, 255, 0.3);
}
.chip--3d.chip--rainbow {
  background:
    radial-gradient(110% 70% at 50% 0%, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0) 70%),
    linear-gradient(135deg, #FFD1E0, #FFF3BF 30%, #C9FFF4 55%, #D6ECFF 78%, #E7DBFF);
  box-shadow:
    0 0.3em 0 #B44BD6,
    0 0.7em 1.2em rgba(60, 20, 50, 0.25),
    inset 0 0.12em 0 rgba(255, 255, 255, 0.95),
    inset 0 0 0 0.13em rgba(255, 255, 255, 0.7);
}
.chip--3d.chip--rainbow .chip-name { background: linear-gradient(90deg, #FF5C8A, #FF8A3D 25%, #2FD9B9 55%, #4FA8FF 78%, #A87CFF); }
.chip--3d.is-used { box-shadow: 0 0.1em 0 rgba(122, 42, 79, 0.16); }
.chip--3d.is-selected {
  box-shadow:
    0 0.35em 0 var(--c-dark),
    0 0.9em 1.6em rgba(60, 20, 50, 0.3),
    0 0 0 0.16em #FFE066,
    inset 0 0.12em 0 rgba(255, 255, 255, 0.95);
}
@media (max-width: 560px) {
  .chip--3d { min-width: 4.9em; }
  .chip--3d .chip-coil { width: 3.9em; height: 3.9em; }
  .chip--3d .chip-pad { top: 3.1em; width: 3.4em; }
}


/* ───────────── v5: coins, moves HUD, Intercambio power-up ───────────── */
.coin-card .score-icon { width: 1.35em; height: 1.35em; display: inline-flex; }
.coin-card .score-icon svg { width: 100%; height: 100%; }
.coin-card.is-bump { animation: coinBump 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes coinBump { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }

.goal-card--moves .goal-body { align-items: center; }
.goal-card--moves .goal-track-wrap { display: flex; align-items: center; justify-content: flex-end; }
.goal-card--moves .goal-track { display: none; }
.goal-card--moves .goal-pips { position: static; display: flex; gap: 0.25em; height: auto; }
.goal-card--moves .pip {
  position: static; transform: none; width: 1.7em; height: 1.7em;
  opacity: 0.28; filter: grayscale(1); transition: opacity 0.25s ease, filter 0.25s ease;
}
.goal-card--moves .pip.is-on { opacity: 1; filter: none; }
.goal-card--moves .pip.is-lost { animation: pipLost 0.6s ease; }
@keyframes pipLost { 0% { transform: scale(1.35) rotate(0); } 60% { transform: scale(0.8) rotate(-20deg); } 100% { transform: scale(1) rotate(0); } }
.goal-card--moves .goal-of { font-size: 0.62em; white-space: nowrap; margin-left: 0.45em; opacity: 0.85; }
.goal-card--moves.is-warn .goal-of { color: #D1477A; }

.stat-icon--coin svg { width: 100%; height: 100%; }

/* power-up button (replaces MOVER) */
.powerup-btn { background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.95) 0 16%, rgba(255, 255, 255, 0) 48%),
    linear-gradient(160deg, #A8F0FF 0%, #48CFFF 50%, #23A9F0 100%);
  box-shadow: 0 5px 0 #1478BD, 0 10px 22px rgba(20, 90, 150, 0.32);
  overflow: visible;
}
.powerup-btn .move-btn-icon { width: 38px; height: 38px; margin-top: -4px; }
.powerup-btn .move-btn-cost {
  position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 7px 2px 3px; font-size: 12px; font-weight: 900; color: #fff;
  background: linear-gradient(180deg, #6FDB2E, #3EAE12); border-radius: 999px;
  box-shadow: 0 2px 0 #2B7D0B; text-shadow: 0 1px 0 rgba(0,0,0,.25);
}
.powerup-btn .coin-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #FFF3A6 0 25%, #FFD02E 26% 62%, #E9A100 63%);
  box-shadow: 0 1px 0 #B87900;
}
.powerup-btn.is-poor .move-btn-cost { background: linear-gradient(180deg, #B9B9C9, #8E8EA3); box-shadow: 0 2px 0 #6C6C80; }
.powerup-btn.is-active .move-btn-cost { background: linear-gradient(180deg, #FF7A9C, #E8466F); box-shadow: 0 2px 0 #B02A50; }

/* power-up modal, adapted from the reference: ribbon + hexagon art + green coin button */
.modal-card--powerup {
  width: min(400px, 92vw); overflow: visible; text-align: center;
  padding: 58px 22px 22px; margin-top: 28px;
  border: 5px solid #BFF0FF; border-radius: 34px;
  background: linear-gradient(180deg, #F2FDFF 0%, #E3F8FF 100%);
  box-shadow: 0 0 0 4px rgba(255,255,255,.6), 0 24px 60px rgba(10, 40, 90, 0.45);
}
.modal-card--powerup .modal-x { top: -18px; right: -12px; }
.pw-ribbon {
  position: absolute; left: 50%; top: -30px; transform: translateX(-50%);
  width: 82%; height: 62px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #5FDAFF 0%, #2DB8F5 100%);
  clip-path: polygon(7% 0, 93% 0, 100% 50%, 93% 100%, 7% 100%, 0 50%);
  filter: drop-shadow(0 4px 0 #168CC8);
}
.pw-ribbon span { font-size: 27px; font-weight: 900; letter-spacing: 0.03em; color: #fff;
  text-shadow: 0 3px 0 #1C8BD0, 0 0 2px #1C8BD0; }
.pw-art { display: flex; justify-content: center; margin: 4px 0 14px; }
.pw-hex {
  position: relative; width: 190px; height: 170px; display: flex; align-items: center; justify-content: center;
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);
  background: radial-gradient(circle at 50% 50%, #C8FBFF 0%, #74E3FF 55%, #3CC7F5 100%);
  overflow: hidden;
}
.pw-rays { position: absolute; inset: -40%;
  background: repeating-conic-gradient(rgba(255,255,255,.45) 0 9deg, rgba(255,255,255,0) 9deg 22deg);
  animation: pwSpin 9s linear infinite; }
@keyframes pwSpin { to { transform: rotate(360deg); } }
.pw-art-svg { position: relative; width: 120px; height: 120px; filter: drop-shadow(0 6px 6px rgba(0, 60, 120, .3)); }
.pw-desc { margin: 0 0 16px; font-size: 19px; line-height: 1.25; font-weight: 900; color: #F25BB8; letter-spacing: 0.01em; }
.pw-buy {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  min-width: 200px; padding: 12px 28px; border: 0; border-radius: 22px; cursor: pointer;
  font: inherit; font-size: 30px; font-weight: 900; color: #fff; text-shadow: 0 2px 0 #2E7D0C;
  background: linear-gradient(180deg, #8BEA3C 0%, #4FC316 55%, #3DAA0E 100%);
  box-shadow: 0 6px 0 #2B7D0B, 0 10px 18px rgba(30, 90, 10, 0.3), inset 0 2px 0 rgba(255,255,255,.5);
  transition: transform .12s ease;
}
.pw-buy:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 2px 0 #2B7D0B; }
.pw-buy:disabled { filter: grayscale(0.8); opacity: 0.7; cursor: not-allowed; }
.pw-coin { width: 40px; height: 40px; display: inline-flex; }
.pw-coin svg { width: 100%; height: 100%; }
.pw-note { margin: 14px 0 0; font-size: 14px; font-weight: 700; color: #3C6C8C; }
