/* ============================================================
   WAHAT AL-HUROOF - KIDS ARABIC LEARNING GAME STYLESHEET
   ============================================================ */

:root {
  --primary: #4361ee;
  --secondary: #3f37c9;
  --accent-pink: #f72585;
  --accent-yellow: #ffb703;
  --accent-green: #06d6a0;
  --accent-cyan: #4cc9f0;
  --bg-gradient: linear-gradient(135deg, #e0f2fe 0%, #fef3c7 50%, #fce7f3 100%);
  --card-bg: rgba(255, 255, 255, 0.92);
  --shadow-soft: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  --shadow-bouncy: 0 12px 0px rgba(0, 0, 0, 0.12);
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
}

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

body {
  font-family: 'Tajawal', 'Fredoka', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-gradient);
  min-height: 100vh;
  color: #1e293b;
  overflow-x: hidden;
  position: relative;
}

/* Floating background clouds & decorations */
.bg-decoration {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
}

.cloud {
  font-size: 4rem;
  animation: floatCloud 25s linear infinite;
}

.c1 { top: 8%; left: -100px; animation-duration: 35s; }
.c2 { top: 40%; left: -100px; animation-duration: 28s; animation-delay: 12s; }
.c3 { top: 75%; left: -100px; animation-duration: 40s; animation-delay: 5s; }
.rainbow {
  font-size: 5rem;
  top: 4%;
  right: 5%;
  animation: gentlePulse 4s ease-in-out infinite alternate;
}

@keyframes floatCloud {
  0% { transform: translateX(-10vw); }
  100% { transform: translateX(110vw); }
}

@keyframes gentlePulse {
  0% { transform: scale(1) rotate(-5deg); }
  100% { transform: scale(1.08) rotate(5deg); }
}

/* App Container */
.app-container {
  position: relative;
  z-index: 2;
  max-width: 900px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 16px;
}

/* Header */
.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  padding: 12px 24px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  border: 3px solid #ffffff;
  margin-bottom: 20px;
}

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

.logo-icon {
  font-size: 2.2rem;
  animation: spinSlow 8s linear infinite;
}

