/* =========================================================================
   YadDari styles
   Warm paper tones, a serif display face (Fraunces) over a clean sans
   (DM Sans), soft cards and flat illustrations.
   ========================================================================= */

:root {
  --bg: #f6f1e9;
  --surface: #fffdf9;
  --surface-2: #f1eadf;
  --warm: #f2c97a;
  --warm-soft: #fbefd6;
  --on-warm-2: #5a4a38;
  --on-warm-3: #7a6247;
  --ink: #2b2620;
  --ink-2: #6f6558;
  --ink-3: #a1968a;
  --line: #ece4d8;
  --line-2: #ddd3c4;
  --shadow: 0 1px 2px rgba(60, 45, 25, 0.05), 0 6px 18px rgba(60, 45, 25, 0.06);
  --shadow-lg: 0 2px 6px rgba(60, 45, 25, 0.06), 0 22px 48px rgba(60, 45, 25, 0.14);

  --ok: #4a9a5b;   --ok-ink: #2f6e3c;   --ok-soft: #e4f0e1;
  --warn: #c8553d; --warn-ink: #983a27; --warn-soft: #f8e4dc;
  --flame: #d98a3d;

  /* Unit colors */
  --lapis: #4767a8;
  --pom: #c8553d;
  --teal: #44879f;
  --saffron: #c98228;
  --green: #4a9a5b;
  --plum: #7d6db8;

  --radius: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --font: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-dari: 'Vazirmatn', 'Noto Naskh Arabic', 'Geeza Pro', Tahoma, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1814; --surface: #26221d; --surface-2: #2f2a24; --warm: #5a4524; --warm-soft: #3a2f22; --on-warm-2: #e3d3bd; --on-warm-3: #c4a984;
    --ink: #f3ece2; --ink-2: #bdb2a3; --ink-3: #85796b; --line: #352f28; --line-2: #463e35;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 18px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.35), 0 22px 48px rgba(0, 0, 0, 0.45);
    --ok: #74c486; --ok-ink: #8fd39f; --ok-soft: #22301f;
    --warn: #e47a62; --warn-ink: #f09a86; --warn-soft: #3a231d;
    --flame: #eba35c;
    --lapis: #7d9be0; --pom: #e47a62; --teal: #6fb3cb; --saffron: #e8a957; --green: #74c486; --plum: #a898e0;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #1b1814; --surface: #26221d; --surface-2: #2f2a24; --warm: #5a4524; --warm-soft: #3a2f22; --on-warm-2: #e3d3bd; --on-warm-3: #c4a984;
  --ink: #f3ece2; --ink-2: #bdb2a3; --ink-3: #85796b; --line: #352f28; --line-2: #463e35;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 18px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.35), 0 22px 48px rgba(0, 0, 0, 0.45);
  --ok: #74c486; --ok-ink: #8fd39f; --ok-soft: #22301f;
  --warn: #e47a62; --warn-ink: #f09a86; --warn-soft: #3a231d;
  --flame: #eba35c;
  --lapis: #7d9be0; --pom: #e47a62; --teal: #6fb3cb; --saffron: #e8a957; --green: #74c486; --plum: #a898e0;
  color-scheme: dark;
}

/* Unit colors: --c is the color, --cs a soft tint of it */
.c-lapis   { --c: var(--lapis); }
.c-pom     { --c: var(--pom); }
.c-green   { --c: var(--green); }
.c-saffron { --c: var(--saffron); }
.c-teal    { --c: var(--teal); }
.c-plum    { --c: var(--plum); }
[class*="c-"] { --cs: color-mix(in srgb, var(--c) 13%, var(--surface)); }

/* ---- Base --------------------------------------------------------------- */

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

html { -webkit-text-size-adjust: 100%; }

/* App-like touch behavior: no bounce, no double-tap zoom, no long-press
   text selection or callout on controls. */
