/* DeutschDost — styles. Themes are CSS variables on [data-theme]; layout uses logical properties for RTL (Urdu). */

:root,
[data-theme='sunny'] {
  --bg: #fff8ec;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, #ffe1ec 0%, transparent 60%), radial-gradient(900px 500px at -10% 110%, #fff0c2 0%, transparent 60%), #fff8ec;
  --card: #ffffff;
  --card-2: #fff4e0;
  --text: #2b2118;
  --muted: #7c6a58;
  --border: #f1e3cf;
  --primary: #ff8a00;
  --primary-dark: #c2410c;
  --primary-soft: #ffedd5;
  --accent: #ff3d7f;
  --good: #16a34a;
  --good-soft: #dcfce7;
  --bad: #e11d48;
  --bad-soft: #ffe4e6;
  --warn: #f59e0b;
  --track: #f3e6d4;
  --soft: #fff1dc;
  --sky1: #ffd9a8;
  --sky2: #ffeedd;
  --gate: #b45309;
  --ground: #f7c58b;
  --shadow: 0 8px 24px rgba(160, 90, 20, 0.12);
  --on-primary: #ffffff;
}
[data-theme='ocean'] {
  --bg: #eef8ff;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, #cdeffd 0%, transparent 60%), radial-gradient(900px 500px at -10% 110%, #d5f5ee 0%, transparent 60%), #eef8ff;
  --card-2: #e3f3fc;
  --text: #0c2433;
  --muted: #557286;
  --border: #d2e7f4;
  --primary: #0284c7;
  --primary-dark: #075985;
  --primary-soft: #dbeefb;
  --accent: #14b8a6;
  --track: #d6e9f5;
  --soft: #e0f2fe;
  --sky1: #8fd3fe;
  --sky2: #e0f2fe;
  --gate: #0e5a84;
  --ground: #9dd9c5;
  --shadow: 0 8px 24px rgba(2, 80, 140, 0.13);
}
[data-theme='forest'] {
  --bg: #f0faf1;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, #d8f5c9 0%, transparent 60%), radial-gradient(900px 500px at -10% 110%, #fdf3c4 0%, transparent 60%), #f0faf1;
  --card-2: #e6f6e8;
  --text: #13261a;
  --muted: #587161;
  --border: #d4ead8;
  --primary: #16a34a;
  --primary-dark: #166534;
  --primary-soft: #dcfce7;
  --accent: #eab308;
  --track: #d9eddc;
  --soft: #e3f7e6;
  --sky1: #bfe9c4;
  --sky2: #effbf1;
  --gate: #2f6b3a;
  --ground: #9bd38b;
  --shadow: 0 8px 24px rgba(20, 90, 40, 0.12);
}
[data-theme='candy'] {
  --bg: #fff0f8;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, #ffd6ec 0%, transparent 60%), radial-gradient(900px 500px at -10% 110%, #e9ddff 0%, transparent 60%), #fff0f8;
  --card-2: #ffe6f3;
  --text: #33152a;
  --muted: #86607a;
  --border: #f6d6e8;
  --primary: #db2777;
  --primary-dark: #9d174d;
  --primary-soft: #fce7f3;
  --accent: #8b5cf6;
  --track: #f6dceb;
  --soft: #fde4f1;
  --sky1: #f9c2e0;
  --sky2: #f3e8ff;
  --gate: #9d174d;
  --ground: #e9b8f5;
  --shadow: 0 8px 24px rgba(160, 30, 100, 0.12);
}
[data-theme='sunset'] {
  --bg: #f7f1ff;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, #ffd7c2 0%, transparent 60%), radial-gradient(900px 500px at -10% 110%, #e2d4ff 0%, transparent 60%), #f7f1ff;
  --card-2: #f0e7ff;
  --text: #241336;
  --muted: #6f5f85;
  --border: #e6daf8;
  --primary: #7c3aed;
  --primary-dark: #5b21b6;
  --primary-soft: #ede9fe;
  --accent: #f97316;
  --track: #e8def7;
  --soft: #efe7ff;
  --sky1: #fdba8c;
  --sky2: #e9d5ff;
  --gate: #5b21b6;
  --ground: #f0abfc;
  --shadow: 0 8px 24px rgba(90, 40, 170, 0.14);
}
[data-theme='germany'] {
  --bg: #fffbea;
  --bg-grad: linear-gradient(180deg, rgba(0, 0, 0, 0.04), transparent 160px), radial-gradient(900px 500px at 110% 110%, #fff1b8 0%, transparent 60%), #fffbea;
  --card-2: #fff6cc;
  --text: #111111;
  --muted: #5f5a4a;
  --border: #efe5bd;
  --primary: #dd0000;
  --primary-dark: #8b0000;
  --primary-soft: #fde2e2;
  --accent: #e0b000;
  --track: #f1e8c3;
  --soft: #fff4c7;
  --sky1: #ffe27a;
  --sky2: #fffbea;
  --gate: #222222;
  --ground: #d4b200;
  --shadow: 0 8px 24px rgba(60, 40, 0, 0.14);
}
[data-theme='pakistan'] {
  --bg: #f1f8f3;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, #cfe9d7 0%, transparent 60%), radial-gradient(900px 500px at -10% 110%, #ffffff 0%, transparent 60%), #f1f8f3;
  --card-2: #e5f2e9;
  --text: #0d2416;
  --muted: #557063;
  --border: #d3e7da;
  --primary: #0b7a3b;
  --primary-dark: #01411c;
  --primary-soft: #dcefe3;
  --accent: #c9a227;
  --track: #d7e9dd;
  --soft: #e3f2e8;
  --sky1: #a7dcb9;
  --sky2: #f1f8f3;
  --gate: #01411c;
  --ground: #8cc79f;
  --shadow: 0 8px 24px rgba(1, 65, 28, 0.14);
}
[data-theme='night'] {
  --bg: #0f1424;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, #2a2160 0%, transparent 60%), radial-gradient(900px 500px at -10% 110%, #3a1645 0%, transparent 60%), #0f1424;
  --card: #1a2137;
  --card-2: #222b45;
  --text: #e8ecf8;
  --muted: #9aa5c4;
  --border: #2c3653;
  --primary: #818cf8;
  --primary-dark: #a5b4fc;
  --primary-soft: #2a2f5a;
  --accent: #f472b6;
  --good: #4ade80;
  --good-soft: #14352a;
  --bad: #fb7185;
  --bad-soft: #3d1a26;
  --track: #2c3653;
  --soft: #232c49;
  --sky1: #312e81;
  --sky2: #1e1b4b;
  --gate: #c7d2fe;
  --ground: #312e81;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  --on-primary: #10132a;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  font-family: 'Baloo 2', 'Noto Nastaliq Urdu', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}
[dir='rtl'] body {
  line-height: 1.95;
  font-size: 16px;
}
a {
  color: var(--primary-dark);
}
img,
svg {
  max-width: 100%;
}
h1,
h2,
h3 {
  line-height: 1.25;
  margin: 0 0 0.5em;
}
[dir='rtl'] h1,
[dir='rtl'] h2,
[dir='rtl'] h3 {
  line-height: 1.9;
}
h1 {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 800;
}
h2 {
  font-size: 1.35rem;
  font-weight: 800;
}
h3 {
  font-size: 1.12rem;
  font-weight: 700;
}
p {
  margin: 0 0 0.75em;
}
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.muted {
  color: var(--muted);
}
.ur {
  font-family: 'Noto Nastaliq Urdu', serif;
  line-height: 2.1;
}
.de {
  font-weight: 700;
}
.hidden {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* ---------- boot ---------- */
.boot {
  min-height: 100vh;
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  color: var(--muted);
}
.boot-dot {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: var(--primary);
  animation: bob 1s ease-in-out infinite;
}

/* ---------- shell ---------- */
.shell {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
}
.side {
  display: none;
}
.main-col {
  min-width: 0;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  padding-top: max(8px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}
.logo b {
  font-size: 1.15rem;
}
.logo small {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.3;
}
.logo-sm b {
  display: none;
}
.chips {
  display: flex;
  gap: 6px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar {
  display: none;
}
.chip-stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
  font-size: 0.9rem;
  text-decoration: none;
  color: var(--text);
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}
.chip-done {
  background: var(--good-soft);
  border-color: var(--good);
}
.chip-level {
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 800;
  border: none;
}
.chip-off {
  background: var(--bad-soft);
}
.top-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.lang-btn {
  font-weight: 800;
  min-width: 64px;
}
.lang-short {
  display: none;
}
/* Phones: everything in the top bar must fit (no chip pushed out of view). */
@media (max-width: 560px) {
  .topbar {
    gap: 6px;
    padding-inline: 8px;
  }
  .topbar .logo-sm {
    display: none;
  }
  .chips {
    gap: 4px;
  }
  .chip-stat {
    padding: 2px 7px;
    font-size: 0.82rem;
    gap: 2px;
  }
  .top-actions {
    gap: 4px;
  }
  .top-actions .icon-btn {
    width: 36px;
    height: 36px;
  }
  .lang-btn {
    min-width: 0;
    padding: 4px 10px;
  }
  .lang-long {
    display: none;
  }
  .lang-short {
    display: inline;
  }
}
.view {
  max-width: 1040px;
  margin: 0 auto;
  padding: 16px 16px 110px;
  outline: none;
}
.view-bare {
  padding-bottom: 40px;
}
.view-enter {
  animation: viewIn 0.35s ease;
}
.tabbar {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--card);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.06);
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 7px 2px 6px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  background: none;
  border: none;
  font-family: inherit;
  cursor: pointer;
  line-height: 1.3;
}
.tab .nav-i {
  font-size: 1.35rem;
  line-height: 1.2;
}
.tab.active {
  color: var(--primary-dark);
}
.tab.active .nav-i {
  transform: translateY(-2px) scale(1.12);
}

@media (min-width: 960px) {
  .shell {
    grid-template-columns: 250px 1fr;
  }
  .side {
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 18px 14px;
    background: var(--card);
    border-inline-end: 1px solid var(--border);
    overflow-y: auto;
  }
  .side-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 14px;
    text-decoration: none;
    color: var(--text);
    font-weight: 600;
  }
  .nav-link:hover {
    background: var(--primary-soft);
  }
  .nav-link.active {
    background: var(--primary);
    color: var(--on-primary);
  }
  .nav-i {
    width: 24px;
    text-align: center;
  }
  .side-foot {
    margin-top: auto;
    display: grid;
    gap: 8px;
  }
  .tabbar,
  .logo-sm {
    display: none;
  }
  .view {
    padding: 24px 28px 60px;
  }
}
.me {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  overflow: hidden;
}
.avatar {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 16px;
  border: 2px solid transparent;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.08s, box-shadow 0.15s, background 0.15s;
  line-height: 1.3;
  min-height: 46px;
}
.btn:active {
  transform: translateY(2px);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 4px 0 var(--primary-dark);
}
.btn-primary:active {
  box-shadow: 0 2px 0 var(--primary-dark);
}
.btn-ghost {
  background: var(--card);
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover {
  border-color: var(--primary);
}
.btn-good {
  background: var(--good);
  color: #fff;
  box-shadow: 0 4px 0 color-mix(in srgb, var(--good) 70%, #000);
}
.btn-bad {
  background: var(--bad);
  color: #fff;
  box-shadow: 0 4px 0 color-mix(in srgb, var(--bad) 70%, #000);
}
.btn-danger {
  background: var(--bad);
  color: #fff;
}
.btn-sm {
  padding: 5px 12px;
  min-height: 36px;
  font-size: 0.9rem;
  border-radius: 12px;
}
.btn-block {
  width: 100%;
}
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  font-size: 1.1rem;
  display: inline-grid;
  place-items: center;
  color: var(--text);
}
.input,
select.input,
textarea.input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 2px solid var(--border);
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 1.05rem;
}
.input:focus {
  outline: none;
  border-color: var(--primary);
}
.input.right {
  border-color: var(--good);
  background: var(--good-soft);
}
.input.wrong {
  border-color: var(--bad);
  background: var(--bad-soft);
}
label.field {
  display: grid;
  gap: 4px;
  font-weight: 700;
}
.form {
  display: grid;
  gap: 14px;
}
.pw-wrap {
  position: relative;
  display: block;
}
.pw-wrap .input {
  padding-inline-end: 52px;
}
.pw-eye {
  position: absolute;
  inset-inline-end: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  font-size: 1.2rem;
  cursor: pointer;
  border-radius: 10px;
}
.pw-eye:hover {
  background: var(--primary-soft);
}
.form-error {
  color: var(--bad);
  font-weight: 700;
  min-height: 1.4em;
}
.switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  font-weight: 600;
  cursor: pointer;
}
.switch-row input {
  width: 22px;
  height: 22px;
  accent-color: var(--primary);
}

/* ---------- cards & layout ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.card + .card {
  margin-top: 16px;
}
.card-hero {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  border: none;
}
.card-hero .muted,
.card-hero a {
  color: rgba(255, 255, 255, 0.9);
}
.card-soft {
  background: var(--card-2);
  box-shadow: none;
}
.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.card-title h2,
.card-title h3 {
  margin: 0;
}
.grid {
  display: grid;
  gap: 16px;
}
.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}
.grid-4 {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.section {
  margin-top: 26px;
}
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.page-head h1 {
  margin-bottom: 4px;
}
.sub {
  color: var(--muted);
  max-width: 680px;
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 0.8rem;
  font-weight: 800;
  white-space: nowrap;
}
.tag-review {
  background: #e0f2fe;
  color: #075985;
}
.tag-hard {
  background: #fef3c7;
  color: #92400e;
}
.tag-good {
  background: var(--good-soft);
  color: var(--good);
}
.notice {
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--card-2);
  border: 1px dashed var(--border);
}
.empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--muted);
  display: grid;
  justify-items: center;
  gap: 10px;
}
.empty-i {
  font-size: 3rem;
}
.stat-tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-tile b {
  display: block;
  font-size: 1.6rem;
  color: var(--primary-dark);
  line-height: 1.2;
}
.stat-tile span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}
.bar {
  height: 12px;
  border-radius: 999px;
  background: var(--track);
  overflow: hidden;
}
.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.6s ease;
}
.ring {
  position: relative;
  display: inline-grid;
  place-items: center;
}
.ring svg circle:last-child {
  transition: stroke-dashoffset 1s ease;
}
.ring-text {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  line-height: 1.1;
}
.ring-text b {
  font-size: 1.6rem;
}
.ring-text small {
  color: var(--muted);
  font-size: 0.75rem;
}

/* ---------- tables ---------- */
.table-wrap {
  overflow-x: auto;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--card);
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.table th,
.table td {
  padding: 9px 12px;
  text-align: start;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table th {
  background: var(--card-2);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--muted);
  white-space: nowrap;
  position: sticky;
  top: 0;
}
[dir='rtl'] .table th {
  text-transform: none;
  letter-spacing: 0;
}
.table tr:last-child td {
  border-bottom: none;
}
.table tbody tr:hover {
  background: color-mix(in srgb, var(--primary-soft) 45%, transparent);
}
.table .num {
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.table th.sortable {
  cursor: pointer;
}
.pct-good {
  color: var(--good);
  font-weight: 800;
}
.pct-bad {
  color: var(--bad);
  font-weight: 800;
}

/* ---------- German text, speakers, stars ---------- */
.de-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.spk {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--primary-soft);
  cursor: pointer;
  font-size: 1rem;
  display: inline-grid;
  place-items: center;
  transition: transform 0.15s;
  vertical-align: middle;
  padding: 0;
}
.spk:hover {
  transform: scale(1.1);
}
.spk.speaking {
  animation: pulse 0.8s ease-in-out infinite;
  background: var(--primary);
}
.spk-slow {
  background: var(--card-2);
}
.spk-big {
  width: 92px;
  height: 92px;
  font-size: 2.6rem;
  background: var(--primary);
  box-shadow: 0 6px 0 var(--primary-dark);
}
.star {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 1.25rem;
  padding: 2px 6px;
  border-radius: 10px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: inherit;
}
.star:hover {
  background: #fef3c7;
}
.star.on {
  color: #b45309;
}
.star-label {
  border: 1px solid var(--border);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 3px 10px;
}
.star-label.on {
  background: #fef3c7;
  border-color: #f59e0b;
}
.meaning {
  display: inline-flex;
  flex-direction: column;
  gap: 0;
}
.m-ur {
  font-size: 1.05em;
}
.m-big {
  font-size: 1.35rem;
  font-weight: 700;
}
.umlauts {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
  justify-content: center;
}
.key {
  min-width: 44px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  font: inherit;
  font-weight: 800;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--border);
  color: var(--text);
}
.key:active {
  transform: translateY(2px);
  box-shadow: none;
}

