/* ==========================================================================
   EasyEnglishWithDyako — Mobile-First RTL Sorani + Bidirectional English CSS
   Original Visual Identity: "Sunrise Over Kurdistan"
   ========================================================================== */

:root {
  /* Warm, cheerful, high-contrast child-friendly palette */
  --bg-cream: #FFFBF2;
  --bg-soft: #FFF5DF;
  --surface: #FFFFFF;
  --surface-muted: #F6F8FA;

  /* Primary Teal / Emerald (Approachable, calm, confident) */
  --primary: #11997E;
  --primary-dark: #0B745F;
  --primary-light: #E4F8F3;
  --primary-border: #8FE0CE;

  /* Sunrise Gold (Streaks, stars, milestones) */
  --sun: #FFB703;
  --sun-dark: #D99200;
  --sun-light: #FFF4CE;

  /* Warm Coral / Orange (Streaks & playful accents) */
  --coral: #FF6B4A;
  --coral-dark: #D84B2C;
  --coral-light: #FFECE7;

  /* Sky Blue (English pills, interactive selections) */
  --sky: #2B7FFF;
  --sky-dark: #195ECC;
  --sky-light: #EBF3FF;
  --sky-border: #9ECAFF;

  /* Berry / Purple (Revision checkpoints & special challenges) */
  --purple: #8B5CF6;
  --purple-dark: #6D3AD8;
  --purple-light: #F3EEFF;

  /* Gentle Encouraging Hint Amber (Never harsh red on mistakes!) */
  --hint-bg: #FFF6E0;
  --hint-border: #F6BD41;
  --hint-text: #7A4F00;

  /* Success Green */
  --success: #16A34A;
  --success-dark: #117A37;
  --success-light: #E6FAEE;
  --success-border: #7BE0A0;

  /* Typography colors */
  --ink: #1E293B;
  --ink-soft: #475569;
  --ink-muted: #64748B;
  --border: #E2E8F0;
  --border-strong: #CBD5E1;

  /* Fonts */
  --font-ku: 'Vazirmatn', 'Noto Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
  --font-en: 'Nunito', 'Segoe UI', Roboto, Arial, sans-serif;

  /* Sizing & Radii */
  --radius-sm: 14px;
  --radius-md: 20px;
  --radius-lg: 26px;
  --radius-xl: 32px;
  --max-app-width: 680px;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  font-family: var(--font-ku);
  background: radial-gradient(circle at 50% 0%, #FFF3D1 0%, var(--bg-cream) 48%, #F6FBF9 100%);
  color: var(--ink);
  line-height: 1.7;
  min-height: 100dvh;
  direction: rtl;
  text-align: right;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

body.fullscreen-mode {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

/* Bidirectional Isolation for English inside RTL Kurdish Sorani */
.en,
[lang="en"],
[dir="ltr"] {
  font-family: var(--font-en);
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-block;
  letter-spacing: 0.01em;
}

.en-block {
  font-family: var(--font-en);
  direction: ltr;
  unicode-bidi: isolate;
  text-align: left;
  display: block;
}

.en-pill {
  font-family: var(--font-en);
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.6rem;
  margin: 0 0.18rem;
  border-radius: 10px;
  background: var(--sky-light);
  border: 1.5px solid var(--sky-border);
  color: var(--sky-dark);
  font-weight: 800;
  font-size: 1.04em;
  line-height: 1.4;
}

/* App Shell */
.app-shell {
  width: 100%;
  max-width: var(--max-app-width);
  min-width: 0;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

body.fullscreen-mode .app-shell {
  height: 100dvh;
  max-height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
}

@media (min-width: 768px) {
  body:not(.fullscreen-mode) {
    padding: 16px 16px 32px;
  }
  body:not(.fullscreen-mode) .app-shell {
    min-height: calc(100dvh - 48px);
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(8px);
    border-radius: var(--radius-xl);
    border: 2px solid rgba(226, 232, 240, 0.9);
    box-shadow: 0 18px 50px rgba(15, 45, 38, 0.08);
    overflow: clip;
  }
  body.fullscreen-mode {
    padding: 12px;
  }
  body.fullscreen-mode .app-shell {
    height: calc(100dvh - 24px);
    max-height: calc(100dvh - 24px);
    min-height: calc(100dvh - 24px);
    background: var(--bg-cream);
    border-radius: var(--radius-xl);
    border: 2px solid rgba(226, 232, 240, 0.95);
    box-shadow: 0 18px 50px rgba(15, 45, 38, 0.1);
    overflow: hidden;
  }
}

/* ==========================================================================
   Buttons — Tactile, Playful 3D Press States, Large Tap Targets (56px+)
   ========================================================================== */
button {
  font-family: inherit;
  cursor: pointer;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 56px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  border: none;
  font-size: 1.12rem;
  font-weight: 800;
  line-height: 1.4;
  transition: transform 0.16s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.12s ease, background-color 0.15s ease, filter 0.15s ease;
  user-select: none;
  text-decoration: none;
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.01);
  filter: brightness(1.03);
}

.btn:active:not(:disabled) {
  transform: translateY(4px) scale(0.985);
}

.btn:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 5px 0 var(--primary-dark);
}
.btn-primary:hover:not(:disabled) {
  background: #13A88B;
}
.btn-primary:active:not(:disabled) {
  box-shadow: 0 2px 0 var(--primary-dark);
}

.btn-sun {
  background: var(--sun);
  color: #3A2500;
  box-shadow: 0 5px 0 var(--sun-dark);
}
.btn-sun:hover:not(:disabled) {
  background: #FFC226;
}
.btn-sun:active:not(:disabled) {
  box-shadow: 0 2px 0 var(--sun-dark);
}

.btn-sky {
  background: var(--sky);
  color: #FFFFFF;
  box-shadow: 0 5px 0 var(--sky-dark);
}
.btn-sky:active:not(:disabled) {
  box-shadow: 0 2px 0 var(--sky-dark);
}

.btn-purple {
  background: var(--purple);
  color: #FFFFFF;
  box-shadow: 0 5px 0 var(--purple-dark);
}
.btn-purple:active:not(:disabled) {
  box-shadow: 0 2px 0 var(--purple-dark);
}

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border: 2px solid var(--border-strong);
  box-shadow: 0 4px 0 var(--border-strong);
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary-dark);
}
.btn-secondary:active:not(:disabled) {
  box-shadow: 0 1px 0 var(--border-strong);
}

