*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* First paint: hide pegs, hint lightbulbs, and toolbar until instructions overlay is ready */
body.toh-boot-hide-game #game-wrapper {
  visibility: hidden;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: #06060f;
  color: #e2e8f0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
  -webkit-user-select: none;
}

body {
  background:
    radial-gradient(ellipse 120% 80% at 20% 15%, rgba(120, 40, 200, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse 100% 70% at 80% 10%, rgba(30, 100, 220, 0.10) 0%, transparent 45%),
    radial-gradient(ellipse 90% 60% at 50% 90%, rgba(200, 50, 80, 0.07) 0%, transparent 40%),
    radial-gradient(ellipse 80% 50% at 70% 60%, rgba(220, 160, 30, 0.05) 0%, transparent 35%),
    #06060f;
}

/* ── Particle Canvas ── */
#particle-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* ── Confetti ── */
#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 100;
  display: none;
}

/* ── Layout ── */
#game-wrapper {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px;
  padding-bottom: clamp(120px, 17vw, 158px);
  gap: 8px;
}

/* ── Top Bar ── */
#top-bar {
  position: relative;
  width: min(94vw, 860px);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 0;
  height: 0;
}

/* ── Hint lightbulbs (top-left) ── */
#hint-lightbulbs {
  position: fixed;
  top: clamp(10px, 2vw, 18px);
  left: clamp(10px, 2vw, 18px);
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: clamp(2px, 0.6vw, 6px);
  align-items: flex-start;
}
#hint-lightbulbs .hint-row {
  display: flex;
  gap: clamp(2px, 0.6vw, 6px);
  align-items: flex-start;
}
#pink-lightbulb {
  width: clamp(52px, 8.5vw, 72px);
  height: clamp(52px, 8.5vw, 72px);
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
              filter 0.3s ease;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
}
#pink-lightbulb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
#pink-lightbulb:hover {
  transform: scale(1.1);
  filter: drop-shadow(0 0 12px rgba(255, 220, 120, 0.55));
}
#pink-lightbulb:active { transform: scale(0.94); }

.hint-lightbulb {
  width: clamp(52px, 8.5vw, 72px);
  height: clamp(52px, 8.5vw, 72px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              filter 0.35s ease;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  font-size: 0;
  line-height: 0;
  border: none;
  background: none;
  border-radius: 50%;
  padding: 0;
}

.hint-lightbulb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

.hint-lightbulb.locked:hover { transform: scale(1.06); }
.hint-lightbulb.available:hover { transform: scale(1.1); }
.hint-lightbulb.available:active { transform: scale(0.94); }
.hint-lightbulb.playing { animation: hintLightbulbPulse 2s ease-in-out infinite; }
.hint-lightbulb.used:hover { transform: scale(1.06); }

@keyframes hintLightbulbPulse {
  0%, 100% {
    filter: drop-shadow(0 0 4px rgba(210, 160, 30, 0.15));
    transform: scale(1);
  }
  50% {
    filter: drop-shadow(0 0 10px rgba(210, 160, 30, 0.4));
    transform: scale(1.02);
  }
}

/* ── Build-up tutorial button ── */
#buildup-btn {
  position: fixed;
  top: clamp(68px, 11vw, 96px);
  right: clamp(10px, 2vw, 18px);
  z-index: 20;
  width: clamp(44px, 7vw, 58px);
  height: clamp(44px, 7vw, 58px);
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.12);
  background: rgba(20, 16, 42, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}
#buildup-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 0 16px rgba(251, 191, 36, 0.2);
}
#buildup-btn:active { transform: scale(0.94); }
.buildup-icon {
  font-size: clamp(1.2rem, 2.5vw, 1.6rem);
  line-height: 1;
}

/* ── Build-up overlay (covers game area) ── */
#buildup-overlay {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 15;
  background: rgba(8, 6, 22, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 2.5vw, 20px);
  padding: clamp(16px, 3vw, 28px);
  text-align: center;
  font-family: 'Fredoka', sans-serif;
  color: rgba(232, 225, 255, 0.95);
  overflow-y: auto;
}
#buildup-overlay.show { display: flex; }

.bu-title {
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  font-weight: 600;
  line-height: 1.3;
}
.bu-subtitle {
  font-size: clamp(0.85rem, 2vw, 1.05rem);
  font-weight: 400;
  color: rgba(200, 195, 230, 0.75);
  line-height: 1.4;
}
.bu-fruit {
  font-size: clamp(2.5rem, 7vw, 4rem);
  line-height: 1;
}
.bu-input-wrap {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.5vw, 12px);
}
.bu-input {
  width: clamp(48px, 8vw, 64px);
  height: clamp(40px, 6vw, 52px);
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  background: rgba(30, 28, 60, 0.6);
  color: rgba(251, 220, 130, 0.95);
  font-family: 'Fredoka', sans-serif;
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  font-weight: 600;
  text-align: center;
  outline: none;
  transition: border-color 0.3s ease;
}
.bu-input:focus { border-color: rgba(251, 191, 36, 0.5); }
.bu-btn {
  padding: clamp(10px, 2vw, 14px) clamp(20px, 4vw, 32px);
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.85), rgba(245, 158, 11, 0.85));
  color: #1a1428;
  font-family: 'Fredoka', sans-serif;
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.bu-btn:hover {
  transform: scale(1.04);
  box-shadow: 0 0 16px rgba(251, 191, 36, 0.3);
}
.bu-btn:active { transform: scale(0.96); }
.bu-btn-sm {
  padding: clamp(5px, 1vw, 8px) clamp(10px, 2vw, 16px);
  font-size: clamp(0.8rem, 1.6vw, 0.95rem);
  border-radius: 8px;
}
.bu-input-inline {
  width: clamp(36px, 6vw, 48px);
  height: clamp(30px, 5vw, 38px);
  font-size: clamp(0.9rem, 2vw, 1.1rem);
}
.bu-input-lg {
  width: clamp(48px, 8vw, 64px);
  height: clamp(38px, 6vw, 48px);
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  text-align: center;
}
.bu-btn-icon {
  width: clamp(38px, 6vw, 48px);
  height: clamp(38px, 6vw, 48px);
  padding: 0;
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
/* Premium submit button */
.bu-submit {
  position: relative;
  height: clamp(42px, 6.4vw, 52px);
  min-width: clamp(42px, 6.4vw, 52px);
  padding: 0 clamp(12px, 2vw, 18px);
  border: 2px solid rgba(251, 220, 100, 0.75);
  border-radius: 14px;
  background: linear-gradient(135deg, #fde047 0%, #fbbf24 55%, #f59e0b 100%);
  color: #1a1428;
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 4px 14px rgba(251, 191, 36, 0.55),
    0 0 22px rgba(251, 191, 36, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  animation: bu-submit-pulse 1.8s ease-in-out infinite;
}
@keyframes bu-submit-pulse {
  0%, 100% {
    box-shadow:
      0 4px 14px rgba(251, 191, 36, 0.55),
      0 0 22px rgba(251, 191, 36, 0.35),
      inset 0 1px 0 rgba(255, 255, 255, 0.35);
  }
  50% {
    box-shadow:
      0 6px 18px rgba(251, 191, 36, 0.7),
      0 0 36px rgba(251, 191, 36, 0.6),
      inset 0 1px 0 rgba(255, 255, 255, 0.45);
  }
}
.bu-submit::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255,255,255,0.35) 0%, transparent 55%);
  pointer-events: none;
}
.bu-submit:hover {
  transform: translateY(-1px) scale(1.05);
  box-shadow:
    0 6px 20px rgba(251, 191, 36, 0.75),
    0 0 40px rgba(251, 191, 36, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
  filter: brightness(1.08);
}
.bu-submit:active {
  transform: translateY(1px) scale(0.97);
  filter: brightness(0.95);
}
.bu-submit svg {
  width: 1.25em;
  height: 1.25em;
  fill: currentColor;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.18));
}
.bu-btn-pill {
  padding: clamp(4px, 0.8vw, 7px) clamp(10px, 2vw, 16px);
  border-radius: 20px;
  border: 1.5px solid rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.1);
  color: rgba(251, 220, 150, 0.9);
  font-family: 'Fredoka', sans-serif;
  font-size: clamp(0.72rem, 1.4vw, 0.85rem);
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}
.bu-btn-pill:hover {
  transform: scale(1.04);
  background: rgba(251, 191, 36, 0.18);
}
.bu-btn-pill:active { transform: scale(0.96); }
.bu-btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(220, 210, 255, 0.85);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
}
.bu-btn-secondary:hover {
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.08);
}