html, body { overscroll-behavior-y: none; }
button, a, .tile, .option, .match-item {
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.lesson-open { overflow: hidden; }

button { font: inherit; color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid var(--ink-2);
  outline-offset: 3px;
}

h1, h2, h3 { margin: 0; line-height: 1.15; font-weight: 600; }
h1 { font: 600 clamp(34px, 6vw, 48px)/1.05 var(--font-display); letter-spacing: -0.02em; }
h2 { font-size: 20px; letter-spacing: -0.01em; }
b, strong { font-weight: 600; }

.muted { color: var(--ink-2); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.icon { width: 20px; height: 20px; flex: none; }
.art { display: block; width: 100%; height: 100%; }

/* Small letter-spaced label, used above titles */
.eyebrow, .sheet-kicker, .unit-kicker, .fact-cat, .fotd-kicker, .form-label, .example-label, .result-label, .sheet-sub, .guide-h, .section-label {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* Dari text */
.dari {
  font-family: var(--font-dari);
  direction: rtl;
  unicode-bidi: isolate;
  font-weight: 500;
}

.word { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 0; line-height: 1.3; }
.word .dari { font-size: 1.25em; font-weight: 600; }

.tr { color: var(--ink-2); font-weight: 500; font-size: 0.85em; }

/* Transliteration can be switched off in settings; prompts can still be tapped to peek. */
.hide-tr .tr { display: none; }
.hide-tr .tr.tr-always,
.hide-tr .reveal.is-revealed .tr { display: revert; }
.reveal-hint { display: none; }
.hide-tr .reveal:not(.is-revealed) .reveal-hint { display: block; }

/* ---- Buttons ------------------------------------------------------------ */

.btn {
  --bc: var(--ink);
  --bt: var(--bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 12px 26px;
  border: 0;
  border-radius: 999px;
  background: var(--bc);
  color: var(--bt);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s, opacity 0.15s;
}
.btn .icon { width: 18px; height: 18px; }
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 16px color-mix(in srgb, var(--bc) 28%, transparent); }
.btn:active:not(:disabled) { transform: translateY(0); box-shadow: none; }
.btn:disabled { --bc: var(--line); --bt: var(--ink-3); cursor: not-allowed; }
.btn-success { --bc: var(--ok); --bt: #fff; }
.btn-danger  { --bc: var(--warn); --bt: #fff; }
:root[data-theme="dark"] .btn-success, :root[data-theme="dark"] .btn-danger { --bt: #1b1814; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn-success, :root:not([data-theme="light"]) .btn-danger { --bt: #1b1814; }
}
.btn-ghost, .btn-danger-ghost {
  --bc: var(--surface);
  --bt: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line-2);
}
.btn-ghost:hover:not(:disabled), .btn-danger-ghost:hover:not(:disabled) { box-shadow: inset 0 0 0 1px var(--ink-3), var(--shadow); }
.btn-danger-ghost { --bt: var(--warn); }
.btn-sm { min-height: 40px; padding: 8px 18px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-wide { min-width: min(320px, 100%); }

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: background 0.15s;
}
.icon-btn:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.icon-btn .icon { width: 22px; height: 22px; }

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.link-btn:hover { background: color-mix(in srgb, var(--ink) 11%, transparent); color: var(--ink); }
.link-btn .icon { width: 16px; height: 16px; }

/* ---- App shell ---------------------------------------------------------- */

.app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 16px 0;
  padding-top: max(14px, env(safe-area-inset-top));
}

.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark { width: 34px; height: 34px; flex: none; border-radius: 10px; }
.brand-name { font: 600 21px/1 var(--font-display); letter-spacing: -0.01em; }

.navlinks { display: none; gap: 4px; }
.navlinks a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  color: var(--ink-2);
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
  transition: background 0.15s, color 0.15s;
}
.navlinks a:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.navlinks a.is-active { color: var(--ink); background: var(--surface); box-shadow: var(--shadow); }
.navlinks .icon { width: 18px; height: 18px; }

.view {
  flex: 1;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 16px calc(110px + env(safe-area-inset-bottom));
}

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-top: 1px solid var(--line);
  padding: 6px 6px env(safe-area-inset-bottom);
}
.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px 8px;
  color: var(--ink-3);
  text-decoration: none;
  font-weight: 500;
  font-size: 11.5px;
}
.tab-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 30px;
  border-radius: 999px;
  transition: background 0.15s;
}
.tab-icon .icon { width: 22px; height: 22px; }
.tabbar a.is-active { color: var(--ink); }
.tabbar a.is-active .tab-icon { background: var(--surface-2); }

@media (min-width: 860px) {
  .navlinks { display: flex; }
  .tabbar { display: none; }
  .topbar { padding-top: max(20px, env(safe-area-inset-top)); }
  .view { padding-top: 44px; padding-bottom: 72px; }
}

/* ---- Cards & shared bits ------------------------------------------------ */

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--surface-2);
  color: var(--ink-2);
}
.badge-new { background: color-mix(in srgb, var(--plum) 15%, var(--surface)); color: var(--plum); }
.badge-culture { background: color-mix(in srgb, var(--saffron) 17%, var(--surface)); color: var(--saffron); }

