/* ==========================================================================
   English Everywhere — Design System v2 (2026)
   Rich, dimensional, motion-aware. Tokens first, then components.
   Keeps every v1 class name so existing pages never break.
   ========================================================================== */

/* ---------- 1. Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
img, svg, video { display: block; max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
ul, ol { list-style: none; padding: 0; }
a { color: inherit; text-decoration: none; }

/* ---------- 2. Tokens ---------- */
:root {
  --space-1: 0.25rem; --space-2: 0.5rem; --space-3: 0.75rem; --space-4: 1rem;
  --space-5: 1.25rem; --space-6: 1.5rem; --space-8: 2rem; --space-10: 2.5rem;
  --space-12: 3rem; --space-16: 4rem; --space-20: 5rem; --space-24: 6rem;

  --radius-xs: 0.5rem; --radius-sm: 0.75rem; --radius-md: 1rem;
  --radius-lg: 1.25rem; --radius-xl: 1.75rem; --radius-2xl: 2.25rem; --radius-full: 999px;

  --content-reading: 44rem; --content-app: 78rem; --content-wide: 68rem;

  --font-ui: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", "Noto Sans Arabic", "Noto Nastaliq Urdu", sans-serif;
  --font-display: "Space Grotesk", "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-reading: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur: 180ms; --dur-slow: 320ms; --dur-slower: 620ms;

  /* ---- light theme ---- */
  --bg: #f7f8fd;
  --bg-soft: #eef1fa;
  --surface: #ffffff;
  --surface-2: #f4f6fc;
  --surface-3: #e8ecf7;
  --text: #0b0e1a;
  --text-muted: #545d75;
  --text-faint: #7f879c;
  --border: #e3e7f2;
  --border-strong: #ced4e5;

  --brand: #5b4bff;
  --brand-2: #8b5cf6;
  --brand-3: #06b6d4;
  --brand-hover: #4a38f0;
  --brand-soft: #eeebff;
  --brand-contrast: #ffffff;
  --accent: #0d9488;
  --accent-2: #f59e0b;
  --accent-soft: #e4f8f4;

  --success: #0f9d58; --success-soft: #e6f8ee;
  --warning: #c2740a; --warning-soft: #fdf3e3;
  --danger: #dc2626; --danger-soft: #fdeaea;

  --grad-brand: linear-gradient(120deg, #5b4bff 0%, #8b5cf6 45%, #06b6d4 100%);
  --grad-warm: linear-gradient(120deg, #f59e0b 0%, #ef4444 100%);
  --grad-cool: linear-gradient(120deg, #06b6d4 0%, #3b82f6 100%);

  --shadow-sm: 0 1px 2px rgba(11, 14, 26, 0.06), 0 1px 3px rgba(11, 14, 26, 0.05);
  --shadow-md: 0 6px 18px rgba(11, 14, 26, 0.07), 0 2px 6px rgba(11, 14, 26, 0.04);
  --shadow-lg: 0 24px 60px -18px rgba(11, 14, 26, 0.22), 0 8px 20px -8px rgba(11, 14, 26, 0.1);
  --shadow-glow: 0 0 0 1px rgba(91, 75, 255, 0.16), 0 18px 50px -16px rgba(91, 75, 255, 0.42);
  --ring: rgba(91, 75, 255, 0.34);
  --glass: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.65);
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #06070e;
  --bg-soft: #0b0d18;
  --surface: #0f1220;
  --surface-2: #161a2c;
  --surface-3: #1f2438;
  --text: #eef1fb;
  --text-muted: #a2abc4;
  --text-faint: #6f7893;
  --border: #232840;
  --border-strong: #333a56;

  --brand: #8b8cff;
  --brand-2: #b18cff;
  --brand-3: #4dd4e8;
  --brand-hover: #a3a4ff;
  --brand-soft: #191d3a;
  --brand-contrast: #06070e;
  --accent: #2dd4bf;
  --accent-2: #fbbf24;
  --accent-soft: #0e2f2c;

  --success: #4ade80; --success-soft: #0e2a1b;
  --warning: #fbbf6b; --warning-soft: #2b2013;
  --danger: #fb8f8f; --danger-soft: #2c1616;

  --grad-brand: linear-gradient(120deg, #8b8cff 0%, #b18cff 45%, #4dd4e8 100%);
  --grad-warm: linear-gradient(120deg, #fbbf24 0%, #fb7185 100%);
  --grad-cool: linear-gradient(120deg, #4dd4e8 0%, #7c9dff 100%);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 30px 70px -20px rgba(0, 0, 0, 0.8);
  --shadow-glow: 0 0 0 1px rgba(139, 140, 255, 0.25), 0 22px 60px -18px rgba(139, 140, 255, 0.5);
  --ring: rgba(139, 140, 255, 0.5);
  --glass: rgba(15, 18, 32, 0.72);
  --glass-border: rgba(255, 255, 255, 0.08);
  color-scheme: dark;
}

/* ---------- 3. Base ---------- */
body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 1rem;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -0.035em;
  color: var(--text);
  text-wrap: balance;
}
h1 { font-size: clamp(2.4rem, 1.4rem + 4.4vw, 4.4rem); }
h2 { font-size: clamp(1.75rem, 1.2rem + 2.4vw, 3rem); letter-spacing: -0.03em; }
h3 { font-size: clamp(1.2rem, 1.05rem + 0.8vw, 1.6rem); letter-spacing: -0.02em; }
p { text-wrap: pretty; }
strong { font-weight: 650; }

:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: var(--radius-xs); }
:focus:not(:focus-visible) { outline: none; }
::selection { background: var(--brand); color: var(--brand-contrast); }

.skip-link { position: absolute; left: -999px; top: 0; z-index: 200; background: var(--brand);
  color: var(--brand-contrast); padding: 0.75rem 1.25rem; border-radius: 0 0 var(--radius-sm) 0; font-weight: 600; }
.skip-link:focus { left: 0; }

.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; }

/* ---------- 4. Ambient background ---------- */
.aurora { position: fixed; inset: 0; z-index: -2; overflow: hidden; pointer-events: none; }
.aurora i { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.34; animation: drift 26s var(--ease) infinite alternate; }
.aurora i:nth-child(1) { width: 46vw; height: 46vw; left: -8vw; top: -12vw; background: var(--brand); }
.aurora i:nth-child(2) { width: 40vw; height: 40vw; right: -10vw; top: 4vw; background: var(--brand-3); animation-delay: -8s; }
.aurora i:nth-child(3) { width: 38vw; height: 38vw; left: 28vw; bottom: -16vw; background: var(--brand-2); animation-delay: -16s; }
[data-theme="dark"] .aurora i { opacity: 0.3; }
/* keep text legible over the colour wash */
.aurora::after { content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse 70% 55% at 30% 40%, color-mix(in srgb, var(--bg) 78%, transparent), transparent 70%); }
@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(4vw, 3vw, 0) scale(1.18); }
}
.grain { position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E"); }
.grid-lines { position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0.5;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 20%, transparent 75%); }

