/* Visual language: soft blue→lavender gradient backdrop, white rounded
   cards with airy shadows, a single strong blue accent, pill buttons, and
   Fluent 3D emoji for illustration. Every component reads these tokens, so
   the dark theme at the bottom only has to redefine them. */
/* Plus Jakarta Sans (SIL Open Font License), self-hosted so visitors' IPs
   aren't sent to Google Fonts (a GDPR issue for EU users). Variable font:
   one file per subset covers every weight 400–800. */
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(fonts/plus-jakarta-sans-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(fonts/plus-jakarta-sans-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --accent: #1f5cf5;
  --accent-dark: #1648c9;
  --accent-soft: rgba(31, 92, 245, 0.10);
  --accent-soft-2: rgba(31, 92, 245, 0.18);
  --amber: #f5a524;
  --green: #22b35e;
  --green-dark: #178a47;
  --red: #f0445a;
  --ink: #161a2b;
  --ink-soft: #6b7185;
  --bg: #f3f5fb;
  --bg-grad-1: #d9e4ff;
  --bg-grad-2: #e7defc;
  --card: #ffffff;
  --card-soft: #f6f7fc;
  --border: #e6e9f2;
  --shadow: 0 10px 30px rgba(40, 60, 140, 0.08), 0 2px 6px rgba(40, 60, 140, 0.05);
  --shadow-sm: 0 4px 14px rgba(40, 60, 140, 0.07);
  --radius: 26px;
  --radius-sm: 18px;
  --nav-bg: rgba(255, 255, 255, 0.92);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Plus Jakarta Sans", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(900px 420px at 15% -80px, var(--bg-grad-1), transparent 70%),
    radial-gradient(800px 420px at 95% -40px, var(--bg-grad-2), transparent 70%),
    var(--bg);
  background-repeat: no-repeat;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.15s ease, color 0.15s ease;
}

button, input, textarea, select { font-family: inherit; }

/* Components below set display: flex/block, which would otherwise override
   the browser's default for the `hidden` attribute that app code toggles. */
[hidden] { display: none !important; }

/* iconify-icon is an inline custom element — sized via explicit width/height
   for deterministic rendering across contexts, with vertical alignment adjustment. */
iconify-icon { display: inline-block; width: 1.2em; height: 1.2em; vertical-align: -0.2em; color: var(--accent); }

/* ---------- Topbar (greeting header) ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 640px;
  margin: 0 auto;
  padding: 18px 16px 6px;
}

.greet { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.greet-avatar {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #7ea2ff, #a88bff);
  color: white;
  font-weight: 800;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 3px var(--card), var(--shadow-sm);
}
.greet-text { min-width: 0; }
.greet-hello { font-weight: 800; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.greet-sub { color: var(--ink-soft); font-size: 13px; font-weight: 500; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.stats { display: flex; align-items: center; gap: 8px; }
.stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 40px;
  padding: 0 12px;
  border: none;
  border-radius: 999px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
}
.stat iconify-icon { font-size: 18px; vertical-align: 0; }
.stat:hover { background: var(--card-soft); }
.stat:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.stat:active { transform: scale(0.98); }
.stat:disabled { opacity: 0.6; cursor: not-allowed; }

.icon-btn {
  border: none;
  background: transparent;
  font-size: 20px;
  color: var(--ink-soft);
  cursor: pointer;
}

.header-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--card);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  font-size: 19px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 0;
}
.header-icon-btn iconify-icon { color: var(--ink); vertical-align: 0; }
.header-icon-btn:hover { background: var(--card-soft); }
.header-icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.header-icon-btn:active { transform: scale(0.95); }
.header-icon-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ---------- Bottom navigation (floating pill) ---------- */

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  gap: 6px;
  padding: 8px;
  background: var(--nav-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: 0 14px 40px rgba(30, 50, 120, 0.16);
}
.tab {
  height: 52px;
  min-width: 52px;
  padding: 0 14px;
  border: none;
  border-radius: 999px;
  background: var(--card-soft);
  color: var(--ink);
  font-weight: 700;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, padding 0.15s ease;
}
.tab iconify-icon { font-size: 23px; color: inherit; vertical-align: 0; }
.tab-label { display: none; }
.tab:hover { background: var(--accent-soft); }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tab:active { transform: scale(0.97); }
.tab:disabled { opacity: 0.6; cursor: not-allowed; }
.tab.active {
  background: var(--accent);
  color: white;
  padding: 0 20px 0 16px;
  box-shadow: 0 8px 20px rgba(31, 92, 245, 0.35);
}
.tab.active .tab-label { display: inline; }

/* No nav mid-lesson — the lesson has its own exit button, and the nav would
   compete with the Check/Hint footer. */
body:has(#view-lesson.active) .bottom-nav,
body:has(#view-complete.active) .bottom-nav { display: none; }

/* ---------- Layout ---------- */

main#app { max-width: 640px; margin: 0 auto; padding: 16px 16px 120px; }

.view { display: none; }
.view.active { display: block; animation: view-in 0.22s ease; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.section-title { font-size: 18px; font-weight: 800; margin: 26px 4px 14px; }

/* Heading scale: consistent hierarchy across the app */
h1 { font-size: 32px; font-weight: 800; line-height: 1.1; margin: 0 0 16px; }
h2 { font-size: 24px; font-weight: 800; line-height: 1.2; margin: 0 0 12px; }
h3 { font-size: 20px; font-weight: 700; line-height: 1.3; margin: 0 0 8px; }
h4 { font-size: 18px; font-weight: 600; line-height: 1.4; margin: 0 0 6px; }

/* ---------- Progress ring (shared) ---------- */

.ring { position: relative; display: inline-flex; width: 56px; height: 56px; flex-shrink: 0; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 3.5; }
.ring-track { stroke: var(--accent-soft); }
.ring-fill { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 0.5s ease; }
.ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}
.ring-light .ring-track { stroke: rgba(255, 255, 255, 0.35); }
.ring-light .ring-fill { stroke: white; }
.ring-light .ring-label { color: white; }
.ring-sm { width: 44px; height: 44px; }
.ring-sm .ring-label { font-size: 11px; }

/* ---------- Learn home: continue card + chips ---------- */

.continue-card {
  background: var(--card);
  border-radius: 30px;
  padding: 18px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.continue-card[hidden] { display: none; }
.continue-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.continue-spark {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--card-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}
.continue-spark iconify-icon { color: var(--ink); vertical-align: 0; }
.continue-body {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card-soft);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 18px 18px 18px 20px;
}
.continue-text { flex: 1; min-width: 0; }
.continue-kicker { font-size: 12px; font-weight: 700; color: var(--accent); }
.continue-title { font-size: 20px; font-weight: 800; margin: 4px 0 6px; }
.continue-sub { color: var(--ink-soft); font-size: 14px; line-height: 1.45; margin: 0; }
.continue-art {
  width: 78px;
  height: 78px;
  flex-shrink: 0;
  border-radius: 24px;
  background: linear-gradient(145deg, #ffd27a, #ff9f43);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  transform: rotate(-8deg);
  box-shadow: 0 12px 24px rgba(255, 159, 67, 0.35), inset 0 -4px 0 rgba(0, 0, 0, 0.06);
}
.continue-art iconify-icon { color: white; vertical-align: 0; }
.continue-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.continue-btn { padding: 16px 34px; }
.continue-xp { font-size: 13px; font-weight: 700; color: var(--ink-soft); display: inline-flex; align-items: center; gap: 4px; }
.continue-xp iconify-icon { font-size: 18px; vertical-align: 0; }

.quick-chips { display: flex; gap: 10px; margin-top: 18px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; }
.quick-chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 50px;
  padding: 0 20px;
  border: none;
  border-radius: 999px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}
.chip iconify-icon { font-size: 21px; color: var(--ink); vertical-align: 0; }
.chip:hover { background: var(--card-soft); }
.chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip:active { transform: scale(0.96); }
.chip:disabled { opacity: 0.6; cursor: not-allowed; }
.chip-count {
  background: var(--accent);
  color: white;
  font-size: 11px;
  font-weight: 800;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Learn front page: level cards ---------- */

.level-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.level-card {
  --tone-a: #8f8cff;
  --tone-b: #6d7cf7;
  text-align: start;
  border: none;
  border-radius: 28px;
  padding: 16px 16px 18px;
  min-height: 190px;
  display: flex;
  flex-direction: column;
  color: white;
  cursor: pointer;
  background: linear-gradient(160deg, var(--tone-a), var(--tone-b));
  box-shadow: 0 14px 28px -10px var(--tone-b);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
  overflow: hidden;
}
.level-card::after {
  content: "";
  position: absolute;
  width: 160px;
  height: 160px;
  inset-inline-end: -60px;
  bottom: -70px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  pointer-events: none;
}
.level-card:hover { transform: translateY(-3px); }
.level-card:active { transform: translateY(0); }
.tone-violet { --tone-a: #9d97ff; --tone-b: #7a73f0; }
.tone-orange { --tone-a: #ffc267; --tone-b: #f79a2e; }
.tone-sky { --tone-a: #74b4ff; --tone-b: #3f7cf5; }
.tone-pink { --tone-a: #ff9cc2; --tone-b: #f06a9e; }
.tone-indigo { --tone-a: #8a8dfc; --tone-b: #4f4fd8; }
.tone-teal { --tone-a: #6fd8cf; --tone-b: #22a79d; }

.level-card-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: auto; }
.level-card-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
}
.level-card-icon iconify-icon { vertical-align: 0; }
.level-card-lock {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
}
.level-card-lock iconify-icon { color: white; vertical-align: 0; }
.level-card-title { font-size: 20px; font-weight: 800; line-height: 1.2; margin-top: 18px; }
.level-card-meta { font-size: 13px; font-weight: 500; opacity: 0.9; margin-top: 8px; }
.level-card.locked { filter: grayscale(0.75); opacity: 0.6; cursor: default; }
.level-card.locked:hover { transform: none; }

@media (max-width: 768px) {
  .level-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .level-grid { gap: 12px; }
  .level-card { min-height: 176px; padding: 14px 14px 16px; }
  .level-card-title { font-size: 17px; }
}

/* ---------- Unit path (drilled into one level) ---------- */

.path { display: none; flex-direction: column; gap: 14px; padding-top: 4px; }

.learn-back-row { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.learn-level-title { font-size: 24px; font-weight: 800; margin: 0; }
.learn-level-title span { font-size: 14px; font-weight: 600; color: var(--ink-soft); margin-inline-start: 4px; }

.round-btn {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: var(--card);
  box-shadow: var(--shadow-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
}
.round-btn iconify-icon { color: var(--ink); vertical-align: 0; }
.round-btn:hover { background: var(--card-soft); }

.level-section { width: 100%; display: flex; flex-direction: column; gap: 14px; }
.level-heading { font-size: 18px; font-weight: 800; margin: 0 4px 2px; }
.level-heading span { font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-inline-start: 4px; }

.unit-block {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 18px 18px;
  box-shadow: var(--shadow);
}
.unit-block.locked { opacity: 0.6; }

.unit-title { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.unit-title-icon {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  border-radius: 16px;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}
.unit-title-icon iconify-icon { vertical-align: 0; }
.unit-title-text { flex: 1; font-weight: 800; font-size: 16px; }
.unit-lock iconify-icon { color: var(--ink-soft); font-size: 22px; }

.unit-node-row { display: flex; flex-wrap: wrap; gap: 10px; }

.node {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--card-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.node:hover:not(:disabled) { transform: translateY(-2px); }
.node.available { background: var(--card-soft); box-shadow: inset 0 0 0 1.5px var(--border); }
.node.current { background: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft-2), 0 8px 18px rgba(31, 92, 245, 0.35); }
.node.current .node-icon, .node.current iconify-icon { color: white; }
.node.complete { background: var(--accent-soft); }
.node.locked { opacity: 0.55; cursor: default; }
.node-icon { font-size: 24px; line-height: 1; vertical-align: 0; }
.node-badge {
  position: absolute;
  bottom: -2px;
  inset-inline-end: -2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  border: 2px solid var(--card);
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.unit-progress { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
.unit-progress-track { flex: 1; height: 8px; background: var(--card-soft); border-radius: 999px; overflow: hidden; }
.unit-progress-fill { height: 100%; background: var(--accent); border-radius: 999px; }
.unit-progress span { font-size: 12px; font-weight: 700; color: var(--ink-soft); min-width: 34px; text-align: end; }

/* ---------- Grammar tab ---------- */

.grammar-list { display: flex; flex-direction: column; gap: 26px; }
.grammar-list .level-section { gap: 10px; }

.grammar-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border-radius: 22px;
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.12s ease;
}
.grammar-item:hover { transform: translateY(-2px); }
.grammar-item-icon {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  border-radius: 16px;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 23px;
}
.grammar-item-icon iconify-icon { vertical-align: 0; }
.grammar-item-body { flex: 1; min-width: 0; }
.grammar-item-name { font-weight: 700; font-size: 15px; }
.grammar-item-bar { height: 6px; background: var(--card-soft); border-radius: 999px; overflow: hidden; margin-top: 8px; }
.grammar-item-bar div { height: 100%; background: var(--accent); border-radius: 999px; }
.grammar-item-meta { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.grammar-item-pct { font-weight: 800; color: var(--accent); font-size: 14px; min-width: 40px; text-align: end; }
.grammar-item.locked { opacity: 0.55; cursor: default; }
.grammar-item.locked:hover { transform: none; }
.grammar-item.locked .grammar-item-icon { background: var(--card-soft); }
.grammar-item.locked .grammar-item-icon iconify-icon { color: var(--ink-soft); }
.grammar-item-lock iconify-icon { color: var(--ink-soft); font-size: 20px; }

/* ---------- Grammar explanation page ---------- */

.grammar-intro-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  max-width: 640px;
  margin: 0 auto;
}
.grammar-intro-back { margin-bottom: 14px; padding: 10px 16px; background: var(--card-soft); }
.grammar-intro-header { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.grammar-intro-icon {
  width: 60px;
  height: 60px;
  border-radius: 20px;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.grammar-intro-icon iconify-icon { font-size: 30px; vertical-align: 0; }
.grammar-intro-header h2 { margin: 0 0 6px; font-size: 21px; font-weight: 800; }
.grammar-intro-level {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 10px;
  border-radius: 999px;
}
.grammar-intro-summary { color: var(--ink); line-height: 1.55; margin: 0 0 16px; }
.grammar-intro-points {
  margin: 0 0 20px;
  padding-inline-start: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--ink);
  line-height: 1.45;
  font-size: 14px;
}
.grammar-point-table-label { font-weight: 700; margin-bottom: 4px; }
.grammar-point-table { border-collapse: collapse; width: 100%; max-width: 280px; font-size: 13px; margin-top: 2px; }
.grammar-point-table td { padding: 5px 10px; border-bottom: 1px solid var(--border); }
.grammar-point-table tr:last-child td { border-bottom: none; }
.grammar-point-table td:first-child { color: var(--ink-soft); }
.grammar-point-table td:last-child { color: var(--accent); font-weight: 700; font-family: monospace; text-align: end; }

.grammar-intro-video:not(:empty) { margin-bottom: 18px; }
.grammar-video-frame { position: relative; width: 100%; padding-top: 56.25%; border-radius: 18px; overflow: hidden; background: #000; }
.grammar-video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: none; }
.grammar-video-credit { display: block; margin-top: 6px; font-size: 12px; color: var(--ink-soft); text-decoration: none; }
.grammar-video-credit:hover { color: var(--accent); text-decoration: underline; }

.grammar-intro-examples { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.grammar-example { background: var(--card-soft); border-radius: 16px; padding: 12px 14px; }
.grammar-example-de { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 700; }
.grammar-example-de .speak-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; font-size: 14px; }
.grammar-example-en { color: var(--ink-soft); font-size: 13px; margin-top: 2px; }
.grammar-intro-missing {
  background: rgba(245, 165, 36, 0.10);
  border-radius: 16px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 20px;
}
.grammar-intro-start { width: 100%; }

/* ---------- Lesson ---------- */

.lesson-shell { display: flex; flex-direction: column; min-height: calc(100vh - 140px); }

.lesson-header { display: flex; align-items: center; gap: 14px; padding-bottom: 18px; }
.lesson-header .icon-btn {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--card);
  box-shadow: var(--shadow-sm);
  font-size: 16px;
  color: var(--ink);
}

.lesson-progress { flex: 1; height: 12px; background: var(--card); border-radius: 999px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--border); }
.lesson-progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #6f95ff, var(--accent)); border-radius: 999px; transition: width 0.25s ease; }

.exercise-card {
  background: var(--card);
  border-radius: 30px;
  padding: 24px 20px;
  box-shadow: var(--shadow);
}
.exercise-kicker {
  display: inline-block;
  margin: 0;
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 700;
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 999px;
}
.exercise-kicker-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.notebook-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; border-radius: 999px; padding: 6px 12px;
  background: var(--card-soft); color: var(--accent);
  font: inherit; font-size: 13px; font-weight: 800; cursor: pointer;
}
.notebook-btn.saved { background: var(--accent-soft); }
.notebook-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.notebook-btn iconify-icon { font-size: 17px; }
.exercise-prompt-row { display: flex; align-items: center; gap: 10px; margin: 14px 0 4px; }
.exercise-prompt { font-size: 26px; font-weight: 800; line-height: 1.3; margin: 0; }
.exercise-subprompt { color: var(--ink-soft); font-size: 15px; margin: 4px 0 20px; }

.speak-btn {
  border: none;
  background: var(--accent-soft);
  color: var(--accent);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 15px;
  cursor: pointer;
  flex-shrink: 0;
  display: none;
}
.speak-btn.show { display: inline-flex; align-items: center; justify-content: center; }
.speak-btn:hover { background: var(--accent-soft-2); }
.feedback .speak-btn { display: inline-flex; align-items: center; justify-content: center; margin-inline-start: 8px; vertical-align: middle; }

.answer-input-row { display: flex; align-items: center; gap: 10px; }
.answer-input-row .answer-input { flex: 1; }

.answer-input {
  width: 100%;
  font-size: 17px;
  padding: 16px 20px;
  border-radius: 999px;
  border: 1.5px solid transparent;
  background: var(--card-soft);
  color: var(--ink);
  outline: none;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.answer-input::placeholder { color: var(--ink-soft); }
.answer-input:focus { border-color: var(--accent); background: var(--card); }
.answer-input.correct { border-color: var(--green); background: rgba(34, 179, 94, 0.08); }
.answer-input.almost { border-color: var(--amber); background: rgba(245, 165, 36, 0.08); }
.answer-input.incorrect { border-color: var(--red); background: rgba(240, 68, 90, 0.07); }

/* Used by the lesson screen's answer-input mic (the Talk tab's mic lives
   inside .chat-input-bar instead, styled like a plain composer icon). */
.mic-btn {
  border: none;
  color: white;
  background: var(--accent);
  box-shadow: 0 0 0 5px var(--accent-soft), 0 8px 18px rgba(31, 92, 245, 0.3);
  width: 52px;
  height: 52px;
  min-width: 52px;
  border-radius: 50%;
  font-size: 22px;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, background 0.12s ease;
}
.mic-btn iconify-icon { color: inherit; vertical-align: 0; }
.mic-btn:hover { transform: scale(1.05); }
.mic-btn:active { transform: scale(0.96); }
.mic-btn.listening { background: var(--red); animation: mic-pulse 1.1s ease-in-out infinite; }
.mic-btn:disabled { opacity: 0.4; cursor: default; box-shadow: none; }
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(240, 68, 90, 0.35); transform: scale(1); }
  50% { box-shadow: 0 0 0 10px rgba(240, 68, 90, 0); transform: scale(1.06); }
}

/* ---------- Mascot (the app's duck) + celebration effects ---------- */

/* Reserves no space when empty (nothing but a stray gap before the feedback
   box appears) — it only takes up room once renderExercise()'s "not answered
   yet" reset is overwritten by an actual correct/almost/incorrect reaction. */
.mascot-row { display: flex; justify-content: center; position: relative; min-height: 0; }
.mascot-row:empty { margin: 0; }
.mascot-row:not(:empty) { margin: 10px 0 2px; }

.mascot { font-size: 40px; line-height: 1; display: inline-block; }
.mascot-row-big .mascot { font-size: 64px; }

.mascot.show-correct { animation: mascot-bounce 0.7s ease; }
.mascot.show-almost { animation: mascot-nod 0.6s ease; }
.mascot.show-incorrect { animation: mascot-sad 0.6s ease forwards; }

@keyframes mascot-bounce {
  0% { transform: scale(0.4) translateY(10px); opacity: 0; }
  45% { transform: scale(1.25) translateY(-14px); opacity: 1; }
  65% { transform: scale(0.95) translateY(0); }
  85% { transform: scale(1.06) translateY(-3px); }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
@keyframes mascot-nod {
  0% { transform: rotate(0deg) scale(0.6); opacity: 0; }
  35% { transform: rotate(-8deg) scale(1.05); opacity: 1; }
  65% { transform: rotate(6deg) scale(1); }
  100% { transform: rotate(0deg) scale(1); opacity: 1; }
}
@keyframes mascot-sad {
  0% { transform: rotate(0deg) scale(0.6) translateY(0); opacity: 0; }
  35% { transform: rotate(-10deg) scale(1.05) translateY(0); opacity: 1; }
  55% { transform: rotate(8deg) scale(1) translateY(0); }
  100% { transform: rotate(4deg) scale(0.95) translateY(4px); opacity: 0.8; }
}

.confetti-piece {
  position: absolute;
  top: 4px;
  left: 50%;
  width: 7px;
  height: 7px;
  pointer-events: none;
  animation: confetti-burst 0.9s ease-out forwards;
}
@keyframes confetti-burst {
  0% { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; }
}

/* Respect the OS-level motion preference: the mascot still appears (so the
   feedback itself isn't lost), it just fades in instead of bouncing/shaking,
   and confetti is skipped entirely (also skipped in JS, so this is a
   backstop rather than the only guard). */
@media (prefers-reduced-motion: reduce) {
  .mascot.show-correct, .mascot.show-almost, .mascot.show-incorrect { animation: none; opacity: 1; }
  .confetti-piece { display: none; }
  .view.active { animation: none; }
}

.feedback { margin-top: 16px; padding: 14px 18px; border-radius: 20px; display: none; font-size: 15px; line-height: 1.5; }
.feedback.show { display: block; }
.feedback.correct { background: rgba(34, 179, 94, 0.10); color: var(--green-dark); }
.feedback.almost { background: rgba(245, 165, 36, 0.12); color: #9a6200; }
.feedback.incorrect { background: rgba(240, 68, 90, 0.09); color: #c02339; }
.feedback strong { display: block; margin-bottom: 4px; font-size: 15px; }
.feedback div strong { display: inline; }
.feedback .explain { margin-top: 8px; color: var(--ink); opacity: 0.85; }
.feedback .alt-answer { margin-top: 6px; font-size: 14px; color: var(--ink-soft); }

/* Word-level mistake view: the learner's own sentence, with each wrong word
   struck through in red and its fix stacked underneath in green. */
.mistake-view {
  background: var(--card);
  border-radius: 14px;
  padding: 10px 12px 12px;
  margin: 6px 0 10px;
}
.mistake-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); margin-bottom: 6px; }
.mistake-line { font-size: 17px; line-height: 1.5; color: var(--ink); display: flex; flex-wrap: wrap; align-items: flex-start; column-gap: 6px; row-gap: 6px; }
.w-ok { padding-top: 1px; }
.w-wrong { display: inline-flex; flex-direction: column; align-items: center; }
.w-was {
  color: var(--red);
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  background: rgba(240, 68, 90, 0.10);
  border-radius: 6px;
  padding: 0 4px;
}
.w-fix { font-size: 13px; font-weight: 700; color: var(--green-dark); line-height: 1.3; padding: 0 2px; }
.w-wrong.typo .w-was { color: #b26b00; background: rgba(245, 165, 36, 0.16); }
.w-wrong.missing .w-was { text-decoration: none; color: var(--green-dark); background: rgba(34, 179, 94, 0.12); font-weight: 800; }

.lesson-footer { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-top: 18px; margin-top: auto; }

.btn {
  border: none;
  border-radius: 999px;
  padding: 15px 28px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}
.btn-primary { background: var(--accent); color: white; box-shadow: 0 10px 22px rgba(31, 92, 245, 0.30); }
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled { background: var(--border); color: var(--ink-soft); box-shadow: none; cursor: default; }
.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: var(--card); color: var(--ink); }
.lesson-footer .btn-ghost { background: var(--card); box-shadow: var(--shadow-sm); color: var(--ink); padding: 15px 20px; }
.lesson-footer .btn-primary { margin-inline-start: auto; padding: 15px 36px; }

/* ---------- Talk (AI assistant) ---------- */

.chat-shell {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 210px);
  min-height: 460px;
  background: var(--card);
  border-radius: 32px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.assistant-hero { text-align: center; padding: 6px 4px 10px; }
.assistant-orb {
  position: relative;
  width: 168px;
  height: 168px;
  margin: 0 auto 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* The dotted "voice cloud" from the reference, approximated with a masked
   dot pattern over a soft blue radial glow — no image asset needed. */
.assistant-orb::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 46% 54% 50% 50% / 52% 44% 56% 48%;
  background:
    radial-gradient(circle, rgba(31, 92, 245, 0.55) 1.2px, transparent 1.6px) 0 0 / 7px 7px,
    radial-gradient(circle at 50% 50%, rgba(94, 150, 255, 0.55), rgba(94, 150, 255, 0.08) 70%);
  -webkit-mask: radial-gradient(circle, #000 55%, transparent 72%);
  mask: radial-gradient(circle, #000 55%, transparent 72%);
  animation: orb-morph 8s ease-in-out infinite;
}
.assistant-orb::after {
  content: "";
  position: absolute;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(31, 92, 245, 0.28), rgba(31, 92, 245, 0.06));
}
.assistant-orb-core {
  position: relative;
  z-index: 1;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  box-shadow: 0 8px 20px rgba(31, 92, 245, 0.25);
}
.assistant-orb-core iconify-icon { vertical-align: 0; }
@keyframes orb-morph {
  0%, 100% { border-radius: 46% 54% 50% 50% / 52% 44% 56% 48%; transform: rotate(0deg) scale(1); }
  50% { border-radius: 54% 46% 44% 56% / 46% 56% 44% 54%; transform: rotate(12deg) scale(1.04); }
}
@media (prefers-reduced-motion: reduce) { .assistant-orb::before { animation: none; } }

.assistant-hello {
  display: inline-block;
  margin: 0 0 8px;
  padding: 12px 22px;
  background: var(--card);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  font-weight: 600;
  font-size: 16px;
}
.chat-intro { color: var(--ink-soft); font-size: 13px; line-height: 1.5; margin: 4px auto 12px; max-width: 420px; }

.prompt-chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; justify-content: flex-start; }
.prompt-chips::-webkit-scrollbar { display: none; }
.prompt-chip {
  flex-shrink: 0;
  border: none;
  background: var(--card-soft);
  color: var(--ink);
  font-weight: 600;
  font-size: 14px;
  padding: 12px 18px;
  border-radius: 999px;
  cursor: pointer;
}
.prompt-chip:hover { background: var(--accent-soft); color: var(--accent); }

/* Once the learner has sent something, the hero collapses so the
   conversation gets the full height. */
.chat-shell:has(.chat-bubble.user) .assistant-orb,
.chat-shell:has(.chat-bubble.user) .chat-intro,
.chat-shell:has(.chat-bubble.user) .assistant-hello { display: none; }
.chat-shell:has(.chat-bubble.user) .assistant-hero { padding: 0 0 6px; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 2px 12px;
}

/* Tutor replies read as plain chat text (no bubble), user messages get a
   soft tinted bubble — the unbubbled-assistant pattern from modern chat
   apps reads cleaner for long multi-paragraph replies. */
.chat-bubble { max-width: 84%; padding: 11px 16px; border-radius: 22px; font-size: 15px; line-height: 1.5; white-space: pre-wrap; }
.chat-bubble.user { align-self: flex-end; background: var(--accent); color: white; border-bottom-right-radius: 6px; }
.chat-bubble.tutor { align-self: flex-start; max-width: 100%; padding: 2px 0; background: none; display: flex; align-items: flex-start; gap: 10px; }
.chat-bubble.system { align-self: center; background: rgba(245, 165, 36, 0.12); color: #9a6200; font-size: 13px; border-radius: 14px; }
.chat-bubble.pending .chat-bubble-content { color: var(--ink-soft); }
.chat-bubble-content { min-width: 0; flex: 1; }
.chat-bubble-image { display: block; max-width: 100%; border-radius: 14px; margin-bottom: 6px; }

.chat-avatar {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #cfe0ff, #8fb2ff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  margin-top: 1px;
}

.typing-dots { display: inline-flex; align-items: center; gap: 4px; height: 16px; padding: 4px 0; }
.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: typing-bounce 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.chat-attachment-preview { display: none; align-items: center; gap: 8px; padding: 8px 0; }
.chat-attachment-preview.show { display: flex; }
.chat-attachment-preview img { height: 56px; width: 56px; object-fit: cover; border-radius: 14px; border: 1px solid var(--border); }

/* Composer: a single rounded pill holding attach + text + mic, with the
   send action as its own circular button beside it. */
.chat-input-row { display: flex; align-items: center; gap: 10px; padding-top: 8px; }

.chat-input-bar {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--card-soft);
  border: 1.5px solid transparent;
  border-radius: 999px;
  padding: 7px 8px 7px 10px;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.chat-input-bar:focus-within { border-color: var(--accent); background: var(--card); }

.chat-bar-icon-btn {
  border: none;
  background: transparent;
  color: var(--ink-soft);
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease, color 0.12s ease;
}
.chat-bar-icon-btn iconify-icon { color: inherit; vertical-align: 0; }
.chat-bar-icon-btn:hover { background: var(--accent-soft); color: var(--accent); }
.chat-bar-icon-btn.listening { background: var(--red); color: white; animation: mic-pulse 1.1s ease-in-out infinite; }
.chat-bar-icon-btn:disabled { opacity: 0.4; cursor: default; }

.chat-bar-divider { width: 1px; height: 22px; background: var(--border); flex-shrink: 0; }

.chat-input {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  padding: 8px 4px;
  border: none;
  outline: none;
  background: transparent;
  color: var(--ink);
}
.chat-input::placeholder { color: var(--ink-soft); }

.chat-send-btn {
  border: none;
  background: var(--accent);
  color: white;
  width: 54px;
  height: 54px;
  min-width: 54px;
  border-radius: 50%;
  font-size: 22px;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 22px rgba(31, 92, 245, 0.32);
  transition: transform 0.12s ease, background 0.12s ease;
}
.chat-send-btn iconify-icon { color: inherit; vertical-align: 0; }
.chat-send-btn:hover { background: var(--accent-dark); }
.chat-send-btn:active { transform: scale(0.95); }
.chat-send-btn:disabled { opacity: 0.5; cursor: default; box-shadow: none; transform: none; }

/* ---------- Modal ---------- */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 45, 0.35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-overlay.show { display: flex; }

.modal-card {
  background: var(--card);
  border-radius: 30px;
  padding: 30px 24px 26px;
  max-width: 340px;
  width: 100%;
  text-align: center;
  position: relative;
  box-shadow: 0 24px 60px rgba(20, 30, 80, 0.25);
}
.modal-close { position: absolute; top: 12px; inset-inline-end: 12px; width: 36px; height: 36px; border-radius: 50%; background: var(--card-soft); font-size: 14px; }
.modal-emoji { font-size: 48px; margin: 0 0 4px; }
.modal-card h2 { font-weight: 800; }
.modal-body { color: var(--ink-soft); font-size: 14px; line-height: 1.5; }

/* ---------- Onboarding (welcome + placement) ---------- */

.onboard-card {
  text-align: center;
  margin: 40px auto 0;
  max-width: 400px;
  background: var(--card);
  border-radius: 32px;
  padding: 34px 24px 26px;
  box-shadow: var(--shadow);
}
.onboard-emoji { font-size: 52px; margin: 0 0 8px; }
.onboard-title { font-size: 24px; font-weight: 800; margin: 0 0 10px; }
.onboard-body { color: var(--ink-soft); font-size: 14px; line-height: 1.5; margin: 0 0 20px; }
.onboard-input { margin-bottom: 16px; text-align: center; }
.onboard-btn { width: 100%; }

.placement-kicker {
  color: var(--accent);
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.placement-intro { text-align: start; margin: 4px 0 16px; }
.placement-context {
  margin: 4px 0 14px; padding: 12px 14px; border-radius: 12px;
  background: var(--accent-soft, rgba(0, 0, 0, 0.04)); border-inline-start: 3px solid var(--accent);
  text-align: left; line-height: 1.55; font-size: 15px;
}
.placement-prompt-de { margin: 6px 0 12px; font-size: 20px; font-weight: 700; text-align: left; }
.placement-result-weak { text-align: start; margin: 8px 0 16px; }
.placement-result-weak-title { font-weight: 700; margin: 0 0 6px; }
.placement-result-weak ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.placement-result-weak li { display: flex; align-items: center; gap: 8px; }
.placement-result-level { font-size: 44px; font-weight: 800; color: var(--accent); margin: 12px 0 4px; }

/* ---------- Complete ---------- */

.complete-card {
  text-align: center;
  margin: 40px auto 0;
  max-width: 420px;
  background: var(--card);
  border-radius: 32px;
  padding: 34px 24px 28px;
  box-shadow: var(--shadow);
}
.complete-card h2 { font-weight: 800; font-size: 24px; }
.complete-emoji { font-size: 56px; margin: 0; }
.complete-summary { color: var(--ink-soft); margin-bottom: 26px; }
.complete-card .btn-primary, .complete-card .btn-ghost { width: 100%; }
.complete-topic-progress { font-weight: 700; color: var(--ink); margin: 0 0 14px; }
.complete-card #complete-next + .btn { margin-top: 10px; }

@media (max-width: 480px) {
  .exercise-prompt { font-size: 22px; }
  .topbar { gap: 8px; padding-top: 14px; }
  .greet { gap: 10px; }
  .greet-avatar { width: 40px; height: 40px; font-size: 16px; box-shadow: 0 0 0 2px var(--card), var(--shadow-sm); }
  .greet-hello { font-size: 15px; }
  .greet-sub { font-size: 12px; }
  .stats { gap: 5px; }
  .stat { height: 34px; padding: 0 8px; font-size: 12px; gap: 3px; }
  .stat iconify-icon { font-size: 15px; }
  .header-icon-btn { width: 34px; height: 34px; font-size: 16px; }
  .node { width: 50px; height: 50px; }
  .node-icon { font-size: 21px; }
  .unit-block { padding: 16px 16px 18px; }
  .stats .sound-toggle { display: none; }
  .tab { height: 48px; min-width: 48px; }
  .continue-art { width: 64px; height: 64px; font-size: 34px; border-radius: 20px; }
  .continue-title { font-size: 18px; }
  .continue-btn { padding: 15px 26px; }
  .assistant-orb { width: 140px; height: 140px; }
}

/* ---------- Notifications ---------- */

.notif-wrap { position: relative; }
.notif-badge {
  position: absolute;
  top: -2px;
  inset-inline-end: -2px;
  background: var(--red);
  color: white;
  font-size: 10px;
  font-weight: 800;
  min-width: 17px;
  height: 17px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--card);
}
.notif-badge[hidden] { display: none; }

.notif-panel {
  position: absolute;
  top: calc(100% + 10px);
  inset-inline-end: 0;
  width: 320px;
  max-width: 88vw;
  max-height: 420px;
  overflow-y: auto;
  background: var(--card);
  border-radius: 22px;
  box-shadow: 0 18px 44px rgba(20, 30, 80, 0.18);
  z-index: 40;
}
.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 800;
  font-size: 14px;
  position: sticky;
  top: 0;
  background: var(--card);
}
.notif-clear-btn { background: none; border: none; color: var(--accent); font-weight: 700; font-size: 12px; cursor: pointer; padding: 0; }
.notif-list { display: flex; flex-direction: column; }
.notif-empty { color: var(--ink-soft); font-size: 13px; padding: 22px 16px; text-align: center; margin: 0; }
.notif-item { padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; }
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--card-soft); }
.notif-item.unread { background: var(--accent-soft); }
.notif-item-title { font-weight: 700; font-size: 13px; }
.notif-item-body { color: var(--ink-soft); font-size: 12px; margin-top: 2px; }
.notif-item-time { color: var(--ink-soft); font-size: 11px; margin-top: 4px; opacity: 0.8; }

/* ---------- Settings ---------- */

.settings-shell { max-width: 560px; margin: 0 auto; padding-bottom: 40px; }
.settings-back { margin-bottom: 10px; padding: 10px 16px; background: var(--card); box-shadow: var(--shadow-sm); }
.settings-title { font-size: 26px; font-weight: 800; margin: 6px 0 18px; }
.settings-section {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px;
  margin-bottom: 14px;
}
.settings-section-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); margin: 0 0 12px; }
.settings-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; gap: 12px; }

.theme-switch { display: flex; gap: 4px; background: var(--card-soft); border-radius: 999px; padding: 4px; }
.theme-option {
  border: none;
  background: none;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
}
.theme-option.active { background: var(--accent); color: white; }

.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider { position: absolute; inset: 0; cursor: pointer; background: var(--border); border-radius: 999px; transition: background 0.15s ease; }
.switch-slider::before {
  content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px;
  background: white; border-radius: 50%; transition: transform 0.15s ease; box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.switch input:checked + .switch-slider { background: var(--accent); }
.switch input:checked + .switch-slider::before { transform: translateX(20px); }

.settings-profile-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.settings-profile-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card-soft);
  border: 1.5px solid transparent;
  border-radius: 16px;
  padding: 10px 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  text-align: start;
}
.settings-profile-row:hover { border-color: var(--accent); }
.settings-profile-switch { margin-inline-start: auto; color: var(--accent); font-size: 12px; font-weight: 700; }
.settings-account-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.settings-account-actions .btn-ghost { background: var(--card-soft); color: var(--ink); }
.settings-account-actions .settings-logout-btn { color: var(--red); }
.settings-link { color: var(--accent); font-weight: 700; font-size: 14px; text-decoration: none; }
.settings-link:hover { text-decoration: underline; }

/* ---------- Login / profile picker ---------- */

.profile-grid { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-bottom: 20px; }
.profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--card-soft);
  border: 1.5px solid transparent;
  border-radius: 22px;
  padding: 16px 14px;
  cursor: pointer;
  width: 110px;
  color: var(--ink);
}
.profile-card:hover { border-color: var(--accent); }
.profile-card-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7ea2ff, #a88bff);
  color: white;
  font-size: 22px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}
.profile-card-avatar.small { width: 32px; height: 32px; font-size: 14px; flex-shrink: 0; }
.profile-card-name { font-size: 13px; font-weight: 700; text-align: center; word-break: break-word; }

/* ---------- Calendar ---------- */

.calendar-shell {
  max-width: 620px;
  margin: 0 auto;
  background: var(--card);
  border-radius: 30px;
  box-shadow: var(--shadow);
  padding: 18px;
}
.calendar-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.calendar-header h2 { margin: 0; font-size: 18px; font-weight: 800; }
.calendar-header .icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--card-soft);
  font-size: 20px;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.calendar-header .icon-btn iconify-icon { color: var(--ink); vertical-align: 0; }

