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

:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-soft: #f1f5f9;
  --text: #0f172a;
  --text-muted: #475569;
  --text-light: #64748b;
  --border: #e2e8f0;
  --primary: #4338ca;
  --primary-light: #eef2ff;
  --teal: #0f766e;
  --teal-light: #f0fdfa;
  --amber: #d97706;
  --amber-light: #fffbeb;
  --rose: #e11d48;
  --rose-light: #fff1f2;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
}

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

body {
  font-family: 'Cairo', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.de-text {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  direction: ltr;
  unicode-bidi: isolate;
}

/* Header */
.app-header {
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 60%, #4338ca 100%);
  color: #fff;
  padding: 16px 16px 20px;
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.2);
}

.header-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.brand-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.brand h1 {
  font-size: 1.15rem;
  font-weight: 900;
  line-height: 1.25;
}

.brand p {
  font-size: 0.78rem;
  color: #c7d2fe;
  font-weight: 600;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-nav-back {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  padding: 6px 14px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 800;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.18s;
}

.btn-nav-back:hover {
  background: rgba(255, 255, 255, 0.28);
}

.voice-select {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 10px;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  max-width: 175px;
  cursor: pointer;
}

.voice-select option {
  color: var(--text);
  background: #fff;
}

/* Container */
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 16px 80px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Hero Diagnostic Banner */
.diag-hero {
  background: linear-gradient(135deg, #ffffff 0%, #f0fdfa 100%);
  border: 2px solid #99f6e4;
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.diag-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.diag-head h2 {
  font-size: 1.25rem;
  font-weight: 900;
  color: #0f766e;
  display: flex;
  align-items: center;
  gap: 8px;
}

.diag-pill {
  background: #fef3c7;
  color: #92400e;
  font-size: 0.76rem;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid #fde68a;
}

.diag-desc {
  font-size: 0.88rem;
  color: #334155;
  line-height: 1.65;
}

/* Infographic 3-Step Trick */
.trick-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  margin-top: 4px;
}

.trick-step-card {
  background: #fff;
  border: 1.5px solid #ccfbf1;
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.trick-step-icon {
  font-size: 1.8rem;
  line-height: 1;
}

.trick-step-title {
  font-size: 0.86rem;
  font-weight: 800;
  color: #0f172a;
}

.trick-step-text {
  font-size: 0.76rem;
  color: #475569;
  line-height: 1.45;
  margin-top: 2px;
}

/* Category Filter Chips */
.cat-filter-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cat-btn {
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.16s;
}

.cat-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.cat-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(67, 56, 202, 0.26);
}

/* Drill Cards Grid */
.drills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 18px;
}

.drill-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: all 0.2s ease;
  position: relative;
}

.drill-card:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-md);
}

.drill-card.playing-now {
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.28);
}

.drill-card.mastered {
  border-color: #6ee7b7;
  background: linear-gradient(180deg, #ffffff 0%, #f0fdf4 100%);
}

.drill-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.drill-cat-badge {
  font-size: 0.72rem;
  font-weight: 800;
  color: #4338ca;
  background: #eef2ff;
  padding: 2px 9px;
  border-radius: 999px;
}

.drill-actions-top {
  display: flex;
  align-items: center;
  gap: 6px;
}

.drill-icon-btn {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.15s;
}

.drill-icon-btn.is-done {
  background: #d1fae5;
  border-color: #34d399;
}

/* German Word Target Box */
.drill-phrase-box {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s;
}

.drill-phrase-box:hover {
  background: #f1f5f9;
}

.drill-de-text {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  direction: ltr;
  font-size: 1.55rem;
  font-weight: 900;
  color: #0f172a;
  letter-spacing: -0.3px;
  line-height: 1.35;
}

/* Phonetic Color Markers */
.ph-s {
  background: #fef08a;
  color: #854d0e;
  padding: 1px 4px;
  border-radius: 5px;
  font-weight: 900;
  border-bottom: 2px solid #ca8a04;
}

.ph-sch {
  background: #a7f3d0;
  color: #065f46;
  padding: 1px 5px;
  border-radius: 5px;
  font-weight: 900;
  border-bottom: 2px solid #059669;
}

.ph-st {
  background: #c7d2fe;
  color: #312e81;
  padding: 1px 4px;
  border-radius: 5px;
  font-weight: 900;
}

.ph-z {
  background: #fecdd3;
  color: #9f1239;
  padding: 1px 5px;
  border-radius: 5px;
  font-weight: 900;
  border-bottom: 2px solid #e11d48;
}

.ph-ich {
  background: #bae6fd;
  color: #0369a1;
  padding: 1px 4px;
  border-radius: 5px;
  font-weight: 900;
}

.ph-ach {
  background: #fed7aa;
  color: #9a3412;
  padding: 1px 4px;
  border-radius: 5px;
  font-weight: 900;
}

.ph-stop {
  background: #fee2e2;
  color: #b91c1c;
  padding: 1px 6px;
  border-radius: 5px;
  font-weight: 900;
  border: 1px dashed #ef4444;
}

.ph-v {
  background: #ddd6fe;
  color: #5b21b6;
  padding: 1px 4px;
  border-radius: 5px;
  font-weight: 900;
}

.ph-f {
  background: #fbcfe8;
  color: #9d174d;
  padding: 1px 4px;
  border-radius: 5px;
  font-weight: 900;
}

.ph-p {
  background: #fef08a;
  color: #854d0e;
  padding: 1px 4px;
  border-radius: 5px;
  font-weight: 900;
}

.ph-b {
  background: #ccfbf1;
  color: #0f766e;
  padding: 1px 4px;
  border-radius: 5px;
  font-weight: 900;
}

.drill-phonetic-guide {
  font-size: 0.8rem;
  color: #475569;
  margin-top: 6px;
  direction: rtl;
  font-weight: 700;
}

.drill-meaning {
  font-size: 0.95rem;
  font-weight: 800;
  color: #1e293b;
  text-align: center;
}

/* Syllable Breakdown Pills */
.syllable-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  direction: ltr;
}

