/* Qur'an-Wörter — Design-System v2
   Ruhig, buchhaft, würdevoll: tiefes Teal (Tinte) + feines Gold (Mushaf-
   Ornamentik), Serifen-Displayschrift für Titel und Zahlen, klare Sans für
   Fließtext, Naskh für Arabisch. Hell/dunkel, responsiv, reduzierte Motion. */

/* Quran-Naskh selbst mitgeliefert (Scheherazade New, SIL OFL — dieselbe Schrift
   wie im Lesekurs). Ohne eigene Schrift greift auf jedem Gerät eine andere
   Systemschrift; einige davon setzen die Vokalzeichen falsch (sichtbar
   verschobene Harakāt, z. B. bei لَا إِلَٰهَ إِلَّا اللَّهُ). Scheherazade bringt
   korrekte Zeichen-Positionierung (GPOS) mit und rendert überall gleich. */
@font-face {
  font-family: "Scheherazade New";
  font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/scheherazade-new-arabic-400.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: "Scheherazade New";
  font-style: normal; font-weight: 700; font-display: swap;
  src: url("../fonts/scheherazade-new-arabic-700.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
}

:root {
  --accent: #0e7268;
  --accent-strong: #0a5d55;
  --accent-soft: rgba(14, 114, 104, 0.1);
  --gold: #b8912f;
  --gold-soft: rgba(184, 145, 47, 0.35);
  --bg: #f3f4f2;
  --card: #ffffff;
  --text: #1b2528;
  --text-secondary: #5f6b6e;
  --border: rgba(27, 37, 40, 0.09);
  --shadow: 0 1px 2px rgba(27, 37, 40, 0.05), 0 10px 28px -18px rgba(27, 37, 40, 0.25);
  --red: #c04a4a;
  --red-soft: rgba(192, 74, 74, 0.1);
  --orange: #b56a1e;
  --orange-soft: rgba(181, 106, 30, 0.1);
  --blue: #3a6ea5;
  --blue-soft: rgba(58, 110, 165, 0.1);
  --green: #2e8b4f;
  --radius: 16px;
  --radius-lg: 22px;
  /* Warmer Gamification-Akzent (Streak, nächstes Ziel) */
  --warm: #c8811d;
  --warm-strong: #a9690f;
  --warm-soft: rgba(245, 166, 35, 0.13);
  --warm-track: rgba(245, 166, 35, 0.22);
  /* Flächen */
  --surface-soft: rgba(14, 114, 104, 0.055);
  --track: rgba(27, 37, 40, 0.08);
  --header-bg: #ffffff;
  /* Textvarianten der Bewertungsfarben: dieselben Töne, dunkel genug für
     WCAG AA auf den pastelligen Flächen (gemessen ≥ 4,5:1). */
  --red-text: #9c2f2f;
  --orange-text: #8a4f0e;
  --blue-text: #2b5480;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --arabic-font: "Scheherazade New", "KFGQPC Uthman Taha Naskh", "Geeza Pro",
    "Al Bayan", "Noto Naskh Arabic", "Traditional Arabic", "Amiri", serif;
}
/* Dunkles Farbschema: greift bei data-theme="dark" oder — im System-Modus —
   wenn das Betriebssystem Dunkelmodus meldet. */
:root[data-theme="dark"] {
  --accent: #3aaf9f;
  --accent-strong: #4cc4b3;
  --accent-soft: rgba(58, 175, 159, 0.14);
  --gold: #d0ab52;
  --gold-soft: rgba(208, 171, 82, 0.35);
  --bg: #131719;
  --card: #1d2326;
  --text: #eef1f1;
  --text-secondary: #98a4a6;
  --border: rgba(238, 241, 241, 0.09);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 30px -18px rgba(0, 0, 0, 0.6);
  --red: #d97070;
  --red-soft: rgba(217, 112, 112, 0.13);
  --orange: #d29050;
  --orange-soft: rgba(210, 144, 80, 0.13);
  --blue: #7aa3d0;
  --blue-soft: rgba(122, 163, 208, 0.13);
  --green: #67b385;
  --warm: #e2a24d;
  --warm-strong: #efb469;
  --warm-soft: rgba(226, 162, 77, 0.14);
  --warm-track: rgba(226, 162, 77, 0.2);
  --surface-soft: rgba(58, 175, 159, 0.08);
  --track: rgba(238, 241, 241, 0.1);
  --header-bg: #1a2023;
  --red-text: #e79191;
  --orange-text: #e0a468;
  --blue-text: #9dc0e6;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --accent: #3aaf9f;
    --accent-strong: #4cc4b3;
    --accent-soft: rgba(58, 175, 159, 0.14);
    --gold: #d0ab52;
    --gold-soft: rgba(208, 171, 82, 0.35);
    --bg: #131719;
    --card: #1d2326;
    --text: #eef1f1;
    --text-secondary: #98a4a6;
    --border: rgba(238, 241, 241, 0.09);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 30px -18px rgba(0, 0, 0, 0.6);
    --red: #d97070;
    --red-soft: rgba(217, 112, 112, 0.13);
    --orange: #d29050;
    --orange-soft: rgba(210, 144, 80, 0.13);
    --blue: #7aa3d0;
    --blue-soft: rgba(122, 163, 208, 0.13);
    --green: #67b385;
    --warm: #e2a24d;
    --warm-strong: #efb469;
    --warm-soft: rgba(226, 162, 77, 0.14);
    --warm-track: rgba(226, 162, 77, 0.2);
    --surface-soft: rgba(58, 175, 159, 0.08);
    --track: rgba(238, 241, 241, 0.1);
    --header-bg: #1a2023;
    --red-text: #e79191;
    --orange-text: #e0a468;
    --blue-text: #9dc0e6;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

/* ---- Layout ----
   Kopfzeile über die volle Breite, Inhalte in einer zentrierten Spalte.
   Die Übersicht nutzt die breite Spalte (#main.main-wide), alle anderen
   Ansichten bleiben bei den gewohnten 760 px. */
#app {
  margin: 0 auto;
  padding: 0 0 calc(30px + env(safe-area-inset-bottom));
  min-height: 100vh;
}
#brand {
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand-inner {
  max-width: 1040px;
  margin: 0 auto;
  min-height: 84px;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 13px;
}
.brand-actions { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; }
.brand-logo-link {
  display: inline-flex; align-items: center; flex: none;
  border-radius: 16px;
  transition: transform 0.15s ease;
}
.brand-logo-link:hover { transform: scale(1.04); }
.brand-logo { width: 45px; height: 45px; border-radius: 18px; flex: none; }

.onboarding-logo { width: 116px; height: 116px; border-radius: 26px; }
/* Logo-Variante folgt dem Farbschema (wie die Farb-Tokens) */
.logo-dark { display: none; }
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: inline-block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) .logo-light { display: none; }
  :root:not([data-theme="light"]):not([data-theme="dark"]) .logo-dark { display: inline-block; }
}
.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.01em;
  white-space: nowrap;      /* sonst bricht der Name auf schmalen Geräten um */
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Burger-Button – öffnet den Menü-Drawer */
.menu-btn {
  width: 42px; height: 42px; border-radius: 12px;
  border: none; background: none; color: var(--text);
  cursor: pointer; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.menu-btn:hover { background: var(--accent-soft); }
.menu-btn .ic { width: 24px; height: 24px; }
.ic { width: 19px; height: 19px; flex: none; vertical-align: -4px; }

#main {
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 24px 40px;
  animation: view-in 0.22s ease both;
}
#main.main-wide { max-width: 1180px; }
@media (max-width: 560px) {
  .brand-inner { padding: 8px 16px; min-height: 72px; gap: 10px; }
  .brand-logo { width: 32px; height: 32px; border-radius: 14px; }
  .brand-name { font-size: 15px; }
  .brand-actions { gap: 4px; }
  #main { padding: 16px 16px 32px; }
}
@keyframes view-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ---- Seitenmenü (Drawer) – ersetzt die frühere Sidebar/Tabbar ---- */
body.no-scroll { overflow: hidden; }
.drawer-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(12, 20, 22, 0.42);
  display: flex; justify-content: flex-end;
  opacity: 0; transition: opacity 0.25s ease;
}
.drawer-overlay[hidden] { display: none; }
.drawer-overlay.open { opacity: 1; }
.drawer {
  width: 320px; max-width: 86vw; height: 100%; overflow-y: auto;
  background: var(--card); box-shadow: -14px 0 44px rgba(0, 0, 0, 0.2);
  border-top-left-radius: 20px; border-top-right-radius: 20px;
  transform: translateX(100%); transition: transform 0.25s ease;
  display: flex; flex-direction: column;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
}
.drawer-overlay.open .drawer { transform: translateX(0); }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 16px 12px 6px;
}
.drawer-title {
  flex: 1; padding-inline-start: 8px;
  font-family: var(--font-display); font-weight: 600; font-size: 17px;
}
.drawer-icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: none; background: none; flex: none;
  color: var(--text); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.drawer-icon-btn:hover { background: var(--accent-soft); }