/* Equation bar in whisper for Level 2+ */
.bu-equation {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 1.2vw, 12px);
  flex-wrap: nowrap;
}
.bu-eq-fruit {
  font-size: clamp(1.4rem, 3.5vw, 2rem);
  line-height: 1;
}
.bu-eq-symbol {
  font-family: 'Fredoka', sans-serif;
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  font-weight: 600;
  color: rgba(200, 195, 230, 0.65);
}
.bu-eq-disc {
  width: clamp(28px, 5vw, 40px);
  height: clamp(14px, 2.5vw, 20px);
  border-radius: 6px;
  display: inline-block;
}

/* Cherry auto-move button */
.bu-cherry-btn {
  padding: clamp(8px, 1.5vw, 12px) clamp(14px, 2.5vw, 22px);
  border-radius: 10px;
  border: 2px solid rgba(255, 70, 90, 0.3);
  background: rgba(255, 70, 90, 0.1);
  color: rgba(255, 200, 200, 0.9);
  font-family: 'Fredoka', sans-serif;
  font-size: clamp(0.85rem, 1.8vw, 1rem);
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: clamp(4px, 0.8vw, 8px);
  transition: transform 0.2s ease, background 0.2s ease;
}
.bu-cherry-btn:hover {
  transform: scale(1.04);
  background: rgba(255, 70, 90, 0.18);
}
.bu-cherry-btn:active { transform: scale(0.96); }
.bu-cherry-btn .bu-cherry-emoji {
  font-size: clamp(1rem, 2vw, 1.3rem);
}

.hint-lock-popup {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: rgba(15, 15, 35, 0.92);
  border: 1px solid rgba(251, 191, 36, 0.2);
  color: rgba(251, 191, 36, 0.8);
  font-size: clamp(0.65rem, 1.5vw, 0.75rem);
  padding: 5px 10px;
  border-radius: 7px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 25;
}

.hint-lock-popup.visible {
  opacity: 1;
}

/* ── Top-right Controls ── */
#top-bar-controls {
  position: fixed;
  top: clamp(10px, 2vw, 18px);
  right: clamp(10px, 2vw, 18px);
  z-index: 20;
  display: flex;
  align-items: flex-start;
  gap: clamp(2px, 0.6vw, 6px);
}

.top-ctrl-btn {
  width: clamp(52px, 8.5vw, 72px);
  height: clamp(52px, 8.5vw, 72px);
  border-radius: 50%;
  border: 2px solid rgba(251, 191, 36, 0.45);
  background: rgba(10, 10, 28, 0.75);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  -webkit-tap-highlight-color: transparent;
  font-size: 0;
  line-height: 0;
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.1), inset 0 1px 0 rgba(255,255,255,0.05);
}

.top-ctrl-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

.top-ctrl-btn:hover {
  border-color: rgba(251, 191, 36, 0.7);
  background: rgba(251, 191, 36, 0.08);
  transform: scale(1.08);
  box-shadow: 0 0 22px rgba(251, 191, 36, 0.2);
}

.top-ctrl-btn:active {
  transform: scale(0.92);
}

.instr-scroll-btn {
  border: none;
  background: none;
  box-shadow: none;
  overflow: hidden;
  border-radius: 50%;
}

#home-btn {
  border: 2px solid rgba(251, 191, 36, 0.5);
  background: radial-gradient(circle at 30% 25%, rgba(30, 22, 6, 0.95), rgba(10, 8, 18, 0.95));
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: #fbbf24;
  text-decoration: none;
  overflow: visible;
}

#home-btn .home-icon {
  width: 58%;
  height: 58%;
  filter: drop-shadow(0 0 4px rgba(251, 191, 36, 0.45));
  transition: filter 0.25s ease;
}

#home-btn:hover {
  border-color: rgba(251, 191, 36, 0.85);
  background: radial-gradient(circle at 30% 25%, rgba(60, 40, 10, 0.95), rgba(18, 14, 30, 0.95));
  box-shadow: 0 0 22px rgba(251, 191, 36, 0.35);
  transform: scale(1.08);
}

#home-btn:hover .home-icon {
  filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.85));
}

.instr-scroll-btn:hover {
  border: none;
  background: none;
  box-shadow: none;
  filter: brightness(1.15);
  transform: scale(1.08);
}

/* ══════════════════════════════════════════════
   WHISPER AREA — fixed reservation above the board
   ══════════════════════════════════════════════ */
#whisper-area {
  position: relative;
  width: min(94vw, 860px);
  height: clamp(100px, 18vh, 180px);
  flex-shrink: 0;
  overflow: visible;
}

/* ══════════════════════════════════════════════
   TOP WHISPER PANEL
   ══════════════════════════════════════════════ */
#top-whisper {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: fit-content;
  max-width: min(86vw, 560px);
  min-width: min(70vw, 280px);
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  overflow-x: hidden;
  overflow-y: auto;
  pointer-events: none;

  /* Hidden until .show; avoids flash when .show + .whisper-fade-out are removed (no 0→1 opacity transition) */
  opacity: 0;

  /* Starts invisible — fades in when .show is added */
  background: transparent;
  border: 1px solid transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transition:
    background 0.4s ease,
    border-color 0.4s ease,
    box-shadow 0.4s ease,
    backdrop-filter 0.4s ease,
    opacity 0.45s ease;
}

#top-whisper.show.whisper-fade-out {
  opacity: 0;
  pointer-events: none;
}

/* Gold beam — only exists when card is active */
#top-whisper::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 5%;
  right: 5%;
  height: 1.5px;
  border-radius: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(251, 191, 36, 0.18) 10%,
    rgba(251, 191, 36, 0.65) 38%,
    rgba(255, 210, 80, 0.95) 50%,
    rgba(251, 191, 36, 0.65) 62%,
    rgba(251, 191, 36, 0.18) 90%,
    transparent 100%);
  opacity: 0;
  transition: opacity 0.4s ease;
}

#top-whisper.show::after {
  opacity: 1;
  animation: twBeamPulse 2.8s ease-in-out infinite;
}

@keyframes twBeamPulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; filter: blur(0.5px); }
}

/* Scan line — only animates when card is active */
#top-whisper::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 55%;
  background: linear-gradient(180deg,
    transparent 0%,
    rgba(140, 110, 255, 0.022) 50%,
    transparent 100%);
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.4s ease;
}

#top-whisper.show::before {
  opacity: 1;
  animation: twScan 6s linear infinite;
}

@keyframes twScan {
  0%  { top: -60%; }
  100%{ top: 110%; }
}

/* Card materialises in place — no transform slide */
#top-whisper.show {
  opacity: 1;
  background:
    radial-gradient(ellipse 100% 60% at 50% -10%, rgba(90, 50, 200, 0.045) 0%, transparent 55%),
    linear-gradient(170deg,
      rgba(18, 14, 44, 0.97) 0%,
      rgba(13, 10, 32, 0.98) 100%);
  border-color: rgba(110, 90, 210, 0.14);
  box-shadow:
    0 0 0 0.5px rgba(70, 50, 150, 0.08),
    0 28px 70px rgba(0, 0, 0, 0.65),
    0 10px 28px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(190, 170, 255, 0.05);
  backdrop-filter: blur(28px) saturate(1.5);
  -webkit-backdrop-filter: blur(28px) saturate(1.5);
  pointer-events: auto;
}

#top-whisper-close {
  position: absolute;
  top: 11px;
  right: 12px;
  width: clamp(28px, 3.8vw, 34px);
  height: clamp(28px, 3.8vw, 34px);
  border-radius: 50%;
  border: 1px solid rgba(140, 120, 230, 0.12);
  background: rgba(255, 255, 255, 0.03);
  color: rgba(170, 155, 220, 0.28);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: background 0.2s, color 0.2s, border-color 0.2s, opacity 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}

#top-whisper.show #top-whisper-close {
  opacity: 1;
  pointer-events: auto;
}

#top-whisper-close svg {
  width: 48%;
  height: 48%;
}

#top-whisper-close:hover {
  background: rgba(255, 255, 255, 0.07);
  color: rgba(170, 155, 220, 0.55);
  border-color: rgba(140, 120, 230, 0.22);
}

#top-whisper-inner {
  position: relative;
  z-index: 1;
  padding: clamp(20px, 3.5vw, 30px) clamp(24px, 4.5vw, 42px) clamp(18px, 3vw, 26px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(14px, 2.5vw, 20px);
}

#top-whisper-text {
  margin: 0;
  font-size: clamp(1.05rem, 3vw, 1.35rem);
  font-weight: 500;
  color: rgba(232, 222, 255, 0.95);
  text-align: center;
  line-height: 1.55;
  letter-spacing: 0.018em;
  text-shadow:
    0 0 28px rgba(130, 100, 255, 0.18),
    0 1px 10px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.3s ease;
}

#top-whisper.show #top-whisper-text {
  opacity: 1;
  transition: opacity 0.32s ease 0.22s;
}