/* ---------- welcome & auth ---------- */
.welcome {
  max-width: 980px;
  margin: 0 auto;
  display: grid;
  gap: 24px;
  align-items: center;
  padding-top: 10px;
}
@media (min-width: 860px) {
  .welcome {
    grid-template-columns: 1.05fr 1fr;
    min-height: 88vh;
  }
}
.welcome-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 980px;
  margin: 0 auto;
  gap: 10px;
}
.welcome h1 {
  font-size: clamp(2rem, 6vw, 3.1rem);
  background: linear-gradient(90deg, var(--primary-dark), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-art {
  width: 100%;
  border-radius: 24px;
  box-shadow: var(--shadow);
}
.features {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 16px 0;
}
.feature {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 0.95rem;
}
.auth-card {
  max-width: 520px;
  margin: 10px auto;
}
.goal-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.goal-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-radius: 14px;
  border: 2px solid var(--border);
  background: var(--card);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-align: start;
  color: var(--text);
  line-height: 1.3;
}
.goal-opt .gi {
  font-size: 1.4rem;
}
.goal-opt.on {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.seg {
  display: inline-flex;
  background: var(--card-2);
  border-radius: 14px;
  padding: 4px;
  gap: 4px;
  flex-wrap: wrap;
}
.seg button {
  border: none;
  background: none;
  padding: 7px 14px;
  border-radius: 10px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  color: var(--text);
}
.seg button.on {
  background: var(--card);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  color: var(--primary-dark);
}

/* ---------- home ---------- */
.home-hero {
  display: flex;
  gap: 16px;
  align-items: center;
}
.home-hero .mascot {
  flex: none;
  animation: bob 2.6s ease-in-out infinite;
}
.bubble {
  position: relative;
  background: var(--card);
  color: var(--text);
  border-radius: 18px;
  padding: 10px 14px;
  font-weight: 600;
  box-shadow: var(--shadow);
}
.continue-card {
  display: flex;
  gap: 16px;
  align-items: center;
}
.big-emoji {
  font-size: 3rem;
  line-height: 1;
}
.wod {
  display: flex;
  align-items: center;
  gap: 14px;
}
.wod .big-emoji {
  font-size: 3.4rem;
}
.quote {
  font-size: 1.1rem;
}
/* Motivation card: Urdu first and big, German only on tap (no hard words up front) */
.quote-box {
  text-align: center;
}
.quote-ur {
  font-size: 1.45rem;
  font-weight: 700;
  margin: 0 0 4px;
  line-height: 2.2;
}
.quote-de summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.9rem;
  list-style: none;
}
.quote-de summary::-webkit-details-marker {
  display: none;
}
.quote-de p {
  margin: 6px 0 0;
}
.quick-games {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}
.game-tile {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 14px 8px;
  border-radius: 18px;
  text-decoration: none;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-weight: 700;
  text-align: center;
  transition: transform 0.15s;
  line-height: 1.3;
}
.game-tile:hover {
  transform: translateY(-3px) rotate(-1deg);
}
.game-tile .gi {
  font-size: 2.2rem;
}

/* ---------- learning path ---------- */
.level-block {
  margin-top: 22px;
  border-radius: 26px;
  padding: 18px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.level-block::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 6px;
  background: var(--lvl);
}
.level-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.level-badge {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: var(--lvl);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.35rem;
  box-shadow: 0 4px 0 color-mix(in srgb, var(--lvl) 65%, #000);
  flex: none;
}
.level-locked {
  opacity: 0.75;
}
.level-locked .level-badge {
  filter: grayscale(0.7);
}
.path {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.node {
  position: relative;
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 2px;
  padding: 14px 8px 10px;
  border-radius: 20px;
  text-decoration: none;
  color: var(--text);
  background: var(--card-2);
  border: 2px solid transparent;
  transition: transform 0.15s;
  line-height: 1.3;
}
.node:hover {
  transform: translateY(-3px);
}
.node-i {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.9rem;
  background: var(--card);
  border: 4px solid var(--lvl);
  margin-bottom: 4px;
}
.node-passed .node-i {
  background: var(--lvl);
}
.node-current {
  border-color: var(--lvl);
  background: var(--card);
  animation: glow 2s ease-in-out infinite;
}
.node-locked {
  filter: grayscale(1);
  opacity: 0.55;
  cursor: not-allowed;
}
.node-check {
  position: absolute;
  top: 8px;
  inset-inline-end: 8px;
  font-size: 1rem;
}
.node small {
  color: var(--muted);
  font-size: 0.78rem;
}
.node-exam .node-i {
  border-style: dashed;
}

/* ---------- lesson ---------- */
.lesson-head {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.lesson-head .big-emoji {
  font-size: 3.2rem;
}
.steps {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 0 10px;
  margin: 10px 0;
  scrollbar-width: none;
}
.steps::-webkit-scrollbar {
  display: none;
}
.step {
  flex: none;
  padding: 8px 14px;
  border-radius: 999px;
  border: 2px solid var(--border);
  background: var(--card);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  color: var(--text);
}
.step.on {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}
.step.done::after {
  content: ' ✓';
}
.word-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}
.word-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 14px;
  display: grid;
  gap: 4px;
  box-shadow: var(--shadow);
  animation: popIn 0.35s ease backwards;
}
.word-card .wc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.word-card .wc-emoji {
  font-size: 2.4rem;
  line-height: 1.1;
}
.word-card .de {
  font-size: 1.25rem;
}
.word-card .pl {
  font-size: 0.85rem;
  color: var(--muted);
}
.art-der {
  color: #2563eb;
}
.art-die {
  color: #db2777;
}
.art-das {
  color: #16a34a;
}
.phrase-list {
  display: grid;
  gap: 10px;
}
.phrase {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}
.phrase .de {
  font-size: 1.1rem;
}
.phrase-full {
  display: block;
  --pc: var(--primary);
  background: color-mix(in srgb, var(--pc) 8%, var(--card));
  border: 1px solid color-mix(in srgb, var(--pc) 35%, var(--border));
  border-inline-start: 6px solid var(--pc);
}
/* Each sentence card gets its own colour so they don't run together. */
.phrase-list > .phrase-full:nth-child(6n + 1) { --pc: #ea580c; }
.phrase-list > .phrase-full:nth-child(6n + 2) { --pc: #0284c7; }
.phrase-list > .phrase-full:nth-child(6n + 3) { --pc: #16a34a; }
.phrase-list > .phrase-full:nth-child(6n + 4) { --pc: #9333ea; }
.phrase-list > .phrase-full:nth-child(6n + 5) { --pc: #db2777; }
.phrase-list > .phrase-full:nth-child(6n + 6) { --pc: #b45309; }
.phrase-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.phrase-main > div {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 4px;
  justify-items: start;
}
.ph-num {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--pc);
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
  margin-top: 2px;
}

/* Pronunciation ("Say it") and the word-by-word table */
.pron {
  display: block;
  width: fit-content;
  line-height: 1.6;
  max-width: 100%;
  font-size: 0.92rem;
  color: var(--text);
  background: var(--soft);
  border-inline-start: 3px solid var(--pc, var(--primary));
  border-radius: 8px;
  padding: 1px 8px;
}
.phrase-full .pron {
  background: color-mix(in srgb, var(--pc) 14%, var(--card));
}
.pron-en {
  letter-spacing: 0.02em;
}
.pron-sep {
  color: var(--muted);
  margin: 0 2px;
}
.pron-ur {
  font-size: 1.02rem;
}
.breakdown {
  margin-top: 10px;
  border-top: 1px dashed color-mix(in srgb, var(--pc, var(--primary)) 40%, var(--border));
  padding-top: 6px;
}
.breakdown summary,
.pron-help summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--muted);
  padding: 2px 0;
}
.wbw-wrap {
  overflow-x: auto;
  margin-top: 6px;
}
.wbw {
  --wb: color-mix(in srgb, var(--pc, var(--primary)) 45%, var(--border));
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.93rem;
  background: var(--card);
  border: 1.5px solid var(--wb);
}
.wbw th,
.wbw td {
  border: 1px solid var(--wb);
  padding: 6px 8px;
  vertical-align: middle;
  text-align: start;
  overflow-wrap: break-word;
}
.wbw th {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text);
  background: color-mix(in srgb, var(--pc, var(--primary)) 20%, var(--card));
}
.wbw tbody tr:nth-child(even) td {
  background: color-mix(in srgb, var(--pc, var(--primary)) 6%, var(--card));
}
.wbw .de {
  font-weight: 700;
  font-size: 1rem;
  hyphens: auto;
}
.wbw .spk {
  width: 28px;
  height: 28px;
  font-size: 0.85rem;
}
.wbw-say > span {
  display: block;
  width: fit-content;
  max-width: 100%;
}
.wbw-say > span + span {
  color: var(--muted);
}
.wbw-ur {
  font-size: 1.02rem;
}
.pron-help {
  margin: 0 0 12px;
  background: var(--soft);
  border-radius: 14px;
  padding: 6px 12px;
}
.pron-help p {
  margin: 6px 0 4px;
  font-size: 0.92rem;
  line-height: 1.7;
}
@media (max-width: 600px) {
  /* Still a real table on phones, just tighter: the speaker goes under the word. */
  .phrase-full {
    padding: 10px 10px 12px;
  }
  .wbw {
    font-size: 0.84rem;
  }
  .wbw th,
  .wbw td {
    padding: 5px 5px;
  }
  .wbw th {
    font-size: 0.72rem;
  }
  .wbw .de {
    font-size: 0.92rem;
  }
  .wbw .de-wrap {
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
  }
  .wbw .spk {
    width: 26px;
    height: 26px;
    font-size: 0.78rem;
  }
  .wbw-ur {
    font-size: 0.95rem;
  }
}
.grammar-points {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}
.grammar-points li {
  background: var(--card-2);
  border-radius: 14px;
  padding: 10px 14px;
  border-inline-start: 5px solid var(--primary);
}
.dialogue {
  display: grid;
  gap: 10px;
}
.line {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.line .avatar {
  background: var(--primary);
}
.line.right {
  flex-direction: row-reverse;
}
.line.right .avatar {
  background: var(--accent);
}
.line-bubble {
  max-width: 78%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 8px 14px;
  box-shadow: var(--shadow);
}
.line.right .line-bubble {
  background: var(--primary-soft);
}
.line-bubble.playing {
  outline: 3px solid var(--accent);
}
.line-who {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 800;
}
.lesson-nav {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
}

/* ---------- quiz ---------- */
.quiz {
  max-width: 680px;
  margin: 0 auto;
  display: grid;
  gap: 12px;
}
.quiz-top {
  display: flex;
  align-items: center;
  gap: 10px;
}
.quiz-progress {
  flex: 1;
  height: 16px;
  border-radius: 999px;
  background: var(--track);
  overflow: hidden;
}
.quiz-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--good), #84cc16);
  transition: width 0.4s ease;
}
.quiz-count {
  font-weight: 800;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.quiz-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  min-height: 24px;
}
.quiz-title {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.9rem;
}
.q-body {
  display: grid;
  gap: 12px;
}
.q-prompt {
  font-size: 1.2rem;
  font-weight: 800;
  margin: 0;
}
.q-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  box-shadow: var(--shadow);
}
.q-small {
  padding: 12px 16px;
  align-items: stretch;
  text-align: start;
}
.q-small p {
  margin: 0;
}
.q-listen {
  flex-direction: row;
  justify-content: center;
  gap: 18px;
  padding: 26px;
}
.q-emoji {
  font-size: 3rem;
  line-height: 1.1;
}
.q-emoji-s {
  font-size: 1.4rem;
}
.de-big {
  font-size: 1.8rem;
}
.opts {
  display: grid;
  gap: 10px;
}
@media (min-width: 560px) {
  .opts {
    grid-template-columns: 1fr 1fr;
  }
}
.opts-article {
  grid-template-columns: repeat(3, 1fr) !important;
}
.opt {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 60px;
  padding: 10px 14px;
  border-radius: 18px;
  border: 2px solid var(--border);
  background: var(--card);
  box-shadow: 0 4px 0 var(--border);
  font: inherit;
  font-size: 1.05rem;
  cursor: pointer;
  text-align: start;
  color: var(--text);
  transition: transform 0.08s, border-color 0.15s;
}
.opt:hover:not(:disabled) {
  border-color: var(--primary);
}
.opt:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: none;
}
.opt.sel {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.opt.right {
  border-color: var(--good);
  background: var(--good-soft);
  box-shadow: 0 4px 0 var(--good);
  animation: pop 0.35s ease;
}
.opt.wrong {
  border-color: var(--bad);
  background: var(--bad-soft);
  box-shadow: 0 4px 0 var(--bad);
  animation: shake 0.4s ease;
}
.opt:disabled {
  cursor: default;
}
.opt-n {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 800;
}
.opt-l {
  flex: 1;
}
.opts-article .opt {
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
}
.opts-article .opt-n {
  display: none;
}
.q-input {
  font-size: 1.3rem;
  text-align: center;
}
.q-write {
  font-size: 1.05rem;
  min-height: 160px;
  resize: vertical;
}
.blank-sentence {
  font-size: 1.4rem;
  margin: 0;
}
.blank {
  display: inline-block;
  min-width: 70px;
  border-bottom: 3px solid var(--primary);
  margin: 0 4px;
}
.order-line {
  min-height: 64px;
  padding: 10px;
  border-radius: 18px;
  border: 2px dashed var(--border);
  background: var(--card);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.order-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.chip {
  padding: 8px 14px;
  border-radius: 14px;
  border: 2px solid var(--border);
  background: var(--card);
  font: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--border);
  color: var(--text);
}
.chip.used {
  opacity: 0.25;
  box-shadow: none;
}
.q-foot {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  position: sticky;
  bottom: 70px;
  z-index: 5;
}
@media (min-width: 960px) {
  .q-foot {
    bottom: 12px;
  }
}
.q-foot .btn {
  min-width: 130px;
}
.feedback {
  width: 100%;
  border-radius: 22px;
  padding: 14px 16px;
  display: grid;
  gap: 8px;
  animation: slideUp 0.25s ease;
  box-shadow: var(--shadow);
}
.fb-ok {
  background: var(--good-soft);
  border: 2px solid var(--good);
}
.fb-bad {
  background: var(--bad-soft);
  border: 2px solid var(--bad);
}
.fb-title {
  font-weight: 800;
  font-size: 1.15rem;
}
.fb-ok .fb-title {
  color: var(--good);
}
.fb-bad .fb-title {
  color: var(--bad);
}
.fb-answer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.fb-hint {
  margin: 0;
  font-weight: 700;
  color: #92400e;
}
.fb-write .sample {
  background: var(--card);
  border-radius: 12px;
  padding: 8px 12px;
}
.kw {
  display: inline-block;
  padding: 0 8px;
  border-radius: 8px;
  background: var(--track);
  margin: 2px;
  font-size: 0.9rem;
}
.kw-on {
  background: var(--good);
  color: #fff;
}
.mic {
  justify-self: center;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: none;
  font-size: 2.6rem;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 0 color-mix(in srgb, var(--accent) 65%, #000);
}
.mic.on {
  animation: pulse 0.9s ease-in-out infinite;
}
.mic-status {
  text-align: center;
  font-weight: 700;
}
.reading {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
  max-height: 46vh;
  overflow-y: auto;
}
.reading-text {
  font-weight: 500;
  font-size: 1.05rem;
  line-height: 1.7;
}
.reading-text,
.sample {
  white-space: pre-line;
}

/* ---------- results ---------- */
.result {
  max-width: 680px;
  margin: 0 auto;
  display: grid;
  gap: 16px;
}
.result-head {
  display: flex;
  align-items: center;
  gap: 14px;
}
.result-head .mascot {
  flex: none;
  animation: bob 2s ease-in-out infinite;
}
.result-main {
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  background: var(--card);
  border-radius: 24px;
  padding: 18px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.result-stats {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, auto);
}
.stat {
  text-align: center;
  display: grid;
}
.stat b {
  font-size: 1.25rem;
}
.stat span {
  color: var(--muted);
  font-size: 0.85rem;
}
.stat-xp b {
  color: var(--warn);
}
.mistakes {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}
.mistakes li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px 12px;
}
.mist-m {
  color: var(--muted);
  flex: 1;
}
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

/* ---------- games ---------- */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.game-card {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-radius: 22px;
  text-decoration: none;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform 0.15s;
  position: relative;
  overflow: hidden;
}
.game-card:hover {
  transform: translateY(-4px);
}
.game-card .gi {
  font-size: 2.6rem;
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: var(--g, var(--primary-soft));
}
.game-card h3 {
  margin: 4px 0 0;
}
.game-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}
.game-best {
  position: absolute;
  top: 12px;
  inset-inline-end: 12px;
}
.game-stage {
  max-width: 760px;
  margin: 0 auto;
  display: grid;
  gap: 14px;
}
.game-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: space-between;
}
.game-bar .stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.flip {
  perspective: 1000px;
  cursor: pointer;
  height: 260px;
}
.flip-in {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.55s;
  transform-style: preserve-3d;
}
.flip.flipped .flip-in {
  transform: rotateY(180deg);
}
.flip-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  background: var(--card);
}
.flip-back {
  transform: rotateY(180deg);
  background: linear-gradient(135deg, var(--primary-soft), var(--card));
}
.memory {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
@media (max-width: 520px) {
  .memory {
    grid-template-columns: repeat(3, 1fr);
  }
}
.mem {
  aspect-ratio: 1 / 0.85;
  border-radius: 18px;
  border: none;
  font: inherit;
  cursor: pointer;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-size: 1.8rem;
  display: grid;
  place-items: center;
  padding: 6px;
  box-shadow: 0 5px 0 var(--primary-dark);
  transition: transform 0.2s;
  line-height: 1.25;
}
.mem.open,
.mem.done {
  background: var(--card);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 700;
  border: 2px solid var(--border);
  box-shadow: 0 4px 0 var(--border);
}
.mem.done {
  border-color: var(--good);
  background: var(--good-soft);
  animation: pop 0.35s ease;
}
.mem.miss {
  animation: shake 0.4s ease;
  border-color: var(--bad);
}
.letters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.letter {
  width: 50px;
  height: 54px;
  border-radius: 14px;
  border: 2px solid var(--border);
  background: var(--card);
  font: inherit;
  font-size: 1.5rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--border);
  color: var(--text);
}
.letter.used {
  opacity: 0.2;
}
.slots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  min-height: 58px;
}
.slot {
  width: 44px;
  height: 52px;
  border-bottom: 4px solid var(--primary);
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  font-weight: 800;
}
.slot.space {
  border: none;
  width: 18px;
}
.pop {
  animation: pop 0.35s ease;
}
.hearts {
  font-size: 1.3rem;
  letter-spacing: 2px;
}
.timer-bar {
  height: 10px;
  border-radius: 999px;
  background: var(--track);
  overflow: hidden;
}
.timer-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--bad), var(--warn));
  transition: width 1s linear;
}
.balloon {
  font-size: 2.6rem;
  display: inline-block;
  animation: float 3s ease-in-out infinite;
}
.source-pick {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.source-pick select {
  width: auto;
  min-width: 220px;
}

/* ---------- misc pages ---------- */
.info-hero {
  display: grid;
  gap: 16px;
  align-items: center;
}
@media (min-width: 760px) {
  .info-hero {
    grid-template-columns: 1.2fr 1fr;
  }
}
.big-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.big-stat {
  background: var(--card);
  border-radius: 20px;
  padding: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.big-stat b {
  display: block;
  font-size: 1.7rem;
  color: var(--primary-dark);
  line-height: 1.2;
}
.path-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}
/* Long Urdu labels wrap onto two lines; Nastaliq needs more line height than 1.3. */
.path-tabs .btn {
  white-space: normal;
  height: auto;
  text-align: start;
}
[dir='rtl'] .path-tabs .btn {
  line-height: 1.9;
  padding-block: 6px;
}
.info-section {
  display: grid;
  gap: 14px;
}
@media (min-width: 760px) {
  .info-section {
    grid-template-columns: 170px 1fr;
    align-items: start;
  }
}
.info-section .illu {
  width: 100%;
  max-width: 220px;
  border-radius: 18px;
}
.info-section ul {
  padding-inline-start: 20px;
  margin: 0 0 10px;
}
.info-section li {
  margin-bottom: 4px;
}
.tip {
  background: #fef3c7;
  color: #78350f;
  border-radius: 14px;
  padding: 8px 12px;
  font-weight: 600;
}
[data-theme='night'] .tip {
  background: #3b2f12;
  color: #fde68a;
}
.roadmap {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: step;
  display: grid;
  gap: 10px;
}
.roadmap li {
  counter-increment: step;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 10px 14px;
}
.roadmap li::before {
  content: counter(step);
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--on-primary);
  display: grid;
  place-items: center;
  font-weight: 800;
}
details.faq {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 10px 14px;
}
details.faq + details.faq {
  margin-top: 8px;
}
details.faq summary {
  cursor: pointer;
  font-weight: 700;
}
.about-card {
  display: grid;
  gap: 16px;
  justify-items: center;
  text-align: center;
}
.creator {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}
.creator-avatar {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 2.6rem;
  font-weight: 800;
  color: #fff;
  background: conic-gradient(from 200deg, #01411c, #0b7a3b, #000, #dd0000, #ffce00, #01411c);
  border: 5px solid var(--card);
  box-shadow: var(--shadow);
}
.flag {
  width: 30px;
  height: 20px;
  border-radius: 3px;
  vertical-align: middle;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
}
.flags {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.theme-swatch {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-radius: 14px;
  border: 2px solid var(--border);
  background: var(--card);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  color: var(--text);
}
.theme-swatch.on {
  border-color: var(--sw);
}
.sw-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--sw);
  flex: none;
}
.more-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.more-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  background: var(--card-2);
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  border: none;
  font: inherit;
  cursor: pointer;
  line-height: 1.3;
}
.more-item span {
  font-size: 1.4rem;
}
.badges {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
}
.badge {
  text-align: center;
  padding: 12px 6px;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--border);
  font-weight: 700;
  font-size: 0.85rem;
  line-height: 1.3;
}
.badge .bi {
  font-size: 2rem;
  display: block;
}
.badge.off {
  filter: grayscale(1);
  opacity: 0.4;
}
.chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 140px;
  padding: 8px 0;
  direction: ltr;
}
.chart-bar {
  flex: 1;
  min-width: 4px;
  background: linear-gradient(180deg, var(--accent), var(--primary));
  border-radius: 6px 6px 2px 2px;
  position: relative;
}
.chart-bar.zero {
  background: var(--track);
}
.chart-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--muted);
  direction: ltr;
}
.week-guide {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 6px;
}
.week-guide li {
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--card-2);
}
.week-guide li.today {
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 700;
}
.custom-word-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 6px;
  align-items: center;
}
@media (max-width: 600px) {
  .custom-word-row {
    grid-template-columns: 1fr 1fr;
  }
  .custom-word-row .input:nth-child(3) {
    grid-column: 1 / 2;
  }
}
.admin-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin: 12px 0;
}
.admin-tools .input {
  max-width: 320px;
}