.drawer-nav { display: flex; flex-direction: column; padding: 8px 10px; }
.drawer-item {
  display: flex; align-items: center; gap: 13px;
  padding: 12px 14px; border-radius: 11px;
  border: none; background: none; width: 100%; text-align: start;
  color: var(--text); font: inherit; font-size: 15.5px; cursor: pointer;
  text-decoration: none;
}
.drawer-item:hover { background: var(--accent-soft); }
.drawer-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.drawer-item .ic { color: var(--accent); flex: none; width: 20px; height: 20px; }
.drawer-item > span { flex: 1; }
.drawer-ext { flex: none !important; margin-inline-start: auto; }
.drawer-ext .ic { width: 16px; height: 16px; color: var(--text-secondary); }
.drawer-sep { border: none; border-top: 1px solid var(--border); margin: 8px 14px; }

/* ---- Typografie ---- */
h1.page-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 0.005em;
  margin: 4px 0 18px;
}
h2.section { font-size: 16px; margin: 24px 0 10px; }
.muted { color: var(--text-secondary); }
.small { font-size: 13px; }
.footnote { font-size: 12.5px; color: var(--text-secondary); margin: 10px 2px 0; line-height: 1.55; }

/* ---- Karten & Bausteine ---- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card h3 {
  margin: 0 0 12px;
  font-size: 11.5px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 7px;
}
.card h3 .ic { width: 15px; height: 15px; color: var(--accent); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.card.stat { padding: 18px 20px; }
.stat-icon { color: var(--accent); display: inline-flex; }
.stat-icon .ic { width: 20px; height: 20px; }
.stat-value {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  margin: 6px 0 2px;
  font-variant-numeric: oldstyle-nums;
}
.stat-label { color: var(--text-secondary); font-size: 12.5px; }

progress {
  width: 100%;
  height: 7px;
  appearance: none;
  border: none;
  border-radius: 4px;
  overflow: hidden;
  background: var(--accent-soft);
}
progress::-webkit-progress-bar { background: var(--accent-soft); }
progress::-webkit-progress-value { background: var(--accent); border-radius: 4px; }
progress::-moz-progress-bar { background: var(--accent); }

.btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: none;
  border-radius: 13px;
  padding: 13px 18px;
  font-size: 15.5px;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent-soft);
  color: var(--accent);
  width: 100%;
  margin-bottom: 10px;
  font-family: inherit;
  transition: transform 0.12s ease, filter 0.15s ease;
}
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-strong); }
.btn.compact { width: auto; padding: 9px 15px; font-size: 14px; margin: 0; }
.btn.danger { background: var(--red-soft); color: var(--red); }
.btn:active { transform: scale(0.985); }
.btn .ic { width: 17px; height: 17px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.chip {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 999px;
  padding: 3px 11px;
  margin: 2px;
}

/* ---- Arabisch ---- */
.arabic {
  font-family: var(--arabic-font);
  direction: rtl;
  unicode-bidi: isolate;
  line-height: 1.9;
}
.arabic.xl { font-size: clamp(46px, 9vw, 66px); text-align: center; }
.arabic.lg { font-size: 34px; text-align: center; }
.arabic.md { font-size: 26px; }
.arabic.sm { font-size: 21px; }