/* ---------- 5. Layout ---------- */
.wrap { width: 100%; max-width: var(--content-wide); margin-inline: auto; padding-inline: var(--space-5); }
.wrap-narrow { max-width: var(--content-reading); }
.wrap-wide { max-width: var(--content-app); }
.section { padding-block: clamp(3.5rem, 2.2rem + 6vw, 7rem); position: relative; }
.stack > * + * { margin-top: var(--space-4); }
.center { text-align: center; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.eyebrow { font-family: var(--font-display); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--brand); display: inline-flex; align-items: center; gap: 0.5rem; }
.eyebrow::before { content: ""; width: 22px; height: 2px; border-radius: 2px; background: var(--grad-brand); }
.eyebrow.center::before { display: none; }
.lead { font-size: clamp(1.05rem, 1rem + 0.45vw, 1.3rem); color: var(--text-muted); }
.grid { display: grid; gap: var(--space-5); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-2 { gap: var(--space-2); } .gap-3 { gap: var(--space-3); } .gap-4 { gap: var(--space-4); }
.wrap-flex { flex-wrap: wrap; }
.hidden { display: none !important; }
.grad-text { background: var(--grad-brand); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- 6. Buttons ---------- */
.btn {
  --btn-bg: var(--surface); --btn-fg: var(--text); --btn-bd: var(--border-strong);
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  gap: var(--space-2); padding: 0.7rem 1.2rem; min-height: 44px;
  border-radius: var(--radius-full); background: var(--btn-bg); color: var(--btn-fg);
  border: 1px solid var(--btn-bd); font-weight: 600; font-size: 0.95rem;
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease),
    border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), color var(--dur) var(--ease);
  white-space: nowrap; user-select: none; overflow: hidden;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0) scale(0.985); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary { --btn-bg: var(--brand); --btn-fg: #fff; --btn-bd: transparent;
  background-image: var(--grad-brand); background-size: 160% 160%; background-position: 0% 50%; box-shadow: var(--shadow-glow); }
.btn-primary:hover { background-position: 100% 50%; box-shadow: 0 0 0 1px rgba(91,75,255,0.2), 0 24px 60px -14px rgba(91,75,255,0.55); }
.btn-ghost { --btn-bg: transparent; --btn-bd: transparent; --btn-fg: var(--text-muted); }
.btn-ghost:hover { --btn-bg: var(--surface-2); --btn-fg: var(--text); }
.btn-soft { --btn-bg: var(--surface-2); --btn-bd: transparent; }
.btn-soft:hover { --btn-bg: var(--surface-3); }
.btn-outline { --btn-bg: transparent; --btn-bd: var(--border-strong); }
.btn-outline:hover { --btn-bd: var(--brand); --btn-fg: var(--brand); }
.btn-lg { padding: 1rem 1.75rem; font-size: 1.05rem; min-height: 54px; }
.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.85rem; min-height: 36px; }
.btn-block { width: 100%; }
.btn-danger { --btn-bg: var(--danger-soft); --btn-fg: var(--danger); --btn-bd: transparent; }

/* ---------- 7. Cards & surfaces ---------- */
.card { position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: var(--space-6); }
.card-tight { padding: var(--space-4); }
.card-hover { transition: transform var(--dur-slow) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur-slow) var(--ease); }
.card-hover:hover { transform: translateY(-5px); border-color: var(--border-strong); box-shadow: var(--shadow-lg); }
.glass { background: var(--glass); backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%); border: 1px solid var(--glass-border); }
.card-glow { position: relative; }
.card-glow::before { content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px;
  background: var(--grad-brand); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; opacity: 0; transition: opacity var(--dur-slow) var(--ease); pointer-events: none; }
.card-glow:hover::before { opacity: 1; }

.pill { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full); background: var(--surface-2); border: 1px solid var(--border);
  font-size: 0.8rem; font-weight: 600; color: var(--text-muted); }