.calendar-review-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(135deg, #e7eeff, #efe8ff);
  border-radius: 20px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.calendar-review-summary-text { font-size: 14px; font-weight: 700; color: var(--ink); }
.calendar-study-now-btn { padding: 10px 20px; font-size: 14px; flex-shrink: 0; }

.calendar-progress { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; margin-bottom: 16px; padding: 0 2px; }
.calendar-progress-stat { display: flex; align-items: baseline; gap: 5px; }
.calendar-progress-stat strong { font-size: 18px; color: var(--ink); }
.calendar-progress-stat span { font-size: 12px; color: var(--ink-soft); }
.calendar-progress-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.calendar-progress-chip {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 10px;
  border-radius: 999px;
}
.calendar-weekday-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.calendar-cell {
  aspect-ratio: 1;
  border: 1.5px solid transparent;
  border-radius: 14px;
  background: var(--card-soft);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 2px;
  gap: 1px;
}
.calendar-cell.empty { border: none; background: none; cursor: default; }
.calendar-cell:not(.empty):hover { border-color: var(--accent); }
.calendar-cell.today { border-color: var(--accent); background: var(--card); }
.calendar-cell-day { font-size: 12px; font-weight: 700; }
.calendar-cell-xp { font-size: 9px; font-weight: 800; color: var(--accent); }
.calendar-cell-mistakes { font-size: 8px; font-weight: 700; color: var(--red); }
.calendar-cell-review { font-size: 8px; font-weight: 700; color: var(--accent-dark); }
.calendar-cell.activity-1 { background: rgba(31, 92, 245, 0.10); }
.calendar-cell.activity-2 { background: rgba(31, 92, 245, 0.20); }
.calendar-cell.activity-3 { background: rgba(31, 92, 245, 0.32); }

.calendar-day-detail { margin-top: 18px; background: var(--card-soft); border-radius: 22px; padding: 16px 18px; }
.calendar-day-detail h3 { margin: 0 0 6px; font-size: 15px; font-weight: 800; }
.calendar-day-summary { color: var(--ink-soft); font-size: 13px; margin: 0 0 12px; }
.calendar-mistakes h4 { font-size: 12px; text-transform: uppercase; color: var(--ink-soft); margin: 0 0 8px; }
.calendar-no-mistakes { color: var(--ink-soft); font-size: 13px; margin: 0; }
.calendar-mistake-item { background: var(--card); border-radius: 14px; padding: 10px 12px; margin-bottom: 8px; }
.calendar-mistake-prompt { font-weight: 700; font-size: 13px; }
.calendar-mistake-sub { color: var(--ink-soft); font-size: 12px; margin-top: 2px; }
.calendar-mistake-answer { font-size: 12px; margin-top: 4px; color: var(--green-dark); }

.calendar-review-plan:not(:empty) { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.calendar-review-plan h4 { font-size: 12px; text-transform: uppercase; color: var(--ink-soft); margin: 0 0 6px; }
.calendar-review-intro { font-size: 13px; color: var(--ink); margin: 0 0 10px; }
.calendar-review-study-btn { width: 100%; margin-top: 4px; }

@media (max-width: 480px) {
  .notif-panel { position: fixed; top: 70px; right: 8px; left: 8px; width: auto; }
  .profile-card { width: 96px; }
  .settings-row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .calendar-shell { padding: 14px; }
  .calendar-grid { gap: 4px; }
}

/* ---------- Dark theme ----------
   "system" (no data-theme attr) follows the OS via the media query below;
   "light"/"dark" pin it explicitly via data-theme, overriding the OS. Every
   component above uses these same tokens, so redefining them is enough. */

:root[data-theme="dark"] {
  --accent: #5b8cff;
  --accent-dark: #7aa2ff;
  --accent-soft: rgba(91, 140, 255, 0.14);
  --accent-soft-2: rgba(91, 140, 255, 0.24);
  --amber: #fbbf24;
  --green: #3ddc84;
  --green-dark: #5fe39a;
  --red: #ff6b7d;
  --ink: #eceef6;
  --ink-soft: #9aa1b8;
  --bg: #0f1220;
  --bg-grad-1: #1a2550;
  --bg-grad-2: #2a1f4d;
  --card: #1a1e30;
  --card-soft: #23283d;
  --border: #2e344c;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.28);
  --nav-bg: rgba(26, 30, 48, 0.9);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --accent: #5b8cff;
    --accent-dark: #7aa2ff;
    --accent-soft: rgba(91, 140, 255, 0.14);
    --accent-soft-2: rgba(91, 140, 255, 0.24);
    --amber: #fbbf24;
    --green: #3ddc84;
    --green-dark: #5fe39a;
    --red: #ff6b7d;
    --ink: #eceef6;
    --ink-soft: #9aa1b8;
    --bg: #0f1220;
    --bg-grad-1: #1a2550;
    --bg-grad-2: #2a1f4d;
    --card: #1a1e30;
    --card-soft: #23283d;
    --border: #2e344c;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.28);
    --nav-bg: rgba(26, 30, 48, 0.9);
  }
}

/* Hard-coded light gradients that need a dark counterpart. */
:root[data-theme="dark"] .calendar-review-summary { background: linear-gradient(135deg, #1f2a4f, #2a2350); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) .calendar-review-summary { background: linear-gradient(135deg, #1f2a4f, #2a2350); }
}

/* ---------- Accounts: sign in, profile questions ---------- */

.loading-card { padding-top: 50px; padding-bottom: 50px; }
.auth-card { text-align: start; }
.auth-card .onboard-emoji, .auth-card .onboard-title, .auth-card .onboard-body { text-align: center; }
.auth-switch { display: flex; background: var(--card-soft); border-radius: 999px; padding: 4px; margin-bottom: 18px; }
.auth-switch-btn {
  flex: 1;
  border: none;
  background: none;
  padding: 10px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  color: var(--ink-soft);
  cursor: pointer;
}
.auth-switch-btn.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm); }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; border: none; margin: 0; padding: 0; min-width: 0; }
.field > span, .field legend { font-size: 13px; font-weight: 700; color: var(--ink-soft); padding: 0 4px; }
.field legend { margin-bottom: 8px; }
.field .answer-input { font-size: 16px; padding: 14px 18px; }
.select-input { appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%), linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%);
  background-position: calc(100% - 22px) 55%, calc(100% - 16px) 55%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 40px; }