.btn-block {
  width: 100%;
}

.icon-btn {
  min-width: 46px;
  min-height: 46px;
  border-radius: 14px;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 1.15rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s, border-color 0.15s, transform 0.1s;
}
.icon-btn:hover {
  border-color: var(--primary-border);
  background: var(--primary-light);
  color: var(--primary-dark);
}
.icon-btn:active {
  transform: scale(0.95);
}

/* ==========================================================================
   Top Sticky Header (Home View — Responsive on 320px+ Phones to Desktops)
   ========================================================================== */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  width: 100%;
  max-width: 100%;
  background: rgba(255, 251, 242, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 2px solid var(--border);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.profile-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  max-width: 48%;
  min-width: 0;
  padding: 4px 10px 4px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 2px solid var(--border-strong);
  box-shadow: 0 3px 0 var(--border);
  font-weight: 800;
  font-size: 0.94rem;
  color: var(--ink);
  flex-shrink: 1;
}
.profile-chip:hover {
  border-color: var(--primary);
}

.profile-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.profile-badge-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  color: #fff;
  font-weight: 900;
  flex-shrink: 0;
}

.stats-row {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 38px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--surface);
  border: 2px solid var(--border);
  font-weight: 800;
  font-size: 0.88rem;
  white-space: nowrap;
}

.top-bar .icon-btn {
  min-width: 38px;
  min-height: 38px;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  font-size: 1rem;
  padding: 0;
}