.pill-brand { background: var(--brand-soft); border-color: transparent; color: var(--brand); }
.pill-success { background: var(--success-soft); border-color: transparent; color: var(--success); }
.pill-accent { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.pill-warm { background: var(--warning-soft); border-color: transparent; color: var(--warning); }

.tag { display: inline-block; padding: 0.18rem 0.55rem; border-radius: var(--radius-xs);
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.tag-review { background: var(--warning-soft); color: var(--warning); }
.tag-new { background: var(--brand-soft); color: var(--brand); }
.tag-done { background: var(--success-soft); color: var(--success); }

/* ---------- 8. Forms ---------- */
label { font-weight: 600; font-size: 0.9rem; display: block; margin-bottom: var(--space-2); }
.input, .select, textarea.input { width: 100%; padding: 0.75rem 1rem; min-height: 48px; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); color: var(--text);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.input::placeholder { color: var(--text-faint); }
.input:focus, .select:focus, textarea.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--ring); }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%); background-position: calc(100% - 1.15rem) 1.25rem, calc(100% - 0.8rem) 1.25rem; background-size: 6px 6px, 6px 6px; background-repeat: no-repeat; padding-inline-end: 2.5rem; }
.field-hint { font-size: 0.82rem; color: var(--text-muted); margin-top: var(--space-1); }

.option { display: flex; align-items: center; gap: var(--space-3); width: 100%; text-align: start;
  padding: 0.9rem 1.1rem; background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-md); font-weight: 600;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), transform var(--dur) var(--ease); }
.option:hover { border-color: var(--border-strong); background: var(--surface-2); transform: translateY(-1px); }
.option[aria-pressed="true"], .option.selected { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.option .opt-key { flex: none; width: 1.9rem; height: 1.9rem; border-radius: var(--radius-xs);
  display: grid; place-items: center; background: var(--surface-2); font-size: 0.85rem; font-weight: 700; color: var(--text-muted); }
.option.selected .opt-key { background: var(--brand); color: var(--brand-contrast); }

/* ---------- 9. Header / nav ---------- */
.site-header { position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); min-height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; white-space: nowrap; font-family: var(--font-display); font-weight: 700; font-size: 1.08rem; letter-spacing: -0.03em; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center; overflow: hidden; }
.brand-mark svg { width: 100%; height: 100%; }
.nav-links { display: flex; align-items: center; gap: var(--space-1); }
.nav-links a { padding: 0.5rem 0.7rem; white-space: nowrap; border-radius: var(--radius-full); font-size: 0.92rem; font-weight: 550; color: var(--text-muted); transition: background var(--dur) var(--ease), color var(--dur) var(--ease); }
.nav-links a:hover, .nav-links a.active { background: var(--surface-2); color: var(--text); }
.nav-actions { display: flex; align-items: center; gap: var(--space-2); }
@media (max-width: 1080px) { .nav-links a { padding: 0.5rem 0.55rem; font-size: 0.88rem; } }
@media (max-width: 960px) { .nav-links { display: none; } }
.icon-btn { width: 42px; height: 42px; border-radius: var(--radius-full); display: grid; place-items: center;
  color: var(--text-muted); border: 1px solid transparent; transition: background var(--dur) var(--ease), color var(--dur) var(--ease); }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 19px; height: 19px; }

/* ---------- 10. Hero ---------- */
.hero { position: relative; padding-block: clamp(3rem, 2rem + 6vw, 6.5rem); overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: 1.02fr 0.98fr; gap: var(--space-10); align-items: center; }
@media (max-width: 960px) { .hero-grid { grid-template-columns: 1fr; gap: var(--space-8); } }
.hero h1 { margin-block: var(--space-5); }
.hero-cta { display: flex; gap: var(--space-3); flex-wrap: wrap; align-items: center; margin-top: var(--space-6); }
.hero-note { margin-top: var(--space-4); font-size: 0.88rem; color: var(--text-faint); display: flex; align-items: center; gap: 0.5rem; }
.hero-art { position: relative; }
.hero-art svg { width: 100%; height: auto; filter: drop-shadow(0 30px 60px rgba(91,75,255,0.22)); }
@media (max-width: 960px) { .hero-art { max-width: 34rem; margin-inline: auto; } }
.float-chip { position: absolute; padding: 0.45rem 0.85rem; border-radius: var(--radius-full);
  background: var(--glass); backdrop-filter: blur(14px); border: 1px solid var(--glass-border);
  font-family: var(--font-display); font-weight: 700; font-size: 0.9rem; box-shadow: var(--shadow-md);
  animation: float 7s var(--ease) infinite alternate; }
.float-chip.c1 { top: 6%; left: 1%; animation-delay: -1s; color: var(--brand); }
.float-chip.c2 { top: 38%; right: 1%; animation-delay: -3s; color: var(--accent); }
.float-chip.c3 { bottom: 10%; left: 4%; animation-delay: -5s; color: var(--accent-2); }
@keyframes float { from { transform: translateY(-8px); } to { transform: translateY(10px); } }

.lang-chip { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.45rem 0.85rem;
  border-radius: var(--radius-full); background: var(--surface); border: 1px solid var(--border);
  font-size: 0.88rem; font-weight: 600; transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.lang-chip:hover { transform: translateY(-2px); border-color: var(--brand); }
.lang-chip .flag { font-size: 1rem; }

.feature-ico { width: 46px; height: 46px; border-radius: var(--radius-sm); display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand); margin-bottom: var(--space-4); }
.feature-ico svg { width: 24px; height: 24px; }

.preview-card { border-radius: var(--radius-2xl); overflow: hidden; box-shadow: var(--shadow-lg);
  border: 1px solid var(--border); background: var(--surface); }
.preview-bar { display: flex; align-items: center; gap: 0.5rem; padding: 0.7rem 1rem; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.preview-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--border-strong); }
.preview-body { padding: var(--space-6); }