#top-whisper-choices {
  display: flex;
  gap: clamp(10px, 2vw, 16px);
  justify-content: center;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

#top-whisper.show #top-whisper-choices {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.3s ease 0.38s, transform 0.3s ease 0.38s;
}

.tw-choice {
  padding: clamp(9px, 1.8vw, 13px) clamp(28px, 5.5vw, 48px);
  background: rgba(255, 255, 255, 0.045);
  border: 1.5px solid rgba(140, 120, 220, 0.18);
  border-radius: 12px;
  color: rgba(215, 205, 255, 0.88);
  font-size: clamp(0.82rem, 1.9vw, 0.96rem);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition:
    background 0.25s ease,
    border-color 0.25s ease,
    color 0.25s ease,
    transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}

.tw-choice:hover {
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.42);
  color: rgba(251, 191, 36, 0.95);
  transform: scale(1.06) translateY(-1px);
  box-shadow:
    0 0 18px rgba(251, 191, 36, 0.14),
    0 5px 14px rgba(0, 0, 0, 0.28);
}

.tw-choice:active {
  transform: scale(0.95);
  transition-duration: 0.1s;
}

/* ── Phase Hint Navigation ── */
.tw-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: clamp(30px, 4.5vw, 38px);
  height: clamp(30px, 4.5vw, 38px);
  border-radius: 50%;
  border: 1.5px solid rgba(140, 120, 230, 0.15);
  background: rgba(255, 255, 255, 0.03);
  color: rgba(200, 185, 255, 0.45);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, background 0.2s, border-color 0.2s, color 0.2s,
    transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 5;
  -webkit-tap-highlight-color: transparent;
}

.tw-nav-btn svg {
  width: 52%;
  height: 52%;
}

.tw-nav-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(140, 120, 230, 0.35);
  color: rgba(220, 210, 255, 0.85);
  transform: translateY(-50%) scale(1.1);
}

.tw-nav-btn:active {
  transform: translateY(-50%) scale(0.9);
  transition-duration: 0.1s;
}

.tw-nav-btn.visible {
  opacity: 1;
  pointer-events: auto;
}

#tw-nav-back { left: clamp(8px, 1.5vw, 14px); }
#tw-nav-fwd  { right: clamp(8px, 1.5vw, 14px); }
#tw-nav-play { right: clamp(8px, 1.5vw, 14px); }

#tw-nav-play.visible {
  border-color: rgba(251, 191, 36, 0.35);
  color: rgba(251, 191, 36, 0.75);
}

#tw-nav-play:hover {
  border-color: rgba(251, 191, 36, 0.65);
  background: rgba(251, 191, 36, 0.08);
  color: rgba(251, 191, 36, 1);
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.12);
}

/* Pulsing glow on the forward/play nav buttons so it's visually obvious
   when it's the player's turn to advance. Pauses on hover so the hover
   state reads cleanly. The back button stays calm — it's not the
   primary action. */
#tw-nav-fwd.visible {
  animation: tw-nav-pulse-purple 1.8s ease-in-out infinite;
}

#tw-nav-play.visible {
  animation: tw-nav-pulse-amber 1.8s ease-in-out infinite;
}

#tw-nav-fwd.visible:hover,
#tw-nav-play.visible:hover {
  animation: none;
}

@keyframes tw-nav-pulse-purple {
  0%, 100% {
    border-color: rgba(140, 120, 230, 0.35);
    box-shadow: 0 0 0 rgba(140, 120, 230, 0);
  }
  50% {
    border-color: rgba(180, 160, 255, 0.9);
    box-shadow: 0 0 14px rgba(140, 120, 230, 0.45);
  }
}

@keyframes tw-nav-pulse-amber {
  0%, 100% {
    border-color: rgba(251, 191, 36, 0.35);
    box-shadow: 0 0 0 rgba(251, 191, 36, 0);
  }
  50% {
    border-color: rgba(251, 191, 36, 1);
    box-shadow: 0 0 14px rgba(251, 191, 36, 0.45);
  }
}

@media (prefers-reduced-motion: reduce) {
  #tw-nav-fwd.visible,
  #tw-nav-play.visible { animation: none; }
}

/* ── Same pulse pattern on the instructions overlay nav buttons ───
   Only the FORWARD chevron and the final GO button pulse. The back
   button stays calm — back is not the primary action. Hover pauses
   the animation so the hover state reads cleanly. */
#instr-fwd-btn.show {
  animation: instr-fwd-pulse 1.8s ease-in-out infinite;
}
#instr-fwd-btn.show:hover {
  animation: none;
}

#instr-end-btns.show #instr-go-btn {
  animation: instr-go-pulse 1.8s ease-in-out infinite;
}
#instr-end-btns.show #instr-go-btn:hover {
  animation: none;
}

@keyframes instr-fwd-pulse {
  0%, 100% {
    border-color: rgba(255, 255, 255, 0.10);
    box-shadow: 0 0 0 rgba(251, 191, 36, 0);
  }
  50% {
    border-color: rgba(251, 191, 36, 0.55);
    box-shadow: 0 0 14px rgba(251, 191, 36, 0.35);
  }
}

@keyframes instr-go-pulse {
  0%, 100% {
    box-shadow: 0 0 18px rgba(251, 191, 36, 0.3);
  }
  50% {
    box-shadow: 0 0 32px rgba(251, 191, 36, 0.65);
  }
}

@media (prefers-reduced-motion: reduce) {
  #instr-fwd-btn.show,
  #instr-end-btns.show #instr-go-btn { animation: none; }
}

/* Pink tutorial mode — hide X, prevent overflow clipping */
#top-whisper.pink-mode #top-whisper-close,
#top-whisper.mission-mode #top-whisper-close {
  display: none;
}
#top-whisper.pink-mode {
  align-items: flex-start;
  /* Tall content like the 3-card Summary needs room for the → button.
     Parent #whisper-area has overflow:visible, so expanding beyond its
     180px cap is safe. */
  max-height: none;
  overflow: visible;
}
/* Widen whisper for the 3-box summary so labels don't wrap/cut */
#top-whisper.pink-mode.phase-hint {
  width: min(96vw, 920px);
}
#top-whisper.pink-mode #top-whisper-inner {
  margin: auto 0;
}

/* Phase hint mode — elevated surface above game background */
#top-whisper.phase-hint {
  min-height: 0;
  width: fit-content;
  max-width: min(90vw, 600px);
  min-width: min(70vw, 280px);
  margin-bottom: -16px;
  background:
    linear-gradient(170deg, rgba(24, 20, 48, 0.97) 0%, rgba(16, 13, 36, 0.98) 100%);
  border-color: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.7),
    0 8px 16px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

#top-whisper.phase-hint #top-whisper-inner {
  padding: clamp(16px, 3vw, 24px) clamp(16px, 3vw, 28px) clamp(18px, 3vw, 26px);
}

#top-whisper.phase-hint #top-whisper-text {
  font-size: clamp(1.18rem, 3.4vw, 1.5rem);
  color: rgba(232, 225, 255, 0.97);
  text-shadow:
    0 0 28px rgba(130, 100, 255, 0.15),
    0 1px 8px rgba(0, 0, 0, 0.5);
}

/* Glow edge — soft purple line across top */
.phase-hint-glow-edge {
  position: absolute;
  top: 0;
  left: 8%;
  right: 8%;
  height: 1px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 2;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(180, 160, 255, 0.15) 15%,
    rgba(200, 180, 255, 0.4) 50%,
    rgba(180, 160, 255, 0.15) 85%,
    transparent 100%);
}

/* ── Mission mode styling ── */
#top-whisper.mission-mode {
  min-height: 0;
  border-color: rgba(251, 191, 36, 0.12);
  box-shadow:
    0 0 0 0.5px rgba(251, 191, 36, 0.06),
    0 20px 50px rgba(0, 0, 0, 0.55),
    0 6px 18px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(251, 191, 36, 0.06);
}

#top-whisper.mission-mode::after {
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(251, 191, 36, 0.18) 10%,
    rgba(251, 191, 36, 0.65) 38%,
    rgba(255, 210, 80, 0.95) 50%,
    rgba(251, 191, 36, 0.65) 62%,
    rgba(251, 191, 36, 0.18) 90%,
    transparent 100%);
}

#top-whisper.mission-mode #top-whisper-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(4px, 1vw, 8px);
}

/* Let success rays extend below the card */
#top-whisper.mission-celebrating {
  overflow: visible;
  z-index: 25;
}

#top-whisper.mission-celebrating #top-whisper-inner {
  overflow: visible;
}

/* Rays emanating downward from the pane */
.mission-pane-fx {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  pointer-events: none;
  z-index: 4;
  overflow: visible;
}

.mission-ray-fan {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 1px;
  height: 1px;
  transform: translateX(-50%);
}

