/* ============ Tokens ============ */
:root {
  --ink: #1f2a44;
  --ink-soft: #55607a;
  --paper: #fff7e8;
  --card: #ffffff;
  --line: #f0e3c8;
  --coral: #ff5d73;
  --sun: #ffc93c;
  --mint: #2ec4a6;
  --ocean: #3a86ff;
  --grape: #9b5de5;
  --orange: #ff8c42;
  --pink: #ff5fa2;
  --good: #23b26d;
  --bad: #ef476f;
  --shadow: 0 10px 30px rgba(31, 42, 68, 0.12);
  --ui: 'Fredoka', 'Trebuchet MS', system-ui, sans-serif;
  --letters: 'Andika', 'Century Gothic', 'Comic Sans MS', sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--ui);
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 12%, rgba(255, 201, 60, 0.35) 0 120px, transparent 121px),
    radial-gradient(circle at 92% 8%, rgba(255, 93, 115, 0.22) 0 160px, transparent 161px),
    radial-gradient(circle at 85% 80%, rgba(58, 134, 255, 0.16) 0 200px, transparent 201px),
    radial-gradient(circle at 5% 90%, rgba(46, 196, 166, 0.2) 0 150px, transparent 151px),
    var(--paper);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.dragging, body.dragging * { cursor: grabbing !important; user-select: none; }
button { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--ink-soft); }
.small { font-size: 0.95rem; }
.row { display: flex; gap: 14px; align-items: center; justify-content: center; flex-wrap: wrap; }
:focus-visible { outline: 4px solid var(--ocean); outline-offset: 3px; }

.fx-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 100; }

/* Graphemes; split digraphs get an arc linking the two letters */
.g { font-family: var(--letters); font-weight: 700; }
.g-split { position: relative; display: inline-flex; align-items: baseline; }
.g-split .g-dash { margin: 0 0.04em; }
.g-split::before {
  content: ''; position: absolute; left: 0.12em; right: 0.12em; top: 0.02em; height: 0.28em;
  border: 0.06em solid currentColor; border-bottom: 0; border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}