@media (max-width: 460px) {
  .streak-day-word {
    display: none;
  }
  .top-bar {
    padding: 8px 10px;
    gap: 5px;
  }
  .stat-pill {
    padding: 3px 8px;
    font-size: 0.85rem;
  }
  .top-bar .icon-btn {
    min-width: 36px;
    min-height: 36px;
    width: 36px;
    height: 36px;
  }
}

.stat-pill.streak-active {
  background: var(--coral-light);
  border-color: #FFB29F;
  color: var(--coral-dark);
}
.stat-pill.streak-idle {
  color: var(--ink-muted);
}
.stat-pill.stars-pill {
  background: var(--sun-light);
  border-color: #FFE082;
  color: #9A6400;
}

/* ==========================================================================
   Dyako Teacher Speech Component
   ========================================================================== */
.dyako-stage {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px;
  background: var(--surface);
  border: 2px solid var(--primary-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(17, 153, 126, 0.08);
}

.dyako-avatar-wrap {
  width: 86px;
  height: 96px;
  flex-shrink: 0;
  border-radius: 22px;
  background: linear-gradient(180deg, #E4F8F3 0%, #FFF3D4 100%);
  border: 2px solid var(--primary-border);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.dyako-avatar-wrap.dyako-lg {
  width: 118px;
  height: 132px;
  border-radius: 28px;
  margin: 0 auto;
}

.dyako-avatar-wrap svg {
  width: 100%;
  height: 100%;
  display: block;
  animation: dyakoFloat 3.4s ease-in-out infinite;
}

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

.dyako-speech {
  flex: 1;
  min-width: 0;
}

.dyako-name-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.84rem;
  font-weight: 800;
  color: var(--primary-dark);
  background: var(--primary-light);
  padding: 2px 10px;
  border-radius: 999px;
  margin-bottom: 6px;
}

.dyako-bubble-text {
  margin: 0;
  font-size: 1.06rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.75;
}

/* ==========================================================================
   Onboarding View ("ناوت چییە؟")
   ========================================================================== */
.onboarding-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px 20px 32px;
  gap: 20px;
}

.brand-banner {
  text-align: center;
}

.brand-badge {
  display: inline-block;
  background: var(--sun-light);
  color: #8A5A00;
  border: 2px solid #FFD666;
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.brand-title {
  margin: 0;
  font-size: 1.7rem;
  font-weight: 900;
  color: var(--primary-dark);
  line-height: 1.35;
}

.onboarding-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  border: 2.5px solid var(--primary-border);
  padding: 24px 20px;
  box-shadow: 0 12px 32px rgba(17, 153, 126, 0.1);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.onboarding-speech-box {
  background: var(--primary-light);
  border: 2px solid var(--primary-border);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  position: relative;
}

.onboarding-question {
  font-size: 1.38rem;
  font-weight: 900;
  color: var(--primary-dark);
  margin: 6px 0 0;
}

.name-input-label {
  display: block;
  font-weight: 800;
  font-size: 1rem;
  margin-bottom: 8px;
  color: var(--ink);
}

.name-input {
  width: 100%;
  min-height: 58px;
  padding: 12px 18px;
  font-family: var(--font-ku);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
  background: var(--bg-cream);
  border: 2.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.name-input:focus {
  border-color: var(--primary);
  background: #FFFFFF;
  box-shadow: 0 0 0 4px rgba(17, 153, 126, 0.16);
}

.avatar-color-picker {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.color-choice-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 3px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  transition: transform 0.15s, box-shadow 0.15s;
}
.color-choice-btn.selected {
  border-color: var(--ink);
  transform: scale(1.12);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.16);
}

/* ==========================================================================
   Home Screen — Hero Card, Smart Review & Winding Sunrise 3 Lesson Path
   ========================================================================== */
.home-main {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 14px 14px 36px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hero-continue-card {
  background: linear-gradient(135deg, #FFFFFF 0%, #F1FCF9 100%);
  border: 2.5px solid var(--primary-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: 0 10px 26px rgba(17, 153, 126, 0.1);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.next-action-box {
  background: var(--bg-cream);
  border: 2px solid #F3E5AB;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.next-lesson-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.next-lesson-tag {
  font-size: 0.85rem;
  font-weight: 800;
  color: #8A5A00;
  background: var(--sun-light);
  padding: 3px 10px;
  border-radius: 999px;
}

.next-lesson-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--ink);
}

.can-do-preview {
  margin: 0;
  font-size: 0.95rem;
  color: var(--ink-soft);
}

/* Android Install App Banner */
.install-app-banner {
  background: linear-gradient(135deg, #FFF8E1 0%, #FFFFFF 100%);
  border: 2px solid #FCD34D;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.install-banner-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 185px;
}

.install-banner-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  flex-shrink: 0;
  box-shadow: 0 3px 8px rgba(17, 153, 126, 0.2);
}

/* Smart Spaced Review Banner */
.review-banner {
  background: linear-gradient(135deg, #F5F0FF 0%, #FFFFFF 100%);
  border: 2px solid #D8B4FE;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.review-banner-info {
  flex: 1;
  min-width: 190px;
}

.review-banner-title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 800;
  color: #5B21B6;
}

.review-banner-sub {
  margin: 2px 0 0;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

/* Unit Selector Tabs (Shows ONLY Selected Unit Below!) */
.unit-tabs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: -8px;
}

.unit-tabs-label {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 900;
  color: var(--ink);
}

.unit-tabs-grid {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 6px 2px 10px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.unit-tabs-grid::-webkit-scrollbar {
  display: none;
}

.unit-jump-pill {
  flex-shrink: 0;
  min-height: 46px;
  padding: 8px 16px;
  border-radius: 16px;
  border: 2.5px solid var(--border-strong);
  box-shadow: 0 4px 0 var(--border-strong);
  background: var(--surface);
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--ink-soft);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.15s, border-color 0.15s, box-shadow 0.12s;
}
.unit-jump-pill:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  color: var(--primary-dark);
}
.unit-jump-pill:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--border-strong);
}
.unit-jump-pill.selected-unit {
  background: var(--primary);
  border-color: var(--primary-dark);
  box-shadow: 0 4px 0 var(--primary-dark);
  color: #FFFFFF;
  transform: translateY(-1px) scale(1.03);
}
.unit-jump-pill.completed-unit:not(.selected-unit) {
  background: var(--success-light);
  border-color: var(--success-border);
  box-shadow: 0 4px 0 #A7E8BD;
  color: var(--success-dark);
}

.single-unit-stage {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  animation: unitCardPopIn 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes unitCardPopIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.unit-prev-next-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 16px 16px;
}

.unit-nav-mini-btn {
  min-height: 44px;
  padding: 6px 14px;
  border-radius: 12px;
  border: 2px solid var(--border-strong);
  background: var(--bg-cream);
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--ink-soft);
  transition: transform 0.12s, border-color 0.15s;
}
.unit-nav-mini-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary-dark);
  transform: translateY(-1px);
}
.unit-nav-mini-btn:disabled {
  opacity: 0.38;
  cursor: default;
}