.mission-ray-fan span {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 3px;
  height: clamp(56px, 14vw, 88px);
  margin-left: -1.5px;
  border-radius: 2px;
  background: linear-gradient(
    to bottom,
    rgba(255, 220, 120, 0.85) 0%,
    rgba(251, 191, 36, 0.35) 45%,
    transparent 100%
  );
  transform-origin: bottom center;
  transform: rotate(var(--ray-angle, 0deg)) translateY(2px);
  opacity: 0;
  animation: missionRayEmanate 1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.mission-ray-fan span:nth-child(1) { animation-delay: 0.02s; }
.mission-ray-fan span:nth-child(2) { animation-delay: 0.05s; }
.mission-ray-fan span:nth-child(3) { animation-delay: 0.08s; }
.mission-ray-fan span:nth-child(4) { animation-delay: 0.11s; }
.mission-ray-fan span:nth-child(5) { animation-delay: 0.11s; }
.mission-ray-fan span:nth-child(6) { animation-delay: 0.08s; }
.mission-ray-fan span:nth-child(7) { animation-delay: 0.05s; }
.mission-ray-fan span:nth-child(8) { animation-delay: 0.02s; }

@keyframes missionRayEmanate {
  0% {
    opacity: 0;
    transform: rotate(var(--ray-angle, 0deg)) translateY(4px) scaleY(0.2);
  }
  35% { opacity: 1; }
  100% {
    opacity: 0;
    transform: rotate(var(--ray-angle, 0deg)) translateY(2px) scaleY(1);
  }
}

/* Call-to-action row: flanking icons + lively text */
.mission-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 2.2vw, 16px);
  text-align: center;
  flex-wrap: wrap;
  max-width: 100%;
}

.mission-cta-sub {
  margin-top: 6px;
  text-align: center;
  font-family: Georgia, 'Times New Roman', serif;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(0.8rem, 2vw, 0.95rem);
  color: rgba(226, 232, 240, 0.72);
  letter-spacing: 0.02em;
}

.mission-cta-flank {
  display: flex;
  align-items: center;
  color: rgba(251, 191, 36, 0.88);
  filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.4));
  flex-shrink: 0;
}

.mission-cta-flank-svg {
  width: clamp(1rem, 2.8vw, 1.35rem);
  height: clamp(1rem, 2.8vw, 1.35rem);
  display: block;
}

.mission-cta-text {
  font-size: clamp(1.1rem, 3.2vw, 1.4rem);
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.02em;
  background: linear-gradient(
    115deg,
    rgba(255, 248, 220, 0.98) 0%,
    rgba(251, 191, 36, 0.95) 28%,
    rgba(200, 210, 255, 0.98) 55%,
    rgba(251, 191, 36, 0.92) 78%,
    rgba(255, 245, 200, 0.98) 100%
  );
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: missionCtaShimmer 7s ease-in-out infinite;
  text-shadow: none;
  filter: drop-shadow(0 1px 12px rgba(251, 191, 36, 0.12));
}

@keyframes missionCtaShimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.mission-body {
  font-size: clamp(1.1rem, 3.2vw, 1.4rem);
  color: rgba(232, 225, 255, 0.95);
  font-weight: 500;
}

.mission-body-instruction {
  font-weight: 600;
  letter-spacing: 0.03em;
  color: rgba(240, 235, 255, 0.98);
  text-shadow:
    0 0 24px rgba(130, 100, 255, 0.2),
    0 0 40px rgba(251, 191, 36, 0.08);
}

/* Mission disc glow (steady, no pulse) */
.disk.mission-glow {
  box-shadow:
    0 4px 10px rgba(0, 0, 0, 0.55),
    0 6px 22px var(--glow),
    0 0 14px 5px rgba(251, 191, 36, 0.32),
    inset 0 2px 4px rgba(255, 255, 255, 0.22),
    inset 0 -3px 6px rgba(0, 0, 0, 0.35);
  filter: brightness(1.08);
}

/* Mission dimmed disc (still shows color, just subdued) */
.disk.mission-dimmed {
  filter: brightness(0.45) saturate(0.7);
  transition: filter 0.5s ease;
}

