/* ============================================================
   Français A1 — Design System
   Apple-style fluid interface · Tricolore accents · Didot display
   ============================================================ */

:root {
  color-scheme: light dark;
  /* Neutrals */
  --bg: #fbfbfd;
  --bg-soft: #f4f4f7;
  --card: #ffffff;
  --ink: #1d1d1f;
  --ink-2: #5f5f66;
  --ink-3: #94949c;
  --line: rgba(20, 20, 30, .09);
  --line-strong: rgba(20, 20, 30, .16);
  /* Tricolore */
  --blue: #0a5ad4;
  --blue-soft: rgba(10, 90, 212, .09);
  --blue-ink: #0846a6;
  --red: #e0432f;
  --red-soft: rgba(224, 67, 47, .09);
  --gold: #b8860b;
  --green-ok: #1d9d54;
  /* Materials */
  --nav-bg: rgba(251, 251, 253, .72);
  --shadow-1: 0 1px 2px rgba(15,15,25,.05), 0 4px 14px rgba(15,15,25,.06);
  --shadow-2: 0 2px 6px rgba(15,15,25,.06), 0 14px 40px rgba(15,15,25,.10);
  --shadow-lift: 0 6px 16px rgba(15,15,25,.08), 0 24px 60px rgba(15,15,25,.14);
  /* Motion */
  --spring: cubic-bezier(.32, 1.35, .36, 1);
  --ease: cubic-bezier(.28, .06, .2, 1);
  --r-sm: 10px; --r-md: 16px; --r-lg: 22px; --r-xl: 30px;
  /* Type */
  --display: "Didot", "Bodoni MT", "Playfair Display", "Georgia", serif;
  --body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, sans-serif;
  --mono: "SF Mono", ui-monospace, "Cascadia Code", Menlo, monospace;
}

[data-theme="dark"] {
  --bg: #000000;
  --bg-soft: #101014;
  --card: #17171b;
  --ink: #f4f4f6;
  --ink-2: #a3a3ab;
  --ink-3: #6d6d75;
  --line: rgba(255, 255, 255, .10);
  --line-strong: rgba(255, 255, 255, .18);
  --blue: #5ba1ff;
  --blue-soft: rgba(91, 161, 255, .13);
  --blue-ink: #8fc0ff;
  --red: #ff6d58;
  --red-soft: rgba(255, 109, 88, .13);
  --nav-bg: rgba(10, 10, 12, .68);
  --shadow-1: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.35);
  --shadow-2: 0 2px 8px rgba(0,0,0,.45), 0 16px 44px rgba(0,0,0,.5);
  --shadow-lift: 0 8px 20px rgba(0,0,0,.5), 0 28px 70px rgba(0,0,0,.6);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --bg-soft: #101014; --card: #17171b;
    --ink: #f4f4f6; --ink-2: #a3a3ab; --ink-3: #6d6d75;
    --line: rgba(255,255,255,.10); --line-strong: rgba(255,255,255,.18);
    --blue: #5ba1ff; --blue-soft: rgba(91,161,255,.13); --blue-ink: #8fc0ff;
    --red: #ff6d58; --red-soft: rgba(255,109,88,.13);
    --nav-bg: rgba(10,10,12,.68);
    --shadow-1: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.35);
    --shadow-2: 0 2px 8px rgba(0,0,0,.45), 0 16px 44px rgba(0,0,0,.5);
    --shadow-lift: 0 8px 20px rgba(0,0,0,.5), 0 28px 70px rgba(0,0,0,.6);
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--body);
  background: var(--bg);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