.syllable-btn {
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 8px;
  padding: 3px 9px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s;
}

.syllable-btn:hover {
  background: #4338ca;
  color: #fff;
  border-color: #4338ca;
}

.syllable-sep {
  color: #94a3b8;
  font-weight: 800;
  font-size: 0.8rem;
}

/* 3-Speed Ladder */
.speed-ladder-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.speed-ladder-title {
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.speed-btns-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.speed-btn {
  border: 1.5px solid var(--border);
  background: #fff;
  border-radius: 10px;
  padding: 7px 4px;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: all 0.16s;
}

.speed-btn-slow {
  background: #f0f9ff;
  border-color: #bae6fd;
  color: #0369a1;
}

.speed-btn-slow:hover {
  background: #e0f2fe;
}

.speed-btn-norm {
  background: #f0fdfa;
  border-color: #99f6e4;
  color: #0f766e;
}

.speed-btn-norm:hover {
  background: #ccfbf1;
}

.speed-btn-fast {
  background: #fffbeb;
  border-color: #fde68a;
  color: #b45309;
}

.speed-btn-fast:hover {
  background: #fef3c7;
}

/* Practice Action Row (Shadowing + Voice Recorder) */
.practice-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.practice-btn {
  flex: 1;
  min-width: 130px;
  border: 1.5px solid var(--border);
  background: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.16s;
}

.practice-btn-shadow {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #3730a3;
}

.practice-btn-shadow:hover {
  background: #e0e7ff;
}

.practice-btn-record {
  background: #fff1f2;
  border-color: #fecdd3;
  color: #be123c;
}

.practice-btn-record.recording {
  background: #be123c;
  color: #fff;
  border-color: #9f1239;
  animation: pulseRec 1s infinite alternate;
}

@keyframes pulseRec {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0.8; transform: scale(0.98); }
}

.practice-btn-playrec {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #047857;
  display: none;
}

.practice-btn-playrec.has-audio {
  display: inline-flex;
}

/* Anatomy & Trap Boxes */
.anatomy-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.anatomy-head {
  font-size: 0.74rem;
  font-weight: 900;
  color: #0f766e;
  display: flex;
  align-items: center;
  gap: 5px;
}

.anatomy-text {
  font-size: 0.78rem;
  color: #334155;
  line-height: 1.5;
}

.trap-pill-box {
  background: #fff1f2;
  border: 1px solid #fecdd3;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.74rem;
  color: #9f1239;
  line-height: 1.45;
}

/* Real Sentence Box */
.context-sentence-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.context-sentence-box .de-text {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
}

.context-sentence-box .ar-meaning {
  font-size: 0.78rem;
  color: #78350f;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #0f172a;
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  z-index: 100;
  transition: transform 0.25s ease;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 640px) {
  .drills-grid {
    grid-template-columns: 1fr;
  }
  .trick-steps {
    grid-template-columns: 1fr;
  }
}