/* Mission target peg — same rod colors as default, extra outer glow only (no pulse) */
.peg-zone.mission-target::before,
.peg-zone.hint-peg-highlight::before {
  background:
    linear-gradient(90deg,
      #1a1a40 0%, #2e2e66 20%, #4a4a8a 42%,
      #5a5aaa 50%, #4a4a8a 58%, #2e2e66 80%, #1a1a40 100%);
  box-shadow:
    inset 1px 0 2px rgba(255, 255, 255, 0.08),
    inset -1px 0 2px rgba(0, 0, 0, 0.3),
    0 0 8px rgba(90, 90, 170, 0.15),
    0 0 22px 8px rgba(90, 100, 200, 0.38),
    0 0 40px 12px rgba(70, 80, 180, 0.2);
}

.peg-zone.mission-target::after,
.peg-zone.hint-peg-highlight::after {
  background:
    radial-gradient(ellipse at 50% 30%, rgba(140, 140, 210, 0.6) 0%, transparent 60%),
    linear-gradient(90deg, #2a2a58 0%, #4a4a90 40%, #5a5aaa 50%, #4a4a90 60%, #2a2a58 100%);
}

/* Disc checkpoint glow — pulsing gold on discs during milestone */
.disk.disc-checkpoint-glow {
  animation: discCheckpointPulse 1.2s ease-in-out infinite !important;
  z-index: 10;
}
@keyframes discCheckpointPulse {
  0%, 100% {
    box-shadow: 0 0 10px 3px rgba(251, 191, 36, 0.5);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 24px 8px rgba(251, 191, 36, 0.85), 0 0 44px 14px rgba(251, 191, 36, 0.2);
    transform: scale(1.06);
  }
}

/* Gold peg highlight — warm glow for target peg */
.peg-zone.hint-peg-gold::before {
  background:
    linear-gradient(90deg,
      #1a1a40 0%, #3d3520 20%, #6b5a2a 42%,
      #8a7030 50%, #6b5a2a 58%, #3d3520 80%, #1a1a40 100%);
  box-shadow:
    inset 1px 0 2px rgba(255, 255, 255, 0.08),
    inset -1px 0 2px rgba(0, 0, 0, 0.3),
    0 0 10px rgba(251, 191, 36, 0.2),
    0 0 24px 8px rgba(251, 191, 36, 0.35),
    0 0 44px 14px rgba(251, 191, 36, 0.15);
}
.peg-zone.hint-peg-gold::after {
  background:
    radial-gradient(ellipse at 50% 30%, rgba(251, 210, 100, 0.55) 0%, transparent 60%),
    linear-gradient(90deg, #3d3520 0%, #6b5a2a 40%, #8a7030 50%, #6b5a2a 60%, #3d3520 100%);
}

/* Step success (inside whisper): burst + soft glow */
.mission-celebration {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: clamp(72px, 18vw, 96px);
  height: clamp(72px, 18vw, 96px);
  margin: 6px auto 8px;
}

.mission-success-glow {
  position: absolute;
  width: 120%;
  height: 120%;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(251, 191, 36, 0.45) 0%,
    rgba(251, 191, 36, 0.08) 45%,
    transparent 70%
  );
  animation: missionSuccessGlow 0.85s ease-out forwards;
  pointer-events: none;
}

@keyframes missionSuccessGlow {
  0% { transform: scale(0.4); opacity: 0; }
  40% { opacity: 1; }
  100% { transform: scale(1.15); opacity: 0.85; }
}

.mission-success-burst-svg {
  position: relative;
  z-index: 1;
  width: clamp(52px, 13vw, 68px);
  height: clamp(52px, 13vw, 68px);
  filter: drop-shadow(0 0 14px rgba(251, 191, 36, 0.55));
  animation: missionBurstPop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes missionBurstPop {
  0% { transform: scale(0) rotate(-18deg); opacity: 0; }
  55% { transform: scale(1.12) rotate(6deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* Number labels on hint arrows (SVG text) */
.hint-arrow-step-label {
  font-family: 'Fredoka', 'Nunito', 'Inter', sans-serif;
}

/* Colored hint ghost (matches disc color) */
.hint-ghost-colored {
  position: absolute;
  border: 3px dashed currentColor;
  border-radius: 100px;
  background: transparent;
  opacity: 0;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 1;
  transition: opacity 0.5s ease;
}
.hint-ghost-colored.show {
  opacity: 0.45;
}

.hint-ghost-colored.hint-ghost-pulse.show {
  animation: hintGhostOutlinePulse 1.5s ease-in-out infinite;
}
.hint-ghost-colored.hint-ghost-confirm {
  animation: hintGhostConfirmFlash 0.4s ease-out forwards !important;
}
@keyframes hintGhostConfirmFlash {
  0%   { opacity: 0.5; filter: drop-shadow(0 0 4px currentColor) brightness(1); }
  40%  { opacity: 1;   filter: drop-shadow(0 0 18px currentColor) drop-shadow(0 0 30px currentColor) brightness(1.6); }
  100% { opacity: 0;   filter: drop-shadow(0 0 6px currentColor) brightness(1); }
}

@keyframes hintGhostOutlinePulse {
  0%, 100% {
    opacity: 0.38;
    filter: drop-shadow(0 0 2px currentColor);
  }
  50% {
    opacity: 0.62;
    filter: drop-shadow(0 0 10px currentColor) drop-shadow(0 0 4px rgba(255, 255, 255, 0.25));
  }
}

/* Hint disc dissolve */
.disk.hint-dissolve {
  opacity: 0 !important;
  transition: opacity 0.6s ease-out !important;
  pointer-events: none !important;
}

/* Hint ghost outline */
.hint-ghost-outline {
  position: absolute;
  border: 3px dashed rgba(80, 160, 255, 0.65);
  border-radius: 100px;
  background: rgba(80, 160, 255, 0.05);
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.hint-ghost-outline.show {
  opacity: 1;
}

/* Hint faded disc — uniform soft gray, still readable on dark board */
.disk.hint-faded {
  filter: brightness(1.02) grayscale(0.78) contrast(0.92);
  opacity: 0.9;
  transition: filter 0.5s ease, opacity 0.5s ease;
}

/* “Moved from” trail during hint 2 phase 1 */
.hint-ghost-colored.hint-ghost-trail {
  opacity: 0.42;
}

/* Thicker cluster ring on grouped destination ghosts */
.hint-ghost-colored.hint-ghost-cluster {
  border-width: 4px;
  opacity: 0.55;
  box-shadow:
    0 0 0 2px rgba(251, 191, 36, 0.28),
    0 0 16px rgba(251, 191, 36, 0.22);
}

.hint-ghost-outline.pulse {
  opacity: 1;
  animation: hintGhostPulse 1.5s ease-in-out infinite;
}

@keyframes hintGhostPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(80, 160, 255, 0);
    filter: brightness(1);
  }
  50% {
    box-shadow: 0 0 14px 4px rgba(80, 160, 255, 0.35);
    filter: brightness(1.3);
  }
}

/* ── Context Bar ── */
#context-bar {
  width: min(94vw, 860px);
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 16px;
  background: rgba(251, 191, 36, 0.06);
  border: 1px solid rgba(251, 191, 36, 0.12);
  border-radius: 10px;
  transition: max-height 0.35s ease, opacity 0.35s ease, padding 0.35s ease, margin 0.35s ease;
  margin: 0;
}

#context-bar.show {
  max-height: 48px;
  opacity: 1;
  padding: 8px 16px;
  margin: 2px 0;
}

#context-text {
  font-size: clamp(0.75rem, 1.8vw, 0.88rem);
  color: rgba(251, 191, 36, 0.85);
  font-weight: 500;
  flex: 1;
  text-align: center;
}

#context-dismiss {
  background: none;
  border: none;
  color: rgba(251, 191, 36, 0.4);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

#context-dismiss:hover {
  color: rgba(251, 191, 36, 0.7);
}

/* ── Game Area ── */
#game-area {
  position: relative;
  width: min(94vw, 860px);
  aspect-ratio: 5 / 3;
  max-height: calc(100dvh - clamp(120px, 17vw, 158px) - 80px - 40px);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ── Peg Zones ── */
.peg-zone {
  position: absolute;
  top: 0;
  width: 33.334%;
  height: 100%;
  cursor: pointer;
  z-index: 1;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

.peg-zone[data-peg="0"] { left: 0; }
.peg-zone[data-peg="1"] { left: 33.333%; }
.peg-zone[data-peg="2"] { left: 66.667%; }

.peg-zone::before {
  content: '';
  position: absolute;
  width: 12px;
  height: 72%;
  bottom: 8%;
  left: 50%;
  transform: translateX(-50%);
  background:
    linear-gradient(90deg,
      #1a1a40 0%, #2e2e66 20%, #4a4a8a 42%,
      #5a5aaa 50%, #4a4a8a 58%, #2e2e66 80%, #1a1a40 100%);
  border-radius: 6px 6px 2px 2px;
  pointer-events: none;
  box-shadow:
    inset 1px 0 2px rgba(255, 255, 255, 0.08),
    inset -1px 0 2px rgba(0, 0, 0, 0.3),
    0 0 8px rgba(90, 90, 170, 0.15);
}

.peg-zone::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 10px;
  bottom: calc(8% + 72% - 3px);
  left: 50%;
  transform: translateX(-50%);
  background:
    radial-gradient(ellipse at 50% 30%, rgba(140, 140, 210, 0.6) 0%, transparent 60%),
    linear-gradient(90deg, #2a2a58 0%, #4a4a90 40%, #5a5aaa 50%, #4a4a90 60%, #2a2a58 100%);
  border-radius: 50%;
  pointer-events: none;
}

.peg-base {
  position: absolute;
  bottom: calc(8% - 6px);
  height: 14px;
  width: 26%;
  border-radius: 7px;
  pointer-events: none;
  z-index: 0;
  background:
    linear-gradient(180deg,
      rgba(80, 80, 150, 0.35) 0%,
      rgba(30, 30, 70, 0.6) 40%,
      rgba(15, 15, 40, 0.8) 100%);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.5),
    0 0 20px rgba(80, 80, 160, 0.08),
    inset 0 1px 1px rgba(255, 255, 255, 0.06);
}

.peg-base[data-peg="0"] { left: calc(16.667% - 13%); }
.peg-base[data-peg="1"] { left: calc(50% - 13%); }
.peg-base[data-peg="2"] { left: calc(83.333% - 13%); }

#game-area::after {
  content: '';
  position: absolute;
  bottom: calc(8% - 4px);
  left: 2%;
  right: 2%;
  height: 6px;
  background: linear-gradient(90deg,
    transparent 0%, rgba(40, 40, 90, 0.4) 8%,
    rgba(40, 40, 90, 0.5) 50%, rgba(40, 40, 90, 0.4) 92%, transparent 100%);
  border-radius: 3px;
  pointer-events: none;
}

/* ── Disks ── */
.disk {
  position: absolute;
  border-radius: 100px;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 2;
  box-shadow:
    0 4px 10px rgba(0, 0, 0, 0.55),
    0 6px 22px var(--glow),
    inset 0 2px 4px rgba(255, 255, 255, 0.22),
    inset 0 -3px 6px rgba(0, 0, 0, 0.35);
  will-change: left, bottom, transform;
}

.disk::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 10%;
  right: 10%;
  height: 38%;
  border-radius: 100px;
  background: linear-gradient(180deg, rgba(255,255,255,0.18) 0%, transparent 100%);
  pointer-events: none;
}

.disk.entering {
  transition:
    bottom 0.42s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.25s ease;
}

.disk.ready {
  transition:
    left 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    bottom 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.2s ease,
    filter 0.2s ease;
}

.disk.selected {
  box-shadow:
    0 0 4px 2px var(--ring),
    0 0 14px 4px var(--glow),
    0 0 32px 2px var(--glow),
    0 8px 24px rgba(0, 0, 0, 0.5),
    inset 0 2px 4px rgba(255, 255, 255, 0.25),
    inset 0 -3px 6px rgba(0, 0, 0, 0.2);
  filter: brightness(1.25) saturate(1.15);
  z-index: 10;
}

.disk.hint-glow {
  animation: hintPulse 1s ease-in-out infinite;
}

/* Hint phase: steady glow on real discs (ghost outlines pulse separately) */
.disk.hint-glow-steady {
  box-shadow:
    0 4px 10px rgba(0, 0, 0, 0.55),
    0 6px 22px var(--glow),
    0 0 14px 6px rgba(255, 200, 60, 0.38),
    inset 0 2px 4px rgba(255, 255, 255, 0.22),
    inset 0 -3px 6px rgba(0, 0, 0, 0.35);
  filter: brightness(1.12);
}

@keyframes hintPulse {
  0%, 100% {
    box-shadow:
      0 4px 10px rgba(0, 0, 0, 0.55),
      0 6px 22px var(--glow),
      0 0 0 0 rgba(255, 200, 60, 0),
      inset 0 2px 4px rgba(255, 255, 255, 0.22),
      inset 0 -3px 6px rgba(0, 0, 0, 0.35);
  }
  50% {
    box-shadow:
      0 4px 10px rgba(0, 0, 0, 0.55),
      0 6px 22px var(--glow),
      0 0 16px 6px rgba(255, 200, 60, 0.4),
      inset 0 2px 4px rgba(255, 255, 255, 0.22),
      inset 0 -3px 6px rgba(0, 0, 0, 0.35);
    filter: brightness(1.15);
  }
}

@keyframes land {
  0%  { transform: translateX(-50%) scaleY(1) scaleX(1); }
  35% { transform: translateX(-50%) scaleY(0.88) scaleX(1.06); }
  65% { transform: translateX(-50%) scaleY(1.04) scaleX(0.97); }
  100%{ transform: translateX(-50%) scaleY(1) scaleX(1); }
}

.disk.landing {
  animation: land 0.25s ease-out;
}

@keyframes victoryPulse {
  0%   { filter: brightness(1); transform: translateX(-50%) scale(1); }
  50%  { filter: brightness(1.5) saturate(1.3); transform: translateX(-50%) scale(1.06); }
  100% { filter: brightness(1); transform: translateX(-50%) scale(1); }
}

.disk.victory-pulse {
  animation: victoryPulse 0.5s ease-out;
}

/* springRattle keyframe is in shared/instructions.css */
.disk.spring-rattle {
  animation: springRattle 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97);
  z-index: 10;
}

