/* ===========================================================
   ألوان هادئة ومبهجة مناسبة للأطفال
   =========================================================== */
:root {
  --bg-1: #fef6e4;      /* خلفية كريمي دافئ */
  --bg-2: #e8f4f8;      /* أزرق فاتح هادئ */
  --primary: #f582ae;   /* وردي لطيف */
  --primary-dark: #e05a93;
  --accent: #8bd3dd;    /* تركواز */
  --accent-2: #ffd803;  /* أصفر مبهج */
  --text: #2d3142;      /* رمادي غامق للنص */
  --card: #ffffff;
  --success: #7ad07a;
  --shadow: 0 8px 24px rgba(45, 49, 66, 0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
  background: linear-gradient(160deg, var(--bg-1) 0%, var(--bg-2) 100%);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.7;
}

/* الشريط العلوي وزر اللغة */
.topbar {
  display: flex;
  justify-content: flex-start;
  padding: 16px 20px;
}
.lang-btn {
  background: var(--card);
  border: 2px solid var(--accent);
  color: var(--text);
  font-family: inherit;
  font-weight: 700;
  font-size: 1rem;
  padding: 8px 20px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.15s, background 0.2s;
}
.lang-btn:hover { background: var(--accent); transform: scale(1.05); }

/* الحاوية الرئيسية */
.container {
  flex: 1;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 10px 20px 40px;
  text-align: center;
}

/* المقدمة */
.intro { margin-bottom: 24px; }
.avatar {
  font-size: 4.5rem;
  line-height: 1;
  margin-bottom: 8px;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}
h1 {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--primary-dark);
}
.title-en {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary-dark);
  opacity: 0.7;
  direction: ltr;
}
.subtitle {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  margin-top: 6px;
}
.subtitle .sep,
.result-badge .sep { opacity: 0.5; margin: 0 4px; }
.description {
  font-size: 1.05rem;
  margin-top: 10px;
  color: var(--text);
  opacity: 0.85;
}
.description-en {
  margin-top: 2px;
  font-size: 0.95rem;
  opacity: 0.6;
  direction: ltr;
}

/* تلميح */
.hint {
  background: rgba(255, 216, 3, 0.25);
  border-radius: 18px;
  padding: 12px 18px;
  margin: 0 auto 26px;
  font-weight: 600;
  max-width: 520px;
}
.hint-en {
  font-size: 0.9rem;
  opacity: 0.65;
  margin-top: 2px;
  direction: ltr;
}

/* زر التسجيل الكبير */
.record-area { margin-bottom: 28px; }
.record-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: linear-gradient(145deg, var(--primary), var(--primary-dark));
  color: #fff;
  border: none;
  font-family: inherit;
  font-weight: 700;
  font-size: 1.4rem;
  padding: 32px 48px;
  border-radius: 30px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.2s;
  min-width: 240px;
}
.record-btn:hover { transform: translateY(-3px); }
.record-btn:active { transform: scale(0.97); }
.record-btn .mic-icon { font-size: 3rem; line-height: 1; }
.record-btn .btn-en {
  font-size: 0.95rem;
  font-weight: 600;
  opacity: 0.9;
  direction: ltr;
}

/* حالة التسجيل النشط */
.record-btn.recording {
  background: linear-gradient(145deg, #ff6b6b, #e63946);
  animation: pulse 1.2s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(230, 57, 70, 0.5); }
  70%  { box-shadow: 0 0 0 22px rgba(230, 57, 70, 0); }
  100% { box-shadow: 0 0 0 0 rgba(230, 57, 70, 0); }
}

.status {
  margin-top: 16px;
  font-weight: 600;
  min-height: 24px;
  font-size: 1.05rem;
}
.status.error { color: #e63946; }

/* بطاقة النتيجة */
.result-card {
  background: var(--card);
  border-radius: 28px;
  padding: 28px 20px;
  margin: 0 auto 26px;
  box-shadow: var(--shadow);
  max-width: 420px;
  border: 4px solid var(--success);
  animation: pop 0.4s ease;
}
@keyframes pop {
  0%   { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.result-image {
  font-size: 7rem;
  line-height: 1;
  margin-bottom: 12px;
}
/* عند استبدال الإيموجي بصورة حقيقية */
.result-image img {
  width: 180px;
  height: 180px;
  object-fit: contain;
}
.result-arabic {
  font-size: 2.4rem;
  font-weight: 900;
  color: var(--primary-dark);
}
.result-english {
  font-size: 1.4rem;
  color: var(--accent);
  font-weight: 700;
  margin-top: 4px;
}
.replay-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  background: var(--accent);
  color: var(--text);
  border: none;
  font-family: inherit;
  font-weight: 700;
  font-size: 1.1rem;
  padding: 12px 26px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.15s, background 0.2s;
}
.replay-btn:hover { transform: scale(1.05); background: #6ec5d1; }
.replay-btn:active { transform: scale(0.96); }
.replay-btn .sep { opacity: 0.5; }

.result-badge {
  margin-top: 14px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--success);
}

/* بطاقة حاول مرة أخرى */
.tryagain-card {
  background: #fff3f3;
  border: 3px dashed #ffb4b4;
  border-radius: 24px;
  padding: 24px;
  margin: 0 auto 26px;
  max-width: 420px;
  animation: pop 0.4s ease;
}
.tryagain-emoji { font-size: 3.5rem; }
.tryagain-ar { font-size: 1.25rem; font-weight: 700; margin-top: 8px; }
.tryagain-en { font-size: 1rem; opacity: 0.7; margin-top: 4px; direction: ltr; }

/* التذييل */
.footer {
  text-align: center;
  padding: 18px;
  font-size: 0.95rem;
  opacity: 0.7;
}

.hidden { display: none !important; }

/* الموبايل */
@media (max-width: 480px) {
  h1 { font-size: 1.7rem; }
  .record-btn { font-size: 1.2rem; padding: 26px 32px; width: 100%; }
  .result-image { font-size: 5.5rem; }
  .result-arabic { font-size: 2rem; }
}