/* ---- Lernkarte: 3D-Flip mit Mushaf-Ornament ---- */
.flashcard-scene {
  perspective: 1400px;
  height: clamp(340px, 52vh, 460px);
  margin-bottom: 4px;
  /* Wächst per JS auf Inhaltshöhe, wenn der Beispielvers aufgeklappt wird. */
  transition: height 0.3s ease;
}
.flashcard3d {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.2, 0.7, 0.25, 1);
  cursor: pointer;
}
.flashcard3d.is-flipped { transform: rotateY(180deg); }
.face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-y: auto;
  display: flex;
}
.face.back { transform: rotateY(180deg); }
.face-inner {
  margin: auto;
  width: 100%;
  padding: 34px 24px 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}
/* Ornament: feine Goldlinie mit Stern — Anklang an Mushaf-Seitenrahmen */
.face::before {
  content: "";
  position: absolute;
  top: 15px; left: 26px; right: 26px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-soft) 18%, var(--gold-soft) 82%, transparent);
  pointer-events: none;
}
.face::after {
  content: "✦";
  position: absolute;
  top: 4px; left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: var(--gold);
  background: var(--card);
  padding: 0 10px;
  pointer-events: none;
}
.flashcard3d .translit { font-style: italic; color: var(--text-secondary); font-size: 16.5px; }
.flashcard3d .meaning { font-size: 22px; font-weight: 650; line-height: 1.35; max-width: 30ch; }
/* Klammerzusatz wie „(männlich, angehängte Endung)" leiser als die Bedeutung */
.flashcard3d .meaning .qualifier { font-weight: 500; color: var(--text-secondary); font-size: 0.82em; }
.present-line { font-size: 14px; color: var(--text-secondary); }
.present-line .arabic { font-size: 22px; line-height: 1.4; }
.example-block {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  width: 100%;
}
.example-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--accent);
  font-size: 13.5px;
  font-weight: 600;
  min-height: 44px;
  padding: 0 20px;
  cursor: pointer;
  font-family: inherit;
  margin-top: 8px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.example-toggle .ic { width: 17px; height: 17px; }