/* Unit Section Card & Path Nodes */
.unit-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.unit-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
}

.unit-card.unit-current {
  border-color: var(--primary);
  box-shadow: 0 8px 24px rgba(17, 153, 126, 0.12);
}

.unit-card.unit-revision {
  border-color: #C4B5FD;
  background: linear-gradient(180deg, #FAF7FF 0%, #FFFFFF 100%);
}

.unit-header {
  padding: 14px 18px;
  background: var(--unit-accent-light, var(--primary-light));
  border-bottom: 2px solid var(--unit-accent-border, var(--primary-border));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.unit-header-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.unit-header-main > div {
  min-width: 0;
}

.unit-icon-bubble {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: #FFFFFF;
  border: 2px solid rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.55rem;
  flex-shrink: 0;
}

.unit-number-label {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--ink-soft);
}

.unit-title {
  margin: 0;
  font-size: 1.14rem;
  font-weight: 900;
  color: var(--ink);
}

.unit-en-topic {
  font-size: 0.81rem;
  font-weight: 800;
  color: var(--sky-dark);
}

.unit-progress-badge {
  font-size: 0.86rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  background: #FFFFFF;
  border: 1.5px solid var(--border-strong);
  color: var(--ink-soft);
  white-space: nowrap;
}

/* Winding Path Nodes inside Unit */
.lesson-nodes-path {
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lesson-node-btn {
  width: 100%;
  min-height: 70px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 2.5px solid var(--border);
  background: var(--surface);
  box-shadow: 0 4px 0 var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: right;
  transition: transform 0.1s, border-color 0.15s, background-color 0.15s;
}

.lesson-node-btn:hover {
  border-color: var(--primary);
}
.lesson-node-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--border);
}