/* ---------- 11. Interlinear gloss (literal translation) ---------- */
.gloss-table { display: grid; gap: var(--space-2); }
.gloss-line { display: grid; grid-template-columns: 7rem 1fr; gap: var(--space-3); align-items: center; }
.gloss-lane-label { font-family: var(--font-display); font-size: 0.66rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text-faint); text-align: end; line-height: 1.25; }
.gloss-cells { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: var(--space-2); }
@media (max-width: 560px) {
  .gloss-line { grid-template-columns: 1fr; gap: var(--space-2); }
  .gloss-lane-label { text-align: start; }
}
.gloss-cell { padding: 0.7rem 0.85rem; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); font-size: 0.95rem; text-align: center; display: flex;
  flex-direction: column; gap: 0.2rem; justify-content: center; min-height: 3.4rem; }
.gloss-cell .g-word { font-weight: 700; font-family: var(--font-display); }
.gloss-cell .g-sub { font-size: 0.76rem; color: var(--text-faint); }
.gloss-line:nth-child(1) .gloss-cell { background: var(--surface-2); }
.gloss-line:nth-child(2) .gloss-cell { background: color-mix(in srgb, var(--accent) 8%, var(--surface)); border-style: dashed; color: var(--text-muted); }
.gloss-line:nth-child(3) .gloss-cell { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 30%, transparent); color: var(--brand); }
.gloss-cell.missing { border-style: dashed; border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); background: var(--danger-soft); color: var(--danger); }
.gloss-cell.missing::after { content: "+"; font-weight: 800; opacity: 0.6; }
.gloss-legend { display: flex; gap: var(--space-4); flex-wrap: wrap; font-size: 0.8rem; color: var(--text-muted); }
.gloss-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 0.35rem; vertical-align: middle; }

/* ---------- 12. Word-order transformation diagram ---------- */
.order-diagram { display: grid; gap: var(--space-6); }
.order-lane { display: grid; gap: var(--space-3); }
.order-lane .lane-label { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); display: flex; align-items: center; gap: 0.5rem; }
.tok-row { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.tok { padding: 0.5rem 0.9rem; border-radius: var(--radius-sm); font-weight: 700; font-family: var(--font-display);
  font-size: 0.95rem; border: 1.5px solid var(--border-strong); background: var(--surface);
  transition: transform var(--dur-slow) var(--ease), background var(--dur) var(--ease), border-color var(--dur) var(--ease), opacity var(--dur) var(--ease); }
.tok.s { border-color: color-mix(in srgb, var(--brand) 55%, transparent); background: var(--brand-soft); color: var(--brand); }
.tok.v { border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: var(--accent-soft); color: var(--accent); }
.tok.o { border-color: color-mix(in srgb, var(--accent-2) 60%, transparent); background: var(--warning-soft); color: var(--warning); }
.tok.missing { border-style: dashed; border-color: color-mix(in srgb, var(--danger) 55%, transparent); background: var(--danger-soft); color: var(--danger); }
.tok.ghost { opacity: 0.42; }
.order-arrow { display: flex; align-items: center; justify-content: center; color: var(--text-faint); }
.order-arrow svg { width: 26px; height: 26px; }

/* ---------- 13. Steps ---------- */
.step-num { width: 44px; height: 44px; border-radius: var(--radius-full); display: grid; place-items: center;
  background: var(--grad-brand); color: #fff; font-family: var(--font-display); font-weight: 800; flex: none; box-shadow: var(--shadow-glow); }

/* ---------- 14. Footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-soft); padding-block: var(--space-12) var(--space-8); margin-top: var(--space-16); }
.footer-grid { display: grid; grid-template-columns: 1.5fr repeat(3, 1fr); gap: var(--space-8); }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
.footer-col h4 { font-family: var(--font-display); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-faint); margin-bottom: var(--space-4); font-weight: 700; }
.footer-col a { display: block; padding: 0.3rem 0; color: var(--text-muted); font-size: 0.92rem; transition: color var(--dur) var(--ease); }
.footer-col a:hover { color: var(--brand); }
.footer-bottom { margin-top: var(--space-10); padding-top: var(--space-6); border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; font-size: 0.85rem; color: var(--text-faint); }

/* ---------- 15. FAQ ---------- */
.faq details { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); margin-bottom: var(--space-3); overflow: hidden; transition: border-color var(--dur) var(--ease); }
.faq details[open] { border-color: var(--border-strong); }
.faq summary { padding: 1.1rem 1.25rem; font-weight: 650; cursor: pointer; display: flex; justify-content: space-between; gap: 1rem; align-items: center; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.5rem; color: var(--brand); font-weight: 300; transition: transform var(--dur) var(--ease); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { padding: 0 1.25rem 1.15rem; color: var(--text-muted); }

/* ---------- 16. APP shell ---------- */
.app-shell { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
@media (max-width: 940px) { .app-shell { grid-template-columns: 1fr; } }
.side-nav { border-inline-end: 1px solid var(--border); background: var(--bg-soft);
  padding: var(--space-5) var(--space-4); position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: var(--space-2); overflow-y: auto; }
@media (max-width: 940px) {
  .side-nav { position: fixed; inset-block: 0; inset-inline-start: 0; width: 284px; z-index: 120;
    transform: translateX(-105%); transition: transform var(--dur-slow) var(--ease); box-shadow: var(--shadow-lg); }
  [dir="rtl"] .side-nav { transform: translateX(105%); }
  .side-nav.open { transform: translateX(0); }
}
.nav-item { display: flex; align-items: center; gap: var(--space-3); padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm); color: var(--text-muted); font-weight: 600; font-size: 0.94rem;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease); width: 100%; text-align: start; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--brand-soft); color: var(--brand); }
.nav-item .ico { width: 20px; text-align: center; flex: none; }
.nav-item .ico svg { width: 18px; height: 18px; }