@keyframes spinSlow {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.main-title {
  font-size: 1.8rem;
  font-weight: 900;
  background: linear-gradient(45deg, #4361ee, #f72585);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
}

.sub-title {
  font-size: 0.82rem;
  color: #64748b;
  font-weight: 700;
  display: block;
}

.stats-panel {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stat-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fef08a;
  border: 2px solid #f59e0b;
  padding: 6px 14px;
  border-radius: 50px;
  font-weight: 900;
  font-size: 1.2rem;
  color: #b45309;
  box-shadow: 0 4px 0 #d97706;
}

.icon-btn {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  font-size: 1.4rem;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 4px 0 #cbd5e1;
  transition: all 0.15s ease;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.btn-tooltip {
  position: absolute;
  top: 110%;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #ffffff;
  font-size: 0.7rem;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.icon-btn:hover .btn-tooltip {
  opacity: 1;
}

/* Views Navigation */
.view {
  display: none;
  flex: 1;
  animation: fadeIn 0.3s ease-out;
}

.view.active {
  display: flex;
  flex-direction: column;
}

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

/* Welcome Banner */
.welcome-banner {
  text-align: center;
  padding: 16px;
  margin-bottom: 20px;
}

.welcome-banner h2 {
  font-size: 2.2rem;
  color: #0f172a;
  font-weight: 900;
}

.welcome-banner p {
  color: #475569;
  font-size: 1.1rem;
  margin-top: 6px;
}

/* Game Menu Grid */
.game-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  padding-bottom: 30px;
}

.game-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  border: 3px solid #ffffff;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08), 0 8px 0 rgba(0, 0, 0, 0.08);
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.game-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 18px 30px rgba(0, 0, 0, 0.12), 0 10px 0 rgba(0, 0, 0, 0.1);
}

.game-card:active {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

.balloon-card { background: linear-gradient(135deg, #ffedd5, #fef9c3); border-color: #fde047; }
.memory-card-banner { background: linear-gradient(135deg, #e0e7ff, #ede9fe); border-color: #c7d2fe; }
.trace-card { background: linear-gradient(135deg, #dcfce7, #d1fae5); border-color: #86efac; }
.safari-card { background: linear-gradient(135deg, #fce7f3, #ffe4e6); border-color: #fbcfe8; }

.card-icon-wrapper {
  position: relative;
  display: inline-block;
  margin-bottom: 12px;
}

.card-emoji {
  font-size: 3.8rem;
  display: block;
}

.floating-mini-letter {
  position: absolute;
  top: -5px;
  right: -15px;
  background: #ffffff;
  border: 2px solid var(--accent-pink);
  color: var(--accent-pink);
  font-size: 1.4rem;
  font-weight: 900;
  width: 36px;
  height: 36px;
  line-height: 32px;
  border-radius: 50%;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  animation: bounceMini 2s infinite ease-in-out;
}

@keyframes bounceMini {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.game-card h3 {
  font-size: 1.6rem;
  font-weight: 900;
  color: #1e293b;
  margin-bottom: 4px;
}

.en-desc {
  color: #64748b;
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.play-pill {
  display: inline-block;
  background: #1e293b;
  color: #ffffff;
  padding: 8px 18px;
  border-radius: 50px;
  font-weight: 700;
  font-size: 0.95rem;
  transition: background 0.2s;
}

.game-card:hover .play-pill {
  background: var(--accent-pink);
}

/* ============================================================
   GAME 1: BALLOON POP STYLES
   ============================================================ */
.game-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-bg);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  border: 2px solid #ffffff;
  box-shadow: var(--shadow-soft);
  margin-bottom: 16px;
}

.target-bubble-box {
  display: flex;
  align-items: center;
  gap: 14px;
}

.prompt-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: #475569;
}

.target-display {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fdf2f8;
  border: 2px solid var(--accent-pink);
  padding: 6px 16px;
  border-radius: var(--radius-md);
}

.target-char {
  font-size: 2.8rem;
  font-weight: 900;
  color: var(--accent-pink);
  line-height: 1;
}

.target-info {
  display: flex;
  flex-direction: column;
}

.target-name {
  font-weight: 900;
  font-size: 1.1rem;
  color: #831843;
}

.target-hint {
  font-size: 0.95rem;
  color: #be185d;
  font-weight: 700;
}

.streak-box {
  background: #fff7ed;
  border: 2px solid #f97316;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-weight: 900;
  font-size: 1.2rem;
  color: #c2410c;
}

/* Balloon Sky Container */
.balloon-sky {
  position: relative;
  flex: 1;
  min-height: 480px;
  background: linear-gradient(180deg, #bae6fd 0%, #e0f2fe 70%, #dcfce7 100%);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: inset 0 4px 12px rgba(0,0,0,0.06);
  border: 4px solid #ffffff;
}

.balloon {
  position: absolute;
  width: 90px;
  height: 110px;
  border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: inset -8px -8px 15px rgba(0, 0, 0, 0.15), 0 10px 15px rgba(0, 0, 0, 0.1);
  transform: translateZ(0);
  transition: transform 0.1s;
}

.balloon:active {
  transform: scale(0.92);
}

.balloon-string {
  position: absolute;
  bottom: -24px;
  left: 50%;
  width: 2px;
  height: 25px;
  background: rgba(0, 0, 0, 0.25);
  transform: translateX(-50%);
}

.balloon-char {
  font-size: 2.8rem;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  pointer-events: none;
}

/* Balloon Pop Particle Animation */
.pop-particle {
  position: absolute;
  pointer-events: none;
  font-size: 1.8rem;
  animation: particlePop 0.6s ease-out forwards;
}

@keyframes particlePop {
  0% { transform: scale(0.5); opacity: 1; }
  100% { transform: translateY(-40px) scale(1.4); opacity: 0; }
}

/* ============================================================
   GAME 2: MEMORY MATCH CARDS STYLES
   ============================================================ */
.memory-grid-container {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 0;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  width: 100%;
  max-width: 650px;
}

.mem-card {
  perspective: 1000px;
  height: 130px;
  cursor: pointer;
}

.mem-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transform-style: preserve-3d;
  border-radius: var(--radius-md);
  box-shadow: 0 6px 0 rgba(0,0,0,0.1);
}

.mem-card.flipped .mem-card-inner {
  transform: rotateY(180deg);
}

.mem-card.matched .mem-card-inner {
  transform: rotateY(180deg) scale(0.95);
  filter: drop-shadow(0 0 12px #22c55e);
}

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

.mem-card-front {
  background: linear-gradient(135deg, #6366f1, #a855f7);
  color: #ffffff;
  font-size: 2.5rem;
}

.mem-card-back {
  background: #ffffff;
  transform: rotateY(180deg);
  padding: 8px;
}

.mem-card-back .card-big-char {
  font-size: 3.2rem;
  font-weight: 900;
  color: #4361ee;
  line-height: 1;
}

.mem-card-back .card-emoji-visual {
  font-size: 3rem;
}

.mem-card-back .card-word-caption {
  font-size: 0.9rem;
  font-weight: 700;
  color: #475569;
  margin-top: 4px;
}

/* ============================================================
   GAME 3: MAGIC LETTER TRACING STYLES
   ============================================================ */
.tracing-nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

.trace-arrow-btn {
  background: #f1f5f9;
  border: 2px solid #cbd5e1;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 3px 0 #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
}

.trace-arrow-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #94a3b8;
}

.trace-info-tag {
  display: flex;
  flex-direction: column;
  text-align: center;
}

#trace-letter-name {
  font-size: 1.3rem;
  font-weight: 900;
  color: #0f172a;
}

#trace-word-hint {
  font-size: 0.95rem;
  font-weight: 700;
  color: #64748b;
}

.canvas-wrapper {
  position: relative;
  width: 100%;
  max-width: 500px;
  height: 380px;
  margin: 10px auto;
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 4px dashed #93c5fd;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.canvas-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.guide-letter {
  font-size: 16rem;
  font-weight: 900;
  color: #e2e8f0;
  line-height: 1;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.05);
}

#trace-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

.color-palette-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--card-bg);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  margin-top: 10px;
  border: 2px solid #ffffff;
}

.palette-label {
  font-weight: 800;
  color: #475569;
}

.color-dots {
  display: flex;
  gap: 12px;
  align-items: center;
}

.color-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid #ffffff;
  box-shadow: 0 3px 6px rgba(0,0,0,0.15);
  transition: transform 0.2s;
}

.color-dot:hover {
  transform: scale(1.18);
}

.color-dot.active {
  transform: scale(1.25);
  outline: 3px solid #0f172a;
}

.rainbow-dot {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  background: #f1f5f9;
}

/* ============================================================
   GAME 4: SAFARI 28 ARABIC LETTERS EXPLORER
   ============================================================ */
.safari-intro {
  text-align: center;
  padding: 8px 12px 18px;
}

.safari-intro h2 {
  font-size: 1.8rem;
  font-weight: 900;
  color: #0f172a;
}

.safari-intro p {
  color: #64748b;
  font-weight: 700;
  font-size: 1.05rem;
}

.safari-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
  gap: 14px;
  padding-bottom: 30px;
}

.safari-item-card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 12px 6px;
  text-align: center;
  cursor: pointer;
  border: 2px solid #ffffff;
  box-shadow: 0 4px 10px rgba(0,0,0,0.06);
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.safari-item-card:hover {
  transform: translateY(-5px) scale(1.05);
  box-shadow: 0 10px 18px rgba(0,0,0,0.1);
  border-color: var(--accent-pink);
}

.safari-char {
  font-size: 2.4rem;
  font-weight: 900;
  color: var(--primary);
  line-height: 1.1;
}

.safari-emoji {
  font-size: 1.6rem;
  margin: 2px 0;
}

.safari-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: #64748b;
}

/* ============================================================
   MODAL POPUP
   ============================================================ */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(5px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 30px 24px;
  max-width: 400px;
  width: 100%;
  position: relative;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  border: 4px solid var(--accent-yellow);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: #f1f5f9;
  border: none;
  font-size: 1.1rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
}

.modal-char-circle {
  width: 110px;
  height: 110px;
  background: linear-gradient(135deg, #fbcfe8, #f472b6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  border: 4px solid #ffffff;
  box-shadow: 0 8px 16px rgba(244, 114, 182, 0.4);
}

#modal-char {
  font-size: 4.8rem;
  font-weight: 900;
  color: #ffffff;
  line-height: 1;
}

#modal-title {
  font-size: 1.8rem;
  font-weight: 900;
  color: #0f172a;
  margin-bottom: 12px;
}

.modal-word-showcase {
  background: #f8fafc;
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 20px;
  border: 2px dashed #cbd5e1;
}

.modal-emoji {
  font-size: 3.5rem;
}

.modal-word-details {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.modal-arabic-word {
  font-size: 1.8rem;
  font-weight: 900;
  color: #1e293b;
}

.modal-english-word {
  font-size: 1rem;
  color: #64748b;
  font-weight: 700;
}

.speak-pill-btn {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  border: none;
  font-size: 1.1rem;
  font-weight: 800;
  padding: 12px 24px;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
  transition: transform 0.15s;
}

.speak-pill-btn:active {
  transform: scale(0.95);
}

.small-action-btn {
  background: #ffffff;
  border: 2px solid #cbd5e1;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 3px 0 #94a3b8;
}

.small-action-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #94a3b8;
}

/* Animations */
.bounce-in {
  animation: bounceIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes bounceIn {
  from { opacity: 0; transform: scale(0.7); }
  to { opacity: 1; transform: scale(1); }
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
  .app-container {
    padding: 10px;
  }
  .top-header {
    padding: 10px 14px;
  }
  .main-title {
    font-size: 1.4rem;
  }
  .sub-title {
    display: none;
  }
  .game-cards-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .game-card {
    padding: 16px 10px;
  }
  .card-emoji {
    font-size: 2.8rem;
  }
  .game-card h3 {
    font-size: 1.2rem;
  }
  .cards-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
  .mem-card {
    height: 105px;
  }
  .balloon {
    width: 75px;
    height: 95px;
  }
  .balloon-char {
    font-size: 2.2rem;
  }
  .canvas-wrapper {
    height: 320px;
  }
  .guide-letter {
    font-size: 12rem;
  }
}