/* ── Below Board ── */
#below-board {
  position: relative;
  width: min(94vw, 860px);
}

#toolbar {
  position: relative;
  width: 100%;
  height: clamp(40px, 7vw, 60px);
}

#reset-btn {
  position: absolute;
  left: 33.333%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: none;
  border: none;
  color: #4a4a6a;
  cursor: pointer;
  padding: clamp(10px, 2vw, 18px);
  border-radius: 14px;
  transition: color 0.2s, background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

#reset-btn .reset-icon {
  width: clamp(30px, 5vw, 48px);
  height: clamp(30px, 5vw, 48px);
}

#reset-btn:hover {
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.04);
}

#reset-btn:active {
  transform: translate(-50%, -50%) scale(0.9);
}

#move-display {
  position: absolute;
  left: 66.667%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: baseline;
  gap: 7px;
}

#move-count {
  font-size: clamp(1.8rem, 4.5vw, 3rem);
  font-weight: 700;
  color: #e2e8f0;
  font-variant-numeric: tabular-nums;
}

.move-label {
  font-size: clamp(0.85rem, 2vw, 1.4rem);
  font-weight: 500;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}


/* ══════════════════════════════════════════════
   GAME-SPECIFIC INSTRUCTION ELEMENTS (pegs, discs)
   ══════════════════════════════════════════════ */
.instr-peg {
  position: absolute;
  width: 8px;
  bottom: 8%;
  height: 65%;
  transform: translateX(-50%);
  background: linear-gradient(90deg, #1a1a40, #3a3a70 50%, #1a1a40);
  border-radius: 4px 4px 0 0;
  pointer-events: none;
  transition: box-shadow 0.3s ease, filter 0.3s ease;
}

.instr-peg-cap {
  position: absolute;
  width: 14px;
  height: 7px;
  bottom: calc(8% + 65% - 2px);
  transform: translateX(-50%);
  background: radial-gradient(ellipse at 50% 30%, rgba(120, 120, 190, 0.5) 0%, transparent 60%),
    linear-gradient(90deg, #2a2a58, #4a4a90 50%, #2a2a58);
  border-radius: 50%;
  pointer-events: none;
}

.instr-base-bar {
  position: absolute;
  bottom: calc(8% - 3px);
  left: 5%;
  right: 5%;
  height: 5px;
  background: linear-gradient(90deg,
    transparent 0%, rgba(40, 40, 90, 0.45) 12%,
    rgba(40, 40, 90, 0.5) 50%, rgba(40, 40, 90, 0.45) 88%, transparent 100%);
  border-radius: 3px;
  pointer-events: none;
}

.instr-disc {
  position: absolute;
  border-radius: 100px;
  transform: translateX(-50%);
  pointer-events: none;
  box-shadow:
    0 3px 8px rgba(0, 0, 0, 0.5),
    0 4px 14px var(--glow),
    inset 0 1px 3px rgba(255, 255, 255, 0.2),
    inset 0 -2px 4px rgba(0, 0, 0, 0.3);
  transition: left 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              bottom 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.3s ease;
}

.instr-disc::after {
  content: '';
  position: absolute;
  top: 1px;
  left: 12%;
  right: 12%;
  height: 36%;
  border-radius: 100px;
  background: linear-gradient(180deg, rgba(255,255,255,0.16) 0%, transparent 100%);
  pointer-events: none;
}

.instr-disc.highlight {
  filter: brightness(1.4) saturate(1.2);
  box-shadow:
    0 0 8px 3px var(--ring),
    0 0 20px 6px var(--glow),
    0 3px 8px rgba(0, 0, 0, 0.5),
    inset 0 1px 3px rgba(255, 255, 255, 0.2),
    inset 0 -2px 4px rgba(0, 0, 0, 0.3);
}

/* ── Arching Arrow (game-specific) ── */
#instr-arrow {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.35s ease;
}

#instr-arrow.show {
  opacity: 1;
}

#instr-arrow-path {
  stroke-dasharray: 150;
  stroke-dashoffset: 150;
  transition: stroke-dashoffset 0.9s ease-out;
}

#instr-arrow.show #instr-arrow-path {
  stroke-dashoffset: 0;
}

/* ── Board-level Start/Goal labels ── */
.instr-peg-label {
  position: absolute;
  bottom: -6%;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: clamp(1.3rem, 4vw, 1.8rem);
  font-weight: 500;
  text-align: center;
  transform: translateX(-50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
  z-index: 5;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.4);
}

.instr-peg-label.show {
  opacity: 1;
}

.instr-peg-label.start-label {
  color: rgba(255, 255, 255, 0.88);
}

.instr-peg-label.goal-label {
  color: #fbbf24;
  text-shadow: 0 0 18px rgba(251, 191, 36, 0.3);
}

/* ── Ghost disc outlines (goal position) ── */
.instr-ghost-disc {
  position: absolute;
  border-radius: 100px;
  transform: translateX(-50%);
  border: 2px dashed currentColor;
  background: transparent;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
  z-index: 0;
}

.instr-ghost-disc.show {
  opacity: 0.35;
}

/* ── Board frost overlay ── */
.instr-board-frost {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: rgba(10, 12, 28, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 18;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
}

.instr-board-frost.show {
  opacity: 1;
}

/* ── Label entrance animation ── */
@keyframes labelDropIn {
  0%   { opacity: 0; transform: translateY(-18px) scale(0.92); }
  50%  { opacity: 1; transform: translateY(3px) scale(1.04); }
  70%  { transform: translateY(-1px) scale(1.01); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes labelGlow {
  0%, 100% { text-shadow: 0 1px 8px rgba(0, 0, 0, 0.4); }
  50%      { text-shadow: 0 0 24px rgba(255, 255, 255, 0.35), 0 0 48px rgba(255, 255, 255, 0.15); }
}

#instr-label.anim-drop {
  animation: labelDropIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
             labelGlow 1.6s ease-in-out 0.6s 1;
}

/* ── Peg Glow (game-specific) ── */
.instr-peg.glow {
  box-shadow: 0 0 10px 3px rgba(251, 191, 36, 0.5),
              0 0 22px 6px rgba(251, 191, 36, 0.2);
  filter: brightness(1.6);
  transition: box-shadow 0.3s ease, filter 0.3s ease;
}

/* ── Victory ── */
#victory-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 4, 12, 0.90);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

#victory-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.victory-content {
  text-align: center;
  transform: scale(0.88);
  opacity: 0;
  transition:
    transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.4s ease;
  transition-delay: 0.1s;
}

#victory-overlay.show .victory-content {
  transform: scale(1);
  opacity: 1;
}

.victory-icon {
  font-size: 2.6rem;
  color: #fbbf24;
  text-shadow: 0 0 28px rgba(251, 191, 36, 0.45);
  margin-bottom: 10px;
}

.victory-title {
  font-size: 1.6rem;
  font-weight: 600;
  color: #f1f5f9;
  margin-bottom: 6px;
}

#victory-moves {
  font-size: 1.6rem;
  font-weight: 600;
  color: #f1f5f9;
  margin-bottom: 8px;
}

#min-moves {
  font-size: 0.8rem;
  color: #64748b;
  margin-bottom: 28px;
}

.perfect-msg {
  color: #fbbf24;
  font-weight: 600;
}

.victory-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
}

#play-again-btn,
#victory-home-btn {
  background: rgba(255, 255, 255, 0.07);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 11px 32px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

#play-again-btn:hover,
#victory-home-btn:hover {
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.16);
}

#play-again-btn:active,
#victory-home-btn:active {
  transform: scale(0.96);
}

#victory-home-btn {
  padding: 0;
  width: 44px;
  height: 44px;
}