.app-main { min-width: 0; display: flex; flex-direction: column; }
.app-topbar { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border); position: sticky; top: 0;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px); z-index: 60; }
.app-content { padding: var(--space-6) var(--space-5) var(--space-16); max-width: var(--content-app); width: 100%; margin-inline: auto; flex: 1; }
.menu-toggle { display: none; }
@media (max-width: 940px) { .menu-toggle { display: grid; } }
.bottom-nav { display: none; }
@media (max-width: 940px) {
  .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; inset-inline: 0; z-index: 90;
    background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(16px);
    border-top: 1px solid var(--border); padding: 0.4rem 0.25rem calc(0.4rem + env(safe-area-inset-bottom)); }
  .bottom-nav .nav-item { flex-direction: column; gap: 2px; font-size: 0.68rem; padding: 0.4rem 0.2rem; border-radius: var(--radius-sm); }
  .bottom-nav .nav-item .ico svg { width: 21px; height: 21px; }
  .app-content { padding-bottom: 6rem; }
}

/* ---------- 17. Dashboard ---------- */
.hero-continue { position: relative; border-radius: var(--radius-2xl); overflow: hidden;
  background: var(--grad-brand); color: #fff; padding: var(--space-8); box-shadow: var(--shadow-lg); }
.hero-continue::after { content: ""; position: absolute; inset: 0;
  background: radial-gradient(120% 90% at 100% 0%, rgba(255,255,255,0.28), transparent 55%); pointer-events: none; }
.hero-continue h2 { color: inherit; }
.hero-continue .btn-primary { --btn-bg: #fff; --btn-fg: var(--brand); --btn-bd: #fff; background-image: none; box-shadow: 0 10px 30px -10px rgba(0,0,0,0.4); }
[data-theme="dark"] .hero-continue .btn-primary { --btn-bg: #06070e; --btn-fg: #fff; --btn-bd: #06070e; }
.hero-continue .btn-ghost { --btn-fg: rgba(255,255,255,0.94); }

.progress-bar { height: 8px; border-radius: var(--radius-full); background: var(--surface-3); overflow: hidden; }
.progress-bar > span { display: block; height: 100%; background: var(--grad-brand); border-radius: inherit; transition: width var(--dur-slower) var(--ease); }
.hero-continue .progress-bar { background: rgba(255,255,255,0.3); }
.hero-continue .progress-bar > span { background: #fff; }

.stat { text-align: center; }
.stat .stat-num { font-family: var(--font-display); font-size: 2rem; font-weight: 700; letter-spacing: -0.04em; color: var(--text); line-height: 1; }
.stat .stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.35rem; font-weight: 600; }

.unit-card { display: flex; gap: var(--space-4); align-items: flex-start; }
.unit-badge { width: 48px; height: 48px; border-radius: var(--radius-sm); display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; flex: none; background: var(--surface-2); color: var(--text-muted); }
.unit-badge.done { background: var(--success-soft); color: var(--success); }
.unit-badge.active { background: var(--grad-brand); color: #fff; }

.lesson-row { display: flex; align-items: center; gap: var(--space-3); padding: 0.9rem 1rem;
  border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); width: 100%;
  text-align: start; transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), transform var(--dur) var(--ease); }
.lesson-row:hover { border-color: var(--brand); transform: translateX(4px); box-shadow: var(--shadow-sm); }
[dir="rtl"] .lesson-row:hover { transform: translateX(-4px); }
.lesson-row .lesson-ico { width: 38px; height: 38px; border-radius: var(--radius-xs); display: grid; place-items: center; background: var(--surface-2); flex: none; }
.lesson-row .lesson-ico svg { width: 17px; height: 17px; }
.lesson-row.complete .lesson-ico { background: var(--success-soft); color: var(--success); }

/* ---------- 18. Lesson player ---------- */
.player { max-width: var(--content-reading); margin-inline: auto; width: 100%; }
.player-top { display: flex; align-items: center; gap: var(--space-4); margin-bottom: var(--space-6); flex-wrap: wrap; }
.exercise { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-2xl);
  padding: clamp(1.35rem, 1rem + 2vw, 2.5rem); box-shadow: var(--shadow-md); }
.exercise .prompt { font-size: clamp(1.15rem, 1rem + 0.8vw, 1.5rem); font-weight: 650; letter-spacing: -0.015em; }
.exercise .prompt-en { font-family: var(--font-display); font-size: clamp(1.35rem, 1.1rem + 1.3vw, 2rem); font-weight: 700; letter-spacing: -0.03em; }
.answer-zone { margin-top: var(--space-6); display: grid; gap: var(--space-3); }
.audio-btn { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.6rem 1.05rem;
  border-radius: var(--radius-full); background: var(--brand-soft); color: var(--brand); font-weight: 650; border: none;
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease); }
.audio-btn:hover { transform: translateY(-2px); background: color-mix(in srgb, var(--brand) 18%, var(--brand-soft)); }
.audio-btn svg { width: 16px; height: 16px; }
.word-bank { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.word-chip { padding: 0.55rem 0.95rem; border-radius: var(--radius-sm); background: var(--surface-2);
  border: 1px solid var(--border); font-weight: 600; transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.word-chip:hover { transform: translateY(-2px); border-color: var(--brand); }
.word-chip.used { opacity: 0.32; pointer-events: none; }
.answer-line { min-height: 60px; padding: 0.75rem; border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-md); display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; background: var(--surface-2); }
.answer-line .placeholder { color: var(--text-faint); font-size: 0.9rem; }
.feedback { border-radius: var(--radius-lg); padding: var(--space-5); margin-top: var(--space-5); border: 1.5px solid; }
.feedback.correct { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 40%, transparent); }
.feedback.incorrect { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 40%, transparent); }
.feedback h4 { display: flex; align-items: center; gap: 0.5rem; margin-bottom: var(--space-2); font-family: var(--font-display); }
.feedback.correct h4 { color: var(--success); }
.feedback.incorrect h4 { color: var(--warning); }
.note { border: 1px solid var(--border); border-inline-start: 4px solid var(--accent);
  border-radius: var(--radius-md); background: var(--accent-soft); padding: var(--space-4) var(--space-5); }