.example-toggle:hover { background: var(--accent-soft); border-color: var(--accent); }
/* Hervorgehobene Fundform des Wortes im Vers (und ihre Wiedergabe in der Übersetzung) */
.hl { color: var(--gold); font-weight: 600; }
/* Im Arabischen NUR die Farbe ändern: Eine andere Schriftstärke zwingt den
   Browser zu einer zweiten Schriftdatei und bricht damit die Verbindung der
   Buchstaben genau an der Span-Grenze auf. Das fällt auf, sobald nur ein Teil
   eines Wortes markiert ist (z. B. die angehängte Endung in رَبُّهُ). */
.arabic .hl { font-weight: inherit; }
/* Hinweiszeile: nur wenn die Übersetzung das Wort kontextuell wiedergibt */
.example-gloss {
  display: inline-block;
  margin-top: 8px;
  padding: 5px 12px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--text-secondary);
  font-size: 12.5px;
  line-height: 1.7;
}
.example-gloss .arabic { font-size: 17px; line-height: 1; }

@media (prefers-reduced-motion: reduce) {
  .flashcard3d { transition: none; }
  .flashcard-scene { transition: none; }
  #main { animation: none; }
  .btn { transition: none; }
}

/* ---- Session-Zeile über der Karte ---- */
.session-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 2px 14px;
}
.session-text { font-size: 13px; color: var(--text-secondary); flex: none; }
.session-meter {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: var(--track);
  overflow: hidden;
  max-width: 260px;
}
.session-meter-fill {
  display: block; height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---- Bewertung: Erklärung + Buttons ----
   Icon UND Text tragen die Bedeutung; die Farbe ist nur Verstärkung. */
.rating-guide {
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-top: 14px;
  /* feiner Goldakzent, sparsam wie auf der Karte */
  border-top: 2px solid var(--gold-soft);
}
.rating-guide-head { display: flex; align-items: flex-start; gap: 12px; }
.rating-guide .rating-guide-title {
  display: block;
  margin: 0;
  font-size: 15.5px;
  font-weight: 650;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
}
.rating-guide-sub { margin: 3px 0 0; font-size: 13px; color: var(--text-secondary); }
.rating-guide-close {
  margin-inline-start: auto;
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--border); background: none;
  color: var(--text-secondary); cursor: pointer; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.rating-guide-close:hover { color: var(--accent); border-color: var(--accent); }
.rating-guide-close .ic { width: 15px; height: 15px; }

.rating-guide-list { list-style: none; margin: 14px 0 0; padding: 0; }
.rating-guide-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 9px 0;
}
.rating-guide-item + .rating-guide-item { border-top: 1px solid var(--border); }
.rating-guide-icon {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.rating-guide-icon .ic { width: 16px; height: 16px; }
.rating-guide-text { min-width: 0; }
.rating-guide-name { font-weight: 650; font-size: 14px; }
.rating-guide-desc { display: block; font-size: 13px; color: var(--text-secondary); line-height: 1.45; }
.rating-guide-short { display: none; font-size: 13px; color: var(--text-secondary); }
.rating-guide .btn.compact { margin-top: 14px; }

/* Farbzuordnung — einmal je Stufe, für Erklärung und Button gemeinsam */
.rating-guide-item.rate-again .rating-guide-icon { background: var(--red-soft); color: var(--red); }
.rating-guide-item.rate-again .rating-guide-name { color: var(--red-text); }
.rating-guide-item.rate-hard .rating-guide-icon { background: var(--orange-soft); color: var(--orange); }
.rating-guide-item.rate-hard .rating-guide-name { color: var(--orange-text); }
.rating-guide-item.rate-good .rating-guide-icon { background: var(--accent-soft); color: var(--accent); }
.rating-guide-item.rate-good .rating-guide-name { color: var(--accent); }
.rating-guide-item.rate-easy .rating-guide-icon { background: var(--blue-soft); color: var(--blue); }
.rating-guide-item.rate-easy .rating-guide-name { color: var(--blue-text); }

.review-buttons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
.review-buttons .btn {
  flex-direction: column;
  justify-content: center;
  margin: 0;
  padding: 12px 6px;
  gap: 3px;
  min-height: 84px;
  border: 1px solid transparent;
  border-radius: 16px;
  transition: transform 0.12s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.review-buttons .btn .ic { width: 20px; height: 20px; margin-bottom: 1px; }
.review-buttons .btn span { font-size: 14.5px; font-weight: 650; }
.review-buttons .btn small { font-size: 11.5px; font-weight: 500; line-height: 1.3; }
.review-buttons .btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px -6px rgba(27, 37, 40, 0.32);
  border-color: currentColor;
}
.review-buttons .btn:active { transform: translateY(0) scale(0.99); }
.btn.rate-again { background: var(--red-soft); color: var(--red-text); }
.btn.rate-hard { background: var(--orange-soft); color: var(--orange-text); }
.btn.rate-good { background: var(--accent-soft); color: var(--accent); }
.btn.rate-easy { background: var(--blue-soft); color: var(--blue-text); }

/* Kompakter, sobald vier Buttons nebeneinander eng werden */
@media (max-width: 560px) {
  .review-buttons { gap: 8px; }
  .review-buttons .btn { min-height: 68px; padding: 10px 4px; }
  .review-buttons .btn small { display: none; }
  /* Kompakte Erklärung: eine Zeile je Stufe („Nochmal – Nicht gewusst"),
     damit die Bewertungsbuttons ohne langes Scrollen erreichbar sind. */
  .rating-guide { padding: 15px 16px; }
  .rating-guide-desc { display: none; }
  .rating-guide-short { display: inline; }
  .rating-guide-short::before { content: " – "; }
  .rating-guide-item { align-items: center; padding: 7px 0; gap: 10px; }
  .rating-guide-icon { width: 28px; height: 28px; }
  .rating-guide-icon .ic { width: 14px; height: 14px; }
  .rating-guide-list { margin-top: 10px; }
  .rating-guide-sub { font-size: 12.5px; }
  .session-meter { max-width: none; }
  /* Karte etwas flacher — sonst beginnt der Bewertungsbereich zu tief */
  .flashcard-scene { height: clamp(300px, 42vh, 420px); }
}
/* Sehr schmal: 2x2, dafür passen die Untertexte wieder */
@media (max-width: 400px) {
  .review-buttons { grid-template-columns: 1fr 1fr; }
  .review-buttons .btn { min-height: 72px; }
  .review-buttons .btn small { display: block; }
}

.hint-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 12px auto 0;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 12.5px;
  cursor: pointer;
  font-family: inherit;
  padding: 6px 10px;
  border-radius: 8px;
}
.hint-toggle:hover { color: var(--accent); background: var(--accent-soft); }
.hint-toggle .ic { width: 16px; height: 16px; flex: none; }
/* Label klappt bei Hover/Fokus rechts neben dem Fragezeichen auf */
.hint-toggle .hint-label {
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  opacity: 0;
  transition: max-width 0.25s ease, opacity 0.2s ease;
}
.hint-toggle:hover .hint-label,
.hint-toggle:focus-visible .hint-label { max-width: 140px; opacity: 1; }