#victory-home-btn svg {
  width: 22px;
  height: 22px;
  color: #e2e8f0;
}

/* ── Screen Too Small ── */
#screen-too-small {
  display: none;
  position: fixed;
  inset: 0;
  background: #06060f;
  color: #64748b;
  z-index: 999;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  text-align: center;
  padding: 24px;
}

@media (max-width: 359px), (max-height: 499px) {
  #screen-too-small { display: flex; }
  #game-wrapper { display: none; }
}

/* ══════════════════════════════════════════════
   MILESTONE STRIP — Board Snapshot Milestones
   ══════════════════════════════════════════════ */
#milestone-strip {
  width: min(94vw, 860px);
  display: none;
  justify-content: center;
  align-items: center;
  gap: clamp(4px, 1vw, 8px);
  padding: clamp(6px, 1.2vw, 10px) clamp(10px, 2vw, 18px);
  background: rgba(10, 10, 28, 0.75);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: visible;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: opacity 0.4s ease;
}

#milestone-strip.show {
  display: flex;
}

/* Milestone title */
.ms-title {
  font-family: 'Fredoka', sans-serif;
  font-size: clamp(0.7rem, 1.5vw, 0.85rem);
  font-weight: 500;
  color: rgba(200, 190, 255, 0.65);
  text-align: center;
  letter-spacing: 0.06em;
  margin-bottom: clamp(6px, 1vw, 10px);
}

/* Big heading variant */
.ms-title.ms-title-big {
  font-size: clamp(1.05rem, 2.5vw, 1.35rem);
  font-weight: 600;
  color: rgba(220, 210, 255, 0.85);
  letter-spacing: 0.08em;
  margin-bottom: clamp(8px, 1.5vw, 14px);
}

/* Phase text bubbles */
.ms-bubble {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(4px, 0.8vw, 7px);
  padding: clamp(8px, 1.4vw, 12px) clamp(6px, 1vw, 10px) clamp(10px, 1.8vw, 14px);
  min-height: clamp(50px, 9vw, 72px);
  background: rgba(30, 30, 60, 0.55);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  text-align: center;
  font-family: 'Fredoka', sans-serif;
  font-size: clamp(0.68rem, 1.5vw, 0.88rem);
  font-weight: 500;
  color: rgba(180, 175, 220, 0.7);
  white-space: nowrap;
  position: relative;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.3s ease,
              border-color 0.3s ease,
              box-shadow 0.3s ease;
}

.ms-bubble-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: clamp(22px, 3.5vw, 28px);
  height: clamp(22px, 3.5vw, 28px);
  border-radius: 50%;
  border: 1.5px solid rgba(148, 143, 190, 0.25);
  background: rgba(255, 255, 255, 0.04);
  font-family: 'Fredoka', sans-serif;
  font-size: clamp(0.65rem, 1.2vw, 0.8rem);
  font-weight: 700;
  color: rgba(148, 143, 190, 0.5);
  transition: color 0.3s ease, border-color 0.3s ease, background 0.3s ease;
}

.ms-bubble.active .ms-bubble-num {
  color: rgba(251, 220, 130, 0.9);
  border-color: rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.12);
}

.ms-bubble.done .ms-bubble-num {
  color: rgba(200, 195, 230, 0.6);
  border-color: rgba(200, 195, 230, 0.25);
}

.ms-bubble-text {
  line-height: 1.3;
}

.ms-bubble.active {
  border-color: rgba(251, 191, 36, 0.5);
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.12);
  color: rgba(251, 220, 130, 0.95);
}

.ms-bubble.done {
  border-color: rgba(200, 195, 230, 0.3);
  color: rgba(200, 195, 230, 0.7);
  opacity: 0.65;
}

.ms-bubble.future {
  opacity: 0.35;
}

/* Whisper step overlay */
.step-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  pointer-events: none;
  background: rgba(16, 13, 38, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 16px;
  opacity: 1;
  transition: opacity 0.5s ease;
}
.step-overlay.fade-out { opacity: 0; }
.step-overlay-text {
  font-family: 'Fredoka', sans-serif;
  font-size: clamp(1.1rem, 2.8vw, 1.5rem);
  font-weight: 600;
  color: rgba(251, 220, 130, 0.95);
  text-shadow: 0 0 20px rgba(251, 191, 36, 0.3);
  text-align: center;
  letter-spacing: 0.04em;
  line-height: 1.4;
}

/* Glassmorphism splash overlay — over the BOARD */
.phase-splash {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  pointer-events: none;
  background: rgba(12, 10, 32, 0.6);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: 16px;
  opacity: 1;
  transition: opacity 0.8s ease;
}
.phase-splash.fade-out {
  opacity: 0;
}
.phase-splash-text {
  font-family: 'Fredoka', sans-serif;
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 700;
  color: rgba(251, 220, 130, 0.95);
  text-shadow: 0 0 32px rgba(251, 191, 36, 0.4), 0 0 60px rgba(251, 191, 36, 0.15);
  letter-spacing: 0.1em;
}

/* ── Mini-board diagram (whisper inline) ── */
.mini-board {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(6px, 1.2vw, 12px);
  padding: clamp(6px, 1vw, 10px) 0;
}
.mini-peg {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  width: clamp(50px, 10vw, 70px);
  height: clamp(36px, 6vw, 48px);
  border-bottom: 2px solid rgba(140, 140, 200, 0.35);
  position: relative;
}
.mini-peg::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 100%;
  background: rgba(140, 140, 200, 0.25);
  border-radius: 2px;
}
.mini-disc {
  width: 70%;
  height: clamp(8px, 1.5vw, 12px);
  border-radius: 6px;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}
.mini-disc.mini-ghost {
  background: transparent !important;
  border: 1.5px dashed;
  opacity: 0.5;
}
.mini-arrow {
  font-size: clamp(1rem, 2.2vw, 1.4rem);
  color: rgba(251, 191, 36, 0.8);
  align-self: center;
  margin-bottom: clamp(8px, 1.5vw, 14px);
}