.note .note-title { font-weight: 700; display: flex; align-items: center; gap: 0.5rem; margin-bottom: var(--space-2); color: var(--accent); font-size: 0.92rem; font-family: var(--font-display); }
.note p { font-size: 0.95rem; }
.rtl-text { direction: rtl; text-align: right; font-size: 1.05rem; }

/* ---------- 19. Vocabulary ---------- */
.vocab-item { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4);
  border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.vocab-item .w { font-weight: 700; font-family: var(--font-display); }
.vocab-item .d { font-size: 0.88rem; color: var(--text-muted); }

/* ---------- 20. Reading ---------- */
.reading-body { font-family: var(--font-reading); font-size: 1.16rem; line-height: 1.8; }
.reading-body p + p { margin-top: var(--space-4); }
mark.hl { background: color-mix(in srgb, var(--accent-2) 26%, transparent); color: inherit; border-radius: 3px; padding: 0 2px; cursor: help; border-bottom: 1px dotted var(--accent-2); }
.reader-grid { display: grid; grid-template-columns: 1fr; gap: var(--space-6); }
@media (min-width: 1000px) { .reader-grid.split { grid-template-columns: 1.6fr 1fr; align-items: start; } }
.reader-toolbar { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-5); }
.text-meta { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }
.gloss { cursor: pointer; border-bottom: 2px dotted var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); border-radius: 3px; padding: 0 2px; transition: background var(--dur) var(--ease); }
.gloss:hover, .gloss:focus-visible { background: color-mix(in srgb, var(--accent) 26%, transparent); }
.gloss.saved { background: color-mix(in srgb, var(--brand) 16%, transparent); border-bottom-style: solid; border-bottom-color: var(--brand); }
.glossary-list { display: grid; gap: var(--space-2); }
.gloss-item { padding: var(--space-3) var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.gloss-item .w { font-weight: 700; font-family: var(--font-display); }
.gloss-item .pos { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-faint); margin-inline-start: 0.4rem; }
.gloss-item .def { font-size: 0.9rem; color: var(--text-muted); margin-top: 2px; }
.gloss-item .native { font-size: 0.95rem; color: var(--accent); font-weight: 650; }
.gloss-item .save-btn { margin-top: var(--space-2); }
.pop { position: absolute; z-index: 140; max-width: 20rem; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-md); padding: var(--space-4); box-shadow: var(--shadow-lg); }
.pop .pop-w { font-weight: 750; font-family: var(--font-display); }
.pop .pop-def { font-size: 0.9rem; color: var(--text-muted); margin-top: var(--space-1); }
.pop .pop-native { font-size: 0.98rem; color: var(--accent); font-weight: 650; margin-top: var(--space-2); }

/* ---------- 21. Quiz ---------- */
.quiz-item { padding: var(--space-4) 0; border-top: 1px solid var(--border); }
.quiz-item:first-of-type { border-top: 0; }
.quiz-q { font-weight: 650; margin-bottom: var(--space-3); }
.quiz-opts { display: grid; gap: var(--space-2); }
.quiz-opt { text-align: start; padding: 0.65rem 0.9rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); font-weight: 550; transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease); }
.quiz-opt:hover { border-color: var(--border-strong); background: var(--surface-2); }
.quiz-opt.right { border-color: var(--success); background: var(--success-soft); }
.quiz-opt.wrong { border-color: var(--danger); background: var(--danger-soft); }

/* ---------- 22. Modal / toast ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(4, 6, 14, 0.55); backdrop-filter: blur(6px); z-index: 150; display: grid; place-items: center; padding: var(--space-4); }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); max-width: 32rem; width: 100%; padding: var(--space-6); box-shadow: var(--shadow-lg); max-height: 90vh; overflow-y: auto; }
.toast-wrap { position: fixed; bottom: 1.25rem; inset-inline-end: 1.25rem; z-index: 200; display: flex; flex-direction: column; gap: 0.5rem; }
.toast { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 0.8rem 1.1rem; box-shadow: var(--shadow-lg); font-weight: 600; font-size: 0.9rem; animation: toastIn var(--dur-slow) var(--ease-spring); }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(0.96); } }
@media (max-width: 940px) { .toast-wrap { bottom: 5rem; inset-inline: 1rem; } }

/* ---------- 23. Onboarding ---------- */
.onboard { min-height: 100vh; display: grid; place-items: center; padding: var(--space-6); }
.onboard-card { max-width: 42rem; width: 100%; }
.onboard-progress { display: flex; gap: 6px; margin-bottom: var(--space-8); }
.onboard-progress span { flex: 1; height: 4px; border-radius: var(--radius-full); background: var(--surface-3); transition: background var(--dur-slow) var(--ease); }
.onboard-progress span.done { background: var(--grad-brand); }
.onboard-progress span.now { background: var(--brand); opacity: 0.55; }
.onboard-step { animation: fadeUp var(--dur-slower) var(--ease); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } }
.opt-grid { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.lang-grid { display: grid; gap: var(--space-2); grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); }
.lang-btn { display: flex; align-items: center; gap: 0.5rem; padding: 0.7rem 0.9rem; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); font-weight: 600;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), transform var(--dur) var(--ease); }
.lang-btn:hover { border-color: var(--brand); transform: translateY(-2px); }
.lang-btn[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }

/* ---------- 24. Contrast blocks ---------- */
.contrast-block { padding-block: var(--space-5); border-top: 1px solid var(--border); }
.contrast-block:first-of-type { border-top: 0; padding-top: 0; }
.contrast-title { font-size: 1.08rem; margin-bottom: var(--space-2); }
.contrast-block > p { color: var(--text-muted); font-size: 0.95rem; max-width: 52rem; }
.contrast-examples { display: grid; gap: var(--space-2); margin-top: var(--space-3); }
.ex { display: grid; grid-template-columns: 1.6rem 1fr auto; align-items: center; gap: var(--space-3);
  padding: 0.65rem 0.9rem; border-radius: var(--radius-sm); font-size: 0.94rem; border: 1px solid var(--border); background: var(--surface); }
.ex-mark { font-weight: 800; text-align: center; }
.ex-ok { border-color: color-mix(in srgb, var(--success) 35%, var(--border)); background: var(--success-soft); }
.ex-ok .ex-mark { color: var(--success); }
.ex-bad { border-color: color-mix(in srgb, var(--danger) 30%, var(--border)); background: var(--danger-soft); }
.ex-bad .ex-mark { color: var(--danger); }
.ex-en { font-weight: 600; }
.ex-bad .ex-en { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--danger) 60%, transparent); }
.ex-native { color: var(--text-muted); font-size: 0.88rem; }
@media (max-width: 560px) { .ex { grid-template-columns: 1.6rem 1fr; } .ex-native { grid-column: 2; } }

/* ---------- 25. Misc widgets ---------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr)); gap: var(--space-4); }
.skill-row { display: grid; grid-template-columns: 8.5rem 1fr 3rem; align-items: center; gap: var(--space-3); }
.skill-row .sk-name { font-weight: 600; font-size: 0.92rem; }
.skill-row .sk-val { text-align: end; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text-muted); }
@media (max-width: 520px) { .skill-row { grid-template-columns: 6.5rem 1fr 2.5rem; } }
.meter { height: 8px; border-radius: var(--radius-full); background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: inherit; background: var(--grad-brand); transition: width var(--dur-slower) var(--ease); }
.heat { display: grid; grid-template-columns: repeat(auto-fill, 12px); gap: 3px; }
.heat i { width: 12px; height: 12px; border-radius: 3px; background: var(--surface-3); display: block; }
.heat i.on { background: var(--brand); }
.heat i.half { background: color-mix(in srgb, var(--brand) 45%, var(--surface-3)); }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: var(--space-3); }
.badge-item { text-align: center; padding: var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.badge-item .b-ico { display: grid; place-items: center; color: var(--brand); }
.badge-item .b-ico svg { width: 30px; height: 30px; }
.badge-item.locked { opacity: 0.45; }
.badge-item .b-name { font-size: 0.82rem; font-weight: 600; margin-top: var(--space-2); }
.divider { height: 1px; background: var(--border); margin-block: var(--space-6); border: 0; }
.kbd { font-family: var(--font-mono); font-size: 0.8rem; padding: 0.15rem 0.4rem; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 6px; background: var(--surface-2); }
.scroll-x { overflow-x: auto; }
.badge-count { background: var(--danger); color: #fff; border-radius: var(--radius-full); font-size: 0.7rem; font-weight: 700; padding: 0.1rem 0.45rem; }

/* ---------- 26. Scroll reveal + SVG motion ---------- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity var(--dur-slower) var(--ease), transform var(--dur-slower) var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.reveal[data-d="1"] { transition-delay: 90ms; }
.reveal[data-d="2"] { transition-delay: 180ms; }
.reveal[data-d="3"] { transition-delay: 270ms; }
.reveal[data-d="4"] { transition-delay: 360ms; }
.reveal[data-d="5"] { transition-delay: 450ms; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; } }
.draw path, .draw circle, .draw line, .draw rect, .draw polyline {
  stroke-dasharray: var(--len, 1200); stroke-dashoffset: var(--len, 1200); animation: draw 2.4s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.spin-slow { animation: spin 34s linear infinite; transform-origin: center; }
@keyframes spin { to { transform: rotate(360deg); } }
.pulse-soft { animation: pulseSoft 4s var(--ease) infinite; }
@keyframes pulseSoft { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
.dash-move { stroke-dasharray: 6 10; animation: dashMove 1.6s linear infinite; }
@keyframes dashMove { to { stroke-dashoffset: -32; } }

/* ---------- 27. Responsive header polish ---------- */
@media (max-width: 720px) {
  .site-header .wrap { gap: var(--space-2); }
  .site-header .brand > span:not(.brand-mark) { display: none; }
  .site-header .nav-actions .select { max-width: 7.5rem; }
}
@media (max-width: 480px) {
  .site-header .nav-actions .btn { display: none; }
  .wrap { padding-inline: var(--space-4); }
}
@media (max-width: 940px) { .app-topbar strong { font-size: 0.95rem; } }