/* ---- Quiz ---- */
.quiz-option {
  width: 100%;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 13px;
  padding: 14px 16px;
  margin-bottom: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
  text-align: center;
  font-family: inherit;
  transition: border-color 0.15s ease, transform 0.12s ease;
}
.quiz-option:not(:disabled):hover { border-color: var(--accent); }
.quiz-option:not(:disabled):active { transform: scale(0.99); }
.quiz-option.correct { border-color: var(--green); }
.quiz-option.wrong { border-color: var(--red); }
.quiz-option:disabled { cursor: default; }
.result-arabic { font-size: 24px; line-height: 1.6; }
.quiz-score {
  font-family: var(--font-display);
  font-size: 54px;
  font-weight: 650;
  color: var(--accent);
  text-align: center;
  margin: 18px 0 2px;
}

/* ---- Wörterliste ---- */
.searchbar {
  width: 100%;
  padding: 12px 15px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 16px;
  margin-bottom: 10px;
  font-family: inherit;
}
.searchbar:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: center; }
.filters select {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
}
.filters label.toggle { font-size: 13px; color: var(--text-secondary); display: flex; gap: 5px; align-items: center; }
.filters input[type="checkbox"] { accent-color: var(--accent); }
.word-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 12px 16px;
  margin-bottom: 8px;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.12s ease, border-color 0.15s ease;
}
.word-row:hover { transform: translateY(-1px); border-color: var(--accent); }
.word-row .meanings { min-width: 0; }
.word-row .de { font-size: 15px; font-weight: 550; }
.word-row .sub { font-size: 12.5px; color: var(--text-secondary); font-style: italic; }
.word-row .learned-dot { color: var(--accent); font-size: 11px; }