/* ── Simplify overlay (board-level) ── */
.simplify-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  pointer-events: none;
  background: rgba(8, 6, 22, 0.0);
  border-radius: 16px;
  overflow: hidden;
  transition: background 0.6s ease, opacity 0.6s ease;
}
.simplify-overlay.show {
  background: rgba(8, 6, 22, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.simplify-overlay.fade-out {
  opacity: 0;
  transition: opacity 0.5s ease;
}
.simplify-label {
  font-family: 'Fredoka', sans-serif;
  font-size: clamp(2.4rem, 7vw, 4rem);
  font-weight: 700;
  background: linear-gradient(135deg, #a78bfa, #f472b6, #fbbf24, #34d399);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 20px rgba(167, 139, 250, 0.5)) drop-shadow(0 0 40px rgba(244, 114, 182, 0.3));
  letter-spacing: 0.06em;
  z-index: 2;
  opacity: 0;
  transform: scale(0.85);
  animation: simplifyLabelIn 0.6s ease 0.2s forwards, simplifyGradientShift 3s ease infinite;
}
@keyframes simplifyLabelIn {
  to { opacity: 1; transform: scale(1); }
}
@keyframes simplifyGradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.simplify-ring {
  position: absolute;
  width: 280%;
  height: 280%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  border-radius: 50%;
  border: 2.5px solid rgba(180, 160, 255, 0.25);
  pointer-events: none;
  animation: simplifyRingPulse 2.2s ease-out forwards;
}
@keyframes simplifyRingPulse {
  0%   { transform: translate(-50%, -50%) scale(0); opacity: 0.85; }
  40%  { opacity: 0.5; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

.ms-phase {
  flex-shrink: 0;
  width: clamp(100px, 20vw, 140px);
  background: rgba(30, 30, 60, 0.6);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: clamp(5px, 0.8vw, 8px) clamp(4px, 0.6vw, 6px);
  text-align: center;
  position: relative;
  overflow: visible;
  cursor: pointer;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.3s ease,
              border-color 0.3s ease,
              box-shadow 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}

.ms-phase .ms-label {
  font-family: 'Fredoka', sans-serif;
  font-size: clamp(0.5rem, 1vw, 0.62rem);
  font-weight: 600;
  color: rgba(148, 163, 184, 0.55);
  margin-top: clamp(2px, 0.4vw, 4px);
  pointer-events: none;
}

.ms-board {
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  height: clamp(40px, 7.5vw, 56px);
  gap: 1px;
  position: relative;
  pointer-events: none;
}

.ms-peg {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 1px;
  width: 30%;
  position: relative;
}

.ms-peg::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 80%;
  background: linear-gradient(180deg, rgba(90,90,170,0.35) 0%, rgba(50,50,100,0.5) 100%);
  border-radius: 1px;
}

.ms-disc {
  height: clamp(5px, 0.9vw, 7px);
  border-radius: 4px;
  z-index: 1;
  position: relative;
}

.ms-disc[data-s="1"] { width: clamp(12px, 2.2vw, 16px);  background: #ff2d78; }
.ms-disc[data-s="2"] { width: clamp(16px, 3vw, 22px);    background: #ff6b1a; }
.ms-disc[data-s="3"] { width: clamp(20px, 3.8vw, 28px);  background: #ffcc00; }
.ms-disc[data-s="4"] { width: clamp(24px, 4.6vw, 34px);  background: #00d68f; }
.ms-disc[data-s="5"] { width: clamp(28px, 5.4vw, 40px);  background: #2b8aff; }

.ms-disc.ms-ghost {
  background: none !important;
  border: 1px dashed;
  opacity: 0.32;
}
.ms-disc.ms-ghost[data-s="1"] { border-color: #ff2d78; }
.ms-disc.ms-ghost[data-s="2"] { border-color: #ff6b1a; }
.ms-disc.ms-ghost[data-s="3"] { border-color: #ffcc00; }
.ms-disc.ms-ghost[data-s="4"] { border-color: #00d68f; }
.ms-disc.ms-ghost[data-s="5"] { border-color: #2b8aff; }

.ms-disc.ms-glow[data-s="1"] { box-shadow: 0 0 3px 1px rgba(255,45,120,0.55); }
.ms-disc.ms-glow[data-s="2"] { box-shadow: 0 0 3px 1px rgba(255,107,26,0.55); }
.ms-disc.ms-glow[data-s="3"] { box-shadow: 0 0 3px 1px rgba(255,204,0,0.55); }
.ms-disc.ms-glow[data-s="4"] { box-shadow: 0 0 3px 1px rgba(0,214,143,0.55); }
.ms-disc.ms-glow[data-s="5"] { box-shadow: 0 0 3px 1px rgba(43,138,255,0.55); }

.ms-disc.ms-faded {
  opacity: 0.18 !important;
  filter: grayscale(0.8);
}

/* Phase states */
.ms-phase.active {
  border-color: rgba(251, 191, 36, 0.5);
  box-shadow: 0 0 14px rgba(251, 191, 36, 0.15);
  transform: scale(1.06);
}
.ms-phase.active .ms-label { color: rgba(251, 191, 36, 0.95); }

.ms-phase.done {
  border-color: #22c55e;
  transform: scale(0.92);
  opacity: 0.65;
}
.ms-phase.done::after {
  content: '\2713';
  position: absolute;
  top: -7px;
  right: -5px;
  background: #22c55e;
  color: #fff;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  font-size: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  z-index: 5;
}

.ms-phase.future {
  transform: scale(0.88);
  opacity: 0.3;
}

.ms-phase.ms-error {
  border-color: #ef4444 !important;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.25) !important;
  animation: msPulseError 0.8s ease-in-out infinite alternate;
}
.ms-phase.ms-error .ms-label { color: #ef4444 !important; }

@keyframes msPulseError {
  0% { box-shadow: 0 0 8px rgba(239, 68, 68, 0.15); }
  100% { box-shadow: 0 0 20px rgba(239, 68, 68, 0.4); }
}

.ms-move-arrow {
  position: absolute;
  left: 0; top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
  overflow: visible;
}

.ms-sep {
  color: rgba(255, 255, 255, 0.12);
  font-size: clamp(0.65rem, 1.2vw, 0.85rem);
  flex-shrink: 0;
  align-self: center;
  transition: opacity 0.3s ease;
}
.ms-sep.dim { opacity: 0.25; }

/* Practice badge */
.practice-badge {
  position: absolute;
  top: clamp(8px, 1.5vw, 14px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.25);
  color: rgba(251, 191, 36, 0.9);
  font-family: 'Fredoka', sans-serif;
  font-size: clamp(0.55rem, 1.2vw, 0.7rem);
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: clamp(3px, 0.6vw, 5px) clamp(10px, 2vw, 16px);
  border-radius: 20px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 15;
}

/* Zoom-in help badge */
.ms-zoom-badge {
  display: inline-block;
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.22);
  color: rgba(251, 191, 36, 0.85);
  font-family: 'Fredoka', sans-serif;
  font-size: clamp(0.6rem, 1.3vw, 0.72rem);
  padding: clamp(3px, 0.5vw, 5px) clamp(8px, 1.5vw, 14px);
  border-radius: 20px;
  margin-bottom: clamp(4px, 0.8vw, 8px);
}

/* Cherry button on board — just the fruit, no circle */
.cherry-board-btn {
  position: absolute;
  top: clamp(2px, 0.8vw, 8px);
  transform: translateX(-50%) scale(0.5);
  z-index: 18;
  border: none;
  background: none;
  cursor: pointer;
  font-size: clamp(2.2rem, 5.5vw, 3.4rem);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  opacity: 0;
  filter: drop-shadow(0 2px 6px rgba(255, 60, 80, 0.5));
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.3s ease,
              filter 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}
.cherry-board-btn.show {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}
.cherry-board-btn:hover {
  filter: drop-shadow(0 2px 14px rgba(255, 60, 80, 0.6)) drop-shadow(0 0 20px rgba(255,100,120,0.3));
  transform: translateX(-50%) scale(1.12);
}
.cherry-board-btn:active {
  transform: translateX(-50%) scale(0.92);
}
.cherry-board-btn.used {
  cursor: default;
  pointer-events: none;
  transform: translateX(-50%) scale(0.95);
  opacity: 0.7;
}
/* Cherry SVG icon — inline and large variants */
.cherry-icon {
  display: inline-block;
  height: 1.6em;
  width: auto;
  vertical-align: middle;
  object-fit: contain;
}
.cherry-icon-lg {
  height: clamp(3rem, 8vw, 4.5rem);
}
.cherry-icon-xl {
  height: clamp(4.5rem, 12vw, 7rem);
}
.cherry-board-btn .cherry-icon {
  height: clamp(3rem, 8vw, 4.5rem);
  width: auto;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.3));
}

/* Pink checkpoint boxes (play3 milestone) */
.pink-checkpoint-box {
  position: absolute;
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 10px;
  pointer-events: none;
  z-index: 4;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.15);
}

/* Wide whisper: force full panel width when content is multi-step (bubbles/summary) */
#top-whisper.whisper-wide { width: min(86vw, 560px); }
#top-whisper.phase-hint.whisper-wide { width: min(90vw, 600px); }

/* Pink summary (after 3-disc solve) */
.pink-summary-title {
  font-family: 'Fredoka', sans-serif;
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  font-weight: 600;
  color: rgba(232, 225, 255, 0.95);
  text-align: center;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: rgba(232, 225, 255, 0.3);
  margin-bottom: clamp(8px, 1.5vw, 14px);
}
.pink-summary-row {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: clamp(10px, 1.6vw, 16px);
  width: 100%;
}
.pink-summary-box {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: clamp(8px, 1.2vw, 12px);
  padding: clamp(10px, 1.6vw, 14px) clamp(12px, 1.8vw, 18px);
  background: rgba(30, 30, 60, 0.55);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  text-align: left;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease;
}
.pink-summary-box.active {
  border-color: rgba(251, 191, 36, 0.5);
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.12);
}
.pink-summary-box.done {
  border-color: rgba(200, 195, 230, 0.3);
  opacity: 0.65;
}
.pink-summary-num {
  width: clamp(22px, 3.5vw, 28px);
  height: clamp(22px, 3.5vw, 28px);
  border-radius: 50%;
  border: 1.5px solid rgba(148, 143, 190, 0.25);
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fredoka', sans-serif;
  font-size: clamp(0.65rem, 1.2vw, 0.8rem);
  font-weight: 700;
  color: rgba(148, 143, 190, 0.5);
  transition: color 0.3s ease, border-color 0.3s ease, background 0.3s ease;
}
.pink-summary-box.active .pink-summary-num {
  color: rgba(251, 220, 130, 0.9);
  border-color: rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.12);
}
.pink-summary-box.done .pink-summary-num {
  color: rgba(200, 195, 230, 0.6);
  border-color: rgba(200, 195, 230, 0.25);
}
.pink-summary-label {
  font-family: 'Fredoka', sans-serif;
  font-size: clamp(0.85rem, 1.55vw, 1rem);
  font-weight: 500;
  color: rgba(200, 195, 230, 0.9);
  line-height: 1.3;
  white-space: nowrap;
  flex: 1;
}

/* ── Orientation-aware gate messages (mobile rotation) ── */
.gate-rotate,
.gate-small {
  display: none;
}
@media (max-width: 479px) {
  .gate-small { display: block; }
}
@media (max-height: 499px) and (min-width: 480px) {
  .gate-rotate { display: block; }
}