.lesson-node-btn.node-next {
  background: #F2FDFB;
  border-color: var(--primary);
  box-shadow: 0 5px 0 var(--primary-dark);
}

.lesson-node-btn.node-done {
  background: #F7FEF9;
  border-color: var(--success-border);
  box-shadow: 0 4px 0 #BCEACB;
}

.lesson-node-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.node-circle {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 900;
  flex-shrink: 0;
  background: var(--surface-muted);
  border: 2px solid var(--border-strong);
  color: var(--ink-soft);
}

.node-next .node-circle {
  background: var(--primary);
  border-color: var(--primary-dark);
  color: #FFFFFF;
  animation: pulseRing 2.2s infinite;
}

.node-done .node-circle {
  background: var(--success);
  border-color: var(--success-dark);
  color: #FFFFFF;
}

@keyframes pulseRing {
  0%, 100% { box-shadow: 0 0 0 0 rgba(17, 153, 126, 0.35); }
  50% { box-shadow: 0 0 0 7px rgba(17, 153, 126, 0); }
}

.node-text-wrap {
  min-width: 0;
}

.node-title {
  display: block;
  font-size: 1.03rem;
  font-weight: 800;
  color: var(--ink);
}

.node-goal {
  display: block;
  font-size: 0.86rem;
  color: var(--ink-soft);
  margin-top: 2px;
}

.node-cta-chip {
  flex-shrink: 0;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 800;
  background: var(--surface-muted);
  color: var(--ink-soft);
}
.node-next .node-cta-chip {
  background: var(--primary);
  color: #FFFFFF;
}
.node-done .node-cta-chip {
  background: var(--sun-light);
  color: #8A5A00;
}

/* ==========================================================================
   Active Lesson Runner View — True Duolingo Full-Screen (Zero Scrolling!)
   ========================================================================== */
.lesson-screen {
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100dvh;
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-cream);
  overflow: hidden;
}

.lesson-topbar {
  flex-shrink: 0;
  padding: 8px 14px;
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border-bottom: 2px solid var(--border);
}

.lesson-topbar .icon-btn {
  min-width: 40px;
  min-height: 40px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 1rem;
}

.progress-track {
  flex: 1;
  height: 14px;
  background: #E2E8F0;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #1ED4B1 0%, var(--primary) 100%);
  border-radius: 999px;
  transition: width 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.step-counter {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--ink-soft);
  min-width: 38px;
  text-align: left;
}

.lesson-body {
  flex: 1;
  min-height: 0;
  width: 100%;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Compact Dyako Stage inside Full-Screen Lesson */
.lesson-screen .dyako-stage {
  flex-shrink: 0;
  padding: 9px 12px;
  gap: 10px;
  border-radius: 18px;
}

.lesson-screen .dyako-avatar-wrap {
  width: 62px;
  height: 68px;
  border-radius: 16px;
}

.lesson-screen .dyako-name-tag {
  font-size: 0.76rem;
  padding: 1px 8px;
  margin-bottom: 3px;
}

.lesson-screen .dyako-bubble-text {
  font-size: 0.96rem;
  line-height: 1.55;
}

#exercise-interactive-area {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}

/* Teach Card — Viewport-Adaptive so Button is Always Visible */
.teach-showcase {
  background: var(--surface);
  border: 2.5px solid var(--sky-border);
  border-radius: var(--radius-lg);
  padding: clamp(12px, 2.2dvh, 20px) 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 1.4dvh, 12px);
  box-shadow: 0 8px 24px rgba(43, 127, 255, 0.08);
}