::selection { background: var(--blue); color: #fff; }

/* ---------- Ambient layered background ---------- */
.ambient {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 600px at 8% -5%, var(--blue-soft), transparent 60%),
    radial-gradient(800px 560px at 100% 12%, var(--red-soft), transparent 62%),
    radial-gradient(700px 700px at 50% 110%, var(--blue-soft), transparent 60%);
}
.ambient::after {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(var(--line) 1px, transparent 1px);
  background-size: 26px 26px;
  opacity: .5;
  mask-image: radial-gradient(1200px 800px at 50% 0%, #000 0%, transparent 75%);
  -webkit-mask-image: radial-gradient(1200px 800px at 50% 0%, #000 0%, transparent 75%);
}

/* ---------- Typography ---------- */
.display { font-family: var(--display); font-weight: 400; letter-spacing: -.01em; }
h1, h2, h3, h4 { line-height: 1.12; letter-spacing: -.022em; font-weight: 700; }
.fr-serif { font-family: var(--display); font-weight: 500; }
.ipa { font-family: var(--mono); font-size: .82em; color: var(--ink-2); letter-spacing: 0; }
a { color: var(--blue); text-decoration: none; }
p { margin: 0 0 .9em; }
strong { font-weight: 650; }
em { font-style: italic; }
code { font-family: var(--mono); font-size: .85em; background: var(--bg-soft); border: 1px solid var(--line); padding: .1em .4em; border-radius: 6px; }
s { color: var(--red); }
hr.rule { border: 0; height: 1px; background: var(--line); margin: 3rem 0; }

/* Tricolore hairline */
.tricolore { display: inline-flex; gap: 0; height: 4px; border-radius: 99px; overflow: hidden; }
.tricolore i { width: 22px; height: 100%; }
.tricolore i:nth-child(1) { background: #0055a4; }
.tricolore i:nth-child(2) { background: #e8e8ec; }
.tricolore i:nth-child(3) { background: #ef4135; }
[data-theme="dark"] .tricolore i:nth-child(2) { background: #3a3a40; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .55em;
  font: 600 15px/1 var(--body); letter-spacing: -.01em;
  padding: 13px 22px; border-radius: 99px; border: 1px solid transparent;
  cursor: pointer; user-select: none;
  transition: transform .28s var(--spring), box-shadow .28s var(--ease), background .2s var(--ease), border-color .2s;
  will-change: transform;
}
.btn:active { transform: scale(.96); }
.btn-primary { background: var(--blue); color: #fff; box-shadow: var(--shadow-1); }
.btn-primary:hover { box-shadow: var(--shadow-2); transform: translateY(-1px); }
.btn-primary:active { transform: scale(.96); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--bg-soft); transform: translateY(-1px); }
.btn-sm { padding: 8px 15px; font-size: 13.5px; }

/* Speaker (TTS) buttons */
.say {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; flex: none;
  border-radius: 50%; border: 1px solid var(--line);
  background: var(--bg-soft); color: var(--ink-2);
  cursor: pointer; font-size: 13px; line-height: 1;
  transition: transform .25s var(--spring), background .2s, color .2s, border-color .2s;
  vertical-align: middle;
}
.say:hover { transform: scale(1.12); color: var(--blue); border-color: var(--blue); background: var(--blue-soft); }
.say:active { transform: scale(.92); }
.say.speaking { background: var(--blue); color: #fff; border-color: var(--blue); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(10,90,212,.35);} 50% { box-shadow: 0 0 0 7px rgba(10,90,212,0);} }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  background: var(--nav-bg);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: 1080px; margin: 0 auto; padding: 0 24px;
  height: 56px; display: flex; align-items: center; gap: 20px;
}
.wordmark { display: flex; align-items: center; gap: 10px; font: 650 17px/1 var(--body); letter-spacing: -.02em; color: var(--ink); }
.wordmark .wm-dot { width: 10px; height: 22px; border-radius: 3px; overflow: hidden; display: flex; flex-direction: column; }
.wordmark .wm-dot i { flex: 1; }
.wordmark .wm-dot i:nth-child(1){ background:#0055a4; } .wordmark .wm-dot i:nth-child(2){ background:#ececf0; } .wordmark .wm-dot i:nth-child(3){ background:#ef4135; }
.nav-links { display: flex; gap: 4px; margin-left: 8px; }
.nav-links a {
  font: 500 13.5px/1 var(--body); color: var(--ink-2); padding: 8px 12px; border-radius: 99px;
  transition: color .2s, background .2s;
}
.nav-links a:hover { color: var(--ink); background: var(--bg-soft); }
.nav-spacer { flex: 1; }
.nav-progress { font: 600 12.5px/1 var(--mono); color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
.nav-progress .bar { width: 64px; height: 4px; border-radius: 99px; background: var(--line); overflow: hidden; }
.nav-progress .bar i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, #0055a4, #4f8fe8 55%, #ef4135); border-radius: 99px; transition: width .8s var(--spring); }
.theme-btn {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line);
  background: transparent; color: var(--ink-2); cursor: pointer; font-size: 15px;
  transition: transform .3s var(--spring), background .2s, color .2s;
}
.theme-btn:hover { transform: rotate(24deg) scale(1.08); color: var(--ink); background: var(--bg-soft); }

/* ---------- Page frame ---------- */
.wrap { max-width: 860px; margin: 0 auto; padding: 0 24px; }
.wrap-wide { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

/* ---------- Scroll reveal ---------- */
html.js .rv { opacity: 0; transform: translateY(26px); transition: opacity .8s var(--ease), transform .8s var(--spring); transition-delay: var(--d, 0s); }
html.js .rv.on { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .rv { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
  * { animation-duration: .001s !important; }
}

/* ============================================================
   INDEX — opening
   ============================================================ */
.hero { padding: 84px 0 40px; position: relative; }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 40px; align-items: center; }
.kicker { display: inline-flex; align-items: center; gap: 10px; font: 600 12.5px/1 var(--body); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 22px; }
.hero h1.display {
  font-size: clamp(64px, 10vw, 118px); line-height: .98; letter-spacing: -.015em;
  font-weight: 400;
}
.hero h1 .accent { color: var(--blue); font-style: italic; }
.hero h1 .bang { color: var(--red); }
.hero-sub { margin-top: 26px; font-size: 19px; color: var(--ink-2); max-width: 46ch; line-height: 1.55; }
.hero-sub strong { color: var(--ink); }
.hero-cta { display: flex; gap: 12px; margin-top: 34px; flex-wrap: wrap; }
.hero-meta { display: flex; gap: 34px; margin-top: 46px; flex-wrap: wrap; }
.hero-meta .m b { display: block; font: 500 34px/1 var(--display); letter-spacing: -.01em; }
.hero-meta .m span { font: 500 12.5px/1.3 var(--body); color: var(--ink-2); letter-spacing: .06em; text-transform: uppercase; }

/* Tower stage */
.tower-stage { position: relative; display: flex; justify-content: center; min-height: 420px; }
.tower-svg { width: min(320px, 80%); color: var(--ink); overflow: visible; }
.tower-svg .draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 2.6s var(--ease) forwards; }
.tower-svg .draw.d2 { animation-delay: .5s; } .tower-svg .draw.d3 { animation-delay: 1s; } .tower-svg .draw.d4 { animation-delay: 1.5s; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.tower-beacon { animation: beacon 2.4s ease-in-out infinite; }
@keyframes beacon { 0%,100% { opacity: .25; } 50% { opacity: 1; } }
.chip-float {
  position: absolute; font: 500 14px/1 var(--display); font-style: italic;
  padding: 9px 15px; border-radius: 99px; background: var(--card); border: 1px solid var(--line);
  box-shadow: var(--shadow-1); color: var(--ink); white-space: nowrap;
  animation: floaty 7s ease-in-out infinite;
}
.chip-float small { display: block; font: 500 10.5px/1.3 var(--body); font-style: normal; color: var(--ink-3); letter-spacing: .04em; margin-top: 3px; }
.chip-float.c1 { top: 6%; left: 2%; animation-delay: 0s; }
.chip-float.c2 { top: 30%; right: 0%; animation-delay: 1.4s; }
.chip-float.c3 { bottom: 26%; left: 0%; animation-delay: 2.6s; }
.chip-float.c4 { bottom: 4%; right: 8%; animation-delay: 3.6s; }
@keyframes floaty { 0%,100% { transform: translateY(0) rotate(-1deg);} 50% { transform: translateY(-13px) rotate(1.2deg);} }

/* Phrase ticker */
.ticker { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); overflow: hidden; padding: 15px 0; margin-top: 34px;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.ticker-track { display: flex; gap: 44px; width: max-content; animation: tick 36s linear infinite; }
.ticker:hover .ticker-track { animation-play-state: paused; }
.ticker-track span { font: 500 17px/1 var(--display); font-style: italic; color: var(--ink-2); white-space: nowrap; display: flex; align-items: center; gap: 44px; }
.ticker-track span::after { content: "·"; color: var(--red); font-style: normal; }
@keyframes tick { to { transform: translateX(-50%); } }

/* ---------- Sections ---------- */
.section { padding: 88px 0 20px; }
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 38px; flex-wrap: wrap; }
.sec-head h2 { font-size: clamp(32px, 4.6vw, 46px); letter-spacing: -.025em; }
.sec-head .sec-no { font: 500 15px/1 var(--mono); color: var(--red); display: block; margin-bottom: 10px; letter-spacing: .1em; }
.sec-head p { color: var(--ink-2); max-width: 40ch; font-size: 16px; }

/* Module blocks */
.module { border-top: 1px solid var(--line-strong); padding: 44px 0 30px; }
.module-head { display: flex; gap: 22px; align-items: flex-start; margin-bottom: 26px; }
.module-no { font: 400 64px/0.9 var(--display); color: transparent; -webkit-text-stroke: 1.4px var(--ink-3); flex: none; }
.module-head h3 { font-size: 26px; letter-spacing: -.02em; }
.module-head .fr { font: 500 17px/1.4 var(--display); font-style: italic; color: var(--blue); }
.module-head p { color: var(--ink-2); font-size: 15.5px; margin-top: 6px; max-width: 60ch; }
.module-icon { margin-left: auto; flex: none; width: 52px; height: 52px; border-radius: 16px; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; }
.module:nth-of-type(even) .module-icon { background: var(--red-soft); color: var(--red); }

.lesson-row {
  display: grid; grid-template-columns: 52px 1fr auto auto; gap: 18px; align-items: center;
  padding: 16px 18px; border-radius: var(--r-md); border: 1px solid transparent;
  color: var(--ink);
  transition: transform .35s var(--spring), background .25s, border-color .25s, box-shadow .35s var(--ease);
}
.lesson-row:hover { background: var(--card); border-color: var(--line); box-shadow: var(--shadow-1); transform: translateX(6px); }
.lesson-row .no { font: 500 15px/1 var(--mono); color: var(--ink-3); }
.lesson-row .ti b { display: block; font-size: 16.5px; font-weight: 650; letter-spacing: -.01em; }
.lesson-row .ti span { font: 500 13.5px/1.4 var(--body); color: var(--ink-2); }
.lesson-row .tag { font: 600 11.5px/1 var(--body); letter-spacing: .05em; color: var(--blue-ink); background: var(--blue-soft); padding: 6px 11px; border-radius: 99px; white-space: nowrap; }
.lesson-row .arr { color: var(--ink-3); transition: transform .3s var(--spring), color .2s; font-size: 18px; }
.lesson-row:hover .arr { transform: translateX(4px); color: var(--blue); }
.lesson-row .done-mark { display: none; color: var(--green-ok); font-weight: 700; }
.lesson-row.is-done .done-mark { display: inline; }
.lesson-row.is-done .no { color: var(--green-ok); }

/* Method list */
.method { counter-reset: step; display: grid; gap: 0; }
.method li {
  list-style: none; counter-increment: step; display: grid; grid-template-columns: 64px 1fr; gap: 22px;
  padding: 26px 0; border-top: 1px solid var(--line); align-items: baseline;
}
.method li::before {
  content: counter(step, decimal-leading-zero);
  font: 400 40px/1 var(--display); color: transparent; -webkit-text-stroke: 1.2px var(--blue);
}
.method li b { display: block; font-size: 18px; letter-spacing: -.01em; margin-bottom: 4px; }
.method li p { color: var(--ink-2); font-size: 15.5px; margin: 0; }

/* Progress ring card */
.progress-card {
  display: flex; align-items: center; gap: 34px; padding: 34px 38px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-1);
  flex-wrap: wrap;
}
.ring { position: relative; width: 110px; height: 110px; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring .track { stroke: var(--line); }
.ring .fill { stroke: url(#ringGrad); stroke-linecap: round; transition: stroke-dashoffset 1s var(--spring); }
.ring .num { position: absolute; inset: 0; display: grid; place-items: center; font: 500 24px/1 var(--display); }
.progress-card .pc-txt h3 { font-size: 22px; margin-bottom: 6px; letter-spacing: -.02em; }
.progress-card .pc-txt p { color: var(--ink-2); font-size: 15px; margin: 0; }

/* Footer */
.footer { margin-top: 100px; border-top: 1px solid var(--line); padding: 44px 0 60px; color: var(--ink-2); font-size: 14px; }
.footer .fb { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; align-items: center; }
.footer .sign { font: 500 18px/1.3 var(--display); font-style: italic; color: var(--ink); }

/* ============================================================
   LESSON PAGES
   ============================================================ */
.lesson-hero { padding: 72px 0 30px; position: relative; }
.crumb { font: 600 12.5px/1 var(--body); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); display: flex; align-items: center; gap: 10px; margin-bottom: 26px; }
.crumb a { color: var(--ink-2); } .crumb a:hover { color: var(--blue); }
.lesson-hero .big-no {
  position: absolute; right: -10px; top: 26px; font: 400 clamp(120px, 22vw, 220px)/0.8 var(--display);
  color: transparent; -webkit-text-stroke: 1.5px var(--line-strong); user-select: none; pointer-events: none;
}
.lesson-hero h1 { font-size: clamp(38px, 6vw, 58px); letter-spacing: -.028em; max-width: 18ch; }
.lesson-hero .fr-title { font: 500 clamp(20px, 3vw, 26px)/1.35 var(--display); font-style: italic; color: var(--blue); margin-top: 12px; }
.lesson-hero .hero-actions { display: flex; gap: 12px; margin-top: 30px; align-items: center; flex-wrap: wrap; }
.complete-btn[aria-pressed="true"] { background: var(--green-ok); border-color: var(--green-ok); color: #fff; }

/* Section chips (on this page) */
.chips { position: sticky; top: 56px; z-index: 90; padding: 12px 0; margin: 0 -24px;
  backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px);
  background: var(--nav-bg); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.chips-inner { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.chips-inner::-webkit-scrollbar { display: none; }
.chip {
  flex: none; font: 600 13px/1 var(--body); color: var(--ink-2); padding: 8px 14px; border-radius: 99px;
  border: 1px solid var(--line); background: transparent; cursor: pointer; white-space: nowrap;
  transition: color .2s, background .2s, border-color .2s, transform .25s var(--spring);
}
.chip:hover { color: var(--ink); background: var(--bg-soft); transform: translateY(-1px); }
.chip.active { color: #fff; background: var(--ink); border-color: var(--ink); }
[data-theme="dark"] .chip.active { color: #000; background: #fff; border-color: #fff; }

/* Lesson sections */
.lsec { padding-top: 66px; scroll-margin-top: 130px; }
.lsec > h2 {
  font-size: clamp(26px, 3.6vw, 34px); letter-spacing: -.024em; margin-bottom: 26px;
  display: flex; align-items: center; gap: 14px;
}
.lsec > h2 .emo { font-size: .85em; }
.lsec h3 { font-size: 20px; letter-spacing: -.015em; margin: 34px 0 14px; }
.lsec h4 { font-size: 16.5px; margin: 24px 0 10px; }

/* Tables */
.tbl-wrap { border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: var(--card); box-shadow: var(--shadow-1); margin: 18px 0 26px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 520px; }
thead th {
  text-align: left; font: 650 12px/1.2 var(--body); letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink-2); padding: 13px 16px; background: var(--bg-soft); border-bottom: 1px solid var(--line);
}
tbody td { padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .18s; }
tbody tr:hover { background: var(--blue-soft); }
td.fr-cell { font-family: var(--display); font-weight: 500; font-size: 16.5px; white-space: nowrap; }
td.fr-cell .say { margin-left: 8px; }
.tbl-tools { display: flex; justify-content: flex-end; gap: 8px; margin: -8px 0 10px; }

/* Callouts */
.callout {
  border-radius: var(--r-md); padding: 18px 22px; margin: 20px 0 26px;
  background: var(--bg-soft); border: 1px solid var(--line); border-left: 4px solid var(--ink-3);
  font-size: 15.5px;
}
.callout .co-title { font-weight: 700; display: block; margin-bottom: 6px; letter-spacing: -.01em; }
.callout.tip { border-left-color: var(--blue); background: var(--blue-soft); }
.callout.warn { border-left-color: var(--red); background: var(--red-soft); }
.callout.culture { border-left-color: #0055a4; background: var(--card); position: relative; }
.callout.culture::before { content: ""; position: absolute; left: -4px; top: 14px; bottom: 14px; width: 4px; border-radius: 99px;
  background: linear-gradient(180deg, #0055a4 0 33%, #d8d8de 33% 66%, #ef4135 66% 100%); }
.callout p:last-child { margin-bottom: 0; }
.callout table { min-width: 0; }

/* Dialogue */
.scene-cap { font: 500 15px/1.5 var(--body); color: var(--ink-2); font-style: italic; margin: 6px 0 18px; padding-left: 14px; border-left: 3px solid var(--line-strong); }
.dialogue { display: grid; gap: 14px; margin: 8px 0 26px; }
.dline {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 15px 18px 13px; box-shadow: var(--shadow-1); max-width: 92%;
  transition: border-color .3s, box-shadow .3s, transform .3s var(--spring);
}
.dialogue.in .dline { animation: dlineIn .6s var(--spring) both; animation-delay: calc(var(--i, 0) * 90ms); }
@keyframes dlineIn { from { opacity: 0; transform: translateY(16px) scale(.98);} to { opacity: 1; transform: none;} }
.dline.current { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft), var(--shadow-1); transform: translateX(4px); }
.dline .sp { font: 700 11.5px/1 var(--body); letter-spacing: .1em; text-transform: uppercase; color: var(--red); display: inline-flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.dline:nth-child(even) .sp { color: var(--blue); }
.dline .fr { font: 500 18.5px/1.45 var(--display); margin: 0 0 5px; }
.dline .en { font-size: 14px; color: var(--ink-2); margin: 0; }
.dlg-controls { display: flex; gap: 10px; margin: 16px 0 6px; }

/* Exercises & answers */
.ex-block { margin: 14px 0 8px; }
.answers {
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--card); overflow: hidden; margin: 18px 0 26px;
}
.answers-toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 17px 22px; background: transparent; border: 0; cursor: pointer;
  font: 650 15.5px/1 var(--body); color: var(--ink); letter-spacing: -.01em;
  transition: background .2s;
}
.answers-toggle:hover { background: var(--bg-soft); }
.answers-toggle .chev { transition: transform .45s var(--spring); color: var(--ink-2); }
.answers.open .answers-toggle .chev { transform: rotate(180deg); }
.answers-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .55s var(--ease); }
.answers.open .answers-body { grid-template-rows: 1fr; }
.answers-body > div { overflow: hidden; }
.answers-body .pad { padding: 4px 22px 22px; border-top: 1px solid var(--line); }

/* Summary card */
.summary-card {
  border-radius: var(--r-xl); border: 1px solid var(--line); background: var(--card);
  box-shadow: var(--shadow-2); overflow: hidden; margin: 20px 0 30px;
}
.summary-card .sc-head { padding: 20px 26px 0; }
.summary-card .sc-head b { font: 500 24px/1.2 var(--display); }

/* Next lesson card */
.next-card {
  display: flex; align-items: center; gap: 22px; padding: 26px 30px; margin: 34px 0 10px;
  border-radius: var(--r-xl); border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow-1);
  color: var(--ink); transition: transform .35s var(--spring), box-shadow .35s var(--ease), border-color .25s;
}
.next-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); border-color: var(--blue); }
.next-card .nk { font: 700 11.5px/1 var(--body); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); display: block; margin-bottom: 6px; }
.next-card b { font-size: 19px; letter-spacing: -.015em; display: block; }
.next-card span.fr-n { font: 500 15px/1.4 var(--display); font-style: italic; color: var(--blue); }
.next-card .arr { margin-left: auto; font-size: 26px; color: var(--blue); transition: transform .35s var(--spring); }
.next-card:hover .arr { transform: translateX(6px); }

/* Prev/Next footer */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 60px 0 90px; }
.pager a {
  padding: 20px 22px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--card); color: var(--ink);
  transition: transform .3s var(--spring), box-shadow .3s var(--ease), border-color .2s;
}
.pager a:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--line-strong); }
.pager .pk { font: 700 11px/1 var(--body); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); display: block; margin-bottom: 6px; }
.pager b { font-size: 16px; letter-spacing: -.01em; }
.pager .next { text-align: right; }

/* Objectives checklist */
.obj-list { list-style: none; display: grid; gap: 10px; margin: 6px 0 10px; }
.obj-list li {
  display: flex; gap: 13px; align-items: flex-start; padding: 13px 16px;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--card); cursor: pointer;
  transition: transform .3s var(--spring), border-color .25s, background .25s;
  font-size: 15.5px;
}
.obj-list li:hover { transform: translateX(4px); border-color: var(--line-strong); }
.obj-list .box {
  flex: none; width: 22px; height: 22px; border-radius: 7px; border: 1.6px solid var(--line-strong);
  display: grid; place-items: center; font-size: 13px; color: transparent; margin-top: 1px;
  transition: background .25s var(--spring), border-color .25s, transform .3s var(--spring);
}
.obj-list li.done .box { background: var(--green-ok); border-color: var(--green-ok); color: #fff; transform: scale(1.05); }
.obj-list li.done { color: var(--ink-2); }

/* ---------- Flashcards ---------- */
.fc-overlay {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 24px;
  background: rgba(10, 10, 16, .45); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  opacity: 0; pointer-events: none; transition: opacity .35s var(--ease);
}
.fc-overlay.open { opacity: 1; pointer-events: auto; }
.fc-panel { width: min(560px, 100%); transform: translateY(30px) scale(.96); transition: transform .5s var(--spring); }
.fc-overlay.open .fc-panel { transform: none; }
.fc-top { display: flex; justify-content: space-between; align-items: center; color: #fff; margin-bottom: 16px; }
[data-theme="dark"] .fc-top { color: var(--ink); }
.fc-top b { font: 500 19px/1 var(--display); font-style: italic; }
.fc-top .fc-count { font: 600 13px/1 var(--mono); opacity: .8; }
.fc-close { background: rgba(255,255,255,.16); border: 0; color: #fff; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 15px; transition: transform .3s var(--spring), background .2s; }
[data-theme="dark"] .fc-close { color: var(--ink); }
.fc-close:hover { transform: scale(1.1) rotate(90deg); }
.fc-card-wrap { perspective: 1400px; height: 300px; cursor: pointer; }
.fc-card {
  position: relative; width: 100%; height: 100%; transform-style: preserve-3d;
  transition: transform .6s var(--spring);
}
.fc-card.flipped { transform: rotateY(180deg); }
.fc-face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: var(--r-xl); display: grid; place-items: center; text-align: center; padding: 30px;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-lift);
}
.fc-face.back { transform: rotateY(180deg); background: var(--blue); color: #fff; border-color: var(--blue); }
.fc-face .word { font: 500 clamp(30px, 6vw, 42px)/1.15 var(--display); }
.fc-face .hint { margin-top: 14px; font: 600 12px/1 var(--body); letter-spacing: .12em; text-transform: uppercase; opacity: .55; }
.fc-face .ipa-big { margin-top: 12px; font-family: var(--mono); font-size: 16px; opacity: .75; }
.fc-face .meta { margin-top: 10px; font-size: 14px; opacity: .8; }
.fc-nav { display: flex; gap: 10px; justify-content: center; margin-top: 20px; }
.fc-nav button {
  background: rgba(255,255,255,.16); color: #fff; border: 1px solid rgba(255,255,255,.25); border-radius: 99px;
  padding: 10px 20px; font: 600 14px/1 var(--body); cursor: pointer;
  transition: transform .25s var(--spring), background .2s;
}
[data-theme="dark"] .fc-nav button { color: var(--ink); background: var(--card); border-color: var(--line); }
.fc-nav button:hover { transform: translateY(-2px); }
.fc-nav button:active { transform: scale(.95); }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .hero-grid { grid-template-columns: 1fr; }
  .tower-stage { min-height: 340px; order: -1; }
  .lesson-hero .big-no { display: none; }
  .lesson-row { grid-template-columns: 40px 1fr auto; }
  .lesson-row .tag { display: none; }
  .pager { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .module-icon { display: none; }
}
