/* ═══════════════════════════════════════════
   grammar.css — Grammar World styles
   All grammar-specific styles: world themes,
   creature animations, round templates,
   particles, world map, achievements.
   ═══════════════════════════════════════════ */

/* ── World theme custom properties (defaults) ── */
:root {
  --world-bg: #F5F5F5;
  --world-primary: #43B047;
  --world-accent: #F8B800;
  --world-surface: #FFFFFF;
  --world-ground: #8B6914;
}

/* ── Per-world color overrides ── */
[data-grammar-world="1"]  { --world-bg: #E8F7E9; --world-primary: #43B047; --world-accent: #F8B800; }
[data-grammar-world="2"]  { --world-bg: #FFF3E0; --world-primary: #C68400; --world-accent: #7B4F00; }
[data-grammar-world="3"]  { --world-bg: #F3E5F5; --world-primary: #A540A0; --world-accent: #049CD8; }
[data-grammar-world="4"]  { --world-bg: #E3F2FD; --world-primary: #049CD8; --world-accent: #FFFFFF; }
[data-grammar-world="5"]  { --world-bg: #FFEBEE; --world-primary: #E52521; --world-accent: #F8B800; }
[data-grammar-world="6"]  { --world-bg: #1A1A3E; --world-primary: #049CD8; --world-accent: #00E5FF; }
[data-grammar-world="7"]  { --world-bg: #EDE7F6; --world-primary: #A540A0; --world-accent: #F8B800; }
[data-grammar-world="8"]  { --world-bg: #E0F7FA; --world-primary: #049CD8; --world-accent: #43B047; }
[data-grammar-world="9"]  { --world-bg: #FFF8E1; --world-primary: #C68400; --world-accent: #F8B800; }
[data-grammar-world="10"] { --world-bg: #F3E5F5; --world-primary: #6C4A8A; --world-accent: #43B047; }
[data-grammar-world="11"] { --world-bg: #E8EAF6; --world-primary: #049CD8; --world-accent: #A540A0; }
[data-grammar-world="12"] { --world-bg: #FFFDE7; --world-primary: #F8B800; --world-accent: #E52521; }
[data-grammar-world="13"] { --world-bg: #E8F5E9; --world-primary: #43B047; --world-accent: #049CD8; }

/* Dark world text fix */
[data-grammar-world="6"] .gw-detail,
[data-grammar-world="6"] .gw-detail-header { color: #E0E0E0; }


/* ═══════════════════════════════════════════
   Particle & Score animations
   ═══════════════════════════════════════════ */
@keyframes particle-burst {
  0%   { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0); opacity: 0; }
}

@keyframes score-float {
  0%   { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-40px) scale(1.2); opacity: 0; }
}


/* ═══════════════════════════════════════════
   Creature animations
   ═══════════════════════════════════════════ */
.creature-wrap { display: inline-block; }

@keyframes creature-bounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}
.creature-idle { animation: creature-bounce 1.2s ease-in-out infinite; }

@keyframes creature-celebrate-kf {
  0%   { transform: translateY(0) rotate(0deg) scale(1); }
  25%  { transform: translateY(-10px) rotate(-8deg) scale(1.1); }
  50%  { transform: translateY(0) rotate(8deg) scale(1); }
  75%  { transform: translateY(-5px) rotate(-4deg) scale(1.05); }
  100% { transform: translateY(0) rotate(0deg) scale(1); }
}
.creature-celebrate { animation: creature-celebrate-kf 0.6s ease-out; }

@keyframes creature-sad-kf {
  0%, 100% { transform: rotate(0deg); }
  25%      { transform: rotate(-4deg); }
  75%      { transform: rotate(4deg); }
}
.creature-sad { animation: creature-sad-kf 0.4s ease-in-out 2; }

@keyframes creature-thinking-kf {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-2px); }
  75%      { transform: translateX(2px); }
}
.creature-thinking { animation: creature-thinking-kf 0.8s ease-in-out infinite; }

@keyframes creature-backflip-kf {
  0%   { transform: rotate(0deg) translateY(0); }
  50%  { transform: rotate(180deg) translateY(-16px); }
  100% { transform: rotate(360deg) translateY(0); }
}
.creature-backflip { animation: creature-backflip-kf 0.5s ease-in-out; }

/* Creature speech bubble */
.creature-bubble {
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%) scale(0);
  background: var(--world-surface, #fff);
  border: 2px solid var(--world-primary, #43B047);
  border-radius: 8px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  transition: transform 0.2s ease;
  z-index: 10;
}
.creature-bubble-show { transform: translateX(-50%) scale(1); }


/* ═══════════════════════════════════════════
   Grammar Runner (progress bar)
   ═══════════════════════════════════════════ */
.grammar-runner-active {
  position: relative;
  height: 50px;
  overflow: visible;
  background: transparent;
}

.gr-ground {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: var(--world-ground, #8B6914);
  border-radius: 3px;
}

.gr-runner {
  position: absolute;
  bottom: 8px;
  left: 3%;
  transition: left 0.4s ease;
  z-index: 2;
}

.gr-obstacle {
  position: absolute;
  bottom: 8px;
  transform: translateX(-50%);
  transition: opacity 0.3s, transform 0.3s;
  z-index: 1;
}
.gr-obstacle-cleared {
  opacity: 0;
  transform: translateX(-50%) translateY(-20px) scale(0.5);
}
.gr-obstacle-hit {
  animation: obstacle-shake 0.3s ease;
}

.gr-chest {
  position: absolute;
  bottom: 8px;
  right: 2%;
  z-index: 1;
}

@keyframes obstacle-shake {
  0%, 100% { transform: translateX(-50%) rotate(0); }
  25%      { transform: translateX(-50%) rotate(-5deg); }
  75%      { transform: translateX(-50%) rotate(5deg); }
}


/* ═══════════════════════════════════════════
   World Map
   ═══════════════════════════════════════════ */
.gw-map {
  padding: var(--sp-4, 16px);
  max-width: 600px;
  margin: 0 auto;
}

.gw-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-4, 16px);
}

.gw-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--dark, #1D1D1F);
}

.gw-creature-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface, #fff);
  border: var(--px-border, 3px solid #1D1D1F);
  border-radius: 12px;
  padding: 6px 12px;
  box-shadow: var(--px-shadow, 4px 4px 0 0 rgba(0,0,0,.08));
}

.gw-creature-sprite { width: 32px; height: 32px; }
.gw-creature-name { font-weight: 700; font-size: 13px; }
.gw-creature-stage { font-size: 11px; color: var(--gray-2, #6E6E73); }

.gw-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-3, 12px);
}

@media (min-width: 480px) {
  .gw-grid { grid-template-columns: 1fr 1fr; }
}

.gw-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--world-bg);
  border: var(--px-border, 3px solid #1D1D1F);
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  box-shadow: var(--px-shadow, 4px 4px 0 0 rgba(0,0,0,.08));
  position: relative;
  overflow: hidden;
}
.gw-card:hover:not(.gw-card-locked) {
  transform: translateY(-2px);
  box-shadow: 4px 6px 0 0 rgba(0,0,0,.12);
}
.gw-card:active:not(.gw-card-locked) { transform: scale(0.97); }

.gw-card-locked {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.5);
}
.gw-card-complete {
  border-color: var(--world-primary);
}

.gw-card-icon { font-size: 28px; flex-shrink: 0; }
.gw-card-info { flex: 1; min-width: 0; }
.gw-card-name { font-weight: 700; font-size: 14px; color: var(--dark, #1D1D1F); }
.gw-card-section { font-size: 11px; color: var(--gray-2, #6E6E73); margin-top: 2px; }

.gw-card-progress-wrap {
  height: 4px;
  background: rgba(0,0,0,.1);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}
.gw-card-progress-fill {
  height: 100%;
  background: var(--world-primary);
  border-radius: 2px;
  transition: width 0.4s ease;
}
.gw-card-progress-label { font-size: 10px; color: var(--gray-2, #6E6E73); margin-top: 2px; }
.gw-card-arrow, .gw-card-lock { font-size: 16px; flex-shrink: 0; }


/* ── World Detail ── */
.gw-detail {
  padding: var(--sp-4, 16px);
  max-width: 600px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--world-bg);
  transition: background 0.4s;
}

.gw-detail-header {
  margin-bottom: var(--sp-4, 16px);
}

.gw-back-btn {
  background: none;
  border: none;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 0;
  color: var(--world-primary);
}

.gw-detail-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.gw-detail-title h2 { font-size: 20px; font-weight: 800; }
.gw-detail-icon { font-size: 24px; }
.gw-detail-section { font-size: 13px; color: var(--gray-2, #6E6E73); margin-top: 4px; }

.gw-lessons {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3, 12px);
}

.gw-lesson {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--world-surface, #fff);
  border: var(--px-border, 3px solid #1D1D1F);
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.12s ease;
  box-shadow: var(--px-shadow, 4px 4px 0 0 rgba(0,0,0,.06));
}
.gw-lesson:hover:not(.gw-lesson-locked) { transform: translateY(-2px); }
.gw-lesson-locked { opacity: 0.45; cursor: not-allowed; }
.gw-lesson-complete { border-color: var(--world-primary); }

.gw-lesson-num {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--world-primary);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}
.gw-lesson-locked .gw-lesson-num { background: var(--gray-3, #AAA); }

.gw-lesson-info { flex: 1; }
.gw-lesson-name { font-weight: 700; font-size: 14px; }
.gw-lesson-structures { font-size: 11px; color: var(--gray-2, #6E6E73); }
.gw-lesson-state { font-size: 18px; }


/* ── Lesson Detail (rounds) ── */
.gw-lesson-detail {
  padding: var(--sp-4, 16px);
  max-width: 500px;
  margin: 0 auto;
}
.gw-lesson-detail-header {
  margin-bottom: var(--sp-4, 16px);
}
.gw-lesson-detail-header h2 { font-size: 18px; font-weight: 800; margin-top: 8px; }

.gw-rounds {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3, 12px);
}

.gw-round {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--world-surface, #fff);
  border: var(--px-border, 3px solid #1D1D1F);
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.12s ease;
  box-shadow: var(--px-shadow, 4px 4px 0 0 rgba(0,0,0,.06));
}
.gw-round:hover:not(.gw-round-locked) { transform: translateY(-2px); }
.gw-round-locked { opacity: 0.45; cursor: not-allowed; }
.gw-round-complete { border-color: var(--world-primary); }

.gw-round-icon { font-size: 24px; }
.gw-round-info { flex: 1; }
.gw-round-name { font-weight: 700; font-size: 14px; }
.gw-round-score { font-size: 11px; color: var(--gray-2, #6E6E73); }
.gw-round-state { font-size: 18px; }


/* ═══════════════════════════════════════════
   R1 — Creature Spotter (mobile-first, kid-friendly)
   ═══════════════════════════════════════════ */
.gr1-scene {
  padding: 16px 14px 24px;
  min-height: 100%;
  position: relative;
  overflow: hidden;
}

/* ── Floating background decorations ── */
.gr1-bg-deco {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.gr1-float {
  position: absolute;
  font-size: 22px;
  opacity: 0.18;
}
.gr1-float-1 { top: 8%; right: 8%; animation: gr1-drift 6s ease-in-out infinite; }
.gr1-float-2 { top: 40%; left: 4%; animation: gr1-drift 5s ease-in-out 1s infinite; }
.gr1-float-3 { bottom: 12%; right: 12%; animation: gr1-drift 7s ease-in-out 2s infinite; }
@keyframes gr1-drift {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-10px) rotate(8deg); }
}

/* ── Banner ── */
.gr1-banner {
  text-align: center;
  padding: 14px 20px;
  background: linear-gradient(135deg, var(--world-primary, #43B047), #2E8B3A);
  color: #fff;
  font-weight: 800;
  font-size: 17px;
  border-radius: 16px;
  margin-bottom: 16px;
  box-shadow: 0 4px 0 0 rgba(0,0,0,.12), 0 6px 16px rgba(67,176,71,.25);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: 0.3px;
}
.gr1-banner-icon { font-size: 22px; }

/* ── Creature + bubble layout ── */
.gr1-passage-area {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.gr1-creature-panel {
  flex-shrink: 0;
  text-align: center;
  min-width: 68px;
}
.gr1-creature-name {
  font-size: 11px;
  font-weight: 800;
  color: var(--world-primary, #43B047);
  margin-top: 4px;
  text-align: center;
}

/* ── Speech bubble ── */
.gr1-bubble {
  flex: 1;
  background: #fff;
  border: 3px solid var(--world-primary, #43B047);
  border-radius: 20px;
  padding: 18px 16px;
  position: relative;
  box-shadow: 0 4px 12px rgba(0,0,0,.06);
}
.gr1-bubble-tail {
  position: absolute;
  left: -12px;
  top: 22px;
  width: 0;
  height: 0;
  border: 8px solid transparent;
  border-right-color: var(--world-primary, #43B047);
  filter: drop-shadow(-2px 0 0 rgba(0,0,0,.05));
}

/* ── Tappable words ── */
.gr1-words {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 4px;
  line-height: 1;
}
.gr1-space { width: 2px; }

.gr1-word {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 18px;
  font-weight: 600;
  min-height: 48px;
  min-width: 48px;
  background: #F5F5F5;
  border: 2px solid #E0E0E0;
  color: #333;
  transition: transform 0.1s ease, background 0.15s, border-color 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  box-shadow: 0 2px 0 0 rgba(0,0,0,.06);
}
.gr1-word:hover {
  background: #EEEEEE;
  border-color: #BDBDBD;
}
.gr1-word:active, .gr1-tapped {
  transform: scale(0.92);
  box-shadow: none;
}

/* Target word found */
.gr1-found {
  background: linear-gradient(135deg, #43B047, #66BB6A) !important;
  color: #fff !important;
  border-color: #2E7D32 !important;
  pointer-events: none;
  animation: gr1-found-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 3px 8px rgba(67,176,71,.35) !important;
}
@keyframes gr1-found-pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.25) rotate(-3deg); }
  70%  { transform: scale(0.95) rotate(2deg); }
  100% { transform: scale(1) rotate(0deg); }
}

/* Wrong tap */
.gr1-wrong {
  background: #FFCDD2 !important;
  border-color: #E57373 !important;
  animation: gr1-wrong-shake 0.4s ease;
}
@keyframes gr1-wrong-shake {
  0%, 100% { transform: translateX(0); }
  15%      { transform: translateX(-6px) rotate(-2deg); }
  30%      { transform: translateX(6px) rotate(2deg); }
  45%      { transform: translateX(-4px) rotate(-1deg); }
  60%      { transform: translateX(4px) rotate(1deg); }
  75%      { transform: translateX(-2px); }
}

/* ── Collection jar ── */
.gr1-jar {
  background: #fff;
  border: 3px solid var(--world-primary, #43B047);
  border-radius: 18px;
  padding: 14px 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,.06);
}
.gr1-jar-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.gr1-jar-icon { font-size: 22px; }
.gr1-jar-label {
  font-size: 14px;
  font-weight: 800;
  color: #555;
  flex: 1;
}
.gr1-jar-count {
  font-size: 16px;
  font-weight: 800;
  color: var(--world-primary, #43B047);
  background: rgba(67,176,71,.1);
  padding: 4px 12px;
  border-radius: 10px;
}
.gr1-count-bump { animation: gr1-count-bump-kf 0.3s ease; }
@keyframes gr1-count-bump-kf {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.gr1-jar-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 20px;
}
.gr1-jar-empty {
  font-size: 13px;
  color: #BDBDBD;
  font-style: italic;
  text-align: center;
  padding: 4px;
}

.gr1-jar-word {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  background: linear-gradient(135deg, var(--world-primary, #43B047), #66BB6A);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  border-radius: 10px;
  box-shadow: 0 3px 6px rgba(67,176,71,.25);
  transform: scale(0);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.gr1-jar-word-in { transform: scale(1); }

/* ── Rule popup overlay ── */
.gr1-rule-popup {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  z-index: 100;
  display: none;
  pointer-events: none;
  padding: 20px;
}
.gr1-rule-show {
  display: flex;
  pointer-events: auto;
}
.gr1-rule-show .gr1-rule-card {
  animation: gr1-popup-bounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.gr1-rule-exit .gr1-rule-card {
  animation: gr1-popup-out 0.3s ease-in forwards;
}

@keyframes gr1-popup-bounce {
  0%   { transform: scale(0.3) translateY(40px); opacity: 0; }
  60%  { transform: scale(1.05) translateY(-8px); opacity: 1; }
  80%  { transform: scale(0.97) translateY(2px); }
  100% { transform: scale(1) translateY(0); }
}
@keyframes gr1-popup-out {
  0%   { transform: scale(1); opacity: 1; }
  100% { transform: scale(0.8) translateY(20px); opacity: 0; }
}

/* ── Popup card ── */
.gr1-rule-card {
  background: linear-gradient(170deg, #FFFEF5 0%, #FFF9E6 40%, #F0FFF0 100%);
  border: 4px solid var(--world-primary, #43B047);
  border-radius: 24px;
  padding: 32px 28px 28px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow:
    0 12px 40px rgba(0, 0, 0, .2),
    0 0 0 6px rgba(255, 255, 255, .3),
    inset 0 1px 0 rgba(255, 255, 255, .8);
  position: relative;
  overflow: visible;
}

/* ── Floating stars ── */
.gr1-rule-stars {
  position: absolute;
  top: -18px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 8px;
  pointer-events: none;
}
.gr1-star {
  font-size: 28px;
  display: inline-block;
  filter: drop-shadow(0 2px 4px rgba(248, 184, 0, .4));
}
.gr1-star-1 { animation: gr1-star-float 2s ease-in-out 0.1s infinite; }
.gr1-star-2 { animation: gr1-star-float 2s ease-in-out 0.4s infinite; font-size: 22px; }
.gr1-star-3 { animation: gr1-star-float 2s ease-in-out 0.7s infinite; }

@keyframes gr1-star-float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-6px) rotate(8deg); }
}

/* ── Creature in popup ── */
.gr1-rule-creature-wrap {
  margin: 8px auto 12px;
  width: 56px;
  height: 56px;
  animation: creature-bounce 1.2s ease-in-out infinite;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .12));
}

/* ── Badge title ── */
.gr1-rule-badge {
  display: inline-block;
  background: var(--world-primary, #43B047);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  padding: 6px 22px;
  border-radius: 20px;
  margin-bottom: 16px;
  letter-spacing: 0.5px;
  box-shadow: 0 3px 8px rgba(67, 176, 71, .3);
}

/* ── Rule body (holds either text or visual cards) ── */
.gr1-rule-body {
  margin-bottom: 20px;
}

/* ── Fallback plain text ── */
.gr1-rule-text {
  font-size: 16px;
  line-height: 1.7;
  color: #333;
  padding: 0 4px;
}

/* ── Visual cards ── */
.gr1-vcards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gr1-vcard {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 3px solid var(--vcard-color, #43B047);
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: 0 3px 0 0 color-mix(in srgb, var(--vcard-color, #43B047) 40%, transparent);
  opacity: 0;
  transform: translateY(16px) scale(0.92);
  animation: gr1-vcard-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  animation-delay: calc(0.3s + var(--vcard-delay, 0s));
}

@keyframes gr1-vcard-in {
  0%   { opacity: 0; transform: translateY(16px) scale(0.92); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.gr1-vcard-emoji {
  font-size: 28px;
  line-height: 1;
  margin-bottom: 4px;
  text-align: center;
}

.gr1-vcard-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.gr1-vcard-subject {
  font-size: 16px;
  font-weight: 700;
  color: #555;
}

.gr1-vcard-arrow {
  font-size: 20px;
  font-weight: 900;
  color: var(--vcard-color, #43B047);
}

.gr1-vcard-form {
  font-size: 22px;
  font-weight: 900;
  color: #fff;
  background: var(--vcard-color, #43B047);
  padding: 4px 18px;
  border-radius: 10px;
  letter-spacing: 1px;
  box-shadow: 0 2px 4px color-mix(in srgb, var(--vcard-color, #43B047) 30%, transparent);
}

.gr1-vcard-example {
  font-size: 13px;
  color: #888;
  font-style: italic;
  margin-top: 6px;
  text-align: center;
}

/* ── Got it button ── */
.gr1-got-it-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 220px;
  padding: 14px 28px;
  background: linear-gradient(180deg, #43B047 0%, #389E3C 100%);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  font-family: inherit;
  border: 3px solid #2E7D32;
  border-radius: 16px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  box-shadow:
    0 4px 0 0 #2E7D32,
    0 6px 12px rgba(46, 125, 50, .25);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .15);
}
.gr1-got-it-btn:hover {
  transform: translateY(-2px);
  box-shadow:
    0 6px 0 0 #2E7D32,
    0 8px 16px rgba(46, 125, 50, .3);
}
.gr1-got-it-btn:active {
  transform: translateY(2px);
  box-shadow:
    0 2px 0 0 #2E7D32,
    0 3px 6px rgba(46, 125, 50, .2);
}
.gr1-got-it-icon {
  font-size: 22px;
  animation: gr1-thumb-wiggle 1.5s ease-in-out 0.5s infinite;
}
@keyframes gr1-thumb-wiggle {
  0%, 100% { transform: rotate(0deg); }
  20%      { transform: rotate(-12deg); }
  40%      { transform: rotate(8deg); }
  60%      { transform: rotate(-4deg); }
  80%      { transform: rotate(0deg); }
}


/* ═══════════════════════════════════════════
   R2 — Pattern Garden (redesigned, kid-first)
   ═══════════════════════════════════════════ */
.gr2-garden {
  padding: 14px 14px 28px;
  text-align: center;
  position: relative;
  overflow: hidden;
  min-height: 100%;
}

/* ── Floating background flowers ── */
.gr2-bg-deco {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.gr2-float {
  position: absolute;
  font-size: 24px;
  opacity: 0.12;
}
.gr2-float-1 { top: 6%; right: 6%; animation: gr1-drift 7s ease-in-out infinite; }
.gr2-float-2 { top: 50%; left: 3%; animation: gr1-drift 6s ease-in-out 1.5s infinite; }
.gr2-float-3 { bottom: 8%; right: 10%; animation: gr1-drift 8s ease-in-out 0.5s infinite; }

/* ── Rule area ── */
.gr2-rule-area {
  background: #fff;
  border: 3px solid var(--world-primary, #43B047);
  border-radius: 20px;
  padding: 14px 16px 16px;
  margin-bottom: 18px;
  box-shadow: 0 4px 12px rgba(0,0,0,.06);
  position: relative;
}

.gr2-rule-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
}
.gr2-rule-creature { flex-shrink: 0; }
.gr2-rule-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--world-primary, #43B047);
}

/* ── Visual rule chips (horizontal scrollable row) ── */
.gr2-rule-visual {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.gr2-rule-visual::-webkit-scrollbar { display: none; }

.gr2-rv-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: #F9F9F9;
  border: 2px solid var(--rv-color, #43B047);
  border-radius: 14px;
  flex-shrink: 0;
  opacity: 0;
  animation: gr2-chip-in 0.35s ease forwards;
  animation-delay: var(--rv-delay, 0s);
}
@keyframes gr2-chip-in {
  0%   { opacity: 0; transform: translateY(8px) scale(0.9); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.gr2-rv-emoji { font-size: 22px; }
.gr2-rv-subject { font-size: 13px; font-weight: 700; color: #555; white-space: nowrap; }
.gr2-rv-arrow { font-size: 16px; font-weight: 900; color: var(--rv-color, #43B047); }
.gr2-rv-form {
  font-size: 16px;
  font-weight: 900;
  color: #fff;
  background: var(--rv-color, #43B047);
  padding: 3px 12px;
  border-radius: 8px;
  white-space: nowrap;
}

/* ── Fallback text rule ── */
.gr2-rule-text-box {
  font-size: 15px;
  line-height: 1.6;
  color: #444;
  text-align: center;
}

/* ── Sentence area with creature ── */
.gr2-sentence-area {
  background: #fff;
  border: 3px solid var(--world-primary, #43B047);
  border-radius: 20px;
  padding: 20px 18px;
  margin-bottom: 18px;
  box-shadow: 0 4px 12px rgba(0,0,0,.06);
}

.gr2-sentence-scene {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}
.gr2-sentence-creature {
  filter: drop-shadow(0 3px 6px rgba(0,0,0,.1));
}

.gr2-sentence-card {
  background: #fff;
  border: 3px solid var(--world-primary, #43B047);
  border-radius: 18px;
  padding: 20px 18px;
  margin-bottom: 16px;
  box-shadow: 0 3px 10px rgba(0,0,0,.05);
}

.gr2-sentence {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.6;
  color: #222;
  text-align: center;
}

.gr2-blank {
  display: inline-block;
  min-width: 70px;
  padding: 6px 14px;
  background: rgba(67,176,71,.08);
  border: 2px dashed var(--world-primary, #43B047);
  border-radius: 10px;
  color: var(--world-primary, #43B047);
  font-weight: 900;
  transition: all 0.3s ease;
  animation: gr2-blank-pulse 2s ease-in-out infinite;
}
@keyframes gr2-blank-pulse {
  0%, 100% { border-color: var(--world-primary, #43B047); }
  50%      { border-color: var(--world-accent, #F8B800); }
}
.gr2-blank-filled {
  color: #fff;
  background: #43B047;
  border-color: #2E7D32;
  border-radius: 8px;
  padding: 4px 14px;
  animation: gr2-blank-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes gr2-blank-pop {
  0%   { transform: scale(0.5); }
  100% { transform: scale(1); }
}

/* ── Answer buttons ── */
.gr2-answers {
  margin-bottom: 14px;
}
.gr2-answers-label {
  font-size: 13px;
  font-weight: 700;
  color: #999;
  margin-bottom: 10px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.gr2-answer-btns {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.gr2-answer-btn {
  padding: 14px 28px;
  border: 3px solid var(--world-primary, #43B047);
  border-radius: 16px;
  background: #fff;
  font-weight: 800;
  font-size: 20px;
  font-family: inherit;
  cursor: pointer;
  min-width: 80px;
  min-height: 56px;
  transition: transform 0.1s ease, box-shadow 0.15s, background 0.15s, border-color 0.15s;
  box-shadow: 0 4px 0 0 rgba(0,0,0,.08);
  -webkit-tap-highlight-color: transparent;
  opacity: 0;
  animation: gr2-btn-in 0.3s ease forwards;
  animation-delay: var(--btn-delay, 0s);
}
@keyframes gr2-btn-in {
  0%   { opacity: 0; transform: translateY(12px); }
  100% { opacity: 1; transform: translateY(0); }
}

.gr2-answer-btn:hover {
  background: rgba(67,176,71,.06);
  transform: translateY(-2px);
  box-shadow: 0 6px 0 0 rgba(0,0,0,.1);
}
.gr2-answer-btn:active {
  transform: translateY(2px) scale(0.96);
  box-shadow: 0 1px 0 0 rgba(0,0,0,.06);
}

.gr2-btn-correct {
  background: linear-gradient(135deg, #43B047, #66BB6A) !important;
  color: #fff !important;
  border-color: #2E7D32 !important;
  box-shadow: 0 4px 0 0 #2E7D32, 0 6px 12px rgba(46,125,50,.25) !important;
  animation: gr2-btn-correct-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}
@keyframes gr2-btn-correct-pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.gr2-btn-wrong {
  background: #FFCDD2 !important;
  border-color: #E57373 !important;
  animation: gr1-wrong-shake 0.4s ease;
}

.gr2-btn-used {
  opacity: 0.25;
  pointer-events: none;
  transform: scale(0.9);
}

/* ── Hint ── */
.gr2-hint {
  min-height: 24px;
  margin-bottom: 8px;
  overflow: hidden;
}
.gr2-hint-text {
  display: inline-block;
  font-size: 15px;
  font-weight: 600;
  color: var(--world-primary, #43B047);
  background: rgba(67,176,71,.08);
  padding: 8px 18px;
  border-radius: 12px;
  animation: gr2-hint-in 0.3s ease;
}
@keyframes gr2-hint-in {
  0%   { opacity: 0; transform: translateY(-8px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ═════════════════════════════════════
   Rule Ticker (auto-scrolling strip)
   ═════════════════════════════════════ */
.gr2-ticker-wrap {
  overflow: hidden;
  border-radius: 12px;
  background: #fff;
  border: 2px solid var(--world-primary, #43B047);
  margin-bottom: 12px;
  padding: 6px 0;
}
.gr2-ticker { overflow: hidden; }
.gr2-ticker-track {
  display: flex;
  align-items: center;
  gap: 0;
  width: max-content;
  animation: gr2-scroll 14s linear infinite;
}
@keyframes gr2-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.gr2-tick-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
}
.gr2-tick-emoji { font-size: 16px; }
.gr2-tick-subj { color: #555; }
.gr2-tick-arrow { color: var(--world-primary, #43B047); font-weight: 900; }
.gr2-tick-form {
  color: #fff;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 900;
}
.gr2-tick-dot {
  color: #DDD;
  padding: 0 6px;
  font-size: 10px;
}

/* ═════════════════════════════════════
   Animated Scene Box
   ═════════════════════════════════════ */
.gr2-scene-box {
  position: relative;
  height: 180px;
  border-radius: 20px;
  border: 3px solid var(--world-primary, #43B047);
  margin-bottom: 12px;
  overflow: hidden;
  box-shadow: inset 0 -20px 40px rgba(0,0,0,.04);
}

.gr2-scene-stage {
  position: absolute;
  inset: 0;
}

.gr2-actor {
  position: absolute;
  transform: translate(-50%, -50%);
  line-height: 1;
  opacity: 0;
  animation-fill-mode: forwards;
  animation-duration: 0.4s;
  animation-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1);
  animation-delay: var(--actor-delay, 0s);
  animation-name: gr2-actor-in;
}
@keyframes gr2-actor-in {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.3); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* ── Actor animation types ── */
.gr2-anim-bob  { animation: gr2-actor-in 0.4s ease var(--actor-delay) forwards, gr2-bob 1.8s ease-in-out calc(var(--actor-delay) + 0.4s) infinite; }
.gr2-anim-wave { animation: gr2-actor-in 0.4s ease var(--actor-delay) forwards, gr2-wave 1.2s ease-in-out calc(var(--actor-delay) + 0.4s) infinite; }
.gr2-anim-wiggle { animation: gr2-actor-in 0.4s ease var(--actor-delay) forwards, gr2-wiggle 2s ease-in-out calc(var(--actor-delay) + 0.4s) infinite; }
.gr2-anim-float { animation: gr2-actor-in 0.4s ease var(--actor-delay) forwards, gr2-float 3s ease-in-out calc(var(--actor-delay) + 0.4s) infinite; }
.gr2-anim-sway { animation: gr2-actor-in 0.4s ease var(--actor-delay) forwards, gr2-sway 3s ease-in-out calc(var(--actor-delay) + 0.4s) infinite; }
.gr2-anim-spin { animation: gr2-actor-in 0.4s ease var(--actor-delay) forwards, gr2-spin 4s linear calc(var(--actor-delay) + 0.4s) infinite; }
.gr2-anim-pulse { animation: gr2-actor-in 0.4s ease var(--actor-delay) forwards, gr2-pulse 1.5s ease-in-out calc(var(--actor-delay) + 0.4s) infinite; }
.gr2-anim-flap { animation: gr2-actor-in 0.4s ease var(--actor-delay) forwards, gr2-flap 0.6s ease-in-out calc(var(--actor-delay) + 0.4s) infinite; }
.gr2-anim-rain { animation: gr2-actor-in 0.4s ease var(--actor-delay) forwards, gr2-rain 1.2s linear calc(var(--actor-delay) + 0.4s) infinite; }
.gr2-anim-run { animation: gr2-actor-in 0.4s ease var(--actor-delay) forwards, gr2-run 0.5s ease-in-out calc(var(--actor-delay) + 0.4s) infinite; }
.gr2-anim-wag { animation: gr2-actor-in 0.4s ease var(--actor-delay) forwards, gr2-wag 0.4s ease-in-out calc(var(--actor-delay) + 0.4s) infinite; }
.gr2-anim-flutter { animation: gr2-actor-in 0.4s ease var(--actor-delay) forwards, gr2-flutter 2s ease-in-out calc(var(--actor-delay) + 0.4s) infinite; }
.gr2-anim-none { animation: gr2-actor-in 0.4s ease var(--actor-delay) forwards; }

@keyframes gr2-bob {
  0%, 100% { transform: translate(-50%, -50%) translateY(0); }
  50%      { transform: translate(-50%, -50%) translateY(-8px); }
}
@keyframes gr2-wave {
  0%, 100% { transform: translate(-50%, -50%) rotate(0deg); }
  25%      { transform: translate(-50%, -50%) rotate(-14deg); }
  75%      { transform: translate(-50%, -50%) rotate(14deg); }
}
@keyframes gr2-wiggle {
  0%, 100% { transform: translate(-50%, -50%) rotate(0deg); }
  25%      { transform: translate(-50%, -50%) rotate(-6deg); }
  75%      { transform: translate(-50%, -50%) rotate(6deg); }
}
@keyframes gr2-float {
  0%, 100% { transform: translate(-50%, -50%) translateY(0) scale(1); }
  50%      { transform: translate(-50%, -50%) translateY(-12px) scale(1.1); }
}
@keyframes gr2-sway {
  0%, 100% { transform: translate(-50%, -50%) rotate(0deg); }
  33%      { transform: translate(-50%, -50%) rotate(-4deg); }
  66%      { transform: translate(-50%, -50%) rotate(4deg); }
}
@keyframes gr2-spin {
  0%   { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}
@keyframes gr2-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  50%      { transform: translate(-50%, -50%) scale(1.25); opacity: 0.7; }
}
@keyframes gr2-flap {
  0%, 100% { transform: translate(-50%, -50%) translateY(0) scaleX(1); }
  25%      { transform: translate(-50%, -50%) translateY(-4px) scaleX(0.85); }
  50%      { transform: translate(-50%, -50%) translateY(-6px) scaleX(1.1); }
  75%      { transform: translate(-50%, -50%) translateY(-3px) scaleX(0.9); }
}
@keyframes gr2-rain {
  0%   { transform: translate(-50%, -50%) translateY(0); opacity: 1; }
  80%  { opacity: 0.6; }
  100% { transform: translate(-50%, -50%) translateY(60px); opacity: 0; }
}
@keyframes gr2-run {
  0%, 100% { transform: translate(-50%, -50%) translateX(0) translateY(0); }
  25%      { transform: translate(-50%, -50%) translateX(3px) translateY(-5px); }
  50%      { transform: translate(-50%, -50%) translateX(6px) translateY(0); }
  75%      { transform: translate(-50%, -50%) translateX(3px) translateY(-5px); }
}
@keyframes gr2-wag {
  0%, 100% { transform: translate(-50%, -50%) rotate(0deg); }
  25%      { transform: translate(-50%, -50%) rotate(-10deg); }
  75%      { transform: translate(-50%, -50%) rotate(10deg); }
}
@keyframes gr2-flutter {
  0%, 100% { transform: translate(-50%, -50%) translateX(0) translateY(0); }
  25%      { transform: translate(-50%, -50%) translateX(12px) translateY(-6px); }
  50%      { transform: translate(-50%, -50%) translateX(-8px) translateY(-10px); }
  75%      { transform: translate(-50%, -50%) translateX(6px) translateY(-4px); }
}

/* Scene celebration on correct answer */
.gr2-scene-celebrate .gr2-actor {
  animation-duration: 0.4s !important;
  animation-name: gr2-actor-jump !important;
  animation-iteration-count: 3 !important;
  animation-timing-function: ease !important;
}
@keyframes gr2-actor-jump {
  0%, 100% { transform: translate(-50%, -50%) translateY(0) scale(1); }
  50%      { transform: translate(-50%, -50%) translateY(-14px) scale(1.15); }
}

/* ═════════════════════════════════════
   Celebration Feedback (5 styles)
   ═════════════════════════════════════ */
.gr2-feedback-overlay {
  position: fixed;
  left: 50%;
  z-index: 50;
  pointer-events: none;
  display: none;
}
.gr2-fb-show { display: block; }

/* Position: above the sentence area */
.gr2-fb-pos-top {
  top: 35%;
  transform: translate(-50%, -50%);
}

/* ── Shared card base ── */
.gr2-fb-card {
  text-align: center;
  padding: 18px 32px 14px;
  border-radius: 22px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  white-space: nowrap;
}

.gr2-fb-big-emoji {
  font-size: 48px;
  line-height: 1.1;
  margin-bottom: 2px;
}

.gr2-fb-word {
  font-size: 24px;
  font-weight: 900;
  margin-bottom: 4px;
}

/* ── Style 1: Party Popper ── */
.gr2-fb-style-1 {
  background: linear-gradient(135deg, #FFF9C4, #FFFDE7);
  border: 3px solid #F8B800;
  box-shadow: 0 6px 24px rgba(248,184,0,.3);
  animation: gr2-fb-bounce-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.gr2-fb-style-1 .gr2-fb-word { color: #E65100; }
.gr2-fb-style-1 .gr2-fb-big-emoji { animation: gr2-fb-party 0.6s ease 0.2s; }
.gr2-fb-stars { font-size: 20px; letter-spacing: 4px; animation: gr2-fb-stars-pop 0.6s ease 0.3s both; }

@keyframes gr2-fb-party {
  0%, 100% { transform: rotate(0deg) scale(1); }
  25%  { transform: rotate(-15deg) scale(1.2); }
  50%  { transform: rotate(10deg) scale(1.3); }
  75%  { transform: rotate(-5deg) scale(1.1); }
}
@keyframes gr2-fb-stars-pop {
  0%   { transform: scale(0); opacity: 0; }
  50%  { transform: scale(1.3); }
  100% { transform: scale(1); opacity: 1; }
}

/* ── Style 2: Rocket Launch ── */
.gr2-fb-style-2 {
  background: linear-gradient(135deg, #E3F2FD, #BBDEFB);
  border: 3px solid #049CD8;
  box-shadow: 0 6px 24px rgba(4,156,216,.3);
  animation: gr2-fb-bounce-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.gr2-fb-style-2 .gr2-fb-word { color: #0277BD; }
.gr2-fb-rocket { animation: gr2-fb-launch 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s both; }
.gr2-fb-trail { font-size: 16px; letter-spacing: 6px; animation: gr2-fb-trail-fade 0.8s ease 0.3s both; }

@keyframes gr2-fb-launch {
  0%   { transform: translateY(30px) scale(0.5); opacity: 0; }
  60%  { transform: translateY(-8px) scale(1.2); opacity: 1; }
  100% { transform: translateY(0) scale(1); }
}
@keyframes gr2-fb-trail-fade {
  0%   { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ── Style 3: Crown Champion ── */
.gr2-fb-style-3 {
  background: linear-gradient(135deg, #FFF8E1, #FFE082);
  border: 3px solid #FFA000;
  box-shadow: 0 6px 24px rgba(255,160,0,.3);
  animation: gr2-fb-bounce-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.gr2-fb-style-3 .gr2-fb-word { color: #E65100; }
.gr2-fb-style-3 .gr2-fb-big-emoji { animation: gr2-fb-crown 1s ease 0.2s; }
.gr2-fb-sparkle { font-size: 24px; animation: gr2-fb-sparkle-spin 1.5s linear infinite; }

@keyframes gr2-fb-crown {
  0%   { transform: translateY(-20px) scale(0.5); opacity: 0; }
  40%  { transform: translateY(4px) scale(1.15); opacity: 1; }
  60%  { transform: translateY(-2px) scale(0.95); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes gr2-fb-sparkle-spin {
  0%   { transform: rotate(0deg) scale(1); }
  50%  { transform: rotate(180deg) scale(1.2); }
  100% { transform: rotate(360deg) scale(1); }
}

/* ── Style 4: Rainbow Burst ── */
.gr2-fb-style-4 {
  background: linear-gradient(135deg, #F3E5F5, #E1BEE7, #C5CAE9, #B2DFDB);
  border: 3px solid #A540A0;
  box-shadow: 0 6px 24px rgba(165,64,160,.2);
  animation: gr2-fb-rainbow-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.gr2-fb-style-4 .gr2-fb-word { color: #6A1B9A; }
.gr2-fb-rainbow-dots {
  font-size: 14px;
  letter-spacing: 6px;
  animation: gr2-fb-dots-spread 0.5s ease 0.3s both;
}
@keyframes gr2-fb-rainbow-in {
  0%   { transform: scale(0.3) rotate(-10deg); opacity: 0; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
@keyframes gr2-fb-dots-spread {
  0%   { letter-spacing: 0px; opacity: 0; }
  100% { letter-spacing: 6px; opacity: 1; }
}

/* ── Style 5: Lightning Bolt ── */
.gr2-fb-style-5 {
  background: linear-gradient(135deg, #FFF3E0, #FFE0B2);
  border: 3px solid #E52521;
  box-shadow: 0 6px 24px rgba(229,37,33,.25);
  animation: gr2-fb-zap-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.gr2-fb-style-5 .gr2-fb-word { color: #BF360C; }
.gr2-fb-zap { animation: gr2-fb-zap-flash 0.4s ease 0.1s 2; }
.gr2-fb-streak { font-size: 18px; letter-spacing: 4px; animation: gr2-fb-fire 0.6s ease 0.3s both; }

@keyframes gr2-fb-zap-in {
  0%   { transform: scale(0.3) translateY(-20px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
@keyframes gr2-fb-zap-flash {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50%      { transform: scale(1.3); filter: brightness(1.5); }
}
@keyframes gr2-fb-fire {
  0%   { transform: scale(0); opacity: 0; }
  60%  { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); }
}

/* ── Shared bounce-in ── */
@keyframes gr2-fb-bounce-in {
  0%   { transform: scale(0.3); opacity: 0; }
  50%  { transform: scale(1.08); }
  70%  { transform: scale(0.95); }
  100% { transform: scale(1); opacity: 1; }
}


/* ═══════════════════════════════════════════
   R3 — Sentence Builder
   ═══════════════════════════════════════════ */
.gr3-builder {
  padding: var(--sp-3, 12px);
}

.gr3-prompt {
  text-align: center;
  margin-bottom: var(--sp-3, 12px);
}
.gr3-picture-hint {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-2, #6E6E73);
  font-style: italic;
}

.gr3-platform {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding: 16px;
  background: var(--world-surface, #fff);
  border: 3px dashed var(--world-primary);
  border-radius: 12px;
  min-height: 60px;
  margin-bottom: var(--sp-3, 12px);
}

.gr3-slot {
  min-width: 50px;
  min-height: 42px;
  border: 2px dashed var(--gray-3, #CCC);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.12s;
  padding: 4px 8px;
}
.gr3-slot-hover, .gr3-slot:hover { border-color: var(--world-primary); background: rgba(67,176,71,.08); }
.gr3-slot-filled { border-style: solid; border-color: var(--world-primary); background: rgba(67,176,71,.1); }
.gr3-slot-correct { border-color: #43B047; background: rgba(67,176,71,.15); }
.gr3-slot-wrong { border-color: #E52521; background: rgba(229,37,33,.1); animation: shake 0.3s ease; }

.gr3-slot-num { font-size: 11px; color: var(--gray-3, #AAA); }
.gr3-slot-word { font-weight: 700; font-size: 14px; }
.gr3-slot-revealed { color: var(--world-primary); font-style: italic; }

.gr3-check {
  display: block;
  margin: 0 auto var(--sp-3, 12px);
  min-width: 120px;
}
.gr3-check:disabled { opacity: 0.4; }

.gr3-river {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding: 12px;
  background: linear-gradient(180deg, rgba(4,156,216,.08), rgba(4,156,216,.02));
  border-radius: 12px;
  border: 2px solid rgba(4,156,216,.2);
}

.gr3-block {
  padding: 8px 14px;
  background: var(--world-surface, #fff);
  border: 3px solid var(--world-primary);
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  cursor: grab;
  transition: transform 0.12s, opacity 0.2s;
  animation: gr3-bob 2s ease-in-out infinite;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gr3-block:hover { transform: scale(1.05); }
.gr3-block:active { cursor: grabbing; transform: scale(0.95); }
.gr3-block-selected { border-color: var(--world-accent); background: rgba(248,184,0,.15); transform: scale(1.08); }
.gr3-block-placed { opacity: 0.3; pointer-events: none; }
.gr3-block-dragging { opacity: 0.5; }

@keyframes gr3-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-3px); }
}

/* Error Fixer sub-mechanic */
.gr3-error-fixer { padding: var(--sp-3, 12px); text-align: center; }
.gr3-ef-title { font-size: 16px; font-weight: 800; margin-bottom: var(--sp-3, 12px); color: var(--world-primary); }

.gr3-ef-sentence {
  font-size: 17px;
  line-height: 2;
  margin-bottom: var(--sp-4, 16px);
}
.gr3-ef-word {
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
}
.gr3-ef-word:hover { background: rgba(0,0,0,.05); }
.gr3-ef-error { }
.gr3-ef-found { background: #FFEB3B; font-weight: 700; }
.gr3-ef-wrong-tap { animation: shake 0.3s; background: #FFE0E0; }

.gr3-ef-options { margin-top: var(--sp-3, 12px); }
.gr3-ef-prompt { font-size: 13px; color: var(--gray-2, #6E6E73); margin-bottom: 8px; }
.gr3-ef-option {
  padding: 10px 20px;
  margin: 4px;
  border: 3px solid var(--world-primary);
  border-radius: 10px;
  background: var(--world-surface, #fff);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.12s;
  min-width: 44px;
  min-height: 44px;
}
.gr3-ef-option:hover { transform: scale(1.05); }
.gr3-ef-correct { background: #43B047; color: #fff; border-color: #43B047; }
.gr3-ef-wrong-opt { animation: shake 0.3s; background: #FFE0E0; }


/* ═══════════════════════════════════════════
   R4 — Story Time
   ═══════════════════════════════════════════ */
.gr4-story {
  padding: var(--sp-3, 12px);
  max-width: 500px;
  margin: 0 auto;
}

.gr4-frame {
  background: var(--world-surface, #fff);
  border: var(--px-border, 3px solid #1D1D1F);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: var(--sp-3, 12px);
  box-shadow: var(--px-shadow);
}

.gr4-scene {
  height: 120px;
  background: var(--world-bg);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.gr4-scene-creature {
  position: relative;
  z-index: 2;
  animation: creature-bounce 1.2s ease-in-out infinite;
}
.gr4-scene-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 60%, var(--world-ground, #8B6914) 100%);
  opacity: 0.3;
}

.gr4-text {
  padding: 14px 16px;
  font-size: 16px;
  line-height: 1.6;
}
.gr4-blank {
  display: inline-block;
  min-width: 60px;
  border-bottom: 3px solid var(--world-primary);
  color: var(--world-primary);
  font-weight: 800;
  transition: color 0.3s;
}
.gr4-blank-filled { color: #43B047; border-color: #43B047; }
.gr4-blank-revealed { color: #E52521; border-color: #E52521; }

.gr4-base-verb {
  text-align: center;
  font-size: 14px;
  margin-bottom: var(--sp-3, 12px);
  color: var(--gray-2, #6E6E73);
}

.gr4-input-area {
  display: flex;
  gap: 8px;
  margin-bottom: var(--sp-2, 8px);
}
.gr4-input {
  flex: 1;
  padding: 10px 14px;
  border: 3px solid var(--world-primary);
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.gr4-input:focus { border-color: var(--world-accent); }
.gr4-submit { white-space: nowrap; }

.gr4-helper-shelf {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: var(--sp-2, 8px);
}
.gr4-helper-label { font-size: 12px; color: var(--gray-2, #6E6E73); }
.gr4-helper-chip {
  padding: 8px 16px;
  border: 2px solid var(--world-primary);
  border-radius: 8px;
  background: var(--world-surface, #fff);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.12s;
  min-width: 44px;
  min-height: 44px;
}
.gr4-helper-chip:hover { transform: scale(1.05); }
.gr4-chip-correct { background: #43B047; color: #fff; border-color: #43B047; }
.gr4-chip-wrong { background: #FFE0E0; animation: shake 0.3s; }

.gr4-suffix-chips {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: var(--sp-3, 12px);
}
.gr4-suffix {
  padding: 4px 10px;
  border: 2px solid var(--gray-3, #CCC);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  background: var(--world-surface, #fff);
  cursor: pointer;
}
.gr4-suffix:hover { border-color: var(--world-primary); }

.gr4-feedback {
  text-align: center;
  padding: 12px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
}
.gr4-fb-pass { background: rgba(67,176,71,.1); color: #2E7D32; }
.gr4-fb-fail { background: rgba(229,37,33,.1); color: #C62828; }
.gr4-fb-correct { font-size: 18px; }


/* ═══════════════════════════════════════════
   R5 — Boss Challenge
   ═══════════════════════════════════════════ */
.gr5-boss {
  padding: var(--sp-3, 12px);
  text-align: center;
}

.gr5-boss-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: var(--sp-3, 12px);
}
.gr5-companion { animation: creature-bounce 1.2s ease-in-out infinite; }
.gr5-vs {
  font-size: 24px;
  font-weight: 900;
  color: #E52521;
  text-shadow: 2px 2px 0 rgba(0,0,0,.15);
}

.gr5-boss-creature { transition: transform 0.3s, opacity 0.3s; }
.gr5-boss-idle { animation: gr5-boss-hover 2s ease-in-out infinite; }
@keyframes gr5-boss-hover {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}
.gr5-boss-defeated {
  animation: gr5-boss-explode 0.5s ease-out forwards;
}
@keyframes gr5-boss-explode {
  0%   { transform: scale(1); opacity: 1; }
  50%  { transform: scale(1.3) rotate(10deg); opacity: 0.5; }
  100% { transform: scale(0) rotate(45deg); opacity: 0; }
}
.gr5-boss-attack { animation: shake 0.3s ease; }

.gr5-boss-label {
  font-size: 18px;
  font-weight: 800;
  color: #E52521;
  margin-bottom: var(--sp-3, 12px);
}

.gr5-power-bar {
  height: 8px;
  background: rgba(0,0,0,.1);
  border-radius: 4px;
  overflow: hidden;
  margin-top: var(--sp-3, 12px);
}
.gr5-power-fill {
  height: 100%;
  background: linear-gradient(90deg, #F8B800, #E52521);
  border-radius: 4px;
  transition: width 0.5s ease;
}


/* ═══════════════════════════════════════════
   Achievements
   ═══════════════════════════════════════════ */
.achievement-toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: #fff;
  border: 3px solid #F8B800;
  border-radius: 12px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 10000;
  box-shadow: 0 4px 20px rgba(0,0,0,.15);
  transition: transform 0.4s ease;
}
.achievement-toast-show { transform: translateX(-50%) translateY(0); }
.achievement-toast-icon { font-size: 24px; }
.achievement-toast-name { font-weight: 800; font-size: 14px; }
.achievement-toast-desc { font-size: 11px; color: #6E6E73; }

.achievement-screen { padding: var(--sp-4, 16px); max-width: 600px; margin: 0 auto; }
.achievement-title { font-size: 20px; font-weight: 800; margin-bottom: var(--sp-3, 12px); }

.achievement-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--sp-3, 12px);
}

.achievement-card {
  text-align: center;
  padding: 14px 10px;
  border: 3px solid #E0E0E0;
  border-radius: 12px;
  background: #fff;
}
.achievement-unlocked { border-color: #F8B800; }
.achievement-locked { opacity: 0.5; filter: grayscale(0.5); }
.achievement-icon { font-size: 28px; margin-bottom: 4px; }
.achievement-name { font-weight: 700; font-size: 12px; }
.achievement-desc { font-size: 10px; color: #6E6E73; margin-top: 2px; }

.gem-grid { margin-top: var(--sp-2, 8px); }
.gem-count { font-size: 14px; font-weight: 700; margin-bottom: 8px; }
.gem-slots { display: flex; flex-wrap: wrap; gap: 4px; }
.gem-slot { font-size: 16px; opacity: 0.2; }
.gem-collected { opacity: 1; }


/* ═══════════════════════════════════════════
   Shared utility animations
   ═══════════════════════════════════════════ */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-4px); }
  75%      { transform: translateX(4px); }
}

/* Idle wobble for buttons (applied via JS after 3s idle) */
@keyframes idle-wobble {
  0%, 100% { transform: rotate(0deg); }
  25%      { transform: rotate(-1deg); }
  75%      { transform: rotate(1deg); }
}

/* Background parallax clouds */
@keyframes cloud-drift {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-200px); }
}
.world-clouds {
  position: absolute;
  top: 0;
  left: 0;
  width: calc(100% + 200px);
  height: 60px;
  opacity: 0.15;
  animation: cloud-drift 30s linear infinite;
  pointer-events: none;
}

/* Gentle pulse for gems/stars */
@keyframes gentle-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.08); }
}
.pulse-gentle { animation: gentle-pulse 2s ease-in-out infinite; }


/* ═══════════════════════════════════════════
   Creature Onboarding
   ═══════════════════════════════════════════ */
.gw-onboard {
  padding: var(--sp-4, 16px);
  max-width: 500px;
  margin: 0 auto;
  text-align: center;
}

.gw-onboard-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--dark, #1D1D1F);
}
.gw-onboard-desc {
  font-size: 14px;
  color: var(--gray-2, #6E6E73);
  margin-bottom: var(--sp-4, 16px);
}

.gw-creature-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: var(--sp-3, 12px);
  margin-bottom: var(--sp-4, 16px);
}

.gw-pick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 10px;
  border: 3px solid #E0E0E0;
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.2s, box-shadow 0.2s;
}
.gw-pick-btn:hover { transform: translateY(-3px); border-color: #F8B800; }
.gw-pick-btn:active { transform: scale(0.96); }
.gw-pick-selected {
  border-color: #F8B800 !important;
  box-shadow: 0 0 0 3px rgba(248,184,0,.3);
  background: #FFFDE7;
}

.gw-pick-sprite { animation: creature-bounce 1.2s ease-in-out infinite; }
.gw-pick-name { font-size: 12px; font-weight: 700; }

.gw-name-input {
  margin-top: var(--sp-3, 12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.gw-name-input label { font-size: 14px; font-weight: 700; }
.gw-name-input input {
  padding: 10px 16px;
  border: 3px solid var(--dark, #1D1D1F);
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  width: 200px;
  font-family: inherit;
}
.gw-name-input input:focus { border-color: #F8B800; outline: none; }

/* Grammar subject card in hub */
.subj-grammar {
  --subj-accent: #43B047;
  color: #43B047;
}