/* ---------- 28. Print ---------- */
@media print {
  .site-header, .site-footer, .bottom-nav, .side-nav, .aurora, .grain, .grid-lines, .no-print { display: none !important; }
  body { background: #fff; }
}

/* ==========================================================================
   29. Visual word cards (per-word SVG illustration + literal meaning)
   ========================================================================== */
.word-cards { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(13.5rem, 1fr)); }
.word-card {
  display: flex; gap: var(--space-4); align-items: flex-start; margin: 0;
  padding: var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); transition: transform var(--dur-slow) var(--ease), box-shadow var(--dur-slow) var(--ease), border-color var(--dur) var(--ease);
}
.word-card:hover { transform: translateY(-4px); border-color: var(--border-strong); box-shadow: var(--shadow-lg); }
.word-card-art { flex: none; width: 72px; height: 72px; }
.word-card-art .word-art { width: 72px; height: 72px; border-radius: 18px; display: block; }
.word-card figcaption { min-width: 0; }
.word-card-head { display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; }
.word-card-w { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; letter-spacing: -0.02em; }
.word-card-pos { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); font-weight: 700; }
.word-card-native { color: var(--accent); font-weight: 650; font-size: 0.95rem; margin-top: 2px; }
.word-card-def { color: var(--text-muted); font-size: 0.88rem; margin-top: 2px; }
.word-card-literal { margin-top: var(--space-2); font-size: 0.82rem; color: var(--text-muted);
  border-inline-start: 3px solid var(--accent-2); padding-inline-start: var(--space-3); }
.word-card-literal span { font-weight: 700; color: var(--accent-2); text-transform: uppercase; font-size: 0.68rem; letter-spacing: 0.06em; display: block; }

/* visual dictionary grid */
.word-dict { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); }
.word-dict .word-card { flex-direction: column; align-items: stretch; }
.word-dict .word-card-art { width: 100%; height: 128px; }
.word-dict .word-card-art .word-art { width: 100%; height: 128px; border-radius: var(--radius-lg); }

/* ==========================================================================
   30. Micro-details: tap-any-word, literal popover, false friends
   ========================================================================== */

/* tappable word */
.wtap {
  cursor: help; border-bottom: 1px dotted color-mix(in srgb, var(--brand) 55%, transparent);
  border-radius: 3px; padding: 0 1px; transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.wtap:hover { background: color-mix(in srgb, var(--brand) 14%, transparent); border-bottom-color: var(--brand); }
.wtap:focus-visible { outline: none; background: color-mix(in srgb, var(--brand) 18%, transparent); box-shadow: 0 0 0 2px var(--ring); }

/* the literal-meaning popover */
.lex-pop {
  position: absolute; z-index: 160; max-width: 21rem; min-width: 14rem;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-md); padding: var(--space-4);
  box-shadow: var(--shadow-lg); animation: fadeUp var(--dur-slow) var(--ease);
}
.lex-pop-head { display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; }
.lex-pop-w { font-family: var(--font-display); font-weight: 750; font-size: 1.08rem; letter-spacing: -0.02em; }
.lex-pop-pos { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-faint); font-weight: 700; }
.lex-pop-say { font-size: 0.8rem; color: var(--accent); font-weight: 650; margin-inline-start: auto; }
.lex-pop-native { color: var(--accent); font-weight: 650; margin-top: var(--space-2); font-size: 1rem; }
.lex-pop-def { color: var(--text-muted); font-size: 0.9rem; margin-top: var(--space-1); }
.lex-pop-literal {
  margin-top: var(--space-3); font-size: 0.86rem; line-height: 1.5;
  border-inline-start: 3px solid var(--accent-2); padding-inline-start: var(--space-3); color: var(--text-muted);
}
.lex-pop-literal span {
  display: block; font-weight: 700; color: var(--accent-2); text-transform: uppercase;
  font-size: 0.64rem; letter-spacing: 0.07em; margin-bottom: 3px;
}
@media (max-width: 520px) { .lex-pop { max-width: calc(100vw - 2rem); } }

/* tap hint strip */
.tap-hint {
  display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.78rem;
  color: var(--text-faint); margin-top: var(--space-3);
}
.tap-hint i { width: 9px; height: 9px; border-radius: 3px; background: color-mix(in srgb, var(--brand) 55%, transparent); display: inline-block; }

/* false friends */
.ff-grid { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); }
.ff-card { padding: var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.ff-pair { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; font-family: var(--font-display); font-weight: 700; }
.ff-en { color: var(--brand); }
.ff-looks { color: var(--danger); }
.ff-arrow { color: var(--text-faint); font-weight: 400; }
.ff-row { display: grid; grid-template-columns: 4.5rem 1fr; gap: var(--space-3); font-size: 0.88rem; margin-top: var(--space-2); align-items: baseline; }
.ff-row b { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); font-weight: 700; }
.ff-row .ff-actual { color: var(--danger); }
.ff-row .ff-right { color: var(--success); font-weight: 600; }

/* article / tense decision helper */
.decider { display: grid; gap: var(--space-4); }
.decider-step { border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-4); background: var(--surface); }
.decider-q { font-weight: 650; margin-bottom: var(--space-3); }
.decider-opts { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.decider-out {
  margin-top: var(--space-4); padding: var(--space-4); border-radius: var(--radius-md);
  background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent);
}
.decider-out .answer { font-family: var(--font-display); font-weight: 800; font-size: 1.3rem; color: var(--brand); }
.decider-out .why { font-size: 0.9rem; color: var(--text-muted); margin-top: var(--space-2); }
.word-card-say { font-size: 0.72rem; font-weight: 650; color: var(--accent); margin-inline-start: auto; font-variant-numeric: tabular-nums; }
