/* ==========================================================================
   Fanfoon: Learn Arabic for Kids - Visual Stylesheet
   Child-Friendly, English & Arabic Bilingual, Tactile 3D & iPad Optimized
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=Cairo:wght@600;700;800;900&family=Tajawal:wght@500;700;800&family=Scheherazade+New:wght@700&display=swap');

@font-face {
  font-family: "FanfoonArabic";
  src: url("../assets/fonts/ScheherazadeNew-Bold-arabic.woff2") format("woff2");
  font-weight: 700;
  font-display: block;
}

:root {
  --color-sand: #FFF8E7;
  --color-sand-dark: #F5E8C7;
  --color-primary: #FF9F43;
  --color-primary-dark: #EE5253;
  --color-green: #10AC84;
  --color-green-dark: #0A8B6B;
  --color-blue: #2E86DE;
  --color-blue-dark: #1E66B4;
  --color-purple: #8854D0;
  --color-purple-dark: #6C3FB0;
  --color-pink: #FF6B81;
  --color-yellow: #FFD32A;
  --color-text-main: #2D3436;
  --color-text-muted: #636E72;
  --font-english: 'Fredoka', system-ui, -apple-system, sans-serif;
  --font-arabic: "FanfoonArabic", "Scheherazade New", 'Cairo', 'Tajawal', system-ui, -apple-system, sans-serif;
  --shadow-tactile: 0 6px 0 rgba(0, 0, 0, 0.15);
  --shadow-active: 0 2px 0 rgba(0, 0, 0, 0.15);
  --border-radius-card: 24px;
}

/* Base HTML & iPad / WebKit Touch Mechanics */
html {
  box-sizing: border-box;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior: none;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

*, *:before, *:after {
  box-sizing: inherit;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

body {
  background-color: var(--color-sand);
  background-image: 
    radial-gradient(#FFEAA7 12%, transparent 12%),
    radial-gradient(#F5CD79 12%, transparent 12%);
  background-size: 40px 40px;
  background-position: 0 0, 20px 20px;
  color: var(--color-text-main);
  min-height: 100vh;
  min-height: -webkit-fill-available;
  overflow-x: hidden;
  position: relative;
  overscroll-behavior: none;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

/* English Primary Default Mode */
html[lang="en"] body {
  font-family: var(--font-english);
  direction: ltr;
  text-align: left;
}

/* Arabic Mode */
html[lang="ar"] body {
  font-family: var(--font-arabic);
  direction: rtl;
  text-align: right;
}

button {
  font-family: inherit;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  cursor: pointer;
}

/* App Header & iPad Safe Area Insets */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  padding-top: max(12px, env(safe-area-inset-top, 12px));
  padding-left: max(20px, env(safe-area-inset-left, 20px));
  padding-right: max(20px, env(safe-area-inset-right, 20px));
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 3px solid rgba(0, 0, 0, 0.06);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.05);
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.back-btn {
  background: var(--color-sand-dark);
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  font-size: 24px;
  display: none; /* Shown dynamically in subviews */
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 0 #D5C29B;
  transition: transform 0.1s;
  touch-action: manipulation;
}

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

.logo-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.logo-icon {
  font-size: 36px;
  animation: gentleWiggle 4s ease-in-out infinite;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.logo-text-group {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.logo-title {
  font-size: 24px;
  font-weight: 900;
  color: #E55039;
  letter-spacing: -0.5px;
}

.logo-arabic-sub {
  font-family: var(--font-arabic);
  font-size: 13px;
  font-weight: 800;
  color: #D35400;
}

/* 1-Click Quick Language Switcher Pill in Header */
.lang-switcher {
  display: flex;
  align-items: center;
  background: #FFF5EB;
  border: 2px solid #FFD399;
  border-radius: 28px;
  padding: 3px;
  gap: 3px;
  box-shadow: 0 3px 0 #E58E3C;
}

.lang-toggle-btn {
  background: transparent;
  border: none;
  border-radius: 22px;
  padding: 6px 14px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: #8C531B;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  transition: all 0.15s ease;
  touch-action: manipulation;
}

.lang-toggle-btn .flag {
  font-size: 17px;
  line-height: 1;
}

.lang-toggle-btn .lang-name {
  line-height: 1;
}

.lang-toggle-btn:hover {
  background: rgba(255, 159, 67, 0.15);
}

.lang-toggle-btn.active {
  background: linear-gradient(135deg, #FF9F43, #EE5253);
  color: white;
  box-shadow: 0 3px 6px rgba(238, 82, 83, 0.35);
}

.lang-toggle-btn:active {
  transform: translateY(2px);
}

/* HUD Buttons */
.hud-star-btn {
  background: #FFF9E6;
  border: 2.5px solid #FFD32A;
  border-radius: 25px;
  padding: 6px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 19px;
  font-weight: 800;
  color: #D35400;
  cursor: pointer;
  box-shadow: 0 4px 0 #F1C40F;
  transition: transform 0.1s;
  min-height: 44px;
  touch-action: manipulation;
}

.hud-star-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #F1C40F;
}

.header-btn {
  background: white;
  border: 2px solid #E4E7EB;
  border-radius: 50%;
  width: 46px;
  height: 46px;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 0 #D1D8E0;
  transition: transform 0.1s;
  touch-action: manipulation;
}

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

/* Main Layout Wrapper */
.app-container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px 20px 48px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Mascot Stage & Speech Bubble */
.mascot-stage {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 4px;
}

.fanfoon-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  touch-action: manipulation;
}

.fanfoon-svg {
  width: 175px;
  height: 175px;
  overflow: visible;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.fanfoon-wrapper:hover .fanfoon-svg {
  transform: scale(1.04);
}

.mascot-jump {
  animation: mascotCheer 0.6s ease-in-out infinite alternate;
}

/* Fanfoon Speech Bubble */
.fanfoon-bubble {
  background: white;
  border: 3px solid var(--color-primary);
  border-radius: 22px;
  padding: 12px 22px;
  max-width: 380px;
  text-align: center;
  box-shadow: 0 8px 24px rgba(255, 159, 67, 0.28);
  margin-bottom: 12px;
  position: relative;
  opacity: 0;
  transform: translateY(10px) scale(0.9);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: none;
}

.fanfoon-bubble.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.fanfoon-bubble::after {
  content: '';
  position: absolute;
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 12px 10px 0 10px;
  border-style: solid;
  border-color: var(--color-primary) transparent transparent transparent;
}

/* English Primary Bubble */
.fanfoon-bubble.en-primary .bubble-en {
  font-size: 17px;
  font-weight: 700;
  color: var(--color-text-main);
  line-height: 1.35;
}

.fanfoon-bubble.en-primary .bubble-ar {
  font-family: var(--font-arabic);
  font-size: 15px;
  font-weight: 800;
  color: #D35400;
  background: #FFF5EB;
  border: 1px solid #FFD399;
  border-radius: 12px;
  padding: 2px 10px;
  margin-top: 6px;
  display: inline-block;
}

/* Arabic Primary Bubble */
.fanfoon-bubble:not(.en-primary) .bubble-ar {
  font-family: var(--font-arabic);
  font-size: 19px;
  font-weight: 800;
  color: var(--color-text-main);
  line-height: 1.4;
}

.fanfoon-bubble:not(.en-primary) .bubble-en {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-top: 4px;
}

/* Home Welcome Banner */
.oasis-welcome-banner {
  text-align: center;
  margin-bottom: 12px;
}

.welcome-title {
  font-size: 29px;
  font-weight: 900;
  color: #D35400;
  letter-spacing: -0.3px;
}

.welcome-sub {
  font-size: 16px;
  color: #7F8C8D;
  font-weight: 600;
  margin-top: 4px;
}

/* Activities Grid - Tactile 3D Cards */
.activities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
  margin-top: 10px;
}

.activity-card {
  border: none;
  border-radius: var(--border-radius-card);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
  overflow: hidden;
  touch-action: manipulation;
  min-height: 170px;
}

.activity-card:active {
  transform: translateY(5px);
}

.card-icon-bubble {
  font-size: 46px;
  margin-bottom: 10px;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.12));
}

.card-title {
  font-size: 21px;
  font-weight: 800;
  color: white;
  margin-bottom: 4px;
  line-height: 1.2;
}

.card-en {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.94);
  line-height: 1.3;
}

.card-badge {
  background: rgba(255, 255, 255, 0.28);
  border-radius: 12px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 700;
  color: white;
  margin-top: 10px;
  letter-spacing: 0.3px;
}

/* Activity Card Color Schemes */
.color-letters {
  background: linear-gradient(135deg, #FF9F43, #EE5253);
  box-shadow: 0 8px 0 #C43031;
}
.color-letters:active { box-shadow: 0 3px 0 #C43031; }

.color-letters-en {
  background: linear-gradient(135deg, #6C5CE7, #4834D4);
  box-shadow: 0 8px 0 #311E94;
}
.color-letters-en:active { box-shadow: 0 3px 0 #311E94; }

.color-bubbles {
  background: linear-gradient(135deg, #48DBFB, #0ABDE3);
  box-shadow: 0 8px 0 #0788A3;
}
.color-bubbles:active { box-shadow: 0 3px 0 #0788A3; }

.color-feed {
  background: linear-gradient(135deg, #1DD1A1, #10AC84);
  box-shadow: 0 8px 0 #0A7A5D;
}
.color-feed:active { box-shadow: 0 3px 0 #0A7A5D; }

.color-builder {
  background: linear-gradient(135deg, #A55EEA, #8854D0);
  box-shadow: 0 8px 0 #5E3498;
}
.color-builder:active { box-shadow: 0 3px 0 #5E3498; }

.color-memory {
  background: linear-gradient(135deg, #FDA7DF, #F368E0);
  box-shadow: 0 8px 0 #B93FA8;
}
.color-memory:active { box-shadow: 0 3px 0 #B93FA8; }

.color-numbers {
  background: linear-gradient(135deg, #FECA57, #FF9F43);
  box-shadow: 0 8px 0 #CC7325;
}
.color-numbers:active { box-shadow: 0 3px 0 #CC7325; }

.color-colors {
  background: linear-gradient(135deg, #FF6B81, #FF4757);
  box-shadow: 0 8px 0 #BD2434;
}
.color-colors:active { box-shadow: 0 3px 0 #BD2434; }

.color-story {
  background: linear-gradient(135deg, #54A0FF, #2E86DE);
  box-shadow: 0 8px 0 #1A5FA6;
}
.color-story:active { box-shadow: 0 3px 0 #1A5FA6; }

.color-duas {
  background: linear-gradient(135deg, #2ED573, #15954B);
  box-shadow: 0 8px 0 #0F6B36;
}
.color-duas:active { box-shadow: 0 3px 0 #0F6B36; }

/* Tracing Screen Layout */
.alphabet-mode-switch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
  background: #F1F5F9;
  padding: 5px;
  border-radius: 999px;
  border: 2px solid #E2E8F0;
  max-width: 380px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

.mode-tab-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  color: #64748B;
  background: transparent;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.mode-tab-btn:hover {
  color: var(--color-text-main);
}

.mode-tab-btn.active {
  background: white;
  color: #4834D4;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
  transform: scale(1.02);
}

.mode-tab-flag {
  font-size: 18px;
}

.badge-char-lower {
  font-size: 24px;
  color: #6C5CE7;
  margin-left: 2px;
  font-weight: 700;
}

.english-phonics-pills {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.pill-info-tag {
  background: #F8FAFC;
  border: 2px solid #E2E8F0;
  border-radius: 14px;
  padding: 6px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 3px 0 #CBD5E1;
}

.pill-info-tag .tag-title {
  font-size: 10px;
  font-weight: 700;
  color: #94A3B8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pill-info-tag .tag-char {
  font-size: 20px;
  font-weight: 800;
  color: #4834D4;
  line-height: 1.1;
}

.alphabet-rail-container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto 12px auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.alphabet-rail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text-muted);
}

.alphabet-rail-progress {
  color: #D35400;
  font-weight: 800;
  font-size: 15px;
}

.alphabet-rail {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 8px 6px 14px 6px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.alphabet-rail::-webkit-scrollbar {
  display: none;
}

.alphabet-chip {
  flex: 0 0 auto;
  min-width: 54px;
  height: 62px;
  background: white;
  border: 2.5px solid #E2E8F0;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  box-shadow: 0 4px 0 #CBD5E1;
  transition: all 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  touch-action: manipulation;
  padding: 2px 8px;
}

.alphabet-chip:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #CBD5E1;
}

.alphabet-chip.active {
  background: linear-gradient(135deg, #FF9F43, #EE5253);
  border-color: #E55039;
  color: white;
  box-shadow: 0 6px 0 #C23616, 0 8px 18px rgba(238, 82, 83, 0.35);
  transform: scale(1.1) translateY(-2px);
  z-index: 2;
}

.alphabet-chip.completed::after {
  content: '⭐';
  position: absolute;
  top: -6px;
  right: -6px;
  font-size: 12px;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.2));
}

.chip-num {
  font-size: 11px;
  font-weight: 700;
  color: #94A3B8;
  line-height: 1;
}

.alphabet-chip.active .chip-num {
  color: rgba(255, 255, 255, 0.9);
}

.chip-char {
  font-family: var(--font-arabic);
  font-size: 28px;
  font-weight: 700;
  color: var(--color-text-main);
  line-height: 1;
}

.alphabet-chip.active .chip-char {
  color: white;
}

.nav-btn.disabled,
.nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
  transform: none;
}

.badge-name-group {
  display: flex;
  flex-direction: column;
  text-align: right;
  line-height: 1.2;
}

.badge-sub-en {
  font-size: 13px;
  color: var(--color-text-muted);
  font-weight: 700;
}

/* Canvas Wrapper & Celebration Success Overlay */
.trace-canvas-wrapper {
  position: relative;
  display: inline-block;
  border-radius: 28px;
}

.trace-success-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  border-radius: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  animation: modalPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 20;
}

.success-stars-burst {
  font-size: 46px;
  animation: gentleWiggle 2s infinite;
}

.success-title {
  font-size: 24px;
  font-weight: 900;
  color: #10AC84;
  line-height: 1.3;
}

.success-sub {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text-muted);
}

.btn-next-letter-big {
  background: linear-gradient(135deg, #1DD1A1, #10AC84);
  border: none;
  border-radius: 22px;
  padding: 14px 28px;
  font-family: inherit;
  font-size: 19px;
  font-weight: 800;
  color: white;
  cursor: pointer;
  box-shadow: 0 6px 0 #0A7A5D, 0 10px 24px rgba(16, 172, 132, 0.3);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: pulseButton 1.6s infinite;
  transition: transform 0.15s;
}

.btn-next-letter-big:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #0A7A5D;
}

.btn-retry-letter {
  background: #F1F5F9;
  border: none;
  border-radius: 14px;
  padding: 8px 18px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: #64748B;
  cursor: pointer;
}

/* Tracing Screen Layout */
.tracing-view-layout {
  display: flex;
  gap: 28px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  padding: 8px;
}

.tracing-left-pane {
  flex: 1;
  min-width: 300px;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.letter-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.nav-btn {
  flex-shrink: 0;
  background: white;
  border: 3px solid #E4E7EB;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 5px 0 #CAD1D9;
  transition: transform 0.1s;
  touch-action: manipulation;
}

.nav-btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #CAD1D9;
}

.letter-badge-card {
  flex: 1;
  min-width: 0;
  background: white;
  border: 3px solid var(--color-primary);
  border-radius: 20px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  box-shadow: 0 6px 0 #E58E3C;
  touch-action: manipulation;
}

.badge-char {
  font-family: var(--font-arabic);
  font-size: 48px;
  font-weight: 900;
  color: #EE5253;
  line-height: 1;
}

.badge-names-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

html[lang="ar"] .badge-names-col {
  align-items: flex-end;
}

.badge-name-primary {
  font-size: 21px;
  font-weight: 800;
  color: var(--color-text-main);
  line-height: 1.1;
}

.badge-name-sub {
  font-family: var(--font-arabic);
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text-muted);
}

.badge-sound-btn {
  font-size: 24px;
}

/* Harakat Selector Pills */
.harakat-pills {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.pill-btn {
  flex: 1;
  background: white;
  border: 2.5px solid #DFE4EA;
  border-radius: 16px;
  padding: 8px 6px;
  min-height: 60px;
  cursor: pointer;
  box-shadow: 0 4px 0 #CAD1D9;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: all 0.15s;
  touch-action: manipulation;
}

.pill-char {
  font-family: var(--font-arabic);
  font-size: 26px;
  font-weight: 900;
  color: var(--color-text-main);
  line-height: 1;
}

.pill-sub {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.pill-btn.active {
  background: #FFF5EB;
  border-color: var(--color-primary);
  box-shadow: 0 4px 0 #E58E3C;
  transform: scale(1.04);
}

.pill-btn.active .pill-char {
  color: #D35400;
}

/* Word Showcase Card */
.word-showcase {
  background: white;
  border-radius: 20px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
  border: 2px solid #F1F2F6;
}

.word-emoji {
  font-size: 44px;
}

.word-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 0 12px;
}

.word-main {
  font-size: 22px;
  font-weight: 800;
  color: #2F3542;
  line-height: 1.2;
}

.word-sub {
  font-size: 15px;
  color: #747D8C;
  font-weight: 600;
  font-family: var(--font-arabic);
}

.say-word-btn {
  background: #FFF2E6;
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 3px 0 #F8D3B3;
  touch-action: manipulation;
}

.say-word-btn:active {
  transform: translateY(2px);
}

/* Tracing Canvas Pane */
.tracing-right-pane {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.trace-guide-hint {
  font-size: 15px;
  font-weight: 700;
  color: #D35400;
  background: #FFF5EB;
  border: 2px dashed #FFB86C;
  border-radius: 16px;
  padding: 8px 18px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(255, 159, 67, 0.1);
}

.trace-canvas-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.trace-canvas {
  background: white;
  border: 4px solid #DFE4EA;
  border-radius: 28px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
  cursor: crosshair;
  touch-action: none !important;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
}

.canvas-action-bar {
  display: flex;
  gap: 10px;
}

.action-btn {
  background: white;
  border: 2px solid #CAD1D9;
  border-radius: 16px;
  padding: 10px 24px;
  font-size: 16px;
  font-weight: 800;
  color: var(--color-text-main);
  cursor: pointer;
  box-shadow: 0 4px 0 #CAD1D9;
  touch-action: manipulation;
}

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

/* Generic Mini-Game Board & HUD */
.game-board {
  background: white;
  border-radius: 28px;
  padding: 24px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 860px;
  margin: 0 auto;
  width: 100%;
}

.game-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 2px dashed #E4E7EB;
}

.game-title {
  font-size: 22px;
  font-weight: 900;
  color: #D35400;
}

.hud-prompt {
  background: #FFF5EB;
  border-radius: 18px;
  padding: 8px 18px;
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.highlight-target {
  font-size: 20px;
  color: #EE5253;
  font-weight: 800;
}

.repeat-audio-btn {
  background: white;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  touch-action: manipulation;
}

.score-badge {
  background: #FECA57;
  color: #78350F;
  border-radius: 20px;
  padding: 6px 16px;
  font-weight: 800;
  font-size: 18px;
}

/* Bubble Pop Phonics */
.bubble-area {
  min-height: 340px;
  position: relative;
  display: flex;
  justify-content: space-around;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  padding: 20px;
}

.floating-bubble {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15), inset 0 6px 12px rgba(255,255,255,0.6);
  animation: floatBubble 3s ease-in-out infinite alternate;
  transition: transform 0.15s;
  touch-action: manipulation;
}

.floating-bubble:active {
  transform: scale(0.92);
}

.bubble-char {
  font-family: var(--font-arabic);
  font-size: 50px;
  font-weight: 900;
  color: white;
  text-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.bubble-reflection {
  position: absolute;
  top: 14px;
  right: 18px;
  width: 22px;
  height: 12px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  transform: rotate(-30deg);
}

.bubble-pop-anim {
  animation: popEffect 0.3s forwards;
}

.bubble-shake-anim {
  animation: gentleShake 0.4s;
}

/* Feed Fanfoon Game */
.feed-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.food-bowl-target {
  background: #FFF3D4;
  border: 4px dashed #FF9F43;
  border-radius: 28px;
  padding: 20px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.bowl-icon {
  font-size: 64px;
}

.bowl-label {
  font-size: 18px;
  font-weight: 800;
  color: #D35400;
}

.food-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 16px;
  width: 100%;
}

.food-card {
  background: white;
  border: 3px solid #E4E7EB;
  border-radius: 22px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 6px 0 #D1D8E0;
  transition: all 0.15s;
  touch-action: manipulation;
  min-height: 110px;
}

.food-card:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #D1D8E0;
}

.food-emoji {
  font-size: 50px;
}

.food-name {
  font-size: 17px;
  font-weight: 800;
  color: var(--color-text-main);
}

.food-name-ar {
  font-family: var(--font-arabic);
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text-muted);
}

.fly-to-mouth {
  animation: flyToMouth 0.5s forwards;
}

/* Word Builder Game */
.word-card-target {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.word-target-emoji {
  font-size: 68px;
}

.word-target-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 24px;
  font-weight: 900;
  color: #2D3436;
}

.word-target-main {
  font-size: 24px;
  font-weight: 900;
}

.word-target-sub {
  font-family: var(--font-arabic);
  font-size: 20px;
  font-weight: 800;
  color: #D35400;
  background: #FFF5EB;
  border-radius: 12px;
  padding: 2px 10px;
}

.word-slots-row {
  display: flex;
  justify-content: center;
  gap: 14px;
}

.word-slot {
  width: 76px;
  height: 76px;
  border-radius: 20px;
  border: 3px dashed #B2BEC3;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-arabic);
  font-size: 40px;
  font-weight: 900;
  color: #2D3436;
  background: #F8F9FA;
}

.word-slot.filled {
  border-style: solid;
  border-color: #10AC84;
  background: #E8F8F5;
  color: #10AC84;
  animation: bounceIn 0.3s;
}

.letter-tiles-pool {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.letter-tile-btn {
  background: white;
  border: 3px solid #FF9F43;
  border-radius: 20px;
  width: 72px;
  height: 72px;
  font-family: var(--font-arabic);
  font-size: 38px;
  font-weight: 900;
  color: #D35400;
  cursor: pointer;
  box-shadow: 0 6px 0 #E58E3C;
  transition: all 0.15s;
  touch-action: manipulation;
}

.letter-tile-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #E58E3C;
}

.builder-actions {
  display: flex;
  justify-content: center;
}

.secondary-btn {
  background: #F1F2F6;
  border: none;
  border-radius: 16px;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 700;
  color: #57606F;
  cursor: pointer;
  touch-action: manipulation;
}

/* Memory Match Cards */
.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  max-width: 540px;
  margin: 0 auto;
}

.memory-card {
  aspect-ratio: 1;
  perspective: 1000px;
  cursor: pointer;
  touch-action: manipulation;
  min-height: 100px;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.5s;
  transform-style: preserve-3d;
  border-radius: 22px;
  box-shadow: 0 6px 0 #D1D8E0;
}

.memory-card.flipped .card-inner,
.memory-card.matched .card-inner {
  transform: rotateY(180deg);
}

.card-front, .card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 3px solid #E4E7EB;
}

.card-front {
  background: linear-gradient(135deg, #FF9F43, #EE5253);
  font-size: 38px;
  color: white;
}

.card-back {
  background: white;
  transform: rotateY(180deg);
  border-color: #10AC84;
  gap: 4px;
}

.card-content-symbol {
  font-family: var(--font-arabic);
  font-size: 40px;
  font-weight: 900;
  color: #2D3436;
  line-height: 1;
}

.card-content-label {
  font-size: 13px;
  font-weight: 700;
  color: #636E72;
}

.memory-card.matched .card-back {
  background: #E8F8F5;
  border-color: #1DD1A1;
}

/* Counting Fun */
.count-big-badge {
  font-size: 26px;
  color: #E55039;
}

.count-items-container {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 20px;
}

.count-item-btn {
  background: white;
  border: 3px solid #FECA57;
  border-radius: 22px;
  padding: 16px;
  min-width: 90px;
  min-height: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  box-shadow: 0 6px 0 #E1B12C;
  transition: transform 0.15s;
  touch-action: manipulation;
}

.count-item-btn.counted {
  background: #FFF9E6;
  border-color: #10AC84;
  box-shadow: 0 4px 0 #0A8B6B;
  transform: scale(0.96);
}

.count-item-emoji {
  font-size: 48px;
}

.count-item-number {
  font-family: var(--font-arabic);
  font-size: 20px;
  font-weight: 900;
  color: #10AC84;
}

/* Colors Fun */
.colors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 16px;
}

.color-splat-btn {
  background: white;
  border: 3px solid #E4E7EB;
  border-radius: 22px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 6px 0 #D1D8E0;
  touch-action: manipulation;
}

.splat-blob {
  width: 64px;
  height: 64px;
  border-radius: 50% 60% 45% 55%;
  background: var(--splat-color);
  box-shadow: 0 6px 14px rgba(0,0,0,0.15);
  transition: transform 0.2s;
}

.splat-name {
  font-size: 19px;
  font-weight: 800;
  color: var(--color-text-main);
}

.splat-sub {
  font-family: var(--font-arabic);
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text-muted);
}

.splat-explode .splat-blob {
  animation: splatBurst 0.4s forwards;
}

/* Interactive Storybook */
.story-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.story-scene-stage {
  height: 220px;
  background: linear-gradient(180deg, #FFEAA7, #FDCB6E);
  border-radius: 22px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.story-hotspot {
  background: white;
  border: 3px solid #FF9F43;
  border-radius: 50px;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
  animation: pulseButton 2s infinite;
  touch-action: manipulation;
}

.hotspot-emoji {
  font-size: 40px;
}

.hotspot-label {
  font-size: 22px;
  font-weight: 900;
  color: #D35400;
}

.scene-hint {
  position: absolute;
  bottom: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #78350F;
  background: rgba(255, 255, 255, 0.7);
  padding: 4px 14px;
  border-radius: 12px;
}

.story-text-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.story-page-title {
  font-size: 22px;
  font-weight: 900;
  color: #D35400;
}

.story-page-ar {
  font-family: var(--font-arabic);
  font-size: 21px;
  font-weight: 700;
  line-height: 1.6;
  color: #2D3436;
}

.story-page-en {
  font-size: 15px;
  font-weight: 600;
  color: #636E72;
  line-height: 1.4;
}

.listen-story-btn {
  align-self: flex-start;
  background: #FFF5EB;
  border: 2px solid var(--color-primary);
  border-radius: 16px;
  padding: 10px 20px;
  font-size: 15px;
  font-weight: 800;
  color: #D35400;
  cursor: pointer;
  margin-top: 6px;
  touch-action: manipulation;
}

.story-nav-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.nav-btn-story {
  background: white;
  border: 2px solid #CAD1D9;
  border-radius: 18px;
  padding: 12px 22px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 0 #CAD1D9;
  touch-action: manipulation;
}

.nav-btn-story.highlight {
  background: var(--color-primary);
  border-color: #E58E3C;
  color: white;
  box-shadow: 0 4px 0 #C27125;
}

/* Duas & Islamic Manners */
.duas-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 20px;
}

.dua-category-pill {
  background: white;
  border: 2.5px solid #DFE4EA;
  border-radius: 20px;
  padding: 8px 18px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  color: var(--color-text-main);
  cursor: pointer;
  box-shadow: 0 4px 0 #CAD1D9;
  transition: all 0.15s ease;
  touch-action: manipulation;
}

.dua-category-pill:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #CAD1D9;
}

.dua-category-pill.active {
  background: var(--color-green);
  border-color: #0A8B6B;
  color: white;
  box-shadow: 0 4px 0 #0A8B6B;
  transform: scale(1.03);
}

.duas-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.dua-card {
  background: white;
  border: 3px solid #E4E7EB;
  border-radius: 22px;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 6px 0 #D1D8E0;
  transition: all 0.15s ease;
  touch-action: manipulation;
  position: relative;
}

.dua-card:hover {
  border-color: var(--color-green);
  transform: translateY(-2px);
  box-shadow: 0 8px 0 #CAD1D9;
}

.dua-card:active, .dua-card.pulse-card {
  transform: translateY(3px) scale(0.98);
  border-color: var(--color-green);
  box-shadow: 0 2px 0 #0A8B6B;
}

.dua-card.playing {
  border-color: #FF9F43;
  box-shadow: 0 6px 0 #E58E3C, 0 0 16px rgba(255, 159, 67, 0.35);
  animation: pulseCardRecite 1s infinite alternate ease-in-out;
}

@keyframes pulseCardRecite {
  0% { transform: scale(1); }
  100% { transform: scale(1.02); }
}

.dua-category-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 12px;
  background: #E8F8F5;
  color: #10AC84;
  letter-spacing: 0.3px;
}

.dua-icon {
  font-size: 44px;
  line-height: 1;
}

.dua-phrase {
  font-family: var(--font-arabic);
  font-size: 24px;
  font-weight: 900;
  color: #10AC84;
  line-height: 1.45;
  word-break: break-word;
}

.dua-name-en {
  font-size: 14px;
  font-weight: 700;
  color: #485460;
  line-height: 1.25;
}

.dua-situation {
  font-size: 13px;
  color: #636E72;
  font-weight: 600;
  line-height: 1.4;
  background: #F8F9FA;
  padding: 6px 12px;
  border-radius: 12px;
  width: 100%;
  box-sizing: border-box;
}

.say-dua-btn {
  background: #E8F8F5;
  border: 2px solid #A3E4D7;
  border-radius: 14px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 800;
  color: #10AC84;
  margin-top: 4px;
  touch-action: manipulation;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

.say-dua-btn:hover {
  background: #10AC84;
  color: white;
  border-color: #0A8B6B;
}

.dua-card.playing .say-dua-btn {
  background: #FF9F43;
  color: white;
  border-color: #E58E3C;
}

/* Modals (Parental Gate, Sticker Book, Settings) */
.fanfoon-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.fanfoon-modal-card {
  background: white;
  border-radius: 28px;
  padding: 26px;
  max-width: 520px;
  width: 100%;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: modalPop 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 22px;
  font-weight: 900;
  color: var(--color-text-main);
}

.close-modal-btn {
  background: #F1F2F6;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 17px;
  cursor: pointer;
  touch-action: manipulation;
}

.album-info-bar {
  background: #FFF9E6;
  border: 2px dashed #FECA57;
  border-radius: 16px;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 700;
  gap: 10px;
}

.gold-text {
  color: #D35400;
}

.stickers-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  max-height: 380px;
  overflow-y: auto;
  padding: 4px;
}

.sticker-item {
  border-radius: 18px;
  padding: 10px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  border: 2px solid #E4E7EB;
  touch-action: manipulation;
}

.sticker-item.unlocked {
  background: #FFFBF5;
  border-color: #FECA57;
  cursor: pointer;
}

.sticker-item.locked {
  background: #F8F9FA;
  opacity: 0.6;
}

.sticker-emoji-circle {
  font-size: 36px;
}

.sticker-label {
  font-size: 13px;
  font-weight: 800;
}

.sticker-sub-ar {
  font-family: var(--font-arabic);
  font-size: 11px;
  font-weight: 700;
  color: #8C531B;
}

.sticker-cost {
  font-size: 11px;
  color: #E67E22;
  font-weight: 700;
}

/* Parental Gate Math Box */
.gate-desc {
  font-size: 15px;
  color: #636E72;
  line-height: 1.4;
}

.gate-math-box {
  background: #F1F2F6;
  border-radius: 16px;
  padding: 16px;
  text-align: center;
}

.gate-equation {
  font-size: 32px;
  font-weight: 900;
  color: #2D3436;
}

.gate-input-row {
  display: flex;
  gap: 10px;
}

.gate-input {
  flex: 1;
  padding: 12px;
  border: 2px solid #DFE4EA;
  border-radius: 16px;
  font-size: 22px;
  text-align: center;
  font-family: inherit;
}

.gate-error-msg {
  color: #EE5253;
  font-weight: 700;
  font-size: 14px;
  text-align: center;
}

/* Primary and Danger Buttons */
.primary-btn {
  background: var(--color-primary);
  border: none;
  border-radius: 16px;
  padding: 12px 24px;
  font-size: 17px;
  font-weight: 800;
  color: white;
  cursor: pointer;
  box-shadow: 0 4px 0 #C27125;
  touch-action: manipulation;
}

.primary-btn.full-width {
  width: 100%;
}

.primary-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #C27125;
}

.danger-btn {
  background: #FF4757;
  border: none;
  border-radius: 14px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 800;
  color: white;
  cursor: pointer;
  touch-action: manipulation;
}

/* Settings List */
.settings-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid #F1F2F6;
  gap: 12px;
}

.setting-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.setting-text span {
  font-size: 13px;
  color: #636E72;
}

.setting-select {
  padding: 8px 12px;
  border-radius: 12px;
  border: 2px solid #DFE4EA;
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  background: white;
  touch-action: manipulation;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #CAD1D9;
  border-radius: 34px;
  transition: 0.3s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  border-radius: 50%;
  transition: 0.3s;
}

input:checked + .slider {
  background-color: #10AC84;
}

input:checked + .slider:before {
  transform: translateX(24px);
}

/* Floating Star Animation for Rewards */
.reward-floating-star {
  position: fixed;
  font-size: 32px;
  pointer-events: none;
  z-index: 10000;
  transition: all 0.85s cubic-bezier(0.25, 1, 0.5, 1);
}

.reward-floating-star.fly-to-hud {
  left: 30px !important;
  top: 15px !important;
  transform: scale(0.3);
  opacity: 0.2;
}

/* Animations */
@keyframes gentleWiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-5deg); }
  75% { transform: rotate(5deg); }
}

@keyframes mascotCheer {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(-20px) scale(1.08); }
}

@keyframes floatBubble {
  0% { transform: translateY(0); }
  100% { transform: translateY(-16px); }
}

@keyframes popEffect {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.8; }
  100% { transform: scale(0); opacity: 0; }
}

@keyframes gentleShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

@keyframes bounceIn {
  0% { transform: scale(0.6); opacity: 0; }
  70% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes splatBurst {
  0% { transform: scale(1); }
  50% { transform: scale(1.4); }
  100% { transform: scale(1.2); }
}

@keyframes pulseButton {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

@keyframes modalPop {
  0% { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes flyToMouth {
  0% { transform: scale(1); }
  50% { transform: translateY(-80px) scale(0.8); }
  100% { transform: translateY(-140px) scale(0); opacity: 0; }
}

/* ==========================================================================
   iPad & Tablet Layout Optimizations (768px, 834px, 1024px, 1194px, 1366px)
   ========================================================================== */

/* Tablet & iPad Portrait / Landscape Base */
@media (min-width: 768px) {
  .app-container {
    max-width: 1200px;
    padding: 22px 28px 60px 28px;
    gap: 26px;
  }

  .welcome-title {
    font-size: 32px;
  }

  .welcome-sub {
    font-size: 18px;
  }

  .activities-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
  }

  .activity-card {
    padding: 26px 18px;
    min-height: 185px;
  }

  .card-icon-bubble {
    font-size: 52px;
    margin-bottom: 12px;
  }

  .card-title {
    font-size: 22px;
  }

  .card-en {
    font-size: 14px;
  }

  .game-board {
    max-width: 900px;
    padding: 32px;
    border-radius: 32px;
  }

  .bubble-area {
    min-height: 380px;
    padding: 30px;
  }

  .floating-bubble {
    width: 110px;
    height: 110px;
  }

  .bubble-char {
    font-size: 54px;
  }

  .letter-tile-btn {
    width: 76px;
    height: 76px;
    font-size: 40px;
  }

  .word-slot {
    width: 76px;
    height: 76px;
    font-size: 40px;
  }

  .memory-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    max-width: 660px;
  }

  .memory-card {
    min-height: 125px;
  }

  .food-card {
    padding: 20px;
    min-height: 125px;
  }

  .food-emoji {
    font-size: 56px;
  }

  .count-item-btn {
    min-width: 100px;
    min-height: 100px;
  }

  .count-item-emoji {
    font-size: 52px;
  }
}

/* iPad Landscape (1024x768, 1194x834, 1366x1024):
   Side-by-side Letter Tracing, 3-column activities grid, spacious tablet boards */
@media (min-width: 768px) and (orientation: landscape) {
  .tracing-view-layout {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 36px;
    align-items: center;
    justify-content: center;
    max-width: 960px;
    margin: 0 auto;
    padding: 12px;
  }

  .tracing-left-pane {
    max-width: none;
    width: 100%;
  }

  .tracing-right-pane {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  .trace-canvas-wrapper {
    width: 420px;
    height: 420px;
  }

  .activities-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
  }

  .story-card {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 24px;
    align-items: center;
  }

  .story-scene-stage {
    height: 280px;
  }

  .story-nav-bar {
    grid-column: 1 / -1;
  }
}

/* Large iPad Pro 12.9" (1366x1024 or 1024x1366) */
@media (min-width: 1024px) {
  .app-container {
    max-width: 1280px;
  }

  .welcome-title {
    font-size: 36px;
  }

  .welcome-sub {
    font-size: 19px;
  }

  .activity-card {
    padding: 28px 20px;
    min-height: 200px;
  }

  .card-icon-bubble {
    font-size: 56px;
  }

  .card-title {
    font-size: 23px;
  }
}

/* Compact Mobile Screens (<680px) */
@media (max-width: 680px) {
  .app-header {
    padding: 10px 12px;
  }

  .logo-title {
    font-size: 20px;
  }

  .lang-toggle-btn {
    padding: 4px 10px;
    font-size: 12px;
    min-height: 34px;
  }

  .hud-star-btn {
    padding: 4px 12px;
    font-size: 16px;
  }

  .fanfoon-svg {
    width: 140px;
    height: 140px;
  }

  .activities-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .activity-card {
    padding: 16px 10px;
    min-height: 140px;
  }

  .card-icon-bubble {
    font-size: 36px;
  }

  .card-title {
    font-size: 18px;
  }

  .tracing-view-layout {
    flex-direction: column;
  }

  .memory-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .stickers-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
