:root {
  --kid-blue: #38bdf8;
  --kid-indigo: #4f46e5;
  --kid-yellow: #fde047;
  --kid-amber: #f59e0b;
  --kid-green: #34d399;
  --kid-emerald: #059669;
  --kid-pink: #f472b6;
  --kid-purple: #c084fc;
  --kid-cream: #fffdf5;
  --kid-ink: #1e1b4b;
  --kid-card-bg: rgba(255, 255, 255, 0.94);
  --shadow-chunky: 0 10px 0 rgba(30, 27, 75, 0.15), 0 20px 30px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background: linear-gradient(135deg, #e0f2fe 0%, #fef3c7 50%, #fce7f3 100%);
  color: var(--kid-ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Header */
.app-header {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 3px solid rgba(79, 70, 229, 0.15);
  position: sticky;
  top: 0;
  z-index: 50;
}

.home-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 2.5px solid #4f46e5;
  color: #4f46e5;
  padding: 8px 18px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 13px;
  text-decoration: none;
  box-shadow: 0 4px 0 #4f46e5;
  transition: transform 0.1s, box-shadow 0.1s;
}

.home-nav-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #4f46e5;
}

.title-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.title-badge .logo-icon {
  font-size: 28px;
}

.title-badge h1 {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--kid-indigo);
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

.calm-btn {
  background: linear-gradient(135deg, #34d399, #059669);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 4px 0 #047857;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.1s;
}

.calm-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #047857;
}

.voice-toggle {
  background: #ffffff;
  border: 2px solid #cbd5e1;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 18px;
  display: grid;
  place-items: center;
  cursor: pointer;
}

/* Main Container */
.game-container {
  max-width: 960px;
  width: 100%;
  margin: 20px auto 40px;
  padding: 0 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Subsection Category Tabs */
.category-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.category-tab {
  background: #ffffff;
  border: 3px solid #cbd5e1;
  border-radius: 20px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  box-shadow: 0 5px 0 #94a3b8;
  transition: all 0.15s ease;
  font-family: inherit;
  color: var(--kid-ink);
}

.category-tab:hover {
  border-color: #6366f1;
  transform: translateY(-2px);
  box-shadow: 0 7px 0 #6366f1;
}

.category-tab.active {
  background: linear-gradient(135deg, #eef2ff 0%, #ffffff 100%);
  border-color: #4f46e5;
  box-shadow: 0 5px 0 #3730a3;
  transform: translateY(1px);
}

.category-tab.active .tab-label {
  color: #4f46e5;
}

.category-tab.active .tab-badge {
  background: #4f46e5;
  color: #ffffff;
}

.tab-emoji {
  font-size: 26px;
}

.tab-label {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: -0.01em;
  text-align: center;
}

.tab-badge {
  font-size: 11px;
  font-weight: 800;
  background: #f1f5f9;
  color: #64748b;
  padding: 2px 8px;
  border-radius: 999px;
}

/* Top Progress bar */
.progress-card {
  background: var(--kid-card-bg);
  border-radius: 24px;
  padding: 16px 24px;
  border: 3px solid #e2e8f0;
  box-shadow: var(--shadow-chunky);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stars-track {
  display: flex;
  gap: 8px;
  font-size: 26px;
}

.star-icon {
  opacity: 0.25;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s;
}

.star-icon.filled {
  opacity: 1;
  transform: scale(1.18);
  filter: drop-shadow(0 4px 8px rgba(245, 158, 11, 0.4));
}

.mission-counter {
  font-size: 14px;
  font-weight: 800;
  color: #64748b;
}

/* Story Scenario Card */
.scenario-card {
  background: var(--kid-card-bg);
  border: 4px solid #4f46e5;
  border-radius: 32px;
  padding: 28px;
  box-shadow: var(--shadow-chunky);
  position: relative;
  overflow: hidden;
}

.scene-hero-stage {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 24px;
}

.scene-character-avatar {
  width: 110px;
  height: 110px;
  border-radius: 28px;
  background: #fef3c7;
  border: 4px solid #f59e0b;
  display: grid;
  place-items: center;
  font-size: 64px;
  flex-shrink: 0;
  box-shadow: 0 6px 0 #d97706;
  position: relative;
}

.scene-feeling-tag {
  position: absolute;
  bottom: -10px;
  background: #ef4444;
  color: #fff;
  font-weight: 900;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.05em;
  box-shadow: 0 3px 0 #b91c1c;
}

.scene-narrative {
  flex: 1;
}

.scene-narrative .scenario-category {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: #f59e0b;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.scene-narrative h2 {
  font-size: 26px;
  font-weight: 900;
  line-height: 1.25;
  color: var(--kid-ink);
  margin-bottom: 8px;
}

.scene-narrative p {
  font-size: 16px;
  color: #475569;
  line-height: 1.5;
  font-weight: 600;
}

.speaker-btn {
  background: #f1f5f9;
  border: 2px solid #cbd5e1;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 800;
  color: #475569;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.speaker-btn:hover {
  background: #e2e8f0;
}

/* Prompt Banner */
.decision-prompt {
  background: linear-gradient(135deg, #e0e7ff, #ede9fe);
  border-radius: 20px;
  padding: 14px 20px;
  margin-bottom: 24px;
  border: 2px dashed #6366f1;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.decision-prompt span {
  font-size: 15px;
  font-weight: 800;
  color: #3730a3;
}

/* Choice Buttons Grid */
.choices-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.choice-row {
  display: flex;
  align-items: stretch;
  gap: 14px;
}

.choice-card {
  background: #ffffff;
  border: 3.5px solid #e2e8f0;
  border-radius: 24px;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  gap: 18px;
  cursor: pointer;
  box-shadow: 0 6px 0 #cbd5e1;
  transition: transform 0.12s ease, border-color 0.12s, box-shadow 0.12s;
  text-align: left;
  flex: 1;
}

.choice-card:hover {
  border-color: #6366f1;
  transform: translateY(-2px);
  box-shadow: 0 8px 0 #6366f1;
}

.choice-card:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #6366f1;
}

.choice-card.correct {
  border-color: #10b981;
  background: #ecfdf5;
  box-shadow: 0 6px 0 #059669;
}

.choice-card.incorrect {
  border-color: #f43f5e;
  background: #fff1f2;
  box-shadow: 0 6px 0 #e11d48;
}

.choice-icon {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  display: grid;
  place-items: center;
  font-size: 28px;
  flex-shrink: 0;
}

.choice-text {
  flex: 1;
}

.choice-title {
  font-size: 17px;
  font-weight: 900;
  color: var(--kid-ink);
  line-height: 1.35;
  margin-bottom: 4px;
}

.choice-tag {
  font-size: 12px;
  font-weight: 800;
  color: #64748b;
}

/* Independent, easily clickable speaker action button */
.speaker-action-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.option-speaker-btn {
  background: #ffffff;
  border: 3px solid #cbd5e1;
  width: 60px;
  height: 60px;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  box-shadow: 0 5px 0 #94a3b8;
  transition: transform 0.12s ease, background 0.12s, border-color 0.12s, box-shadow 0.12s;
  font-family: inherit;
}

.option-speaker-btn .speaker-ico {
  font-size: 22px;
  line-height: 1;
}

.option-speaker-btn .speaker-lbl {
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.05em;
  color: #64748b;
  text-transform: uppercase;
}

.option-speaker-btn:hover {
  background: #eef2ff;
  border-color: #4f46e5;
  transform: scale(1.05);
  box-shadow: 0 7px 0 #4f46e5;
}

.option-speaker-btn:hover .speaker-lbl {
  color: #4f46e5;
}

.option-speaker-btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #4f46e5;
}

.option-speaker-btn.speaking {
  background: #fde047;
  border-color: #f59e0b;
  box-shadow: 0 5px 0 #d97706;
  animation: pulseSpeaking 0.5s infinite alternate;
}

.option-speaker-btn.speaking .speaker-lbl {
  color: #78350f;
}

@keyframes pulseSpeaking {
  from { transform: scale(1); }
  to { transform: scale(1.15); }
}

/* Feedback Drawer / Banner */
.feedback-drawer {
  background: #ffffff;
  border: 3.5px solid #10b981;
  border-radius: 28px;
  padding: 24px;
  box-shadow: var(--shadow-chunky);
  margin-top: 8px;
  display: none;
  animation: slideUp 0.25s ease;
}

.feedback-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.feedback-icon {
  font-size: 38px;
}

.feedback-header h3 {
  font-size: 22px;
  font-weight: 900;
}

.feedback-body p {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  color: #334155;
  margin-bottom: 18px;
}

.magic-phrase-badge {
  background: #fef3c7;
  border: 2px dashed #f59e0b;
  padding: 12px 18px;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 900;
  color: #b45309;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.btn-next-scene {
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  color: #fff;
  border: none;
  padding: 14px 28px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 5px 0 #312e81;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: transform 0.1s;
}

.btn-next-scene:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #312e81;
}

/* Calm Corner / Breathing Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.calm-modal {
  max-width: 480px;
  width: 100%;
  background: #ffffff;
  border-radius: 36px;
  padding: 32px;
  text-align: center;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
  border: 4px solid #34d399;
}

.breathing-bubble {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, #a7f3d0 0%, #34d399 100%);
  border: 6px solid #059669;
  margin: 24px auto;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 900;
  color: #064e3b;
  box-shadow: 0 0 40px rgba(52, 211, 153, 0.6);
  transition: transform 4s ease-in-out;
}

.breathing-bubble.inhale {
  transform: scale(1.35);
}

.breathing-bubble.exhale {
  transform: scale(0.9);
}

.close-modal-btn {
  background: #f1f5f9;
  border: 2px solid #cbd5e1;
  color: #475569;
  padding: 10px 24px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  margin-top: 14px;
}

/* Feelings Wheel / Word Bank Modal */
.word-bank-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 18px 0;
  text-align: left;
}

.word-card {
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  padding: 10px 14px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.word-card span.emoji {
  font-size: 24px;
}

.word-card b {
  font-size: 14px;
  color: var(--kid-ink);
  display: block;
}

.word-card small {
  font-size: 11px;
  color: #64748b;
  display: block;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 640px) {
  .category-tabs {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .category-tab {
    flex-direction: row;
    justify-content: space-between;
    padding: 10px 16px;
  }
  .choice-row {
    flex-direction: column;
    gap: 8px;
  }
  .speaker-action-box {
    align-items: stretch;
  }
  .option-speaker-btn {
    width: 100%;
    height: 44px;
    flex-direction: row;
    gap: 8px;
  }
  .scene-hero-stage {
    flex-direction: column;
    text-align: center;
    gap: 14px;
  }
  .scene-character-avatar {
    width: 90px;
    height: 90px;
    font-size: 52px;
  }
  .scene-narrative h2 {
    font-size: 21px;
  }
  .app-header {
    padding: 0 14px;
  }
  .title-badge h1 {
    font-size: 16px;
  }
}