/* ============ Buttons ============ */
.btn {
  --btn: var(--ocean);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 10px 24px;
  border: 0; border-radius: 999px;
  background: var(--btn); color: #fff;
  font-weight: 600; font-size: 1.15rem; text-decoration: none;
  box-shadow: 0 5px 0 color-mix(in srgb, var(--btn) 70%, #000), 0 8px 18px rgba(0, 0, 0, 0.12);
  cursor: pointer; user-select: none;
  transition: transform 0.08s, box-shadow 0.08s, filter 0.15s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 color-mix(in srgb, var(--btn) 70%, #000); }
.btn:disabled { filter: grayscale(0.4) opacity(0.7); cursor: default; }
.btn-big { min-height: 72px; padding: 14px 40px; font-size: 1.6rem; }
.btn-small { min-height: 42px; padding: 6px 16px; font-size: 1rem; }
.btn-ghost { --btn: #ffffff; color: var(--ink); box-shadow: 0 5px 0 #e2d6bd, 0 8px 18px rgba(0, 0, 0, 0.08); }
.btn-ghost:active { box-shadow: 0 1px 0 #e2d6bd; }
.btn-sun { --btn: var(--sun); color: var(--ink); }
.btn-round { width: 64px; height: 64px; min-height: 0; padding: 0; font-size: 1.6rem; }

.icon-btn {
  width: 46px; height: 46px; border-radius: 50%; flex: none;
  border: 0; background: #fff; box-shadow: 0 3px 0 #e2d6bd;
  font-size: 1.3rem; cursor: pointer; display: grid; place-items: center;
}
.icon-btn[aria-pressed='false'] { opacity: 0.6; }
.icon-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #e2d6bd; }

.tabs { display: inline-flex; background: #fff; padding: 5px; border-radius: 999px; box-shadow: inset 0 0 0 2px var(--line); gap: 4px; flex-wrap: wrap; justify-content: center; }
.tab { border: 0; background: transparent; padding: 8px 16px; border-radius: 999px; font-weight: 600; font-size: 1rem; cursor: pointer; color: var(--ink-soft); }
.tab[aria-selected='true'] { background: var(--accent, var(--ocean)); color: #fff; }

.pill { background: #fff; border-radius: 999px; padding: 8px 18px; font-weight: 700; font-size: 1.3rem; box-shadow: 0 3px 0 #e2d6bd; white-space: nowrap; color: var(--ink); }
.score-pill.bump { animation: bump 0.35s; }
.timer-pill.urgent { background: var(--bad); color: #fff; box-shadow: 0 3px 0 #b8264b; animation: bump 0.5s infinite; }

.pic { display: block; width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.pic-native { display: grid; place-items: center; font-size: min(1em, 100%); line-height: 1; }

.progress-dots { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.progress-dots i { width: 16px; height: 16px; border-radius: 50%; background: rgba(255, 255, 255, 0.55); box-shadow: inset 0 0 0 2px rgba(31, 42, 68, 0.15); }
.progress-dots i.ok { background: var(--good); }
.progress-dots i.no { background: var(--bad); }
.progress-dots i.meh { background: var(--sun); }

/* ============ Drag and drop ============ */
.draggable { touch-action: none; cursor: grab; }
.drag-ghost { position: fixed !important; z-index: 90; margin: 0 !important; pointer-events: none; transition: none !important; animation: none !important; box-shadow: 0 24px 40px rgba(0, 0, 0, 0.25) !important; opacity: 0.95; }
.drag-source { opacity: 0.25; }
.drop-zone { transition: transform 0.15s, box-shadow 0.15s; }
.drop-zone.drop-hover { transform: scale(1.06); box-shadow: 0 0 0 6px var(--sun), 0 14px 30px rgba(0, 0, 0, 0.18) !important; }
.spring-back { animation: spring-back 0.4s cubic-bezier(.2, 1.6, .5, 1); }

/* ============ Home ============ */
.home { max-width: 1240px; margin: 0 auto; padding: 16px 24px 48px; }
.home-top { display: flex; justify-content: flex-end; }
.top-actions { display: flex; gap: 10px; }
.hero { text-align: center; padding: 8px 0 28px; }
.logo { margin: 0; display: inline-flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: center; }
.logo-tiles { display: inline-flex; gap: 6px; }
.logo-tile {
  display: grid; place-items: center;
  width: clamp(40px, 7vw, 76px); height: clamp(48px, 8.4vw, 90px);
  border-radius: 16px; color: #fff;
  font-family: var(--letters); font-weight: 700; font-size: clamp(1.8rem, 5.4vw, 3.6rem);
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.18);
  animation: wave 2.8s ease-in-out infinite; animation-delay: calc(var(--i) * 0.12s);
}
.logo-tile:nth-child(odd) { rotate: -4deg; }
.logo-tile:nth-child(even) { rotate: 3deg; }
.logo-party { font-weight: 700; font-size: clamp(2.2rem, 6vw, 4.4rem); color: var(--ink); rotate: -6deg; text-shadow: 4px 4px 0 var(--sun); }
.tagline { font-size: clamp(1.1rem, 2vw, 1.35rem); color: var(--ink-soft); max-width: 640px; margin: 20px auto 0; line-height: 1.45; }

.panel { background: var(--card); border-radius: 28px; padding: 22px 26px; box-shadow: var(--shadow); margin-bottom: 30px; }
.panel h2, .games-head h2 { margin: 0; font-size: 1.6rem; }
.panel p { margin: 4px 0 0; }

/* Sound picker */
.picker-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.picker-actions { display: flex; align-items: center; gap: 12px; }
.picker-count { font-weight: 600; background: #e8faf5; color: #138a71; padding: 8px 14px; border-radius: 999px; }
.picker-count.warn { background: #fff4d6; color: #8a6400; }
.picker-set + .picker-set { margin-top: 18px; }
.picker-set-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.picker-set-head h3 { margin: 0 8px 0 0; font-size: 1.2rem; color: #138a71; }
.sound-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.sound-chip {
  position: relative; border: 3px solid var(--line); background: #fffdf8; border-radius: 18px; padding: 10px 8px 10px;
  cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center;
  transition: transform 0.12s, border-color 0.12s, background 0.12s;
}
.sound-chip:hover { transform: translateY(-2px); }
.chip-g { font-size: 2.6rem; line-height: 1.1; }
.chip-phrase { font-size: 0.85rem; color: var(--ink-soft); line-height: 1.2; }
.chip-say { position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 0.95rem; background: rgba(255, 255, 255, 0.85); cursor: pointer; }
.chip-say:hover { background: #fff; transform: scale(1.1); }
.sound-chip[aria-pressed='true'] { border-color: var(--mint); background: #e2f8f1; }
.sound-chip[aria-pressed='true']::after {
  content: '✓'; position: absolute; top: 4px; left: 6px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--mint); color: #fff; font-weight: 700; font-size: 0.85rem; display: grid; place-items: center;
}

.games-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 22px; }
.game-card {
  display: flex; flex-direction: column; text-decoration: none; background: var(--card);
  border-radius: 26px; overflow: hidden; box-shadow: var(--shadow);
  transition: transform 0.18s cubic-bezier(.3, 1.6, .5, 1), box-shadow 0.18s;
  animation: rise-in 0.5s both; animation-delay: var(--d);
}
.game-card:hover, .game-card:focus-visible { transform: translateY(-6px) rotate(-0.6deg); box-shadow: 0 18px 40px rgba(31, 42, 68, 0.18); }
.game-card:hover .game-art-bubble { animation: wiggle 0.6s; }
.game-art {
  position: relative; height: 150px; display: grid; place-items: center;
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.22) 0 30px, transparent 31px),
    radial-gradient(circle at 85% 75%, rgba(255, 255, 255, 0.18) 0 46px, transparent 47px),
    var(--accent);
}
.game-art-bubble { width: 104px; height: 104px; padding: 16px; border-radius: 50%; background: rgba(255, 255, 255, 0.92); box-shadow: 0 8px 0 rgba(0, 0, 0, 0.12); font-size: 64px; }
.game-tag, .game-drag { position: absolute; top: 12px; background: rgba(255, 255, 255, 0.95); color: var(--ink); font-weight: 600; font-size: 0.9rem; padding: 4px 12px; border-radius: 999px; }
.game-tag { left: 12px; }
.game-drag { top: auto; bottom: 12px; right: 12px; background: var(--ink); color: #fff; }
.game-body { padding: 16px 20px 20px; }
.game-body h3 { margin: 0 0 6px; font-size: 1.45rem; }
.game-body p { margin: 0; color: var(--ink-soft); line-height: 1.4; }
.home-foot { text-align: center; color: var(--ink-soft); margin-top: 40px; }

/* ============ Game shell ============ */
.shell { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.bar { display: flex; align-items: center; gap: 14px; padding: 12px 18px; z-index: 5; }
.bar-title { display: flex; align-items: center; gap: 10px; margin: 0; font-size: clamp(1.2rem, 2.4vw, 1.7rem); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-title .pic { width: 1.5em; height: 1.5em; flex: none; }
.bar-right { display: flex; align-items: center; gap: 10px; }
.stage { position: relative; flex: 1; overflow: hidden; display: grid; place-items: center; padding: 8px 18px 18px; }

.overlay { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(31, 42, 68, 0.45); backdrop-filter: blur(3px); z-index: 50; padding: 16px; overflow-y: auto; }
.modal { background: #fff; border-radius: 32px; padding: 34px 38px 30px; width: min(620px, 100%); text-align: center; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3); margin: 60px 0 16px; }
.modal h2 { font-size: 2.1rem; margin: 10px 0 6px; }
.modal-icon { width: 110px; height: 110px; padding: 20px; border-radius: 50%; margin: -90px auto 0; box-shadow: 0 8px 0 rgba(0, 0, 0, 0.15); border: 6px solid #fff; }
.howto { text-align: left; font-size: 1.15rem; line-height: 1.4; padding-left: 1.2em; margin: 10px 0 14px; }
.howto li { margin-bottom: 6px; }
.howto li::marker { color: var(--coral); font-weight: 700; }
.opts { background: #fbf6ea; border-radius: 22px; padding: 12px 14px; display: grid; gap: 10px; margin-bottom: 10px; }
.opt-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.opt-label { font-weight: 600; text-align: left; }
.opts .tabs { box-shadow: none; }
.opts .tab { padding: 6px 12px; font-size: 0.95rem; }
.today { margin: 6px 0 14px; }
.today strong { font-family: var(--letters); color: var(--ink); word-spacing: 0.3em; }
.modal .btn-big { margin-top: 4px; }
.stars { display: flex; justify-content: center; gap: 10px; }
.star { font-size: 80px; line-height: 1; color: #e9e2d2; }
.star.on { color: var(--sun); text-shadow: 0 5px 0 #e0a800; animation: star-in 0.6s both; animation-delay: calc(0.2s + var(--i) * 0.25s); }
.star:nth-child(2) { translate: 0 -16px; }
.final-score { font-size: 1.4rem; margin: 0 0 22px; }
.modal-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ============ Sound-button words ============ */
.sb-word { display: inline-grid; column-gap: 0.04em; row-gap: 0; justify-content: center; align-items: end; font-family: var(--letters); font-weight: 700; font-size: clamp(4rem, 11vw, 8.5rem); line-height: 1.05; }
.sb-letter { text-align: center; padding: 0 0.02em; cursor: pointer; border-radius: 0.12em; }
.sb-letter.lit { animation: lit 0.55s; }
.sb-mark { border: 0; padding: 0; cursor: pointer; justify-self: center; background: transparent; position: relative; height: 0.46em; width: 100%; }
.sb-mark::before { content: ''; position: absolute; left: 50%; top: 0.2em; translate: -50% 0; background: var(--coral); border-radius: 999px; }
.sb-dot::before { width: 0.2em; height: 0.2em; }
.sb-bar::before { width: calc(100% - 0.12em); height: 0.13em; top: 0.24em; }
.sb-arc { height: 0.3em; }
.sb-arc::before { background: transparent; width: calc(100% - 0.2em); height: 0.22em; top: -0.06em; border: 0.06em solid var(--coral); border-top: 0; border-radius: 0 0 50% 50% / 0 0 100% 100%; }
.sb-mark.lit::before { background: var(--sun); box-shadow: 0 0 0 0.06em rgba(255, 201, 60, 0.45); }
.sb-arc.lit::before { background: transparent; border-color: var(--sun); box-shadow: none; }
.sb-word.blended { animation: blended 0.8s; }
.sb-word.blended .sb-letter { color: var(--good); }

/* ============ Speedy Sounds (flash cards) ============ */
.flash-wrap { display: flex; flex-direction: column; align-items: center; gap: 18px; width: 100%; max-width: 1100px; }
.flash-area { display: flex; align-items: center; gap: 24px; width: 100%; justify-content: center; }
.flash-card-wrap { position: relative; perspective: 1200px; }
.flash-card {
  width: min(70vw, 780px); height: min(56vh, 480px);
  border: 0; border-radius: 36px; background: #fff; cursor: pointer;
  display: grid; place-items: center; padding: 20px;
  box-shadow: 0 14px 0 var(--orange), 0 24px 50px rgba(0, 0, 0, 0.15);
  background-image: repeating-linear-gradient(transparent 0 58px, rgba(58, 134, 255, 0.08) 58px 60px);
}
.flash-face { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.flash-g { font-size: min(24vw, 30vh); line-height: 1; }
.flash-phrase { font-size: clamp(1.4rem, 3vw, 2.2rem); color: var(--ink-soft); }
.flash-word.plain { font-family: var(--letters); font-weight: 700; font-size: min(15vw, 22vh); line-height: 1; }
.flash-card .sb-word { font-size: min(12vw, 20vh); }
.flash-card.flip-next { animation: flip-next 0.35s; }
.flash-card.flip-prev { animation: flip-prev 0.35s; }
.flash-badge { position: absolute; top: -16px; right: 24px; background: var(--grape); color: #fff; font-weight: 600; padding: 6px 16px; border-radius: 999px; }
.flash-count { font-size: 1.2rem; font-weight: 600; }

/* ============ Blend Machine ============ */
.bm-wrap { display: flex; flex-direction: column; align-items: center; gap: 18px; width: 100%; max-width: 1100px; }
.bm-machine {
  position: relative; width: 100%; min-height: min(56vh, 500px);
  background: linear-gradient(#5b9bff, #3a86ff); border-radius: 40px; padding: 48px 28px 28px;
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 24px;
  box-shadow: 0 12px 0 #2563c9, 0 24px 50px rgba(0, 0, 0, 0.2);
}
.bm-word { background: #fff; border-radius: 28px; padding: 18px 26px 10px; box-shadow: inset 0 -8px 0 #e8eefb; display: grid; place-items: center; min-height: 100%; }
.bm-lights { position: absolute; top: 16px; left: 50%; translate: -50% 0; display: flex; gap: 14px; }
.bm-lights i { width: 16px; height: 16px; border-radius: 50%; background: var(--sun); box-shadow: 0 0 12px var(--sun); animation: blink 1.4s infinite; }
.bm-lights i:nth-child(2n) { background: var(--coral); box-shadow: 0 0 12px var(--coral); animation-delay: 0.35s; }
.bm-lights i:nth-child(3n) { background: var(--mint); box-shadow: 0 0 12px var(--mint); animation-delay: 0.7s; }
.bm-word.slide-in { animation: slide-in 0.45s cubic-bezier(.2, 1.4, .5, 1); }
.bm-reveal {
  width: min(28vw, 280px); aspect-ratio: 1; border-radius: 28px; background: rgba(255, 255, 255, 0.2);
  border: 5px dashed rgba(255, 255, 255, 0.7); display: grid; place-items: center; padding: 18px; text-align: center;
}
.bm-reveal.shown { background: #fff; border: 5px solid #fff; animation: pop-in 0.5s cubic-bezier(.2, 1.6, .5, 1); grid-template-rows: 1fr auto; }
.bm-q { font-size: 7rem; font-weight: 700; color: #fff; }
.bm-pic { max-height: 100%; }
.bm-yes { font-size: 6rem; color: var(--good); }
.bm-label { font-family: var(--letters); font-weight: 700; font-size: 2rem; }

/* Alien friend */
.alien {
  --hue: 140;
  position: relative; width: 60%; aspect-ratio: 1 / 0.9; border-radius: 50% 50% 44% 44%;
  background: radial-gradient(circle at 35% 30%, hsl(var(--hue) 90% 75%), hsl(var(--hue) 70% 45%));
  display: flex; justify-content: center; gap: 12%; padding-top: 22%;
  animation: float 2.4s ease-in-out infinite;
}
.alien::before, .alien::after { content: ''; position: absolute; top: -18%; width: 6%; height: 26%; background: hsl(var(--hue) 70% 45%); border-radius: 4px; }
.alien::before { left: 28%; rotate: -18deg; }
.alien::after { right: 28%; rotate: 18deg; }
.alien i { width: 26%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 55% 55%, #1f2a44 0 32%, #fff 34%); animation: look 3s infinite; }
.alien-pop { position: absolute; width: 90px; left: 50%; top: -70px; translate: -50% 0; animation: alien-up 1.6s both; }
.alien-pop b { position: absolute; bottom: 105%; left: 50%; translate: -50% 0; background: #fff; color: var(--ink); white-space: nowrap; padding: 6px 12px; border-radius: 14px; font-size: 1rem; }

/* ============ Planet Post ============ */
.stage-planet-post { background: radial-gradient(ellipse at 50% 120%, #4b2a8f, #1b1440 55%, #0d0b24); color: #fff; }
.shell:has(.stage-planet-post) { background: #0d0b24; }
.shell:has(.stage-planet-post) .bar-title { color: #fff; }
.stars-bg {
  position: absolute; inset: 0; opacity: 0.9;
  background-image:
    radial-gradient(2px 2px at 10% 20%, #fff, transparent), radial-gradient(2px 2px at 30% 70%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 50% 40%, #fff, transparent), radial-gradient(2px 2px at 70% 15%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 85% 60%, #fff, transparent), radial-gradient(2px 2px at 20% 90%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 60% 85%, #fff, transparent), radial-gradient(2px 2px at 92% 88%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 40% 10%, #fff, transparent), radial-gradient(1.5px 1.5px at 5% 55%, #fff, transparent);
  animation: twinkle 4s ease-in-out infinite alternate;
}
.ps-wrap { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; gap: 10px; }
.ps-field { flex: 1; display: grid; grid-template-columns: 1fr 1.3fr 1fr; align-items: center; gap: 12px; }
.ps-planet {
  position: relative; border: 0; background: transparent; color: #fff; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 12px; border-radius: 30px;
}
.ps-planet.drop-hover { box-shadow: 0 0 0 6px var(--sun), 0 0 60px rgba(255, 201, 60, 0.4) !important; }
.ps-planet.catch { animation: catch 0.5s; }
.ps-globe { width: min(22vw, 240px); height: auto; filter: drop-shadow(0 0 30px rgba(58, 134, 255, 0.6)); animation: spin-slow 30s linear infinite; }
.zog-ball {
  position: relative; width: min(22vw, 240px); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ff9de2, #b04fd8 50%, #5a1f8f);
  box-shadow: 0 0 40px rgba(255, 95, 162, 0.55), inset -20px -20px 40px rgba(0, 0, 0, 0.25);
}
.zog-ball::before, .zog-ball::after { content: ''; position: absolute; border-radius: 50%; background: rgba(90, 31, 143, 0.45); }
.zog-ball::before { width: 22%; height: 22%; left: 55%; top: 25%; }
.zog-ball::after { width: 14%; height: 14%; left: 30%; top: 60%; }
.zog-ring { position: absolute; left: -22%; right: -22%; top: 42%; height: 18%; border: 6px solid #ffc93c; border-radius: 50%; rotate: -14deg; border-top-color: transparent; }
.ps-label { font-size: clamp(1.3rem, 2.4vw, 2rem); font-weight: 700; }
.ps-tally { position: absolute; top: 4px; right: 12%; background: var(--sun); color: var(--ink); font-weight: 700; font-size: 1.4rem; min-width: 44px; height: 44px; border-radius: 22px; display: grid; place-items: center; }
.ps-center { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.ps-rocket { position: relative; display: flex; flex-direction: column; align-items: center; }
.ps-word {
  position: relative; z-index: 1;
  background: #fff; color: var(--ink); font-family: var(--letters); font-weight: 700;
  font-size: clamp(3.2rem, 7.5vw, 6.2rem); line-height: 1; padding: 0.35em 0.6em 0.45em;
  border-radius: 999px 999px 40px 40px; box-shadow: 0 10px 0 #c9c3e8;
  min-width: 3.4em; text-align: center;
}
.ps-flame { order: 2; width: 70px; height: 70px; margin-top: -6px; background: radial-gradient(ellipse at 50% 0, #fff 0 15%, #ffc93c 30%, #ff5d73 60%, transparent 70%); animation: flame 0.15s infinite alternate; }
.drag-ghost.ps-rocket { background: transparent; box-shadow: none !important; }
.ps-rocket.launch-in { animation: launch-in 0.6s cubic-bezier(.2, 1.3, .5, 1); }
.ps-rocket.shake { animation: shake 0.5s; }
.ps-rocket.fly { transition: transform 0.6s cubic-bezier(.6, 0, .9, .5), opacity 0.6s; transform: translate(var(--dx), var(--dy)) scale(0.2) rotate(20deg); opacity: 0; }
.ps-msg { min-height: 2.4em; font-size: clamp(1.1rem, 2vw, 1.5rem); text-align: center; font-weight: 600; }

/* ============ Sound Baskets ============ */
.stage-sound-sort { background: linear-gradient(#fff7e8 0 60%, #e9f7df); }
.bk-wrap { width: 100%; height: 100%; display: grid; grid-template-rows: 1fr auto; gap: 18px; }
.bk-top { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.bk-pile { min-height: 200px; display: grid; place-items: center; }
.word-card {
  display: flex; align-items: center; gap: 18px; background: #fff; border-radius: 28px; padding: 18px 34px;
  box-shadow: 0 10px 0 #d9ead0, 0 18px 40px rgba(0, 0, 0, 0.12); user-select: none;
}
.wc-pic { width: clamp(70px, 9vw, 110px); height: clamp(70px, 9vw, 110px); }
.wc-word { font-family: var(--letters); font-weight: 700; font-size: clamp(3.2rem, 7vw, 5.8rem); line-height: 1; }
.word-card.deal { animation: deal 0.45s cubic-bezier(.2, 1.4, .5, 1); }
.word-card.shake { animation: shake 0.45s; }
.word-card.into-basket { transition: transform 0.4s cubic-bezier(.5, 0, .8, .5), opacity 0.4s; transform: translate(var(--dx), var(--dy)) scale(0.2); opacity: 0; }
.bk-left { font-weight: 600; font-size: 1.1rem; }
.bk-row { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 18px; max-width: 1200px; width: 100%; margin: 0 auto; }
.basket {
  --bk: var(--mint);
  position: relative; border: 0; cursor: pointer; border-radius: 26px 26px 40px 40px; padding: 14px 12px 40px; min-height: 230px;
  background: color-mix(in srgb, var(--bk) 22%, #fff); box-shadow: inset 0 0 0 5px var(--bk), 0 10px 0 color-mix(in srgb, var(--bk) 70%, #000);
  display: flex; flex-direction: column; align-items: center; gap: 4px; overflow: hidden;
}
.bk-head { display: flex; align-items: center; gap: 10px; position: relative; }
.bk-g { font-size: clamp(3rem, 6vw, 4.6rem); line-height: 1.1; }
.bk-head .chip-say { position: static; }
.bk-phrase { color: var(--ink-soft); font-size: 1rem; }
.bk-list { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 6px; }
.bk-chip { background: #fff; border-radius: 10px; padding: 3px 10px; font-family: var(--letters); font-weight: 700; font-size: 1.1rem; animation: pop-in 0.3s; }
.bk-weave { position: absolute; left: 0; right: 0; bottom: 0; height: 28px; background: repeating-linear-gradient(90deg, var(--bk) 0 14px, color-mix(in srgb, var(--bk) 75%, #000) 14px 28px); opacity: 0.9; }
.basket.catch { animation: catch 0.5s; }
.basket.shake { animation: shake 0.45s; }

/* ============ Word Builders ============ */
.wb-wrap { display: flex; flex-direction: column; align-items: center; gap: 2.2vh; width: 100%; max-width: 1000px; }
.wb-top { display: flex; align-items: center; gap: 24px; }
.wb-pic { width: min(26vh, 230px); aspect-ratio: 1; background: #fff; border: 0; cursor: pointer; border-radius: 36px; padding: 22px; box-shadow: 0 10px 0 #f3c6cd, var(--shadow); }
.wb-spelled { font-family: var(--letters); font-weight: 700; font-size: clamp(2.6rem, 6vw, 4.4rem); color: var(--good); min-width: 1em; }
.wb-spelled:empty { display: none; }
.wb-frame { display: flex; gap: 12px; padding: 14px; background: #fff; border-radius: 28px; box-shadow: var(--shadow); }
.wb-slot {
  width: clamp(80px, 11vw, 132px); height: clamp(90px, 12vw, 140px); border-radius: 20px;
  border: 4px dashed #f2b8c2; background: #fff6f7; cursor: pointer;
  font-size: clamp(2.6rem, 5.6vw, 4.4rem); line-height: 1; color: var(--ink); display: grid; place-items: center;
}
.wb-slot.filled { border-style: solid; border-color: var(--coral); background: #fff; }
.wb-slot.drop { animation: drop 0.25s; }
.wb-slot.wrong { border-color: var(--bad); background: #ffe3ea; animation: shake 0.45s; }
.wb-slot.right { border-color: var(--good); background: #e2f8ec; animation: bump 0.4s; }
.wb-tray { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; max-width: 960px; }
.wb-tile {
  min-width: clamp(70px, 8vw, 100px); height: clamp(70px, 8vw, 100px); padding: 0 16px; border-radius: 20px; border: 0;
  background: var(--sun); color: var(--ink);
  font-size: clamp(2.2rem, 4.6vw, 3.4rem); line-height: 1;
  box-shadow: 0 7px 0 #e0a800; transition: transform 0.1s;
}
.wb-tile:nth-child(3n) { background: #8fd3ff; box-shadow: 0 7px 0 #4fa9e0; }
.wb-tile:nth-child(3n + 1) { background: #b7f0a0; box-shadow: 0 7px 0 #7cc85f; }
.wb-tile:hover { transform: translateY(-3px) rotate(-2deg); }
.wb-tile.used { visibility: hidden; }
.wb-tile.hint { animation: bump 0.5s; }

/* ============ Picture Match ============ */
.pm-wrap { width: 100%; max-width: 1100px; display: flex; flex-direction: column; align-items: center; gap: 2.4vh; }
.pm-grid { --n: 4; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 18px; width: 100%; }
.pm-card {
  border: 0; background: #fff; border-radius: 28px; padding: 16px 14px 14px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 10px; box-shadow: 0 8px 0 #cde9ef, var(--shadow);
}
.pm-pic { width: 100%; max-width: 150px; height: min(18vh, 150px); }
.pm-slot {
  width: 100%; min-height: 64px; border: 4px dashed #bfe3ea; border-radius: 16px; display: grid; place-items: center;
  font-family: var(--letters); font-weight: 700; font-size: clamp(1.8rem, 3.4vw, 2.6rem); line-height: 1;
}
.pm-card.done { box-shadow: 0 8px 0 #9fdcb8, var(--shadow); }
.pm-card.done .pm-slot { border-style: solid; border-color: var(--good); background: #e2f8ec; color: var(--good); }
.pm-card.shake { animation: shake 0.45s; }
.pm-tray { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; min-height: 80px; }
.word-chip {
  border: 0; border-radius: 18px; background: var(--ocean); color: #fff; padding: 10px 24px;
  font-family: var(--letters); font-weight: 700; font-size: clamp(2rem, 4vw, 3rem); line-height: 1.1;
  box-shadow: 0 7px 0 #2563c9; transition: transform 0.1s;
}
.word-chip:nth-child(3n) { background: var(--grape); box-shadow: 0 7px 0 #7339b8; }
.word-chip:nth-child(3n + 1) { background: var(--orange); box-shadow: 0 7px 0 #d9691e; }
.word-chip:hover { transform: translateY(-3px) rotate(-2deg); }
.word-chip.selected { outline: 6px solid var(--sun); outline-offset: 3px; transform: translateY(-6px); }
.word-chip.shake { animation: shake 0.45s; }

/* ============ Froggy Sound Spotter ============ */
.stage-frog-spotter { background: linear-gradient(#bfe9ff, #7cc8f2 30%, #4aa3df); }
.fh-water {
  position: absolute; inset: 0; opacity: 0.5;
  background:
    radial-gradient(ellipse 120px 30px at 20% 30%, transparent 70%, rgba(255, 255, 255, 0.6) 72%, transparent 76%),
    radial-gradient(ellipse 160px 40px at 75% 65%, transparent 70%, rgba(255, 255, 255, 0.6) 72%, transparent 76%),
    radial-gradient(ellipse 100px 26px at 40% 85%, transparent 70%, rgba(255, 255, 255, 0.6) 72%, transparent 76%);
  animation: ripple 5s ease-in-out infinite alternate;
}
.fh-wrap { position: relative; width: 100%; height: 100%; display: grid; grid-template-columns: minmax(220px, 30%) 1fr; gap: 24px; align-items: center; }
.fh-target { background: #fff; border-radius: 32px; padding: 22px; text-align: center; box-shadow: 0 10px 0 #2b8bc9, var(--shadow); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.fh-pic { width: min(24vw, 240px); aspect-ratio: 1; border: 0; background: transparent; cursor: pointer; padding: 0; }
.fh-q { font-size: clamp(1.2rem, 2vw, 1.6rem); font-weight: 600; }
.fh-pond { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 2vmin; height: min(100%, 76vh); }
.fh-pad { position: relative; display: grid; place-items: end center; }
.fh-pad:nth-child(3n + 2) { translate: 0 18%; }
.fh-pad.shake { animation: shake 0.45s; }
.fh-lily {
  position: absolute; bottom: 4%; left: 50%; translate: -50% 0; width: 92%; aspect-ratio: 2.3;
  border-radius: 50%; background: conic-gradient(from 330deg, transparent 0 30deg, #56b847 30deg 360deg);
  box-shadow: inset 0 -8px 0 #3d9435;
}
.frog {
  --hue: 115;
  position: relative; z-index: 1; margin-bottom: 9%; width: min(78%, 170px); aspect-ratio: 1.15;
  border: 0; cursor: pointer; padding: 0; touch-action: none;
  border-radius: 50% 50% 46% 46% / 58% 58% 42% 42%;
  background: radial-gradient(circle at 50% 30%, hsl(var(--hue) 65% 58%), hsl(var(--hue) 60% 38%));
  box-shadow: 0 8px 0 hsl(var(--hue) 55% 28%);
  animation: hop-up 0.4s cubic-bezier(.2, 1.6, .5, 1) both;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
}
.frog-eyes { position: absolute; top: -18%; left: 0; right: 0; display: flex; justify-content: space-between; padding: 0 6%; pointer-events: none; }
.frog-eyes i { width: 34%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 50% 55%, #1f2a44 0 28%, #fff 30% 62%, hsl(var(--hue) 60% 45%) 64%); animation: blink-eye 4s infinite; }
.frog-belly { margin-bottom: 10%; width: 76%; padding: 4% 0 6%; border-radius: 50%; background: #f6ffd9; color: var(--ink); font-size: clamp(1.7rem, 4vw, 3.4rem); line-height: 1.1; }
.frog.gone { animation: dive 0.35s forwards; pointer-events: none; }
.frog.caught { animation: caught 0.5s forwards; pointer-events: none; }

/* ============ Sound Balloons ============ */
.stage-balloon-pop { background: linear-gradient(#8fd3ff, #d4f0ff 70%, #f4fbff); padding: 0; }
.bp-clouds i { position: absolute; width: 220px; height: 70px; background: #fff; border-radius: 999px; opacity: 0.85; animation: drift 40s linear infinite; }
.bp-clouds i::before { content: ''; position: absolute; width: 110px; height: 90px; background: #fff; border-radius: 50%; left: 40px; top: -40px; }
.bp-clouds i:nth-child(1) { top: 18%; left: -10%; }
.bp-clouds i:nth-child(2) { top: 45%; left: 40%; animation-duration: 55s; scale: 0.7; }
.bp-clouds i:nth-child(3) { top: 70%; left: 75%; animation-duration: 48s; scale: 0.9; }
.bp-sky { position: absolute; inset: 0; overflow: hidden; }
.bp-sky.done .balloon { pointer-events: none; animation-play-state: paused; }
.balloon {
  position: absolute; bottom: -230px; width: clamp(120px, 13vw, 170px); border: 0; background: none; padding: 0; cursor: pointer; touch-action: none;
  display: flex; flex-direction: column; align-items: center;
  animation: rise var(--dur) linear forwards;
}
.balloon.wide { width: clamp(140px, 15vw, 200px); }
.balloon-body {
  position: relative; width: 100%; aspect-ratio: 0.82; border-radius: 50% 50% 48% 48% / 55% 55% 45% 45%;
  background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.7) 0 9%, transparent 10%), radial-gradient(circle at 40% 35%, color-mix(in srgb, var(--c) 70%, #fff), var(--c) 60%, color-mix(in srgb, var(--c) 75%, #000));
  display: grid; place-items: center;
  animation: sway var(--sway) ease-in-out infinite alternate;
}
.balloon-body::after { content: ''; position: absolute; bottom: -10px; left: 50%; translate: -50% 0; border: 10px solid transparent; border-bottom: 14px solid var(--c); border-top: 0; rotate: 180deg; }
.balloon-word { font-family: var(--letters); font-weight: 700; font-size: clamp(1.6rem, 3vw, 2.5rem); color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.25); padding: 0 6px; }
.balloon:not(.wide) .balloon-word { font-size: clamp(2.4rem, 4.4vw, 3.6rem); }
.balloon-string { width: 2px; height: 70px; background: rgba(31, 42, 68, 0.35); margin-top: 10px; }
.balloon.popped .balloon-body { animation: popped 0.25s forwards; }
.balloon.popped .balloon-string { opacity: 0; }
.balloon-body.wobble { animation: wobble 0.5s; }
.bp-sign {
  position: absolute; top: 14px; left: 50%; translate: -50% 0; z-index: 3;
  background: #fff; border-radius: 26px; padding: 12px 18px 12px 26px; box-shadow: 0 8px 0 #f5b0cc, var(--shadow);
  display: flex; align-items: center; gap: 16px;
}
.bp-sign-label { font-weight: 600; color: var(--ink-soft); font-size: 1.2rem; }
.bp-sign-word { font-size: clamp(2.6rem, 5vw, 4rem); line-height: 1.1; color: var(--pink); }
.bp-ear { font-size: 0.8em; }

/* ============ Spin & Read ============ */
.sw-wrap { display: grid; grid-template-columns: auto minmax(260px, 380px); gap: 4vw; align-items: center; }
.sw-wheel { position: relative; width: min(72vh, 52vw); aspect-ratio: 1; }
.sw-canvas { width: 100%; height: 100%; cursor: pointer; border-radius: 50%; box-shadow: 0 0 0 12px #fff, 0 0 0 20px var(--sun), 0 24px 60px rgba(0, 0, 0, 0.25); }
.sw-pointer {
  position: absolute; top: -34px; left: 50%; translate: -50% 0; z-index: 2;
  width: 0; height: 0; border-left: 26px solid transparent; border-right: 26px solid transparent; border-top: 56px solid var(--ink);
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.2)); transform-origin: 50% 0;
}
.sw-pointer.flick { animation: flick 0.15s; }
.sw-side { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.sw-result {
  width: 100%; min-height: 240px; background: #fff; border: 0; border-radius: 30px; box-shadow: var(--shadow); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 16px; text-align: center; font-size: 1.2rem;
}
.sw-item { font-family: var(--letters); font-weight: 700; font-size: clamp(3.6rem, 7vw, 6rem); line-height: 1.1; }
.sw-phrase { color: var(--ink-soft); font-size: 1.3rem; }
.sw-pic { width: 100px; height: 100px; }
.sw-spin { --btn: var(--coral); font-size: 2rem; padding: 14px 60px; }

/* ============ Animations ============ */
.pop-in { animation: pop-in 0.45s cubic-bezier(.2, 1.6, .5, 1); }
@keyframes pop-in { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes rise-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes bump { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.18); } }
@keyframes wave { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes wiggle { 0%, 100% { rotate: 0deg; } 25% { rotate: -10deg; } 75% { rotate: 10deg; } }
@keyframes star-in { from { transform: scale(0) rotate(-120deg); } 70% { transform: scale(1.3) rotate(10deg); } to { transform: scale(1) rotate(0); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-14px); } 40%, 80% { transform: translateX(14px); } }
@keyframes lit { 0% { transform: translateY(0); background: transparent; } 35% { transform: translateY(-0.12em); background: #fff4cc; } 100% { transform: translateY(0); background: transparent; } }
@keyframes blended { 0% { transform: scale(1); } 30% { transform: scaleX(0.9); } 60% { transform: scale(1.1); } 100% { transform: scale(1); } }
@keyframes flip-next { from { transform: rotateY(-70deg) translateX(40px); opacity: 0.3; } to { transform: none; opacity: 1; } }
@keyframes flip-prev { from { transform: rotateY(70deg) translateX(-40px); opacity: 0.3; } to { transform: none; opacity: 1; } }
@keyframes slide-in { from { transform: translateX(60px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes deal { from { transform: translateY(-60px) rotate(-8deg) scale(0.8); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes spring-back { from { transform: scale(0.85); } to { transform: none; } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes look { 0%, 40%, 100% { transform: translateX(0); } 50%, 70% { transform: translateX(10%); } }
@keyframes alien-up { 0% { transform: translateY(60px) scale(0.3); opacity: 0; } 20%, 80% { transform: none; opacity: 1; } 100% { transform: translateY(40px) scale(0.5); opacity: 0; } }
@keyframes twinkle { from { opacity: 0.6; } to { opacity: 1; } }
@keyframes spin-slow { to { rotate: 360deg; } }
@keyframes catch { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.1); } }
@keyframes flame { from { transform: scaleY(0.85); opacity: 0.85; } to { transform: scaleY(1.15); opacity: 1; } }
@keyframes launch-in { from { transform: translateY(70vh) scale(0.6); } to { transform: none; } }
@keyframes ripple { from { transform: translate(0, 0); } to { transform: translate(30px, 10px); } }
@keyframes hop-up { from { transform: translateY(60%) scale(0.4); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes dive { to { transform: translateY(70%) scale(0.3); opacity: 0; } }
@keyframes caught { 30% { transform: translateY(-50%) scale(1.15) rotate(-10deg); } 100% { transform: translateY(-120%) scale(0.2) rotate(30deg); opacity: 0; } }
@keyframes blink-eye { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(0.1); } }
@keyframes drop { from { transform: scale(1.25); } to { transform: scale(1); } }
@keyframes rise { to { transform: translateY(var(--rise)); } }
@keyframes sway { from { transform: rotate(-6deg) translateX(-8px); } to { transform: rotate(6deg) translateX(8px); } }
@keyframes popped { to { transform: scale(1.6); opacity: 0; } }
@keyframes wobble { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-14deg); } 75% { transform: rotate(14deg); } }
@keyframes drift { to { translate: 140vw 0; } }
@keyframes flick { 50% { transform: rotate(-18deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
  .balloon { animation-duration: var(--dur) !important; }
}

/* ============ Smaller screens ============ */
@media (max-width: 900px) {
  .fh-wrap { grid-template-columns: 1fr; grid-template-rows: auto 1fr; gap: 12px; }
  .fh-target { flex-direction: row; padding: 12px 18px; justify-content: center; }
  .fh-pic { width: 110px; }
  .fh-pond { height: 100%; }
  .sw-wrap { grid-template-columns: 1fr; justify-items: center; gap: 28px; }
  .sw-wheel { width: min(84vw, 50vh); }
  .sw-result { min-height: 140px; }
  .bm-machine { grid-template-columns: 1fr; justify-items: center; }
  .bm-reveal { width: 200px; }
  .ps-field { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr auto; }
  .ps-center { grid-column: 1 / -1; grid-row: 1; }
  .ps-globe, .zog-ball { width: 30vw; }
  .bk-row { grid-template-columns: repeat(min(var(--n), 2), minmax(0, 1fr)); }
  .basket { min-height: 160px; }
  .pm-grid { grid-template-columns: repeat(min(var(--n), 3), minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .home { padding: 12px 16px 40px; }
  .bar { padding: 10px 12px; gap: 8px; flex-wrap: wrap; }
  .bar-title { font-size: 1.05rem; }
  .bar .btn-small { padding: 6px 12px; }
  .bar-right .icon-btn { width: 38px; height: 38px; font-size: 1.05rem; }
  .pill { font-size: 1rem; padding: 6px 12px; }
  .flash-area { gap: 8px; }
  .flash-area .btn-round { width: 48px; height: 48px; }
  .flash-card { width: 70vw; height: 40vh; }
  .modal { padding: 28px 18px 22px; }
  .opt-row { justify-content: center; }
  .bp-sign { top: 8px; padding: 8px 12px; gap: 10px; }
  .bp-sign-label { display: none; }
  .sound-chips { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .chip-g { font-size: 2.1rem; }
  .pm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .word-card { padding: 14px 20px; }
}

/* ============ Pirate Plank ============ */
.stage-pirate-plank { padding: 0; background: linear-gradient(#7fd0ff, #c9ecff 55%, #e8f7ff); }
.shell:has(.stage-pirate-plank) { background: #7fd0ff; }
.pp-scene { position: absolute; inset: 0; overflow: hidden; }
.pp-sun { position: absolute; top: 6%; right: 8%; width: 110px; height: 110px; border-radius: 50%; background: radial-gradient(circle, #fff6b0, #ffd23f 60%); box-shadow: 0 0 60px #ffd23f; animation: pulse-sun 4s ease-in-out infinite; }
.pp-cloud { position: absolute; width: 180px; height: 56px; border-radius: 999px; background: #fff; opacity: 0.9; animation: drift 60s linear infinite; }
.pp-cloud::before { content: ''; position: absolute; width: 90px; height: 74px; left: 34px; top: -34px; border-radius: 50%; background: #fff; }
.pp-cloud.c1 { top: 12%; left: -12%; }
.pp-cloud.c2 { top: 26%; left: 30%; scale: 0.7; animation-duration: 80s; }
.pp-gull { position: absolute; top: 18%; left: 20%; font-size: 1.6rem; color: #33475b; animation: gull 14s linear infinite; }
.pp-sea { position: absolute; left: -60px; right: -60px; bottom: 0; }
.pp-sea.back { height: 27%; background: radial-gradient(circle at 50% 0, transparent 22px, #3aa0e0 23px) 0 0 / 70px 44px repeat-x, linear-gradient(transparent 22px, #3aa0e0 22px); animation: waves 6s linear infinite; }
.pp-sea.front { height: 15%; z-index: 6; pointer-events: none; opacity: 0.95; background: radial-gradient(circle at 50% 0, transparent 24px, #1f7fc4 25px) 0 0 / 80px 48px repeat-x, linear-gradient(transparent 24px, #1f7fc4 24px); animation: waves 4s linear infinite reverse; }
.pp-ship {
  position: absolute; left: -2%; bottom: 7%; width: 34%; height: 28%; z-index: 2;
  background: repeating-linear-gradient(#8b5a2b 0 22px, #7a4c22 22px 26px); border-radius: 0 0 46% 10% / 0 0 70% 20%;
  box-shadow: inset 0 10px 0 #a36a33;
}
.pp-rail { position: absolute; left: 0; right: 0; top: -22px; height: 22px; background: repeating-linear-gradient(90deg, #a36a33 0 8px, transparent 8px 30px); border-top: 8px solid #a36a33; }
.pp-mast { position: absolute; left: 30%; bottom: 100%; width: 14px; height: 130%; background: #6b4220; border-radius: 6px; }
.pp-flag { position: absolute; left: 14px; top: 0; width: 90px; height: 60px; background: #1f1f2e; color: #fff; display: grid; place-items: center; font-size: 2rem; clip-path: polygon(0 0, 100% 0, 85% 50%, 100% 100%, 0 100%); animation: flag 1.4s ease-in-out infinite alternate; transform-origin: left center; }
.pp-plank { position: absolute; left: 30%; bottom: 33%; width: 22%; height: 18px; z-index: 3; background: linear-gradient(#b07a3e, #8a5a28); border-radius: 4px; box-shadow: 0 6px 0 #5c3a1a; }
.pp-rock { position: absolute; right: 2%; bottom: 7%; width: 26%; height: 19%; z-index: 2; background: radial-gradient(circle at 40% 30%, #a9a9b8, #6e6e80); border-radius: 50% 50% 10% 10% / 70% 70% 10% 10%; }
.pp-pirate { position: absolute; left: 42%; bottom: calc(33% + 14px); height: 36%; aspect-ratio: 200 / 320; z-index: 4; transform-origin: 50% 100%; }
.pirate { width: 100%; height: 100%; overflow: visible; }
.pirate .p-all, .pirate .p-arm, .pirate .p-leg, .pirate .p-hat, .pirate .p-head { transform-box: fill-box; }
.pirate .p-all { transform-origin: 50% 100%; }
.pirate .p-arm, .pirate .p-leg { transform-origin: 50% 0; }
.pirate .p-hat { transform-origin: 50% 100%; }
.pirate .p-head { transform-origin: 50% 90%; animation: head-bob 3s ease-in-out infinite; }
.pirate .p-mouth-oh { display: none; }
.pirate.dance .p-all { animation: jig 0.32s ease-in-out 6 alternate; }
.pirate.dance .p-arm-l { animation: wave-l 0.32s ease-in-out 6 alternate; }
.pirate.dance .p-arm-r { animation: wave-r 0.32s ease-in-out 6 alternate; }
.pirate.dance .p-leg-l { animation: kick 0.32s ease-in-out 6 alternate; }
.pirate.dance .p-hat { animation: hat-hop 0.64s ease-in-out 3; }
.pirate.shock .p-mouth-happy { display: none; }
.pirate.shock .p-mouth-oh { display: inline; }
.pirate.shock .p-all { animation: wobble 0.4s; }
.pirate.shock .p-arm-l { transform: rotate(150deg); }
.pirate.shock .p-arm-r { transform: rotate(-150deg); }
.pp-pirate.dive { animation: dive-sea 1.15s cubic-bezier(.45, 0, .8, .6) forwards; }
.pp-pirate.dive .p-mouth-happy { display: none; }
.pp-pirate.dive .p-mouth-oh { display: inline; }
.pp-pirate.dive .p-arm-l { transform: rotate(170deg); }
.pp-pirate.dive .p-arm-r { transform: rotate(-170deg); }
.pp-pirate.climb { animation: climb-out 1.1s cubic-bezier(.2, 1.3, .5, 1); }
.pp-pirate.climb::after { content: '💧'; position: absolute; top: 10%; right: 0; font-size: 2rem; animation: drip 1s forwards; }
.pp-splash { position: absolute; left: 55%; bottom: 11%; width: 160px; height: 60px; translate: -50% 0; z-index: 7; pointer-events: none; border-radius: 50%; border: 6px solid rgba(255, 255, 255, 0.9); opacity: 0; }
.pp-splash.go { animation: splash-ring 0.9s ease-out; }
.pp-chest { position: absolute; left: 5%; bottom: 35%; width: 17%; max-width: 210px; aspect-ratio: 1.3; z-index: 5; border: 0; background: none; padding: 0; cursor: pointer; }
.pp-chest-box { position: absolute; left: 0; right: 0; bottom: 0; height: 60%; background: linear-gradient(#9a5d25, #6e3f16); border-radius: 10px 10px 14px 14px; border: 5px solid #ffc93c; display: grid; place-items: center; box-shadow: 0 8px 0 #4a2a0e; }
.pp-chest-lid { position: absolute; left: 0; right: 0; top: 6%; height: 40%; background: linear-gradient(#b5732f, #8a5a28); border-radius: 50% 50% 6px 6px / 90% 90% 6px 6px; border: 5px solid #ffc93c; transform-origin: 50% 100%; transition: transform 0.35s cubic-bezier(.2, 1.4, .5, 1); z-index: 2; }
.pp-chest-lid i { position: absolute; left: 50%; bottom: -14px; translate: -50% 0; width: 22px; height: 26px; background: #ffc93c; border-radius: 4px; }
.pp-chest-gold { position: absolute; left: 10%; right: 10%; top: 30%; height: 26%; background: radial-gradient(circle at 30% 60%, #fff3a0 0 12%, transparent 13%), radial-gradient(circle at 70% 50%, #fff3a0 0 10%, transparent 11%), linear-gradient(#ffd23f, #f5a524); border-radius: 50% 50% 0 0; opacity: 0; transition: opacity 0.3s; }
.pp-chest.open .pp-chest-lid { transform: translateY(-30%) rotateX(0) rotate(-24deg); }
.pp-chest.open .pp-chest-gold { opacity: 1; box-shadow: 0 0 40px #ffd23f; }
.pp-barrel { position: absolute; right: 9%; bottom: 25%; width: 12%; max-width: 150px; aspect-ratio: 0.8; z-index: 5; border: 0; background: none; padding: 0; cursor: pointer; }
.pp-barrel-body { position: absolute; inset: 0; border-radius: 40% / 12%; background: repeating-linear-gradient(90deg, #9a5d25 0 18px, #8a5021 18px 22px); box-shadow: inset 0 18px 0 -8px #555, inset 0 -18px 0 -8px #555, 0 8px 0 #4a2a0e; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.pp-skull { font-size: 2.2rem; color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.3); }
.pp-plaque { background: #fff3d6; color: #4a2a0e; font-weight: 700; font-size: clamp(0.9rem, 1.6vw, 1.3rem); padding: 2px 10px; border-radius: 8px; border: 3px solid #4a2a0e; }
.pp-chest.hint, .pp-barrel.hint { animation: bump 0.5s 3; }
.pp-barrel.catch { animation: catch 0.5s; }
.pp-top { position: absolute; top: 12px; left: 0; right: 0; z-index: 8; display: flex; flex-direction: column; align-items: center; gap: 10px; pointer-events: none; }
.pp-map {
  pointer-events: auto; position: relative; padding: 16px 44px 20px; min-width: 260px; text-align: center;
  background: radial-gradient(circle at 30% 20%, #fff7dc, #f3dfa8); border-radius: 12px;
  box-shadow: inset 0 0 0 4px #d9b56b, 0 12px 26px rgba(0, 0, 0, 0.2); rotate: -2deg;
}
.pp-map::before, .pp-map::after { content: ''; position: absolute; top: -8px; bottom: -8px; width: 18px; background: linear-gradient(90deg, #c9a35a, #f3dfa8, #c9a35a); border-radius: 9px; }
.pp-map::before { left: -10px; }
.pp-map::after { right: -10px; }
.pp-map-x { position: absolute; right: 18px; bottom: 6px; color: #c0392b; font-weight: 700; font-size: 1.4rem; opacity: 0.7; }
.pp-map-word { font-family: var(--letters); font-weight: 700; font-size: clamp(2.8rem, 6vw, 4.8rem); line-height: 1.05; color: #4a2a0e; }
.pp-map.unroll { animation: unroll 0.5s cubic-bezier(.2, 1.4, .5, 1); }
.pp-map.stow { transition: transform 0.45s cubic-bezier(.5, 0, .8, .5), opacity 0.45s; transform: translate(var(--dx), var(--dy)) scale(0.15) rotate(25deg); opacity: 0; }
.drag-ghost.pp-map { rotate: 0deg; }
.pp-msg { font-weight: 700; font-size: clamp(1.1rem, 2vw, 1.5rem); color: #13324a; background: rgba(255, 255, 255, 0.75); padding: 4px 16px; border-radius: 999px; min-height: 1.6em; }
.pp-msg:empty { visibility: hidden; }

/* ============ Alien Snack Attack ============ */
.stage-alien-snack { padding: 0; background: radial-gradient(ellipse at 50% 0, #4a2d8f, #22134d 60%, #120a2c); color: #fff; }
.shell:has(.stage-alien-snack) { background: #22134d; }
.shell:has(.stage-alien-snack) .bar-title { color: #fff; }
.ac-stars { position: absolute; inset: 0; background-image: radial-gradient(2px 2px at 12% 18%, #fff, transparent), radial-gradient(2px 2px at 34% 8%, #fff, transparent), radial-gradient(1.5px 1.5px at 58% 22%, #fff, transparent), radial-gradient(2px 2px at 80% 12%, #fff, transparent), radial-gradient(1.5px 1.5px at 92% 34%, #fff, transparent), radial-gradient(1.5px 1.5px at 6% 42%, #fff, transparent), radial-gradient(2px 2px at 46% 36%, #fff, transparent); animation: twinkle 3s ease-in-out infinite alternate; }
.ac-planet { position: absolute; top: 8%; right: 14%; width: 90px; height: 90px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, #ffd27a, #ff8c42); box-shadow: 0 0 40px rgba(255, 140, 66, 0.5); }
.ac-ground { position: absolute; left: -10%; right: -10%; bottom: -30%; height: 55%; border-radius: 50% 50% 0 0; background: radial-gradient(circle at 20% 20%, #7b5fc4 0 30px, transparent 31px), radial-gradient(circle at 70% 30%, #7b5fc4 0 46px, transparent 47px), radial-gradient(circle at 45% 60%, #7b5fc4 0 22px, transparent 23px), #5d43a8; }
.ac-wrap { position: absolute; inset: 0; display: grid; grid-template-columns: 1fr minmax(260px, 0.9fr) 1fr; align-items: end; padding: 12px 2% 3%; gap: 8px; }
.ac-middle { align-self: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.ac-plate { min-height: 220px; width: 100%; display: grid; place-items: center; background: radial-gradient(ellipse 46% 12% at 50% 86%, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.08) 70%, transparent 72%); }
.ac-left { font-weight: 600; opacity: 0.85; }
.ac-snack {
  --h: 30;
  position: relative; display: grid; place-items: center; padding: 30px 40px; min-width: 200px; border-radius: 999px;
  background: radial-gradient(circle at 50% 50%, hsl(var(--h) 90% 82%) 0 45%, hsl(var(--h) 80% 62%) 46% 100%);
  box-shadow: 0 10px 0 hsl(var(--h) 60% 40%), 0 18px 30px rgba(0, 0, 0, 0.3); color: var(--ink);
}
.ac-snack-word { position: relative; font-family: var(--letters); font-weight: 700; font-size: clamp(2.6rem, 5vw, 4.2rem); line-height: 1; }
.ac-sprinkles i { position: absolute; width: 14px; height: 5px; border-radius: 3px; background: #fff; }
.ac-sprinkles i:nth-child(1) { top: 12%; left: 22%; rotate: 30deg; background: #ff5d73; }
.ac-sprinkles i:nth-child(2) { top: 10%; left: 60%; rotate: -20deg; background: #3a86ff; }
.ac-sprinkles i:nth-child(3) { top: 80%; left: 30%; rotate: 70deg; background: #ffc93c; }
.ac-sprinkles i:nth-child(4) { top: 82%; left: 68%; rotate: -50deg; background: #2ec4a6; }
.ac-sprinkles i:nth-child(5) { top: 45%; left: 6%; rotate: 90deg; background: #fff; }
.ac-sprinkles i:nth-child(6) { top: 45%; right: 6%; rotate: 10deg; background: #9b5de5; }
.ac-sprinkles i:nth-child(7) { top: 22%; left: 84%; rotate: 45deg; background: #ff8c42; }
.ac-snack.deal { animation: deal 0.45s cubic-bezier(.2, 1.4, .5, 1); }
.ac-snack.eaten { transition: transform 0.38s cubic-bezier(.5, 0, .8, .5), opacity 0.38s; transform: translate(var(--dx), var(--dy)) scale(0.2); opacity: 0; }
.ac-snack.gulp { transition: transform 0.36s cubic-bezier(.5, 0, .8, .5); transform: translate(var(--dx), var(--dy)) scale(0.4); }
.ac-snack.spat { animation: spat 0.7s cubic-bezier(.2, 1.3, .5, 1); }
.ac-alien { --full: 0; position: relative; border: 0; background: none; padding: 0; color: #fff; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.ac-alien.drop-hover { transform: none; box-shadow: none !important; }
.ac-art { width: min(100%, 340px); aspect-ratio: 220 / 240; }
.ac-svg { width: 100%; height: 100%; overflow: visible; }
.ac-svg g { transform-box: fill-box; }
.ac-bob { transform-origin: 50% 100%; animation: alien-bob 2.4s ease-in-out infinite; }
.ac-zorp .ac-bob { animation-duration: 2.9s; animation-delay: -1s; }
.ac-body { transform-origin: 50% 100%; transform: scale(calc(1 + var(--full) * 0.035), calc(1 + var(--full) * 0.02)); transition: transform 0.4s cubic-bezier(.2, 1.6, .5, 1); }
.ac-pupil { transition: transform 0.12s; }
.ac-lid { transform-origin: 50% 100%; transform: scaleY(0); }
.ac-alien.blink .ac-lid { animation: lid 0.25s; }
.ac-mouth { transform-origin: 50% 0; transform: scaleY(0.08); opacity: 0; transition: transform 0.18s, opacity 0.1s; }
.ac-smile { transition: opacity 0.1s; }
.ac-alien.drop-hover .ac-mouth, .ac-alien.open .ac-mouth { transform: scaleY(1.15); opacity: 1; }
.ac-alien.drop-hover .ac-smile, .ac-alien.open .ac-smile, .ac-alien.chomp .ac-smile { opacity: 0; }
.ac-alien.chomp .ac-mouth { opacity: 1; animation: chomp 0.22s ease-in-out 4 alternate; }
.ac-alien.chomp .ac-arm-l { animation: wave-l 0.3s 3 alternate; }
.ac-alien.chomp .ac-arm-r { animation: wave-r 0.3s 3 alternate; }
.ac-arm { transform-origin: 90% 90%; }
.ac-arm-r { transform-origin: 10% 90%; }
.ac-alien.yuck .ac-art { animation: yuck 0.9s; }
.ac-alien.yuck .ac-mouth { opacity: 1; transform: scaleY(0.7) scaleX(1.1); }
.ac-sign { position: relative; background: #fff; color: var(--ink); border-radius: 18px; padding: 8px 40px 8px 16px; box-shadow: 0 6px 0 rgba(0, 0, 0, 0.25); text-align: center; }
.ac-sign .chip-say { top: 50%; translate: 0 -50%; right: 6px; }
.ac-name { font-weight: 700; font-size: 1.1rem; color: var(--grape); }
.ac-gloop .ac-name { color: #2f9a3a; }
.ac-wants { display: flex; align-items: center; gap: 8px; justify-content: center; font-weight: 600; font-size: 1.1rem; }
.ac-wants strong { font-size: 1.5rem; color: var(--coral); }
.ac-sign-g { font-size: clamp(2rem, 4vw, 3rem); line-height: 1.1; color: var(--coral); }
.ac-bubble { position: absolute; top: 34%; left: 50%; translate: -50% 0; z-index: 3; font-weight: 700; font-size: clamp(1.6rem, 3.4vw, 2.6rem); white-space: nowrap; padding: 6px 18px; border-radius: 20px; background: #fff; color: var(--ink); opacity: 0; pointer-events: none; }
.ac-bubble.yum { color: #e2457a; }
.ac-bubble.yuck { color: #3b9b2f; background: #e6ffd0; }
.ac-bubble.show { animation: bubble 1.4s cubic-bezier(.2, 1.5, .5, 1); }

/* ============ Flip & Find ============ */
.ff-wrap { width: 100%; max-width: 1200px; height: 100%; display: flex; flex-direction: column; gap: 14px; }
.ff-head { display: flex; align-items: center; justify-content: center; gap: 18px; min-height: 52px; }
.ff-turn { font-weight: 700; font-size: clamp(1.2rem, 2.2vw, 1.6rem); }
.ff-team { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 999px; padding: 8px 18px; font-weight: 700; font-size: 1.2rem; box-shadow: 0 4px 0 #e2d6bd; opacity: 0.6; transition: opacity 0.2s, transform 0.2s; }
.ff-team b { font-size: 1.6rem; }
.ff-team.t0 b { color: #e63946; }
.ff-team.t1 b { color: #3a86ff; }
.ff-team.active { opacity: 1; transform: scale(1.1); box-shadow: 0 4px 0 #e2d6bd, 0 0 0 5px var(--sun); }
.ff-team.bump { animation: bump 0.4s; }
.ff-grid { --cols: 6; flex: 1; display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); grid-auto-rows: 1fr; gap: clamp(8px, 1.4vw, 18px); min-height: 0; }
.ff-card { border: 0; background: none; padding: 0; cursor: pointer; perspective: 900px; min-height: 0; animation: rise-in 0.45s both; animation-delay: calc(var(--i) * 35ms); }
.ff-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform 0.5s cubic-bezier(.3, 1.4, .5, 1); }
.ff-card.up .ff-inner { transform: rotateY(180deg); }
.ff-back, .ff-front { position: absolute; inset: 0; border-radius: 20px; backface-visibility: hidden; -webkit-backface-visibility: hidden; display: grid; place-items: center; }
.ff-back {
  background: radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.3) 0 14%, transparent 15%), radial-gradient(circle at 75% 70%, rgba(255, 255, 255, 0.22) 0 18%, transparent 19%), linear-gradient(135deg, #ef476f, #9b5de5);
  box-shadow: 0 6px 0 #7a2e8f, inset 0 0 0 5px rgba(255, 255, 255, 0.6); color: #fff; font-size: clamp(2rem, 4vw, 3.4rem);
}
.ff-card:hover .ff-back { filter: brightness(1.08); }
.ff-front { transform: rotateY(180deg); background: #fff; box-shadow: 0 6px 0 #e2d6bd, inset 0 0 0 4px #f0e3c8; padding: 10%; }
.ff-pic { width: 100%; height: 100%; }
.ff-g { font-size: clamp(2.4rem, 5.6vw, 5rem); line-height: 1.1; }
.ff-word { font-family: var(--letters); font-weight: 700; font-size: clamp(1.6rem, 3.4vw, 3rem); }
.ff-card.matched .ff-front { box-shadow: 0 6px 0 #9fdcb8, inset 0 0 0 5px var(--good); background: #f0fff6; }
.ff-card.matched { animation: bump 0.4s; }
.ff-card.nope .ff-inner { animation: nope 0.4s; }

/* new keyframes */
@keyframes pulse-sun { 50% { transform: scale(1.06); } }
@keyframes gull { from { transform: translateX(-30vw); } to { transform: translateX(110vw); } }
@keyframes waves { to { background-position-x: 70px, 0; } }
@keyframes flag { to { transform: skewY(-6deg) scaleX(0.92); } }
@keyframes head-bob { 50% { transform: rotate(3deg); } }
@keyframes jig { from { transform: translateY(0) rotate(-7deg); } to { transform: translateY(-14%) rotate(7deg); } }
@keyframes wave-l { from { transform: rotate(10deg); } to { transform: rotate(150deg); } }
@keyframes wave-r { from { transform: rotate(-10deg); } to { transform: rotate(-150deg); } }
@keyframes kick { from { transform: rotate(0); } to { transform: rotate(40deg); } }
@keyframes hat-hop { 50% { transform: translateY(-30%) rotate(-12deg); } }
@keyframes dive-sea {
  0% { transform: none; }
  25% { transform: translate(18%, -22%) rotate(25deg); }
  55% { transform: translate(55%, 10%) rotate(120deg); }
  100% { transform: translate(70%, 150%) rotate(180deg); }
}
@keyframes climb-out { from { transform: translateY(120%); } to { transform: none; } }
@keyframes drip { from { transform: translateY(0); opacity: 1; } to { transform: translateY(160px); opacity: 0; } }
@keyframes splash-ring { 0% { opacity: 1; transform: scale(0.2); } 100% { opacity: 0; transform: scale(1.8); } }
@keyframes unroll { from { transform: scaleX(0.1) rotate(-6deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes alien-bob { 50% { transform: translateY(-3%) scaleY(1.02); } }
@keyframes lid { 50% { transform: scaleY(1); } }
@keyframes chomp { from { transform: scaleY(1.1); } to { transform: scaleY(0.1); } }
@keyframes yuck {
  0%, 100% { transform: none; filter: none; }
  15% { transform: rotate(-8deg) scale(1.05); filter: hue-rotate(60deg) saturate(1.4); }
  35% { transform: rotate(8deg) scale(0.95); filter: hue-rotate(60deg) saturate(1.4); }
  55% { transform: rotate(-5deg); filter: hue-rotate(40deg); }
  75% { transform: rotate(3deg); }
}
@keyframes spat { 0% { transform: translate(var(--dx), var(--dy)) scale(0.4) rotate(0); } 60% { transform: translate(calc(var(--dx) * -0.15), -40px) scale(1.1) rotate(-12deg); } 100% { transform: none; } }
@keyframes bubble { 0% { opacity: 0; transform: translateY(20px) scale(0.5); } 15% { opacity: 1; transform: translateY(-30px) scale(1.1); } 80% { opacity: 1; transform: translateY(-40px) scale(1); } 100% { opacity: 0; transform: translateY(-60px); } }
@keyframes nope { 0%, 100% { transform: rotateY(180deg); } 25% { transform: rotateY(180deg) translateX(10px); } 75% { transform: rotateY(180deg) translateX(-10px); } }

@media (max-width: 900px) {
  .ac-wrap { grid-template-columns: 1fr 1fr; grid-template-rows: auto 1fr; }
  .ac-middle { grid-column: 1 / -1; grid-row: 1; }
  .ac-plate { min-height: 150px; }
  .ff-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .pp-chest { width: 22%; }
  .pp-barrel { width: 16%; }
  .pp-pirate { left: 40%; height: 30%; }
}

/* ============ Mode switch + green/red pickers ============ */
.mode-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 22px; }
.mode-h { margin: 0; font-size: 1.3rem; color: var(--ink-soft); }
.mode-tabs { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.mode-tab {
  --m: var(--ocean);
  display: flex; align-items: center; gap: 10px; border: 0; cursor: pointer;
  padding: 14px 28px; border-radius: 20px; font-weight: 700; font-size: clamp(1.1rem, 2.2vw, 1.45rem);
  background: #fff; color: var(--ink); box-shadow: 0 5px 0 #e2d6bd, var(--shadow); transition: transform 0.12s;
}
.mode-tab:hover { transform: translateY(-2px); }
.mode-icon { font-size: 1.5em; line-height: 1; }
.mode-sounds { --m: #3a86ff; }
.mode-red { --m: #e63946; }
.mode-green { --m: #23a55a; }
.mode-tab[aria-selected='true'] { background: var(--m); color: #fff; box-shadow: 0 5px 0 color-mix(in srgb, var(--m) 70%, #000), var(--shadow); transform: scale(1.05); }

.sound-chip.short { padding: 14px 8px; justify-content: center; }
.sound-chips.set1 { grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); }
.green-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.green-chip {
  position: relative; border: 3px solid var(--line); background: #fffdf8; border-radius: 18px; padding: 10px 14px;
  cursor: pointer; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; transition: transform 0.12s, border-color 0.12s, background 0.12s;
}
.green-chip:hover { transform: translateY(-2px); }
.green-title { font-weight: 700; font-size: 1.1rem; }
.green-g { font-size: 2rem; line-height: 1.1; color: #138a4a; }
.green-words { font-family: var(--letters); color: var(--ink-soft); font-size: 1.02rem; line-height: 1.3; }
.green-n { font-size: 0.85rem; color: var(--ink-soft); }
.green-chip[aria-pressed='true'] { border-color: #23a55a; background: #e6f8ec; }
.green-chip[aria-pressed='true']::after { content: '✓'; position: absolute; top: 8px; right: 10px; width: 24px; height: 24px; border-radius: 50%; background: #23a55a; color: #fff; font-weight: 700; font-size: 0.85rem; display: grid; place-items: center; }
.red-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.red-chip {
  position: relative; display: inline-flex; align-items: center; gap: 4px; border: 3px solid var(--line); background: #fffdf8;
  border-radius: 14px; padding: 6px 38px 6px 14px; cursor: pointer; font-family: var(--letters); font-weight: 700; font-size: 1.35rem; transition: transform 0.12s;
}
.red-chip:hover { transform: translateY(-2px); }
.red-chip .chip-say { top: 50%; translate: 0 -50%; right: 3px; width: 28px; height: 28px; font-size: 0.8rem; }
.red-temp { color: #9aa0ad; font-size: 0.9rem; }
.red-chip[aria-pressed='true'] { border-color: #e63946; background: #fde8ea; color: #b3202c; }

.game-card.off { filter: grayscale(0.85); opacity: 0.55; cursor: not-allowed; animation-name: none; }
.game-card.off:hover { transform: none; box-shadow: var(--shadow); }
.game-off { position: absolute; bottom: 12px; left: 12px; background: var(--ink); color: #fff; font-weight: 600; font-size: 0.85rem; padding: 4px 12px; border-radius: 999px; }

.flash-badge.red { background: #e63946; }
.flash-word.plain.red, .ff-word.red, .bp-red { color: #d62839; }
.red-text { color: #e63946 !important; }
.green-text { color: #23a55a !important; }

/* ============ Red-word games ============ */
.red-machine { background: linear-gradient(#ff6b78, #e63946); box-shadow: 0 12px 0 #a8202c, 0 24px 50px rgba(0, 0, 0, 0.2); }
.rs-word { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.rs-letter {
  width: clamp(64px, 9vw, 110px); height: clamp(80px, 11vw, 130px); border: 0; border-radius: 18px; cursor: pointer;
  background: #fde8ea; box-shadow: inset 0 -6px 0 #f5c2c8; display: grid; place-items: center;
  font-family: var(--letters); font-weight: 700; font-size: clamp(3rem, 7vw, 5.6rem); color: transparent; transition: color 0.2s, background 0.2s;
}
.rs-letter.on { color: #c1121f; background: #fff; }
.rs-letter.lit { animation: lit 0.55s; }
.rs-word.blended .rs-letter { color: #c1121f; background: #fff; }
.rs-big { font-family: var(--letters); font-weight: 700; font-size: clamp(2.6rem, 5vw, 4.4rem); color: #c1121f; line-height: 1.1; }
.rw-card {
  position: relative; min-width: 300px; padding: 22px 50px; border-radius: 30px; background: #fff; overflow: hidden;
  box-shadow: 0 10px 0 #f5c2c8, var(--shadow); text-align: center;
}
.rw-text { font-family: var(--letters); font-weight: 700; font-size: clamp(3.6rem, 8vw, 6.4rem); color: #c1121f; line-height: 1.1; }
.rw-curtain {
  position: absolute; inset: 0; display: grid; place-items: center; font-size: 4rem;
  background: repeating-linear-gradient(45deg, #e63946 0 22px, #d62839 22px 44px);
  transform: translateY(-105%); transition: transform 0.45s cubic-bezier(.5, 1.4, .5, 1);
}
.rw-card.covered .rw-curtain { transform: none; }
.pm-speaker { font-size: clamp(3rem, 7vw, 5rem); height: min(18vh, 150px); display: grid; place-items: center; }
.pm-speaker.bump { animation: bump 0.4s; }
.fh-ear { font-size: clamp(4rem, 9vw, 7rem); display: grid; place-items: center; background: #e8f5ff; border-radius: 50%; }
.fh-shown { font-family: var(--letters); font-weight: 700; font-size: 2.4rem; min-height: 0; }
.fh-shown:empty { display: none; }
.frog.word .frog-belly { font-size: clamp(1.2rem, 2.4vw, 2.1rem); width: 86%; padding: 6% 2% 8%; }