/* ---------- modal & toast ---------- */
.modal-wrap {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 15, 30, 0.45);
  display: grid;
  place-items: center;
  padding: 16px;
  opacity: 0;
  transition: opacity 0.2s;
}
.modal-wrap.show {
  opacity: 1;
}
.modal {
  position: relative;
  width: min(520px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  background: var(--card);
  color: var(--text);
  border-radius: 24px;
  padding: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: translateY(20px) scale(0.97);
  transition: transform 0.25s;
}
.modal-wide {
  width: min(900px, 100%);
}
.modal-wrap.show .modal {
  transform: none;
}
.modal-x {
  position: absolute;
  top: 12px;
  inset-inline-end: 12px;
  border: none;
  background: var(--card-2);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  color: var(--text);
}
.modal-title {
  padding-inline-end: 40px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.toasts {
  position: fixed;
  z-index: 200;
  inset-inline: 0;
  top: 12px;
  display: grid;
  justify-items: center;
  gap: 8px;
  pointer-events: none;
  padding: 0 12px;
}
.toast {
  background: var(--text);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 14px;
  font-weight: 700;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  transform: translateY(-20px);
  opacity: 0;
  transition: all 0.3s;
  max-width: 520px;
}
.toast.show {
  transform: none;
  opacity: 1;
}
.toast-good {
  background: var(--good);
  color: #fff;
}
.toast-bad {
  background: var(--bad);
  color: #fff;
}
.toast-warn {
  background: #f59e0b;
  color: #1f1300;
}
.confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 150;
}

/* ---------- animations ---------- */
@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}
@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
}
@keyframes pop {
  50% {
    transform: scale(1.06);
  }
}
@keyframes shake {
  20%,
  60% {
    transform: translateX(-6px);
  }
  40%,
  80% {
    transform: translateX(6px);
  }
}
@keyframes bob {
  50% {
    transform: translateY(-6px) rotate(-2deg);
  }
}
@keyframes pulse {
  50% {
    transform: scale(1.12);
  }
}
@keyframes glow {
  50% {
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--lvl) 25%, transparent);
  }
}
@keyframes slideUp {
  from {
    transform: translateY(16px);
    opacity: 0;
  }
}
@keyframes float {
  50% {
    transform: translateY(-10px);
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- messages (suggestions & replies) ---------- */
.fab {
  display: none;
  position: fixed;
  z-index: 25;
  inset-inline-end: 16px;
  bottom: calc(84px + env(safe-area-inset-bottom));
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 1.6rem;
  cursor: pointer;
  place-items: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
  transition: transform 0.15s;
}
.fab:hover {
  transform: scale(1.08) rotate(-6deg);
}
@media (min-width: 960px) {
  .fab {
    bottom: 24px;
    inset-inline-end: 24px;
  }
}
body.show-fab .fab {
  display: grid;
}
/* never cover quiz or game buttons */
body:has(.quiz, .result, .game-stage) .fab {
  display: none;
}
.nav-badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--bad);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  margin-inline-start: auto;
}
.nav-badge[hidden] {
  display: none;
}
.tab {
  position: relative;
}
.tab .nav-badge {
  position: absolute;
  top: 2px;
  inset-inline-end: 18%;
  min-width: 18px;
  height: 18px;
  font-size: 0.65rem;
}
.more-item .nav-badge {
  font-size: 0.75rem;
}
.seg a {
  padding: 7px 14px;
  border-radius: 10px;
  font-weight: 700;
  text-decoration: none;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.seg a.on {
  background: var(--card);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  color: var(--primary-dark);
}
.msg-text {
  min-height: 140px;
  resize: vertical;
  line-height: 1.6;
}
.msg-count {
  margin: -6px 0 0;
  text-align: end;
  font-size: 0.85rem;
}
.chat {
  display: grid;
  gap: 10px;
}
.chat-row {
  display: flex;
}
.chat-row.mine {
  justify-content: flex-end;
}
.chat-bubble {
  max-width: min(82%, 620px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  border-end-start-radius: 6px;
  padding: 8px 14px;
  box-shadow: var(--shadow);
}
.chat-row.mine .chat-bubble {
  background: var(--primary-soft);
  border-end-start-radius: 18px;
  border-end-end-radius: 6px;
}
.chat-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 0.82rem;
}
.chat-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin-top: 2px;
}
.thread-list {
  display: grid;
  gap: 8px;
}
.thread {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
}
.thread.unread {
  border-color: var(--bad);
  border-width: 2px;
}
.thread-main {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}
.thread-top {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.thread-last {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.thread-side {
  display: grid;
  justify-items: end;
  gap: 4px;
  flex: none;
}
.requests {
  list-style: none;
  padding: 0;
  margin: 0 auto;
  max-width: 560px;
  display: grid;
  gap: 10px;
}
.requests li {
  background: var(--card-2);
  border-radius: 14px;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 1.05rem;
}