.note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 18px 0 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--warm-soft);
  color: var(--ink);
  text-align: start;
  font-size: 15px;
}
.note > .icon { width: 18px; height: 18px; margin-top: 2px; color: var(--flame); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.chip-pic { width: 28px; height: 28px; margin-inline-end: 10px; }
.chip .pic-numeral { font-size: 22px; line-height: 1; }
.chip-glyph .dari { font-size: 28px; line-height: 1.2; min-width: 28px; text-align: center; }

/* Status chips under a page title (streak, XP, today) */
.stats { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 22px 0 0; }
.stat { display: inline-flex; align-items: center; gap: 7px; font-size: 15px; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.stat b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.stat .icon { width: 20px; height: 20px; color: var(--ink-3); }
.stat.is-lit .icon { color: var(--flame); }
.stat-xp .icon { color: var(--saffron); }

.page-head { margin: 0 0 28px; }
.page-head h1 { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 16px; }
.page-head > p { margin: 10px 0 0; font-size: 18px; color: var(--ink-2); max-width: 560px; }
.page-head-dari { font-size: 0.62em; color: var(--ink-3); font-weight: 500; }

.meter-wrap { margin-top: 22px; max-width: 420px; }
.meter { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.meter-fill { height: 100%; background: var(--c, var(--ink)); border-radius: inherit; transition: width 0.4s; }
.meter-label { margin: 8px 0 0; font-size: 14px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.section-label { margin: 40px 0 14px; }

/* Progress ring */
.ring { flex: none; }
.ring-bg { fill: none; stroke: var(--line); stroke-width: 3.5; }
.ring-fg { fill: none; stroke: var(--flame); stroke-width: 3.5; stroke-linecap: round; transition: stroke-dasharray 0.5s; }
.ring-sm { width: 20px; height: 20px; }
.ring-lg { width: 60px; height: 60px; }

/* An illustration sitting in a soft rounded tile */
.art-tile {
  display: grid;
  place-items: center;
  flex: none;
  width: 64px;
  height: 64px;
  padding: 10px;
  border-radius: 20px;
  background: var(--cs, var(--surface-2));
}

/* ---- Learn -------------------------------------------------------------- */

.hero { margin-bottom: 30px; }
.hero h1 { margin-top: 6px; }
.hero-sub { margin: 12px 0 0; font-size: 18px; color: var(--ink-2); max-width: 540px; }
.hero-sub .dari { color: var(--ink); font-weight: 600; font-size: 1.1em; }

.overview { display: grid; gap: 14px; }
@media (min-width: 640px) { .overview { grid-template-columns: 1.35fr 1fr; } }

.next-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 22px;
  background: var(--warm);
  overflow: hidden;
}
.next-card .eyebrow { color: var(--on-warm-3); }
.next-card h2 { margin: 4px 0 0; font: 600 25px/1.2 var(--font-display); max-width: calc(100% - 84px); }
.next-card h2 .dari { display: block; font-size: 0.85em; }
.next-card p { margin: 2px 0 18px; color: var(--on-warm-2); max-width: 420px; }
.next-card .btn { margin-top: auto; }
.next-art { position: absolute; top: 18px; right: 18px; width: 72px; height: 72px; }
.welcome { padding: 26px; }
.welcome .next-art { width: 96px; height: 96px; }
.welcome h2 { font-size: 27px; max-width: calc(100% - 104px); }

.goal-card { display: flex; flex-direction: column; justify-content: space-between; gap: 16px; }
.goal-top { display: flex; align-items: center; gap: 16px; }
.goal-text h2 { font-size: 18px; }
.goal-text p { margin: 2px 0 0; font-size: 15px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.goal-card .btn { align-self: flex-start; }

.unit {
  margin-top: 16px;
  padding: 22px 22px 10px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.unit-head { display: flex; align-items: flex-start; gap: 16px; }
.unit-text { flex: 1; min-width: 0; }
.unit-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: -2px; }
.unit-kicker { color: var(--c); }
.unit-head h2 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; margin: 2px 0 2px; font: 600 24px/1.25 var(--font-display); }
.unit-head p { margin: 0; color: var(--ink-2); font-size: 15px; }
.unit-dari { font-family: var(--font-dari); font-size: 19px; font-weight: 500; line-height: 1.3; color: var(--ink-3); white-space: nowrap; }
.unit-progress { height: 4px; margin: 18px 0 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.unit-progress span { display: block; height: 100%; border-radius: inherit; background: var(--c); transition: width 0.4s; }

.lessons { list-style: none; margin: 0; padding: 0; }
.lessons li { position: relative; }
/* The thin line joining one lesson's status dot to the next */
.lessons li + li::before {
  content: '';
  position: absolute;
  left: 19px;
  top: -12px;
  height: 24px;
  border-left: 2px solid var(--line);
}
.lessons li.is-done + li::before { border-color: color-mix(in srgb, var(--c) 45%, var(--line)); }

.lesson-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 14px;
  width: calc(100% + 24px);
  margin: 0 -12px;
  padding: 12px;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  text-align: start;
  cursor: pointer;
  transition: background 0.15s;
}
.lesson-row:hover { background: var(--surface-2); }
.lr-status {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: inset 0 0 0 2px var(--line);
  color: var(--ink-3);
}
.lr-status .icon { width: 18px; height: 18px; }
.lr-status .dari { font-size: 20px; font-weight: 600; line-height: 1; padding-bottom: 3px; }
.lr-status > span:not(.dari) { font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; }
.lr-title { display: block; font-weight: 600; font-size: 16px; }
.lr-sub { display: block; font-size: 14px; color: var(--ink-2); }
.lr-end { display: flex; align-items: center; gap: 6px; color: var(--ink-3); font-size: 14px; }
.lr-end .icon { width: 18px; height: 18px; }

.lesson-row.is-done .lr-status { background: var(--c); box-shadow: none; color: var(--surface); }
.lesson-row.is-done .lr-status .icon { stroke-width: 2.6; }
.lesson-row.is-current { background: var(--cs); }
.lesson-row.is-current .lr-status { background: var(--c); color: var(--surface); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 22%, transparent); }
.lesson-row.is-current .lr-status .dari, .lesson-row.is-current .lr-status .icon { color: var(--surface); }
.lr-go {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 14px 7px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  font-size: 14px;
}
.lesson-row.is-locked .lr-title { color: var(--ink-2); }
.lesson-row.is-locked .lr-sub { color: var(--ink-3); }

.finale { display: flex; align-items: center; gap: 18px; margin-top: 16px; }
.finale h2 { font: 600 22px/1.2 var(--font-display); }
.finale p { margin: 4px 0 0; }

/* Lesson sheet & guide */
.sheet-kicker { color: var(--c, var(--ink-3)); margin-bottom: 6px; }
.sheet-sub { margin: 22px 0 10px; }
.sheet .muted { margin: 6px 0 0; font-size: 15px; }
.sheet .btn { margin-top: 24px; }
.locked-note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 24px 0 0;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink-2);
}
.locked-note .icon { width: 18px; height: 18px; }