/* ---- Detailseite ---- */
.hero-card { text-align: center; padding: 30px 20px 24px; }
.hero-card .translit { font-style: italic; color: var(--text-secondary); font-size: 18px; margin-top: 2px; }
.review-card { border-left: 3px solid var(--orange); }
.kv {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
}
.kv:last-of-type { border-bottom: none; }
.kv .k { color: var(--text-secondary); flex: none; }
.kv .v { text-align: right; }
a.similar-row { text-decoration: none; color: var(--text); border-radius: 8px; }
a.similar-row:hover { background: var(--accent-soft); }
a.similar-row .k { color: var(--text); }
.forms-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-cell {
  background: var(--accent-soft);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
}
.forms-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.pager { display: flex; justify-content: space-between; gap: 10px; margin: 18px 0 6px; }
.pager.pager-top { margin: 0 0 14px; }
.theme-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.theme-row .choice { margin-bottom: 0; padding: 12px 10px; justify-content: center; gap: 7px; font-size: 14.5px; }

/* ---- Onboarding-Overlay ---- */
#overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 100;
  overflow-y: auto;
  padding: 36px 20px 44px;
}
.onboarding { max-width: 520px; margin: 0 auto; text-align: center; }
.onboarding .big-icon { font-family: var(--arabic-font); font-size: 52px; color: var(--gold); }
.onboarding h1 { font-family: var(--font-display); font-size: 27px; font-weight: 600; }
.onboarding .claim { text-align: left; }
.choice {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 13px;
  padding: 15px 18px;
  margin-bottom: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.15s ease;
}
.choice:hover { border-color: var(--accent); }
.choice.selected { border-color: var(--accent); }
.choice .check { color: var(--accent); }

.empty-state { text-align: center; padding: 52px 16px; }
.empty-state .icon { color: var(--accent); }
.empty-state .icon .ic { width: 44px; height: 44px; }
.empty-state h2 { font-family: var(--font-display); font-size: 20px; font-weight: 600; }
.loading { text-align: center; padding: 60px; color: var(--text-secondary); }
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 12px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}
.back-link .ic { width: 15px; height: 15px; }
a { color: var(--accent); }

/* =========================================================================
   ÜBERSICHT (Startseite)
   Ruhige helle Flächen, eine dominante Tageskarte, darunter Kennzahlen,
   Wochenroutine und der Haupt-CTA. Warme Töne ausschließlich für die
   Gamification-Elemente (Streak, nächstes Ziel).
   ========================================================================= */

.dash-hero {
  position: relative;
  display: flex;
  align-items: center;
  gap: 24px;
  margin: 4px 0 22px;
  min-height: 132px;
}
.dash-hero-text { flex: 1; min-width: 0; }
.dash-greeting {
  margin: 0 0 6px;
  font-size: 14.5px;
  color: var(--text-secondary);
}
.dash-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 3.6vw, 42px);
  line-height: 1.16;
  font-weight: 600;
  letter-spacing: -0.005em;
  margin: 0 0 10px;
  max-width: 21ch;          /* hält die Headline auf höchstens zwei Zeilen */
}
.dash-subtitle { margin: 0; color: var(--text-secondary); font-size: 15.5px; }