.teach-art {
  width: clamp(92px, 16dvh, 140px);
  height: clamp(82px, 14.5dvh, 126px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.teach-art svg {
  width: 100%;
  height: 100%;
}

.teach-en-word {
  font-family: var(--font-en);
  direction: ltr;
  unicode-bidi: isolate;
  font-size: clamp(1.4rem, 3.4dvh, 1.9rem);
  font-weight: 900;
  color: var(--sky-dark);
  background: var(--sky-light);
  padding: 4px 18px;
  border-radius: 14px;
  border: 2px solid var(--sky-border);
  line-height: 1.25;
}

.teach-ku-meaning {
  font-size: clamp(1.02rem, 2.2dvh, 1.18rem);
  font-weight: 800;
  color: var(--ink);
  margin: 0;
}

.teach-example-box {
  background: var(--bg-soft);
  border: 1.5px solid #F3DC9B;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  width: 100%;
}

/* Visual Choice 2x2 Grid — Fits Cleanly on Every Phone */
.visual-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.visual-card-btn {
  background: var(--surface);
  border: 2.5px solid var(--border-strong);
  box-shadow: 0 4px 0 var(--border-strong);
  border-radius: var(--radius-md);
  padding: clamp(8px, 1.6dvh, 14px) 8px;
  min-height: clamp(104px, 17dvh, 138px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.12s, border-color 0.15s, background-color 0.15s;
}

.visual-card-btn:hover:not(:disabled) {
  border-color: var(--sky);
  transform: translateY(-2px);
}
.visual-card-btn:active:not(:disabled) {
  transform: translateY(3px) scale(0.98);
}
.visual-card-btn.selected {
  background: var(--sky-light);
  border-color: var(--sky);
  box-shadow: 0 4px 0 var(--sky-dark);
  animation: popBounce 0.24s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.visual-card-btn.correct {
  background: var(--success-light);
  border-color: var(--success);
  box-shadow: 0 4px 0 var(--success-dark);
  animation: popBounce 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popBounce {
  0% { transform: scale(0.94); }
  60% { transform: scale(1.04); }
  100% { transform: scale(1); }
}
.visual-card-btn.wrong-try {
  background: var(--hint-bg);
  border-color: var(--hint-border);
  animation: gentleShake 0.35s ease;
}

.visual-card-art {
  width: clamp(56px, 10dvh, 78px);
  height: clamp(52px, 9dvh, 72px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.visual-card-art svg {
  width: 100%;
  height: 100%;
}

.visual-card-label {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--ink);
  text-align: center;
  line-height: 1.25;
}

/* Fill-in-Blank / Sentence Choice — Compact & Clear */
.scene-prompt-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.scene-art-box {
  width: clamp(72px, 12dvh, 110px);
  height: clamp(64px, 10.5dvh, 96px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.scene-art-box svg {
  width: 100%;
  height: 100%;
}

.sentence-display-ltr {
  font-family: var(--font-en);
  direction: ltr;
  unicode-bidi: isolate;
  text-align: center;
  font-size: clamp(1.12rem, 2.4dvh, 1.32rem);
  font-weight: 800;
  color: var(--ink);
  background: var(--surface-muted);
  padding: 8px 12px;
  border-radius: 14px;
  border: 2px dashed var(--border-strong);
  width: 100%;
  line-height: 1.4;
}

.blank-slot {
  display: inline-block;
  min-width: 58px;
  padding: 1px 10px;
  margin: 0 3px;
  border-bottom: 3px solid var(--sky);
  color: var(--sky-dark);
  background: var(--sky-light);
  border-radius: 8px;
}

.choices-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.choice-row-btn {
  width: 100%;
  min-height: clamp(46px, 7dvh, 54px);
  padding: 8px 16px;
  border-radius: 16px;
  border: 2.5px solid var(--border-strong);
  box-shadow: 0 3px 0 var(--border-strong);
  background: var(--surface);
  font-size: 1.08rem;
  font-weight: 800;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.14s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.14s, border-color 0.14s;
}
.choice-row-btn:hover:not(:disabled) {
  border-color: var(--sky);
  transform: translateY(-2px);
}
.choice-row-btn:active:not(:disabled) {
  transform: translateY(3px) scale(0.985);
}
.choice-row-btn.selected {
  background: var(--sky-light);
  border-color: var(--sky);
  box-shadow: 0 4px 0 var(--sky-dark);
  color: var(--sky-dark);
  animation: popBounce 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.choice-row-btn.correct {
  background: var(--success-light);
  border-color: var(--success);
  box-shadow: 0 4px 0 var(--success-dark);
  color: var(--success-dark);
}
.choice-row-btn.wrong-try {
  background: var(--hint-bg);
  border-color: var(--hint-border);
  animation: gentleShake 0.35s ease;
}

/* Word Bank & Spelling Tiles (Strictly LTR inside tray!) */
.ltr-tray {
  direction: ltr;
  unicode-bidi: isolate;
  min-height: 56px;
  padding: 8px 10px;
  background: var(--surface);
  border: 2.5px dashed var(--sky-border);
  border-radius: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
}

.ltr-tray-placeholder {
  font-family: var(--font-ku);
  direction: rtl;
  width: 100%;
  text-align: center;
  color: var(--ink-muted);
  font-size: 0.9rem;
}

.ltr-bank {
  direction: ltr;
  unicode-bidi: isolate;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 2px 0;
}

.word-tile {
  font-family: var(--font-en);
  direction: ltr;
  unicode-bidi: isolate;
  min-height: 46px;
  min-width: 46px;
  padding: 8px 14px;
  border-radius: 12px;
  border: 2.5px solid var(--border-strong);
  box-shadow: 0 3px 0 var(--border-strong);
  background: var(--surface);
  font-size: 1.12rem;
  font-weight: 800;
  color: var(--ink);
  transition: transform 0.1s, background-color 0.12s;
}
.word-tile:hover:not(:disabled) {
  border-color: var(--sky);
  transform: translateY(-2px);
}
.word-tile:active:not(:disabled) {
  transform: translateY(3px) scale(0.95);
}
.word-tile.tile-placed {
  background: var(--sky-light);
  border-color: var(--sky);
  box-shadow: 0 3px 0 var(--sky-dark);
  color: var(--sky-dark);
  animation: popBounce 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.word-tile.tile-used {
  opacity: 0.25;
  pointer-events: none;
}

/* Tap-to-Match Pairs */
.pairs-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.pairs-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pair-btn {
  min-height: clamp(48px, 7.4dvh, 56px);
  padding: 8px 10px;
  border-radius: 14px;
  border: 2.5px solid var(--border-strong);
  box-shadow: 0 3px 0 var(--border-strong);
  background: var(--surface);
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.3;
}
.pair-btn.selected {
  background: var(--sky-light);
  border-color: var(--sky);
  box-shadow: 0 4px 0 var(--sky-dark);
  color: var(--sky-dark);
}
.pair-btn.matched {
  background: var(--success-light);
  border-color: var(--success-border);
  box-shadow: none;
  color: var(--success-dark);
  opacity: 0.78;
  cursor: default;
}
.pair-btn.wrong-try {
  background: var(--hint-bg);
  border-color: var(--hint-border);
  animation: gentleShake 0.35s ease;
}

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

/* Pinned Bottom Action Footer inside Full-Screen Lesson */
.lesson-footer {
  flex-shrink: 0;
  padding: 10px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--surface);
  border-top: 2px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lesson-footer .btn {
  min-height: 50px;
  padding: 10px 20px;
  font-size: 1.06rem;
}

.lesson-footer.footer-correct {
  background: var(--success-light);
  border-top-color: var(--success-border);
}

.lesson-footer.footer-hint {
  background: var(--hint-bg);
  border-top-color: var(--hint-border);
}

.feedback-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.feedback-icon {
  font-size: 1.3rem;
  line-height: 1.2;
  flex-shrink: 0;
}

.feedback-text-wrap {
  flex: 1;
  min-width: 0;
}

.feedback-headline {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 900;
  line-height: 1.4;
}
.footer-correct .feedback-headline {
  color: var(--success-dark);
}
.footer-hint .feedback-headline {
  color: var(--hint-text);
}

.feedback-detail {
  margin: 2px 0 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.45;
}

/* ==========================================================================
   Lesson Celebration Screen — Full-Screen Fit Without Scrolling
   ========================================================================== */
.celebration-screen {
  flex: 1;
  height: 100%;
  max-height: 100dvh;
  padding: 12px 14px calc(14px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow-y: auto;
}

.celebration-card {
  width: 100%;
  background: var(--surface);
  border: 2.5px solid var(--sun);
  border-radius: var(--radius-lg);
  padding: clamp(14px, 2.4dvh, 22px) 16px;
  box-shadow: 0 14px 36px rgba(255, 183, 3, 0.16);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(8px, 1.6dvh, 14px);
  position: relative;
  overflow: hidden;
  animation: unitCardPopIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.celebration-screen .dyako-avatar-wrap.dyako-lg {
  width: clamp(84px, 14dvh, 114px);
  height: clamp(92px, 15dvh, 126px);
}

.celebration-title {
  margin: 0;
  font-size: clamp(1.28rem, 2.8dvh, 1.52rem);
  font-weight: 900;
  color: var(--primary-dark);
}

.celebration-learned-box {
  width: 100%;
  background: var(--primary-light);
  border: 2px solid var(--primary-border);
  border-radius: 16px;
  padding: 10px 12px;
  text-align: right;
}

.celebration-learned-heading {
  margin: 0 0 4px;
  font-size: 0.88rem;
  font-weight: 900;
  color: var(--primary-dark);
}

.learned-words-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.celebration-stats-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.celeb-stat-box {
  background: var(--bg-cream);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 7px 6px;
}

.celeb-stat-val {
  display: block;
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--ink);
}

.celeb-stat-lbl {
  display: block;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.celebration-card .btn {
  min-height: 48px;
  padding: 10px 16px;
  font-size: 1rem;
}

/* ==========================================================================
   Modals (Profile Switcher, Guide & Install — 100% Centered Across All Screens)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100dvh;
  z-index: 200;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  margin: 0;
}

.hidden {
  display: none !important;
}

.modal-card {
  width: 100%;
  max-width: min(440px, calc(100vw - 28px));
  max-height: 86dvh;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 2px solid var(--border);
  padding: 18px 16px;
  margin: 0 auto;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.24);
  animation: unitCardPopIn 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.modal-card-wide {
  max-width: min(520px, calc(100vw - 28px));
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.16rem;
  font-weight: 900;
  min-width: 0;
}

.modal-subtitle {
  margin: 0 0 14px;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

.profile-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
  width: 100%;
}

.profile-item-btn {
  width: 100%;
  min-width: 0;
  min-height: 60px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-strong);
  background: var(--bg-cream);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: right;
}
.profile-item-btn.active-profile {
  background: var(--primary-light);
  border-color: var(--primary);
}

.profile-item-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.profile-item-name {
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--ink);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-item-stats {
  font-size: 0.8rem;
  color: var(--ink-soft);
  display: block;
}

.confetti-Piece {
  position: absolute;
  top: -12px;
  width: 10px;
  height: 14px;
  border-radius: 3px;
  opacity: 0.9;
  animation: confettiFall 2.4s ease-out forwards;
  pointer-events: none;
}

@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(340px) rotate(420deg); opacity: 0; }
}

.guide-badge {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 800;
  font-size: 0.86rem;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.guide-list {
  padding-right: 20px;
  margin: 12px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