.form-message { display: none; margin: 0; font-size: 14px; line-height: 1.45; padding: 10px 14px; border-radius: 14px; }
.form-message.show { display: block; }
.form-message.error { background: rgba(240, 68, 90, 0.09); color: #c02339; }
.form-message.success { background: rgba(34, 179, 94, 0.10); color: var(--green-dark); }
.link-btn { display: block; margin: 12px auto 0; background: none; border: none; color: var(--accent); font-weight: 700; font-size: 14px; cursor: pointer; padding: 4px; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--red); margin: 0; }
.auth-legal { text-align: center; font-size: 12px; color: var(--ink-soft); margin: 16px 0 0; }
.auth-legal a { color: var(--accent); }
.auth-age { display: flex; align-items: center; gap: 10px; margin: 14px 0 4px; font-size: 14px; color: var(--ink); cursor: pointer; }
.auth-age input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; margin: 0; }
.choice-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.choice-btn {
  border: 1.5px solid var(--border);
  background: var(--card-soft);
  color: var(--ink);
  font-weight: 600;
  font-size: 14px;
  padding: 10px 14px;
  border-radius: 999px;
  cursor: pointer;
}
.choice-btn.active { background: var(--accent); border-color: var(--accent); color: white; }
.settings-wide-btn { width: 100%; }
.settings-note { font-size: 12px; color: var(--ink-soft); margin: 12px 0 0; }
.settings-note a { color: var(--accent); }