.guide-title-dari { font-size: 0.8em; color: var(--ink-3); margin-inline-start: 8px; }
.guide-h { margin: 28px 0 8px; color: var(--c); }
.guide-table { width: 100%; border-collapse: collapse; }
.guide-table td { padding: 10px 6px; border-top: 1px solid var(--line); vertical-align: middle; }
.guide-table td:first-child { font-size: 20px; white-space: nowrap; padding-left: 0; }
.guide-table .dari { font-weight: 600; }
.guide-table td.tr { font-size: 14px; }
.guide-sentence {
  display: flex;
  flex-direction: column;
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.guide-sentence .dari { font-size: 19px; font-weight: 600; align-self: flex-start; }
.guide-letters { display: grid; gap: 8px; }
.guide-letter { display: flex; align-items: center; gap: 14px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.guide-glyph { font-size: 34px; font-weight: 600; min-width: 44px; text-align: center; line-height: 1.3; color: var(--c); }

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

.lesson {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.lesson[hidden] { display: none; }

.lesson-top {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 14px 16px 6px;
  padding-top: max(14px, env(safe-area-inset-top));
}
.progress { flex: 1; height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress-fill {
  height: 100%;
  width: 2%;
  border-radius: inherit;
  background: var(--ok);
  transition: width 0.35s ease;
}
.combo { display: inline-flex; align-items: center; gap: 5px; min-width: 0; font-weight: 600; font-size: 14px; color: var(--flame); white-space: nowrap; font-variant-numeric: tabular-nums; }
.combo .icon { width: 18px; height: 18px; }
.combo:empty { display: none; }

.lesson-body {
  flex: 1;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 18px 16px 32px;
  overflow-y: auto;
}
.lesson-body.is-locked .option,
.lesson-body.is-locked .tile,
.lesson-body.is-locked .match-item { pointer-events: none; }

.ex { animation: rise 0.3s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.ex-head { margin: 4px 0 12px; }
.ex-title { margin: 10px 0 24px; font: 500 28px/1.2 var(--font-display); letter-spacing: -0.01em; }
.ex-title .inline-glyph { font-size: 1.15em; font-weight: 600; padding: 0 4px; color: var(--lapis); }

.lesson-foot {
  border-top: 1px solid var(--line);
  background: var(--bg);
  padding: 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  transition: background 0.2s, border-color 0.2s;
}
.lesson-foot.is-correct { background: var(--ok-soft); border-color: transparent; }
.lesson-foot.is-wrong { background: var(--warn-soft); border-color: transparent; }
.foot-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  max-width: 640px;
  margin: 0 auto;
}
.feedback { flex: 1 1 280px; min-width: 0; display: flex; gap: 14px; align-items: flex-start; }
.feedback:empty { display: none; }
.foot-inner .btn { flex: 0 0 auto; min-width: 170px; margin-inline-start: auto; }
.fb-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface);
}
.fb-mark .icon { width: 22px; height: 22px; stroke-width: 2.6; }
.is-correct .fb-mark { color: var(--ok); }
.is-wrong .fb-mark { color: var(--warn); }
.fb-body { min-width: 0; }
.fb-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; font: 600 21px/1.3 var(--font-display); }
.is-correct .fb-title { color: var(--ok-ink); }
.is-wrong .fb-title { color: var(--warn-ink); }
.fb-dari { font-size: 24px; font-weight: 600; }
.fb-answer { margin-top: 4px; }
.is-correct .fb-answer { color: var(--ok-ink); }
.is-wrong .fb-answer { color: var(--warn-ink); }
.fb-answer .dari { font-size: 20px; font-weight: 600; }
.fb-answer .tr { color: inherit; opacity: 0.8; }
.fb-pic { display: inline-block; width: 26px; height: 26px; vertical-align: -7px; margin-inline-end: 4px; }
.fb-hint { display: flex; gap: 8px; margin-top: 8px; color: var(--ink); font-size: 15px; }
.fb-hint .icon { width: 18px; height: 18px; margin-top: 2px; color: var(--flame); }

@media (max-width: 560px) {
  .foot-inner .btn { flex: 1 1 100%; }
}

/* Intro cards */
.intro-card {
  padding: 30px 22px 26px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}
.intro-pic { width: 112px; height: 112px; margin: 0 auto 10px; }
.intro-dari { display: block; font-size: 52px; font-weight: 600; line-height: 1.5; }
.intro-tr { display: block; font-size: 19px; }
.intro-en { margin-top: 10px; font: 500 24px/1.3 var(--font-display); }
.intro-en .muted { font-family: var(--font); font-size: 18px; }
.glyph-xl { display: block; font-size: 108px; font-weight: 600; line-height: 1.35; color: var(--lapis); }

.forms { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin: 20px 0 4px; }
.form {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 68px;
  padding: 8px 12px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.form-glyph { font-size: 32px; font-weight: 600; line-height: 1.4; }
.form-label { font-size: 10.5px; }

.example {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 4px 10px;
  margin-top: 20px;
}
.example-label { width: 100%; }
.example-dari { font-size: 28px; font-weight: 600; }

/* Culture card inside a lesson */
.fact-card {
  padding: 26px 24px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.fact-art { width: 88px; height: 88px; padding: 14px; border-radius: 26px; }
.fact-cat { margin: 18px 0 6px; color: var(--saffron); }
.fact-card h2 { font: 600 26px/1.2 var(--font-display); }
.fact-card p:last-child { margin: 12px 0 0; font-size: 17px; line-height: 1.65; color: var(--ink-2); }

/* Prompts */
.prompt-word {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 24px;
  padding: 14px 22px;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: start;
  cursor: default;
}
.hide-tr .prompt-word { cursor: pointer; }
.prompt-dari { font-size: 36px; font-weight: 600; line-height: 1.5; }
.prompt-word .tr { font-size: 17px; }
.reveal-hint { font-size: 12px; font-weight: 500; color: var(--ink-3); }
.prompt-glyph { margin: -4px 0 20px; text-align: center; }
.glyph-lg { font-size: 92px; font-weight: 600; line-height: 1.35; color: var(--lapis); }

/* Choice options */
.options { display: grid; gap: 10px; }
.options--grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.option {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 60px;
  padding: 12px 16px;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: inset 0 0 0 1.5px var(--line-2);
  text-align: start;
  font-weight: 500;
  font-size: 17px;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, transform 0.08s;
}
.option:hover { box-shadow: inset 0 0 0 1.5px var(--ink-3); }
.option:active { transform: scale(0.99); }
.option kbd {
  flex: none;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  box-shadow: inset 0 0 0 1px var(--line-2);
  font: 500 12px var(--font);
  color: var(--ink-3);
}
.option .word .dari { font-size: 24px; }
.option.is-selected { background: var(--surface-2); box-shadow: inset 0 0 0 2px var(--ink); }
.option.is-selected kbd { box-shadow: inset 0 0 0 1px var(--ink); color: var(--ink); }
.option.is-correct { background: var(--ok-soft); box-shadow: inset 0 0 0 2px var(--ok); color: var(--ok-ink); }
.option.is-wrong { background: var(--warn-soft); box-shadow: inset 0 0 0 2px var(--warn); color: var(--warn-ink); }
.option.is-correct kbd, .option.is-wrong kbd { box-shadow: inset 0 0 0 1px currentColor; color: inherit; }
.option.is-correct .tr, .option.is-wrong .tr { color: inherit; }
.option:disabled { cursor: default; }
.option--pic, .option--center { flex-direction: column; justify-content: center; gap: 6px; text-align: center; }
.option--pic { min-height: 140px; }
.option--pic kbd, .option--center kbd { align-self: flex-start; margin-bottom: -22px; }
.pic { display: grid; place-items: center; width: 84px; height: 84px; }
.pic-numeral { font-family: var(--font-dari); font-size: 56px; line-height: 1.2; font-weight: 600; color: var(--lapis); }
.sound-opt { font: 600 24px var(--font-display); }
.glyph-opt { font-size: 44px; font-weight: 600; line-height: 1.3; }

/* Matching */
.match { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.match-col { display: grid; gap: 10px; align-content: start; }
.match-item {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 76px;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: inset 0 0 0 1.5px var(--line-2);
  font-weight: 500;
  font-size: 16px;
  text-align: center;
  cursor: pointer;
  transition: opacity 0.25s, background 0.15s, box-shadow 0.15s;
}
.match-item:hover { box-shadow: inset 0 0 0 1.5px var(--ink-3); }
.match-item .word { align-items: center; }
.match-item .word .dari { font-size: 22px; }
.glyph-match { font-size: 36px; font-weight: 600; line-height: 1.3; }
.match-item.is-selected { background: var(--surface-2); box-shadow: inset 0 0 0 2px var(--ink); }
.match-item.is-matched { opacity: 0.3; background: var(--ok-soft); box-shadow: none; cursor: default; }
.match-item.is-wrong { background: var(--warn-soft); box-shadow: inset 0 0 0 2px var(--warn); animation: shake 0.35s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* Sentence building */
.sentence { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 20px; }
.speaker { flex: none; width: 68px; height: 68px; padding: 4px; border-radius: 50%; background: var(--surface-2); overflow: hidden; }
.speaker .art { transform: translateY(5px) scale(1.08); }
.bubble {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 14px 18px;
  border: 0;
  border-radius: 20px 20px 20px 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: start;
  font-weight: 500;
  font-size: 18px;
}
.bubble-dari { font-size: 26px; font-weight: 600; line-height: 1.5; }
button.bubble { cursor: default; }
.hide-tr button.bubble { cursor: pointer; }

.answer-line {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
  min-height: 132px;
  padding: 8px 0;
  background-image: linear-gradient(var(--line-2), var(--line-2)), linear-gradient(var(--line-2), var(--line-2));
  background-size: 100% 1px;
  background-position: 0 62px, 0 128px;
  background-repeat: no-repeat;
}
.answer-line.is-rtl { direction: rtl; }
.answer-line.is-correct .tile { box-shadow: inset 0 0 0 2px var(--ok); }
.answer-line.is-wrong .tile { box-shadow: inset 0 0 0 2px var(--warn); }

.bank { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 24px; }
.tile {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 6px 16px;
  border: 0;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1.5px var(--line-2), 0 1px 2px rgba(60, 45, 25, 0.06);
  font-weight: 500;
  font-size: 17px;
  line-height: 1.25;
  cursor: pointer;
  animation: pop 0.15s ease-out;
}
.tile:hover { box-shadow: inset 0 0 0 1.5px var(--ink-3); }
.tile .dari { font-size: 22px; font-weight: 600; line-height: 1.4; }
.tile .tr { font-size: 12px; }
.tile.is-used { background: var(--surface-2); box-shadow: none; color: transparent; cursor: default; animation: none; }
.tile.is-used > * { visibility: hidden; }
@keyframes pop { from { transform: scale(0.94); } }

/* Lesson complete */
.complete {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px 16px max(24px, env(safe-area-inset-bottom));
  text-align: center;
  overflow: hidden;
}
.complete-art { width: 132px; height: 132px; margin-bottom: 6px; animation: rise 0.5s ease-out; }
.complete h1 { font-size: clamp(34px, 7vw, 46px); }
.complete-sub { margin: 0; display: flex; align-items: baseline; gap: 10px; font-size: 17px; }
.complete-dari { font-size: 26px; font-weight: 600; color: var(--ink); }
.complete-notes { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px; }
.complete-note { display: inline-flex; align-items: center; gap: 7px; margin: 0; font-weight: 600; font-size: 16px; }
.complete-note .icon { color: var(--flame); }
.result-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; width: 100%; max-width: 440px; margin: 18px 0 10px; }
.result { padding: 16px 8px 14px; border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow); }
.result-label { font-size: 11px; }
.result-value { margin-top: 4px; font: 600 28px/1.1 var(--font-display); color: var(--c); font-variant-numeric: tabular-nums; }
.complete .btn { margin-top: 14px; }

.confetti { position: absolute; inset: 0; pointer-events: none; }
.complete > :not(.confetti) { position: relative; z-index: 1; }
.confetti i {
  position: absolute;
  top: -20px;
  width: 8px;
  height: 12px;
  border-radius: 2px;
  opacity: 0.85;
  animation: fall linear forwards;
}
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* ---- Culture ------------------------------------------------------------ */

.fotd {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 22px;
  width: 100%;
  margin-bottom: 30px;
  padding: 24px;
  border: 0;
  background: var(--warm);
  text-align: start;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.fotd:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.fotd-art { width: 104px; height: 104px; padding: 16px; border-radius: 30px; background: color-mix(in srgb, var(--surface) 60%, transparent); }
.fotd-kicker { color: var(--on-warm-3); }
.fotd-title { display: block; margin: 6px 0; font: 600 25px/1.2 var(--font-display); }
.fotd-text {
  color: var(--on-warm-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
@media (max-width: 480px) {
  .fotd { grid-template-columns: 1fr; gap: 14px; }
  .fotd-art { width: 80px; height: 80px; padding: 12px; border-radius: 24px; }
}

.filters { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px 18px; padding: 2px 16px 6px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filter {
  flex: none;
  padding: 8px 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--line-2);
  color: var(--ink-2);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.filter:hover { color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink-3); }
.filter.is-active { background: var(--ink); color: var(--bg); box-shadow: none; }

.fact-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 600px) { .fact-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.fact-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 16px;
  border: 0;
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: start;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.fact-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.fact-tile .art-tile { width: 60px; height: 60px; margin-bottom: 10px; border-radius: 18px; }
.fact-tile-title { font-weight: 600; line-height: 1.3; }
.fact-tile-cat { font-size: 13px; color: var(--ink-3); }
.fact-tile-new, .fact-tile-check { position: absolute; top: 14px; right: 14px; }
.fact-tile-new { width: 8px; height: 8px; border-radius: 50%; background: var(--pom); box-shadow: 0 0 0 4px color-mix(in srgb, var(--pom) 18%, transparent); }
.fact-tile-check { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); color: var(--ok); }
.fact-tile-check .icon { width: 14px; height: 14px; stroke-width: 2.6; }

/* Topic tints for culture art */
.cat-language { --cs: color-mix(in srgb, var(--lapis) 13%, var(--surface)); }
.cat-family { --cs: color-mix(in srgb, var(--pom) 12%, var(--surface)); }
.cat-food { --cs: color-mix(in srgb, var(--green) 14%, var(--surface)); }
.cat-celebrations { --cs: color-mix(in srgb, var(--saffron) 17%, var(--surface)); }
.cat-arts { --cs: color-mix(in srgb, var(--plum) 14%, var(--surface)); }
.cat-sports { --cs: color-mix(in srgb, var(--teal) 15%, var(--surface)); }
.cat-places { --cs: color-mix(in srgb, var(--ink-3) 16%, var(--surface)); }

.fact-modal p { line-height: 1.65; color: var(--ink-2); font-size: 16.5px; }
.fact-modal .fact-art { margin-bottom: 18px; }
.fact-modal .fact-cat { margin: 0 0 6px; }
.fact-modal .modal-title { margin-top: 2px; }
.quiz { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.quiz-q { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin: 0 0 14px; color: var(--ink) !important; font-weight: 600; }
.quiz .option { min-height: 52px; font-size: 16px; }
.quiz-result { display: flex; align-items: center; gap: 8px; margin: 14px 0 0; color: var(--ink) !important; }
.quiz-result .icon { color: var(--ok); width: 20px; height: 20px; stroke-width: 2.4; }
.quiz-result:empty { display: none; }

/* ---- Alphabet ----------------------------------------------------------- */

.letter-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 540px) { .letter-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (min-width: 720px) { .letter-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); } }
.letter-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 4px 12px;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.letter-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.letter-tile.is-learned { background: color-mix(in srgb, var(--teal) 12%, var(--surface)); }
.lt-glyph { font-size: 34px; font-weight: 600; line-height: 1.5; }
.lt-name { font-size: 13px; font-weight: 600; }
.lt-sound { font-size: 12px; color: var(--ink-3); }
.lt-star { position: absolute; top: 8px; left: 9px; width: 6px; height: 6px; border-radius: 50%; background: var(--saffron); }
.lt-check { position: absolute; top: 6px; right: 6px; color: var(--teal); }
.lt-check .icon { width: 14px; height: 14px; stroke-width: 2.6; }

.tips { margin-top: 24px; }
.tips h2 { font: 600 22px/1.2 var(--font-display); }
.tips ul { margin: 14px 0 0; padding: 0; list-style: none; }
.tips li { padding: 12px 0; border-top: 1px solid var(--line); color: var(--ink-2); }
.tips li b { color: var(--ink); }
.tips .dari { font-size: 20px; font-weight: 600; padding: 0 2px; color: var(--ink); }
.dot-saffron { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--saffron); vertical-align: 2px; }

.letter-modal { text-align: center; }
.letter-modal .modal-title { margin-top: -6px; padding-right: 0; }
.letter-modal .modal-title .muted { font-family: var(--font); font-weight: 400; font-size: 0.75em; }
.pill { display: inline-flex; align-items: center; gap: 6px; margin: 10px 0 0; padding: 5px 12px; border-radius: 999px; background: var(--warm-soft); color: var(--ink-2); font-weight: 500; font-size: 13px; }
.letter-modal .note .dari { font-size: 22px; font-weight: 600; }

/* ---- Profile ------------------------------------------------------------ */

.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (min-width: 540px) { .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.stat-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 18px;
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.stat-card-icon { display: grid; place-items: center; width: 38px; height: 38px; margin-bottom: 12px; border-radius: 12px; background: var(--cs); color: var(--c); }
.stat-card-icon .icon { width: 20px; height: 20px; }
.stat-card-icon .dari { font-size: 17px; font-weight: 600; line-height: 1; padding-bottom: 2px; }
.stat-card b { font: 600 30px/1.1 var(--font-display); font-variant-numeric: tabular-nums; }
.stat-card span:last-child { font-size: 14px; color: var(--ink-2); }

.settings { margin-top: 16px; }
.settings h2, .install-section h2, .danger-zone h2 { font: 600 20px/1.2 var(--font-display); }
.settings h2 { margin: 0 0 14px; }
.settings h2:not(:first-child) { margin-top: 30px; }
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 16px; background: var(--surface-2); }
.segmented button {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 6px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}
.segmented button small { font-size: 12.5px; color: var(--ink-2); font-weight: 400; }
.segmented button:hover { background: color-mix(in srgb, var(--surface) 55%, transparent); }
.segmented button[aria-checked="true"] { background: var(--surface); box-shadow: var(--shadow); }
.segmented--sm button { padding: 6px 14px; font-size: 14px; font-weight: 500; }

.setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  cursor: pointer;
}
.setting > span:first-child { display: flex; flex-direction: column; }
.setting b { font-weight: 500; }
.setting small { color: var(--ink-2); font-size: 14px; line-height: 1.45; margin-top: 2px; }
div.setting { cursor: default; flex-wrap: wrap; }

.switch {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  position: relative;
  width: 48px;
  height: 28px;
  margin: 0;
  border-radius: 999px;
  background: var(--line-2);
  cursor: pointer;
  transition: background 0.2s;
}
.switch::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s;
}
.switch:checked { background: var(--ok); }
.switch:checked::before { transform: translateX(20px); }

.danger-zone { margin-top: 16px; }
.danger-zone p { margin: 6px 0 16px; }

.about { margin: 32px 0 0; text-align: center; font-size: 14px; color: var(--ink-3); line-height: 1.8; }
.about .dari { font-size: 19px; font-weight: 600; color: var(--ink-2); }

/* ---- Home-screen install ------------------------------------------------ */

.install-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-top: 14px;
  padding-right: 52px;
}
.install-icon { flex: none; width: 52px; height: 52px; border-radius: 14px; box-shadow: var(--shadow); }
.install-text { min-width: 0; }
.install-text h2 { font-size: 17px; }
.install-text p { margin: 6px 0 0; color: var(--ink-2); }
.install-text .btn, .install-section .btn { margin-top: 14px; }
.install-x { position: absolute; top: 10px; right: 10px; }
.install-tip { font-size: 14px; color: var(--ink-3) !important; }
.share-icon { width: 18px; height: 18px; vertical-align: -3px; color: var(--ink); }
.install-section { margin-top: 16px; }
.install-section p { margin: 8px 0 0; color: var(--ink-2); }
.install-ok { display: inline-flex; align-items: center; gap: 8px; }
.install-ok .icon { color: var(--ok); width: 18px; height: 18px; stroke-width: 2.4; }