/* Dekoration: mitgeliefertes Motiv, bewusst zurückhaltend eingebunden */
.dash-hero-art {
  flex: none;
  width: 360px;
  height: auto;
  opacity: 0.92;
  /* Motiv nach unten laufen lassen, wie im Entwurf */
  align-self: flex-end;
  margin-bottom: -8px;
  pointer-events: none;
  user-select: none;
  /* Zum Text und nach unten hin ausblenden — sonst stehen die Wolken als
     Block mit sichtbarer Schnittkante im Layout. */
  -webkit-mask-image:
    linear-gradient(to right, transparent 0%, #000 26%),
    linear-gradient(to bottom, #000 62%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to right, transparent 0%, #000 26%),
    linear-gradient(to bottom, #000 62%, transparent 100%);
  mask-composite: intersect;
}
/* Auf dunklem Grund sind die hellen Wolken sonst zu präsent */
:root[data-theme="dark"] .dash-hero-art { opacity: 0.3; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) .dash-hero-art { opacity: 0.3; }
}

/* ---- Tageskarte ---- */
.dash-today {
  display: flex;
  align-items: stretch;
  gap: 30px;
  padding: 26px 28px;
  border-radius: var(--radius-lg);
  margin-bottom: 18px;
}
.dash-today-main { flex: 1; min-width: 0; }
.dash-eyebrow {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 14px;
  font-size: 11.5px; font-weight: 650;
  text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--text-secondary);
}
.dash-eyebrow .ic { width: 15px; height: 15px; color: var(--accent); }
.dash-bignum {
  margin: 0 0 16px;
  font-size: 15.5px;
  color: var(--text-secondary);
}
.dash-bignum strong {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 600;
  color: var(--accent);
  margin-inline-end: 4px;
  vertical-align: -2px;
}
.dash-today-status { margin: 12px 0 0; font-size: 14px; color: var(--text-secondary); }
.dash-today-status.is-done { color: var(--accent); font-weight: 650; }
.dash-today-new { margin: 4px 0 0; font-size: 13px; color: var(--text-secondary); }

/* Fortschrittsbalken (auch für „nächstes Ziel" wiederverwendet) */
.meter {
  position: relative;
  height: 13px;
  border-radius: 999px;
  background: var(--track);
  overflow: hidden;
}
.meter-fill {
  display: block; height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
}
.meter-sm { height: 8px; }
.meter-warm { background: var(--warm-track); }
.meter-warm .meter-fill { background: var(--warm); }

/* ---- Streak in der Tageskarte ---- */
.dash-today-streak {
  flex: none;
  width: 300px;
  display: flex;
  align-items: center;
  gap: 20px;
  padding-inline-start: 30px;
  border-inline-start: 1px solid var(--border);
}
.streak-col { flex: none; display: flex; flex-direction: column; align-items: center; gap: 7px; }
.streak-ring { position: relative; width: 88px; height: 88px; }
.streak-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.streak-ring circle { fill: none; stroke-width: 6; stroke-linecap: round; }
.ring-track { stroke: var(--warm-track); }
.ring-fill {
  stroke: var(--warm);
  transition: stroke-dashoffset 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.streak-ring-body {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  line-height: 1;
}
.streak-flame { color: var(--warm); display: inline-flex; }
.streak-flame .ic { width: 17px; height: 17px; }
.streak-num {
  font-family: var(--font-display);
  font-size: 24px; font-weight: 600;
  margin-top: 1px;
}
.streak-unit { font-size: 10px; color: var(--text-secondary); margin-top: 2px; }
.streak-ring-caption { font-size: 12.5px; color: var(--text-secondary); }
.streak-note { min-width: 0; }
.streak-note-title { margin: 0 0 5px; font-size: 14.5px; font-weight: 650; color: var(--warm-strong); }
.streak-note-body { margin: 0; font-size: 13.5px; color: var(--text-secondary); line-height: 1.5; }

/* ---- Kennzahlen ---- */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}
.stat-tile {
  margin: 0;
  padding: 20px;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
}
.stat-tile-icon {
  width: 40px; height: 40px; border-radius: 13px;
  background: var(--surface-soft); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.stat-tile-icon .ic { width: 20px; height: 20px; }
.stat-tile-value {
  font-family: var(--font-display);
  font-size: 30px; font-weight: 600; line-height: 1.1;
  margin: 0 0 6px;
}
.stat-tile-value small { font-size: 15px; color: var(--text-secondary); font-weight: 500; }
.stat-tile-label { margin: 0; font-size: 13.5px; color: var(--text-secondary); }
.stat-tile-hint { margin: 6px 0 0; font-size: 12px; color: var(--text-secondary); opacity: 0.85; }
.stat-tile-badge {
  align-self: flex-start;
  margin: 10px 0 0;
  background: var(--accent-soft); color: var(--accent);
  border-radius: 999px; padding: 3px 10px;
  font-size: 12px; font-weight: 600;
}
/* Vierte Kachel: warmer Akzent */
.stat-tile.is-warm .stat-tile-icon { background: var(--warm-soft); color: var(--warm-strong); }
.goal-title { margin-bottom: 4px; }
.goal-value {
  font-family: var(--font-display);
  font-size: 19px; font-weight: 600;
  margin: 0 0 auto;
  padding-bottom: 14px;
}
.goal-row { display: flex; align-items: center; gap: 10px; }
.goal-row .meter { flex: 1; }
.goal-count { font-size: 12.5px; color: var(--text-secondary); white-space: nowrap; }

/* ---- Wochenroutine ---- */
.dash-routine {
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 18px 24px;
  border-radius: var(--radius-lg);
  margin-bottom: 18px;
}
.routine-intro { display: flex; align-items: center; gap: 13px; flex: 1; min-width: 0; }
.routine-icon {
  width: 40px; height: 40px; border-radius: 13px; flex: none;
  background: var(--surface-soft); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
}
.routine-title { margin: 0; font-weight: 650; font-size: 15px; }
.routine-subtitle { margin: 2px 0 0; font-size: 13px; color: var(--text-secondary); }
.routine-days {
  display: flex; gap: 12px; margin: 0; padding: 0; list-style: none;
  flex: none;
}
.routine-day { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.routine-day-label { font-size: 12px; color: var(--text-secondary); }
.routine-dot {
  width: 30px; height: 30px; border-radius: 50%;
  border: 1.6px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  color: transparent;
}
.routine-dot .ic { width: 15px; height: 15px; stroke-width: 3; }
.routine-day.is-done .routine-dot { border-color: var(--accent); color: var(--accent); background: var(--surface-soft); }
.routine-day.is-today .routine-dot { box-shadow: 0 0 0 3px var(--accent-soft); }
.routine-day.is-future .routine-day-label { opacity: 0.5; }
.routine-day.is-future .routine-dot { opacity: 0.5; border-style: dashed; }
.routine-goal { flex: none; text-align: end; padding-inline-start: 22px; border-inline-start: 1px solid var(--border); }
.routine-goal-label { margin: 0; font-size: 12.5px; color: var(--text-secondary); }
.routine-goal-count { margin: 3px 0 0; font-weight: 650; color: var(--accent); font-size: 15px; }

/* ---- Haupt-CTA ---- */
.cta-learn {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 4px;
  min-height: 78px;
  padding: 14px 22px;
  border-radius: 18px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  text-align: center;
  transition: background 0.15s ease, transform 0.12s ease;
}
.cta-learn:hover { background: var(--accent-strong); transform: translateY(-1px); }
.cta-learn:active { transform: translateY(0); }
.cta-learn-title {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 19px; font-weight: 650;
}
.cta-learn-title .ic { width: 20px; height: 20px; }
.cta-learn-sub { font-size: 13px; opacity: 0.85; font-weight: 400; }
.cta-quiz { margin-top: 10px; }

/* ---- Tipp des Tages ---- */
.main-wide .footnote { max-width: 70ch; margin-top: 18px; }
.dash-tip {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  column-gap: 12px;
  background: var(--surface-soft);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-top: 14px;
}
.tip-icon { color: var(--accent); display: inline-flex; grid-row: 1 / span 2; }
.tip-icon .ic { width: 18px; height: 18px; }
.tip-title { margin: 0; font-size: 13px; font-weight: 650; }
.tip-body { margin: 2px 0 0; grid-column: 2; font-size: 13px; color: var(--text-secondary); }
.tip-close {
  grid-column: 3; grid-row: 1 / span 2;
  width: 32px; height: 32px; border-radius: 9px;
  border: none; background: none; color: var(--text-secondary);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.tip-close:hover { background: var(--accent-soft); color: var(--accent); }
.tip-close .ic { width: 15px; height: 15px; }

/* ---- Übersicht: Tablet ---- */
@media (max-width: 900px) {
  .dash-stats { grid-template-columns: 1fr 1fr; }
  .dash-today { flex-direction: column; gap: 22px; }
  .dash-today-streak {
    width: auto;
    padding-inline-start: 0;
    padding-top: 20px;
    border-inline-start: none;
    border-top: 1px solid var(--border);
  }
  .dash-routine { flex-wrap: wrap; gap: 16px 22px; }
  .routine-days { order: 3; width: 100%; justify-content: space-between; }
  .routine-goal { border-inline-start: none; padding-inline-start: 0; }
  .dash-hero-art { width: 220px; }
}

/* ---- Übersicht: Mobil ---- */
@media (max-width: 560px) {
  .dash-hero { min-height: 0; margin-bottom: 16px; }
  .dash-hero-art { display: none; }          /* Dekoration weg, Platz für Inhalt */
  .dash-title { max-width: none; font-size: 27px; }
  .dash-today { padding: 20px 18px; gap: 18px; }
  .dash-bignum strong { font-size: 34px; }
  .dash-today-streak { gap: 14px; }
  .streak-ring { width: 74px; height: 74px; }
  .streak-num { font-size: 21px; }
  .dash-stats { gap: 12px; }
  .stat-tile { padding: 16px; }
  .stat-tile-icon { width: 34px; height: 34px; border-radius: 11px; margin-bottom: 10px; }
  .stat-tile-value { font-size: 24px; }
  .goal-value { font-size: 16px; padding-bottom: 10px; }
  /* Routine untereinander: Text, Wochentage, Ziel — sonst quetschen sich
     Untertitel und Zielangabe nebeneinander. */
  .dash-routine { padding: 16px; flex-direction: column; align-items: stretch; gap: 14px; }
  .routine-days { order: 2; width: 100%; justify-content: space-between; gap: 4px; }
  .routine-goal {
    order: 3; display: flex; align-items: baseline; justify-content: space-between;
    gap: 10px; text-align: start; padding-top: 12px; border-top: 1px solid var(--border);
  }
  .routine-dot { width: 30px; height: 30px; }   /* Touch-Ziel beibehalten */
  .routine-day-label { font-size: 11px; }
  .cta-learn { min-height: 64px; padding: 12px 16px; }
  .cta-learn-title { font-size: 17px; }
  .cta-learn-sub { font-size: 12px; }
}

/* Sehr schmale Geräte: Kennzahlen untereinander statt gequetscht */
@media (max-width: 340px) {
  .dash-stats { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .meter-fill, .ring-fill { transition: none; }
  .cta-learn:hover { transform: none; }
  .brand-logo-link:hover { transform: none; }
}