/* ---------- Rating prompt ---------- */

.rating-card h2 { font-size: 20px; margin: 4px 0 6px; }
.star-row { display: flex; justify-content: center; gap: 6px; margin: 14px 0; }
.star-btn { border: none; background: none; font-size: 38px; line-height: 1; color: var(--border); cursor: pointer; padding: 2px; transition: transform 0.1s ease, color 0.1s ease; }
.star-btn.on { color: #ffb400; }
.star-btn:hover { transform: scale(1.12); }
.rating-comment { border-radius: 18px; font-size: 15px; resize: vertical; margin-bottom: 12px; }
.rating-card .form-message { margin-bottom: 12px; }

/* ---------- Manager dashboard ---------- */

.admin-shell { display: flex; flex-direction: column; gap: 14px; }
.admin-header { display: flex; align-items: center; gap: 12px; }
.admin-title { font-size: 24px; font-weight: 800; margin: 0; }
.admin-tabs { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 6px; }
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tab { height: 44px; padding: 0 16px; font-size: 14px; }
.admin-tab.active { background: var(--accent); color: white; }
.admin-tab.active iconify-icon { color: white; }
#admin-panel { display: flex; flex-direction: column; gap: 12px; }
.admin-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.admin-stat { background: var(--card); border-radius: 22px; box-shadow: var(--shadow-sm); padding: 16px; display: flex; flex-direction: column; gap: 2px; }
.admin-stat strong { font-size: 26px; font-weight: 800; }
.admin-stat span { font-size: 13px; color: var(--ink-soft); }
.admin-subtle { font-size: 12px; color: var(--ink-soft); margin: 0; }
.admin-empty { text-align: center; color: var(--ink-soft); padding: 30px 10px; margin: 0; }
.admin-toolbar { display: flex; gap: 8px; align-items: center; }
.admin-toolbar > .answer-input, .admin-search { flex: 1; min-width: 0; font-size: 15px; padding: 12px 16px; }
.admin-small-btn { padding: 11px 16px; font-size: 13px; white-space: nowrap; flex-shrink: 0; }
.admin-toolbar .btn-ghost { background: var(--card); box-shadow: var(--shadow-sm); color: var(--ink); }
.admin-list { display: flex; flex-direction: column; gap: 10px; }
.admin-card { background: var(--card); border-radius: 20px; box-shadow: var(--shadow-sm); padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; text-align: left; border: none; color: var(--ink); font: inherit; }
button.admin-card { cursor: pointer; }
button.admin-card:hover { background: var(--card-soft); }
.admin-entry strong { font-size: 15px; }
.admin-card-head { display: flex; align-items: center; gap: 10px; }
.admin-card-title { display: flex; flex-direction: column; min-width: 0; }
.admin-card-title span { font-size: 12px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; }
.admin-card-foot { display: flex; align-items: center; justify-content: space-between; }
.admin-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-tag { font-size: 12px; font-weight: 600; background: var(--card-soft); padding: 4px 10px; border-radius: 999px; }
.admin-stars { color: #ffb400; font-size: 18px; letter-spacing: 1px; }
.admin-stars span { color: var(--border); }
.admin-comment { margin: 0; font-size: 14px; line-height: 1.5; white-space: pre-wrap; }
.admin-dist { background: var(--card); border-radius: 20px; box-shadow: var(--shadow-sm); padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.admin-dist-row { display: grid; grid-template-columns: 36px 1fr 30px; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.admin-dist-bar { height: 8px; background: var(--card-soft); border-radius: 999px; overflow: hidden; }
.admin-dist-bar div { height: 100%; background: #ffb400; border-radius: 999px; }
.admin-pay-row { grid-template-columns: minmax(70px, auto) 1fr auto; }
.admin-pay-warn { background: var(--card); border-radius: 16px; box-shadow: var(--shadow-sm); padding: 10px 14px; }
.admin-section-title { font-size: 16px; font-weight: 800; margin: 8px 4px 0; }
.admin-form { background: var(--card); border-radius: 24px; box-shadow: var(--shadow-sm); padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.admin-form .link-btn { margin: 0; align-self: flex-start; }
.admin-textarea { border-radius: 18px; resize: vertical; font-family: inherit; }
.admin-form-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn.danger { color: var(--red); }
.admin-icon-row { display: flex; gap: 10px; align-items: center; }
.admin-icon-row .answer-input { flex: 1; }

/* ---------- Study plan: daily goal card + onboarding ---------- */

.goal-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  border: none;
  text-align: start;
  background: var(--card);
  border-radius: 24px;
  box-shadow: var(--shadow-sm);
  padding: 12px 16px 12px 12px;
  margin-bottom: 14px;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.goal-row { display: flex; gap: 10px; margin-bottom: 14px; }
.goal-row .goal-card { flex: 1; min-width: 0; margin-bottom: 0; }
.goal-calendar-btn {
  flex: 0 0 auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-width: 76px; padding: 10px 12px;
  border: none; border-radius: 24px;
  background: var(--card); box-shadow: var(--shadow-sm);
  color: var(--accent); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
}
.goal-calendar-btn iconify-icon { font-size: 26px; }
.goal-calendar-btn:hover { background: var(--card-soft); }
.goal-card:hover { background: var(--card-soft); }
.goal-card.done { background: linear-gradient(135deg, rgba(34, 179, 94, 0.12), rgba(31, 92, 245, 0.08)); }
.goal-card.done .ring-fill { stroke: var(--green); }
.goal-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.goal-text strong { font-size: 15px; font-weight: 800; }
.goal-text span { font-size: 13px; color: var(--ink-soft); }
.goal-text .goal-exam { color: var(--accent); font-weight: 700; display: inline-flex; align-items: center; gap: 4px; margin-top: 2px; }
.goal-exam iconify-icon { font-size: 16px; vertical-align: 0; }
.goal-chevron { color: var(--ink-soft); font-size: 20px; }
.goal-hint { font-size: 13px; color: var(--ink-soft); margin: 10px 4px 0; }
.choice-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(34, 179, 94, 0.14);
  color: var(--green-dark);
  padding: 2px 6px;
  border-radius: 999px;
  margin-inline-start: 4px;
  vertical-align: 1px;
}
.choice-btn.active .choice-badge { background: rgba(255, 255, 255, 0.25); color: white; }

/* ---------- Social sign-in ---------- */

.auth-social { display: flex; flex-direction: column; gap: 10px; margin-bottom: 4px; }
.social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 18px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--card);
  color: var(--ink);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.social-btn:hover { background: var(--card-soft); border-color: var(--ink-soft); }
.social-btn iconify-icon { font-size: 20px; vertical-align: 0; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 16px 0; color: var(--ink-soft); font-size: 13px; font-weight: 600; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.admin-status { width: auto; padding: 6px 30px 6px 12px; font-size: 12px; font-weight: 700; flex-shrink: 0; }

/* Small phones (≤ 360 px): keep the three lesson buttons on one line each. */
@media (max-width: 360px) {
  .lesson-footer { gap: 6px; }
  .lesson-footer .btn { padding: 14px 13px; font-size: 14px; white-space: nowrap; }
  .lesson-footer .btn-primary { padding: 14px 22px; }
}


/* ---------- Right-to-left (Arabic interface) ---------- */
/* Most of the layout flips by itself (flexbox, logical properties above);
   these are the few pieces drawn with physical directions. */
:root[lang="ar"] body { font-family: "Plus Jakarta Sans", "Segoe UI", "Noto Sans Arabic", "Geeza Pro", Tahoma, system-ui, sans-serif; }
[dir="rtl"] .switch-slider::before { left: auto; right: 3px; }
[dir="rtl"] .switch input:checked + .switch-slider::before { transform: translateX(-20px); }
[dir="rtl"] .select-input { background-position: 16px 55%, 22px 55%; padding-right: 18px; padding-left: 40px; }
/* Arrows point the way the page reads */
[dir="rtl"] iconify-icon[icon*="arrow-left"],
[dir="rtl"] iconify-icon[icon*="arrow-right"],
[dir="rtl"] .goal-chevron { transform: scaleX(-1); }
/* German stays left-to-right inside the Arabic page */
[dir="rtl"] #answer-input, [dir="rtl"] #placement-input,
[dir="rtl"] input[type="email"], [dir="rtl"] input[type="password"] { text-align: left; }

/* Show/hide password */
.password-wrap { position: relative; display: block; direction: ltr; }
.password-wrap .answer-input { width: 100%; padding-right: 52px; }
.password-eye {
  position: absolute; top: 50%; right: 8px; transform: translateY(-50%);
  width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-soft); font-size: 20px; background: transparent; border: 0; box-shadow: none; padding: 0;
}
.password-eye:hover, .password-eye:focus-visible { color: var(--accent); background: var(--card-soft); }
/* Hide the browser's own reveal button so there is only one eye */
input::-ms-reveal, input::-ms-clear { display: none; }

/* Language switch on the sign-in card */
.auth-card { position: relative; }
.lang-toggle {
  position: absolute; top: 14px; inset-inline-end: 14px;
  padding: 6px 14px; border-radius: 999px; font-size: 14px; font-weight: 700;
  color: var(--accent); background: var(--card-soft); border: 1px solid var(--border);
}
.lang-toggle:hover, .lang-toggle:focus-visible { background: var(--accent); color: white; }
/* German answer boxes: Arabic placeholder reads right-to-left, typed German left-to-right */
[dir="rtl"] #answer-input:placeholder-shown, [dir="rtl"] #placement-input:placeholder-shown,
[dir="rtl"] .password-wrap .answer-input:placeholder-shown { direction: rtl; text-align: right; }

/* ---------- Help & support: report a problem, my reports ---------- */
.lesson-report-btn { color: var(--ink-soft); font-size: 20px; }
.report-card, .reports-card { max-width: 420px; max-height: 90vh; overflow-y: auto; text-align: start; }
.report-card h2, .reports-card h2, .report-card .modal-emoji, .report-card .modal-body { text-align: center; }
.report-card .choice-grid { margin-bottom: 4px; }
.report-shot { display: flex; flex-direction: column; gap: 8px; }
.report-shot .btn { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; }
.report-shot-preview { position: relative; align-self: flex-start; }
.report-shot-preview img { max-height: 180px; max-width: 100%; border-radius: 14px; border: 1px solid var(--border); display: block; }
.report-shot-preview .icon-btn { position: absolute; top: 6px; inset-inline-end: 6px; width: 30px; height: 30px; border-radius: 50%; background: var(--card); box-shadow: var(--shadow-sm); }
.report-context { font-size: 13px; color: var(--ink-soft); }
.report-context summary { cursor: pointer; font-weight: 600; }
.report-context ul { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.report-context code { font-family: inherit; color: var(--ink); overflow-wrap: anywhere; }
.reports-list { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.reports-empty { color: var(--ink-soft); text-align: center; margin: 18px 0; }
.report-item { border: 1px solid var(--border); border-radius: 18px; padding: 12px 14px; background: var(--card-soft); }
.report-item.has-new { border-color: var(--accent); }
.report-item-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.report-status { padding: 3px 10px; border-radius: 999px; background: var(--border); color: var(--ink); font-weight: 700; white-space: nowrap; }
.report-status.status-reviewing, .report-status.status-planned { background: #fff3d6; color: #8a5a00; }
.report-status.status-done { background: #dcf5e4; color: #146c3a; }
.report-text { margin: 8px 0 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.report-date { margin: 0; font-size: 12px; color: var(--ink-soft); }
.report-reply { margin-top: 10px; padding: 10px 12px; border-radius: 14px; background: var(--card); border-inline-start: 3px solid var(--accent); }
.report-reply strong { font-size: 13px; color: var(--accent); }
.report-reply p { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
/* manager dashboard */
.admin-shot { max-width: 160px; max-height: 240px; border-radius: 12px; border: 1px solid var(--border); cursor: zoom-in; display: block; margin: 6px 0; }
.admin-shot.zoom { max-width: 100%; max-height: none; cursor: zoom-out; }
.admin-context { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 12px; margin: 6px 0; }
.admin-context dt { color: var(--ink-soft); }
.admin-context dd { margin: 0; overflow-wrap: anywhere; }
.admin-reply { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.admin-reply .btn { align-self: flex-start; }
.admin-reply-sent { border-inline-start: 3px solid var(--accent); padding-inline-start: 8px; }
#report-shot-remove { position: absolute; top: 6px; inset-inline-end: 6px; width: 30px; height: 30px; min-width: 0; padding: 0; font-size: 14px; border-radius: 50%; background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm); display: inline-flex; align-items: center; justify-content: center; }

/* Guests */
.auth-guest { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); text-align: center; }
.auth-guest-note { margin: 8px 0 0; font-size: 13px; color: var(--ink-soft); }
.guest-banner { background: var(--card-soft); border: 1px solid var(--accent); border-radius: 18px; padding: 14px 16px; margin: 4px 0 14px; }
.guest-banner > p { margin: 0 0 10px; }

/* Guests */
.auth-guest { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); text-align: center; }
.auth-guest[hidden] { display: none; }
.auth-guest-note { margin: 8px 0 0; font-size: 13px; color: var(--ink-soft); }
.guest-banner { background: var(--card-soft); border: 1px solid var(--accent); border-radius: 18px; padding: 14px 16px; margin: 4px 0 14px; }
.guest-banner[hidden] { display: none; }
.guest-banner > p { margin: 0 0 10px; }

/* ---------- Plans & billing (pricing.js) ---------- */
.pricing-shell { max-width: 760px; margin: 0 auto; padding: 16px 16px 120px; }
.plan-card { background: var(--card); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); padding: 16px; display: flex; flex-direction: column; gap: 8px; border: 2px solid transparent; }
.plan-owned { color: var(--green-dark); font-weight: 700; font-size: 14px; }
.plan-card .btn { width: 100%; }
.plan-legal { color: var(--ink-soft); font-size: 12px; line-height: 1.6; margin-top: 8px; }
.plan-legal a { color: var(--accent); }
/* Billing period: one segmented control instead of three loose chips. */
.plan-periods { display: flex; background: var(--card-soft); border: 1px solid var(--border); border-radius: 999px; padding: 4px; margin: 8px 0 16px; max-width: 420px; }
.plan-period { flex: 1; white-space: nowrap; border: 0; background: none; font: inherit; font-size: 14px; font-weight: 700; color: var(--ink-soft); padding: 9px 10px; border-radius: 999px; cursor: pointer; }
.plan-period.active { background: var(--card); color: var(--accent); box-shadow: var(--shadow-sm); }
.plan-period:focus-visible, .plan-level-pill:focus-visible, .plan-why-edit:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Why this plan is suggested: the learner's own study-plan answers. */
.plan-why { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 14px; }
.plan-why-title { font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.plan-facts { display: contents; list-style: none; }
.plan-facts li { background: var(--accent-soft); color: var(--accent-dark); font-size: 13px; font-weight: 700; border-radius: 999px; padding: 4px 10px; }
.plan-why-edit { border: 0; background: none; font: inherit; font-size: 13px; font-weight: 700; color: var(--accent); text-decoration: underline; cursor: pointer; padding: 4px 0; }
.plan-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; align-items: stretch; }
.plan-option { padding: 22px 20px 20px; gap: 12px; position: relative; }
.plan-option.recommended { order: -1; border-color: var(--accent); box-shadow: 0 12px 32px rgba(31, 92, 245, 0.16); }
.plan-option h2 { font-size: 21px; margin: 0; }
.plan-rec-badge { align-self: flex-start; background: var(--accent); color: #fff; font-size: 12px; font-weight: 800; border-radius: 999px; padding: 4px 10px; margin-top: -4px; }
.plan-lead { color: var(--ink-soft); margin: -6px 0 0; font-size: 14px; }
.plan-includes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.plan-includes li { padding-inline-start: 24px; position: relative; }
.plan-includes li::before { content: "✓"; position: absolute; inset-inline-start: 0; color: var(--accent); font-weight: 800; }
.plan-level-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.plan-level-pill { min-width: 52px; border: 2px solid var(--border); background: var(--card); color: var(--ink); font: inherit; font-weight: 800; font-size: 15px; border-radius: 12px; padding: 8px 10px; cursor: pointer; }
.plan-level-pill.picked { border-color: var(--accent); background: var(--accent); color: #fff; }
.plan-level-pill.owned { border-color: transparent; background: var(--card-soft); color: var(--green-dark); cursor: default; }
.plan-save { margin: 0; font-size: 13px; color: var(--ink-soft); }
.plan-save.on { color: var(--green-dark); font-weight: 700; }
.plan-price { font-size: 26px; font-weight: 800; min-height: 34px; margin-top: auto; }
.plan-per { font-size: 14px; font-weight: 600; color: var(--ink-soft); }
.plan-footnote { color: var(--ink-soft); font-size: 13px; margin: 16px 0 0; }
.settings-plan-list, .settings-history { margin: 6px 0; padding-inline-start: 20px; line-height: 1.7; }
.settings-history { color: var(--ink-soft); font-size: 13px; }
.level-card.plan-locked { cursor: pointer; }

/* ---------- First-open intro (app.js showIntro) ---------- */
.intro {
  max-width: 440px; margin: 0 auto;
  min-height: calc(100dvh - 32px);
  display: flex; flex-direction: column;
  padding: 8px 4px calc(12px + env(safe-area-inset-bottom));
}
.intro-top { display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
.intro-top .lang-toggle { position: static; }
.intro-skip { width: auto; margin: 0 0 0 auto; margin-inline-start: auto; margin-inline-end: 0; display: inline-block; font-weight: 700; font-size: 15px; color: var(--ink-soft); padding: 10px 6px; }
.intro-track { flex: 1; display: grid; align-items: center; }
.intro-slide { grid-area: 1 / 1; text-align: center; padding: 8px 12px; opacity: 0; visibility: hidden; transform: translateY(12px); transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s; }
.intro-slide.active { opacity: 1; visibility: visible; transform: none; }
.intro-visual { min-height: 210px; display: grid; place-items: center; margin-bottom: 26px; }
.intro-logo {
  width: 124px; height: 124px; border-radius: 36px; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--accent), #7a5cf5); box-shadow: 0 18px 40px rgba(31, 92, 245, 0.35);
}
.intro-logo span { font-size: 64px; line-height: 1; }
.intro-title { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; margin: 0 0 8px; }
.intro-kicker { font-size: 17px; font-weight: 700; color: var(--accent); margin: 0 0 14px; }
.intro-body { font-size: 15.5px; line-height: 1.6; color: var(--ink-soft); margin: 0 auto; max-width: 330px; }
.intro-mock {
  width: 100%; max-width: 300px; background: var(--card); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); padding: 18px; text-align: start;
}
.intro-mock-label { margin: 0 0 4px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: var(--accent); }
.intro-mock-prompt { margin: 0 0 12px; font-size: 20px; font-weight: 800; }
.intro-mock-input { direction: ltr; text-align: left; border: 2px solid var(--accent); border-radius: 14px; padding: 11px 14px; font-weight: 600; background: var(--card-soft); }
.intro-typed { display: inline-block; overflow: hidden; white-space: nowrap; vertical-align: bottom; border-inline-end: 2px solid var(--accent); }
.intro-slide.active .intro-typed { animation: intro-type 1.1s steps(8) 0.3s both, intro-caret 0.8s step-end 1.4s 2 both; }
@keyframes intro-type { from { width: 0; } to { width: 7.2ch; } }
@keyframes intro-caret { 50% { border-color: transparent; } }
.intro-mock-result { display: flex; align-items: center; gap: 6px; margin-top: 12px; padding: 9px 12px; border-radius: 12px; font-size: 14px; font-weight: 700; }
.intro-mock-result iconify-icon { color: inherit; font-size: 18px; }
.intro-ok { color: var(--green-dark); background: rgba(34, 179, 94, 0.12); }
.intro-almost { color: #9a6200; background: rgba(245, 165, 36, 0.15); }
.intro-slide.active .intro-mock-result { animation: intro-pop 0.35s ease 1.5s both; }
.intro-slide[data-slide="2"].active .intro-mock-result { animation-delay: 0.9s; }
@keyframes intro-pop { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: none; } }
.intro-mock-sentence, .intro-mock-fix { direction: ltr; text-align: left; margin: 0; font-size: 16px; font-weight: 600; }
.intro-mock-sentence s { color: var(--red); text-decoration-thickness: 2px; }
.intro-mock-fix { margin-top: 6px; color: var(--ink-soft); }
.intro-mock-fix b { color: var(--green-dark); }
.intro-chat { display: flex; flex-direction: column; gap: 10px; background: transparent; box-shadow: none; padding: 0; }
.intro-bubble { direction: ltr; text-align: left; margin: 0; padding: 11px 14px; border-radius: 18px; font-size: 14.5px; line-height: 1.45; max-width: 85%; box-shadow: var(--shadow-sm); }
.intro-bubble-me { align-self: flex-end; background: var(--accent); color: white; border-bottom-right-radius: 6px; }
.intro-bubble-tutor { align-self: flex-start; background: var(--card); border-bottom-left-radius: 6px; }
.intro-slide.active .intro-bubble-tutor { animation: intro-pop 0.35s ease 0.6s both; }
.intro-progress { display: flex; align-items: center; justify-content: center; gap: 22px; }
.intro-ring {
  width: 104px; height: 104px; border-radius: 50%; display: grid; place-content: center; text-align: center;
  background: radial-gradient(closest-side, var(--card) 78%, transparent 80%), conic-gradient(var(--accent) 0 72%, var(--accent-soft-2) 0);
}
.intro-ring span { font-size: 28px; font-weight: 800; line-height: 1; }
.intro-ring small { font-size: 12px; color: var(--ink-soft); font-weight: 700; }
.intro-pills { display: flex; flex-direction: column; gap: 10px; }
.intro-pill { background: var(--card-soft); border: 1px solid var(--border); border-radius: 999px; padding: 8px 16px; font-size: 16px; }
.intro-levels { display: flex; justify-content: space-between; gap: 6px; }
.intro-levels span { flex: 1; text-align: center; padding: 14px 0; border-radius: 14px; font-weight: 800; background: var(--card-soft); color: var(--ink-soft); }
.intro-levels span.on { background: var(--accent); color: white; box-shadow: 0 8px 18px rgba(31, 92, 245, 0.35); transform: scale(1.1); }
.intro-footer { display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 0 8px; }
.intro-dots { display: flex; gap: 8px; }
.intro-dot { width: 8px; height: 8px; padding: 0; border: 0; border-radius: 999px; background: var(--border); cursor: pointer; transition: width 0.25s ease, background 0.25s ease; }
.intro-dot.active { width: 26px; background: var(--accent); }
.intro-footer .onboard-btn { padding-block: 16px; font-size: 16px; }
@media (prefers-reduced-motion: reduce) {
  .intro-slide, .intro-dot { transition: none; }
  .intro-slide.active .intro-typed, .intro-slide.active .intro-mock-result, .intro-slide.active .intro-bubble-tutor { animation: none; }
  .intro-typed { width: auto; border: 0; }
}

/* ---------- Practice tab (practice.js) ---------- */
.practice-shell { max-width: 620px; margin: 0 auto; padding: 4px 0 120px; display: flex; flex-direction: column; gap: 14px; }
.practice-title { font-size: 28px; font-weight: 800; margin: 4px 0 0; }
.practice-sub { color: var(--ink-soft); margin: -6px 0 0; }
.practice-top { display: flex; }
.practice-back { color: var(--accent); font-weight: 700; padding: 0; }
[dir="rtl"] .practice-back { unicode-bidi: plaintext; }
.practice-card {
  display: flex; flex-direction: column; gap: 6px; text-align: start; width: 100%;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm); padding: 20px 22px; font: inherit; color: var(--ink); cursor: pointer;
}
.practice-card:hover { background: var(--card-soft); }
.practice-card-title { font-size: 20px; font-weight: 800; }
.practice-card-sub { color: var(--ink-soft); font-size: 15px; line-height: 1.45; }
.practice-card-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.practice-card-primary:hover { background: var(--accent-dark); }
.practice-card-primary .practice-card-sub { color: rgba(255, 255, 255, 0.88); }
.practice-panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); padding: 18px 20px; }
.practice-lookup { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px 18px; }
.practice-lookup-label { display: block; color: var(--ink-soft); margin-bottom: 10px; }
.practice-lookup-row { display: flex; gap: 10px; }
.practice-lookup-row .answer-input { flex: 1; min-width: 0; margin: 0; }
.practice-lookup-result { margin: 10px 0 0; font-weight: 600; unicode-bidi: plaintext; }
.practice-lookup-result:empty { display: none; }
.practice-prompt { font-size: 20px; font-weight: 700; line-height: 1.45; margin: 0; }
.practice-hint { color: var(--ink-soft); margin: 10px 0 0; }
.practice-label { color: var(--ink-soft); font-weight: 600; margin: 0; display: flex; align-items: center; gap: 8px; }
.practice-textarea { min-height: 96px; resize: vertical; text-align: left; font: inherit; }
.practice-check { align-self: stretch; }
.practice-error { color: var(--red); margin: 0; }
.practice-error:empty { display: none; }
.practice-answer-text { font-size: 18px; font-weight: 700; margin: 4px 0 12px; }
.practice-attempt-text { margin: 4px 0 0; }
.practice-grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.practice-grade { color: #fff; font-weight: 700; }
.grade-again { background: var(--red); }
.grade-hard { background: var(--amber); }
.grade-good { background: var(--green); }
.grade-easy { background: var(--accent); }
.practice-flashcard { display: flex; flex-direction: column; align-items: center; gap: 10px; min-height: 220px; justify-content: center; font: inherit; color: var(--ink); cursor: pointer; width: 100%; }
.practice-flashcard:disabled { cursor: default; }
.flashcard-emoji { font-size: 44px; }
.flashcard-word { font-size: 30px; font-weight: 800; color: var(--accent); }
.flashcard-meaning { font-size: 20px; font-weight: 700; }
.flashcard-example { color: var(--ink-soft); }
.flashcard-hint { color: var(--ink-soft); font-size: 14px; }
.practice-actions { display: flex; justify-content: center; }
.practice-done { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.practice-done h3 { margin: 0; }
.practice-subjects { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.practice-subject { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; text-align: start; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; font: inherit; color: var(--ink); cursor: pointer; }
.practice-subject:hover { background: var(--card-soft); }
.practice-subject-emoji { font-size: 26px; }
.practice-subject-name { font-weight: 700; }
.practice-subject-count { color: var(--ink-soft); font-size: 13px; }
.practice-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.practice-chip { border: 1px solid var(--border); background: var(--card); color: var(--ink); border-radius: 999px; padding: 8px 14px; font: inherit; font-weight: 600; cursor: pointer; }
.practice-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.practice-gap { display: inline-block; min-width: 3em; border-bottom: 2px solid var(--accent); color: var(--accent); text-align: center; padding: 0 4px; }
.practice-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.practice-option { border: 2px solid var(--border); background: var(--card); color: var(--ink); border-radius: 14px; padding: 14px; font: inherit; font-size: 17px; font-weight: 700; cursor: pointer; }
.practice-option:hover:not(:disabled) { border-color: var(--accent); }
.practice-option.correct { border-color: var(--green); background: var(--green); color: #fff; }
.practice-option.incorrect { border-color: var(--red); background: var(--red); color: #fff; }
.practice-phrase p { margin: 0 0 6px; }
.practice-phrase-de { font-size: 19px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.practice-phrase-meaning { font-weight: 600; }
.practice-phrase-register { color: var(--ink-soft); font-size: 14px; }
.practice-phrase-example { font-style: italic; }

/* Intro walkthrough: feature list + calendar mocks */
.intro-list { display: flex; flex-direction: column; gap: 8px; }
.intro-row { display: flex; align-items: center; gap: 10px; background: var(--card-soft); border-radius: 12px; padding: 10px 12px; font-weight: 700; font-size: 15px; text-align: start; }
.intro-row b { font-size: 18px; }
.intro-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.intro-cal span { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border-radius: 10px; background: var(--card-soft); font-weight: 700; font-size: 14px; color: var(--ink-soft); }
.intro-cal span.xp { background: var(--accent-soft); color: var(--accent); }
.intro-cal span.due { background: var(--amber); color: #fff; }

/* ---------- Learn: unit list (compact rows, renderUnitPath) ---------- */
.unit-list { display: flex; flex-direction: column; gap: 12px; }
.unit-row {
  --tile-bg: #eeecff; --tile-ink: #6c63ff;
  display: flex; align-items: center; gap: 16px; width: 100%;
  background: var(--card); border: 1px solid var(--border); border-radius: 22px;
  box-shadow: var(--shadow-sm); padding: 14px 16px; font: inherit; color: var(--ink);
  text-align: start; cursor: pointer; transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.unit-row:hover:not(:disabled) { transform: translateY(-1px); box-shadow: var(--shadow); }
.unit-row.current { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-sm); }
.unit-row.locked { cursor: default; opacity: 0.6; box-shadow: none; }
.tone-0 { --tile-bg: #eeecff; --tile-ink: #6c63ff; }
.tone-1 { --tile-bg: #e3f7e6; --tile-ink: #22a04b; }
.tone-2 { --tile-bg: #ffeede; --tile-ink: #f08a24; }
.tone-3 { --tile-bg: #e2efff; --tile-ink: #2f7cf6; }
.tone-4 { --tile-bg: #ffe6ee; --tile-ink: #e5487a; }
.tone-5 { --tile-bg: #fff6d6; --tile-ink: #d9a400; }
.unit-row-tile {
  position: relative; flex: none; width: 64px; height: 64px; border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  background: var(--tile-bg); color: var(--tile-ink); font-size: 32px;
}
.unit-row-check {
  position: absolute; inset-block-end: -4px; inset-inline-end: -4px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--green); color: #fff; font-size: 13px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; border: 2px solid var(--card);
}
.unit-row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.unit-row-kicker { font-size: 13px; color: var(--ink-soft); font-weight: 600; }
.unit-row.current .unit-row-kicker { color: var(--accent); }
.unit-row-title { font-size: 18px; font-weight: 800; line-height: 1.25; }
.unit-row-dots { display: flex; gap: 4px; margin-top: 2px; }
.unit-row-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.unit-row-dots i.done { background: var(--tile-ink); }
.unit-row-dots i.next { background: transparent; box-shadow: inset 0 0 0 2px var(--tile-ink); }
.unit-row-progress { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.unit-row-track { flex: 1; height: 6px; border-radius: 99px; background: var(--card-soft); overflow: hidden; }
.unit-row-fill { display: block; height: 100%; border-radius: 99px; background: var(--tile-ink); }
.unit-row-pct { font-size: 13px; color: var(--ink-soft); font-weight: 600; min-width: 3ch; }
.unit-row-end { flex: none; color: var(--ink-soft); font-size: 22px; display: flex; }
[dir="rtl"] .unit-row-chevron { transform: scaleX(-1); }
.unit-row-start {
  flex: none; background: var(--accent); color: #fff; font-weight: 700; font-size: 15px;
  padding: 10px 18px; border-radius: 999px; box-shadow: 0 8px 18px -8px var(--accent);
}
@media (max-width: 420px) {
  .unit-row { gap: 12px; padding: 12px; }
  .unit-row-tile { width: 54px; height: 54px; font-size: 27px; border-radius: 16px; }
  .unit-row-title { font-size: 16px; }
  .unit-row-start { padding: 8px 14px; font-size: 14px; }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tone-0 { --tile-bg: rgba(108, 99, 255, 0.18); --tile-ink: #a9a4ff; }
  :root:not([data-theme="light"]) .tone-1 { --tile-bg: rgba(34, 160, 75, 0.18); --tile-ink: #5fdc86; }
  :root:not([data-theme="light"]) .tone-2 { --tile-bg: rgba(240, 138, 36, 0.18); --tile-ink: #ffb066; }
  :root:not([data-theme="light"]) .tone-3 { --tile-bg: rgba(47, 124, 246, 0.2); --tile-ink: #7fb0ff; }
  :root:not([data-theme="light"]) .tone-4 { --tile-bg: rgba(229, 72, 122, 0.18); --tile-ink: #ff8db1; }
  :root:not([data-theme="light"]) .tone-5 { --tile-bg: rgba(217, 164, 0, 0.18); --tile-ink: #ffd452; }
}
:root[data-theme="dark"] .tone-0 { --tile-bg: rgba(108, 99, 255, 0.18); --tile-ink: #a9a4ff; }
:root[data-theme="dark"] .tone-1 { --tile-bg: rgba(34, 160, 75, 0.18); --tile-ink: #5fdc86; }
:root[data-theme="dark"] .tone-2 { --tile-bg: rgba(240, 138, 36, 0.18); --tile-ink: #ffb066; }
:root[data-theme="dark"] .tone-3 { --tile-bg: rgba(47, 124, 246, 0.2); --tile-ink: #7fb0ff; }
:root[data-theme="dark"] .tone-4 { --tile-bg: rgba(229, 72, 122, 0.18); --tile-ink: #ff8db1; }
:root[data-theme="dark"] .tone-5 { --tile-bg: rgba(217, 164, 0, 0.18); --tile-ink: #ffd452; }
.unit-row-tile iconify-icon { color: var(--tile-ink); vertical-align: 0; }
.unit-row-end iconify-icon { color: inherit; vertical-align: 0; }
.unit-row-chevron iconify-icon { color: var(--accent); }

/* ---------- Subscribe prompts (pricing.js: Learn home card + popup) ---------- */

.upsell-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  margin: 14px 0 4px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent-soft-2), var(--accent-soft));
  border: 1px solid var(--accent-soft-2);
}
.upsell-card[hidden] { display: none; }
.upsell-card-icon { font-size: 34px; line-height: 0; flex: none; }
.upsell-card-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.upsell-card-text strong { font-weight: 800; color: var(--ink); }
.upsell-card-text span { font-size: 13px; color: var(--ink-soft); line-height: 1.35; }
.upsell-card-btn { flex: none; padding: 10px 18px; }

.upsell-modal { max-width: 400px; padding: 28px 20px 20px; max-height: calc(100dvh - 40px); overflow-y: auto; }
.upsell-modal-art { font-size: 52px; line-height: 1; display: block; }
.upsell-modal h2 { margin: 8px 0 4px; font-size: 24px; }
.upsell-modal .modal-body { margin: 0 0 16px; }

.compare { position: relative; text-align: start; margin-bottom: 18px; }
/* The Full column is one raised, accent-tinted strip behind its cells. */
.compare-full-col {
  position: absolute;
  top: 0;
  bottom: -6px;
  inset-inline-end: 0;
  width: 31%;
  border-radius: 16px;
  background: var(--accent-soft);
  border: 1.5px solid var(--accent-soft-2);
}
.compare-row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 27% 31%;
  align-items: center;
  min-height: 46px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.compare-row:last-child { border-bottom: 0; }
.compare-row > span:first-child { color: var(--ink); padding-inline-end: 8px; line-height: 1.3; }
.compare-row > span:not(:first-child) { text-align: center; color: var(--ink-soft); font-weight: 600; padding: 8px 4px; }
.compare-head { min-height: 44px; }
.compare-head > span:not(:first-child) { font-weight: 800; font-size: 15px; color: var(--ink); }
.compare-head .compare-full { color: var(--accent); }
.compare-row .compare-full { color: var(--ink); }
.compare-row iconify-icon { font-size: 22px; vertical-align: middle; }
.compare-yes iconify-icon { color: var(--accent); }
.compare-no iconify-icon { color: var(--ink-soft); opacity: 0.6; }
#upsell-price { color: var(--accent); font-weight: 800; }

.upsell-cta { width: 100%; padding: 15px; font-size: 16px; }
.upsell-later { width: 100%; margin-top: 6px; }
.upsell-note { margin: 6px 0 0; font-size: 12px; color: var(--ink-soft); }

@media (prefers-reduced-motion: no-preference) {
  .modal-overlay.show .upsell-modal { animation: upsell-in 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
  @keyframes upsell-in { from { transform: translateY(16px) scale(0.97); opacity: 0; } }
}
/* Iconify icons that replaced inline emoji: sit on the text baseline. */
.theme-option iconify-icon, .admin-tag iconify-icon, .admin-subtle iconify-icon,
.intro-bubble iconify-icon, .goal-ring-text iconify-icon { vertical-align: -0.15em; }
.theme-option { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.admin-dot-ok { color: #1f9d55; }
.admin-dot-warn { color: #e8890c; }
.admin-dot-off { color: #9aa3b2; }

/* Auto-renewal terms right under each Subscribe button */
.plan-renew-terms { font-size: 12px; line-height: 1.5; color: var(--ink-soft); margin: 8px 0 0; text-align: start; }

/* My notebook (practice.js renderNotebook) */
.notebook-row { display: flex; align-items: flex-start; gap: 12px; }
.notebook-row-text { flex: 1; min-width: 0; }
.notebook-german { font-size: 20px; font-weight: 800; margin: 0 0 2px; }
.notebook-english { color: var(--ink-soft); margin: 0; }
.notebook-example { margin: 8px 0 0; line-height: 1.45; }
.notebook-row-actions { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.notebook-remove { color: var(--accent); }
.notebook-empty { text-align: center; }
.notebook-empty-title { font-size: 18px; font-weight: 800; margin: 0 0 6px; }

/* Lesson-finished pop-up (showLessonCelebration) */
.celebrate-card { text-align: center; }
.celebrate-number { font-size: 64px; font-weight: 800; line-height: 1; color: var(--accent); margin: 4px 0 0; }
.celebrate-unit { font-size: 18px; margin: 6px 0 0; }
.celebrate-message { margin: 14px 0 18px; line-height: 1.5; }
.celebrate-continue { width: 100%; }

/* "Review the grammar" link under a wrong answer (renderAnswerFeedback) */
.grammar-link {
  display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 10px;
  border: 0; border-radius: 14px; padding: 10px 12px; background: var(--card);
  color: var(--accent); font: inherit; text-align: start; cursor: pointer;
}
.grammar-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.grammar-link iconify-icon { font-size: 20px; flex: none; }
.grammar-link-label { display: block; color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.grammar-link-title { display: block; font-size: 15px; }

/* ---------- Handwriting pad (lesson answers) ---------- */
.hw-btn { background: var(--card-soft); color: var(--accent); box-shadow: none; }
.hw-card { max-width: 520px; text-align: start; }
.hw-card h2 { margin: 0 0 4px; }
/* Always white with dark ink (also in dark mode) so the AI gets a clean, high-contrast picture. */
.hw-canvas {
  display: block;
  width: 100%;
  height: 220px;
  margin-top: 12px;
  border-radius: 18px;
  border: 1px solid #d9dcef;
  background: #ffffff;
  touch-action: none;
  cursor: crosshair;
}
.hw-error { color: var(--red); font-size: 14px; min-height: 1em; margin: 8px 0 0; }
.hw-actions { display: flex; gap: 10px; align-items: center; margin-top: 10px; }
.hw-small {
  width: 48px; height: 48px; flex-shrink: 0; border: none; border-radius: 50%;
  background: var(--card-soft); color: var(--ink); font-size: 20px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.hw-small:disabled, .hw-use:disabled { opacity: 0.5; cursor: default; }
.hw-use { flex: 1; }