/* ---- Modals & toasts ---------------------------------------------------- */

.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(30, 24, 16, 0.42); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); opacity: 0; transition: opacity 0.2s; }
.modal-panel {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 28px 24px 26px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(14px) scale(0.98);
  transition: opacity 0.2s, transform 0.2s;
}
.modal.is-open .modal-backdrop { opacity: 1; }
.modal.is-open .modal-panel { opacity: 1; transform: none; }
.modal.is-closing .modal-backdrop { opacity: 0; }
.modal.is-closing .modal-panel { opacity: 0; transform: translateY(14px) scale(0.98); }
.modal-x { position: absolute; top: 14px; right: 14px; }
.modal-title { padding-right: 40px; font: 600 28px/1.15 var(--font-display); letter-spacing: -0.01em; }
.modal-panel > .muted { margin: 10px 0 0; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.modal-actions .btn { flex: 1 1 160px; }

.modal--sheet { place-items: end center; padding: 0; }
.modal--sheet .modal-panel {
  max-width: 640px;
  border-radius: var(--radius) var(--radius) 0 0;
  padding-bottom: max(26px, env(safe-area-inset-bottom));
  transform: translateY(100%);
}
.modal--sheet .modal-panel::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  width: 36px;
  height: 4px;
  margin-left: -18px;
  border-radius: 999px;
  background: var(--line-2);
}
.modal--sheet.is-closing .modal-panel { transform: translateY(100%); }
@media (min-width: 720px) {
  .modal--sheet { place-items: center; padding: 16px; }
  .modal--sheet .modal-panel { border-radius: var(--radius); max-width: 520px; transform: translateY(14px) scale(0.98); }
  .modal--sheet .modal-panel::before { display: none; }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(92px + env(safe-area-inset-bottom));
  z-index: 70;
  max-width: calc(100% - 32px);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity 0.25s, transform 0.25s;
}
.toast.is-visible { opacity: 0.94; transform: translate(-50%, 0); }
@media (min-width: 860px) { .toast { bottom: 32px; } }

.noscript { padding: 24px; text-align: center; font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .confetti { display: none; }
}
