/* ==========================================================================
   Français Vivant — feuille de style
   Une esthétique papier, éditoriale, chaleureuse ; lisible et imprimable.
   ========================================================================== */

:root {
  --paper: #f6f0e4;
  --paper-deep: #eee3d1;
  --paper-light: #fbf7ee;
  --surface: #fffdf8;
  --surface-2: #faf5ea;
  --ink: #1d2a32;
  --ink-soft: #43515a;
  --muted: #5f6967;
  --muted-light: #6f7876;
  --line: #e5dac8;
  --line-strong: #d5c6ae;
  --terra: #c4553d;
  --terra-dark: #9f3a26;
  --terra-soft: #f6e3db;
  --teal: #28685e;
  --teal-dark: #1f5149;
  --teal-soft: #dfeee9;
  --gold: #d9a441;
  --gold-soft: #f6ead0;
  --blue: #2d4b73;
  --blue-soft: #e1e8f1;
  --danger: #b23a2e;
  --danger-soft: #f8e2de;
  --success: #24735d;
  --success-soft: #dff0e9;
  --shadow: 0 22px 60px rgba(63, 46, 30, 0.12);
  --shadow-sm: 0 10px 28px rgba(63, 46, 30, 0.08);
  --radius: 24px;
  --radius-sm: 15px;
  --radius-xs: 9px;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --max-width: 1180px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
}

body {
  margin: 0;
  min-width: 320px;
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 7% -2%, rgba(217, 164, 65, 0.13), transparent 32rem),
    radial-gradient(circle at 96% 3%, rgba(196, 85, 61, 0.09), transparent 34rem),
    radial-gradient(circle at 50% 100%, rgba(40, 104, 94, 0.06), transparent 40rem);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.62;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--terra); color: #fff; }

h1, h2, h3, h4, p, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
strong { font-weight: 650; }

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.shell {
  width: min(calc(100% - 48px), var(--max-width));
  margin-inline: auto;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 1.15em;
  height: 1.15em;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 200;
  padding: 12px 18px;
  border-radius: 0 0 12px 12px;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  transition: top 180ms ease;
}
.skip-link:focus { top: 0; }

/* --------------------------------------------------------------------------
   Typographie et éléments communs
   -------------------------------------------------------------------------- */

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
  color: var(--terra-dark);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.16em;
  line-height: 1.35;
  text-transform: uppercase;
}

.eyebrow-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--terra);
  box-shadow: 0 0 0 4px rgba(196, 85, 61, 0.12);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  line-height: 1.35;
  text-transform: uppercase;
}

.micro-note {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.55;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  padding: 11px 20px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  transition: transform 180ms var(--ease), background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--terra);
  color: #fff;
  box-shadow: 0 8px 20px rgba(196, 85, 61, 0.22);
}
.btn-primary:hover { background: var(--terra-dark); box-shadow: 0 12px 26px rgba(196, 85, 61, 0.28); }

.btn-dark { background: var(--ink); color: var(--paper); }
.btn-dark:hover { background: #091219; }

.btn-soft {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}
.btn-soft:hover { border-color: var(--line-strong); background: var(--surface-2); }

.btn-ghost {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--ink);
}
.btn-ghost:hover { background: rgba(255, 253, 248, 0.6); }

.btn-small { min-height: 38px; padding: 8px 14px; font-size: 0.78rem; }
.btn-block { width: 100%; }

.btn.is-playing,
.audio-pill.is-playing {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.text-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.4;
  text-decoration: none;
  transition: color 160ms ease, border-color 160ms ease;
}
.text-btn:hover { color: var(--terra-dark); border-color: var(--terra); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--line-strong); transform: translateY(-1px); }

.is-hidden { display: none !important; }

/* --------------------------------------------------------------------------
   En-tête
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  border-bottom: 1px solid transparent;
  background: rgba(246, 240, 228, 0.88);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}
.site-header.is-scrolled {
  border-bottom-color: var(--line);
  box-shadow: 0 14px 30px rgba(58, 44, 29, 0.05);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 28px;
  min-height: 78px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  flex: 0 0 auto;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-style: italic;
  line-height: 1;
  box-shadow: 0 6px 14px rgba(29, 42, 50, 0.18);
}
.brand-dot {
  position: absolute;
  right: 7px;
  bottom: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
}

.brand-text { display: grid; line-height: 1.08; }
.brand-text strong { font-family: var(--font-serif); font-size: 1.06rem; font-weight: 600; letter-spacing: -0.015em; }
.brand-text small { margin-top: 3px; color: var(--muted); font-size: 0.58rem; font-weight: 700; letter-spacing: 0.15em; text-transform: uppercase; }

.header-nav { display: flex; align-items: center; gap: 22px; margin-left: auto; }
.header-nav > a {
  color: var(--ink-soft);
  font-size: 0.79rem;
  font-weight: 700;
  text-decoration: none;
}
.header-nav > a:hover { color: var(--terra-dark); }

.teacher-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.65);
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 700;
  transition: background 160ms ease, border-color 160ms ease;
}
.teacher-link:hover { background: var(--surface); border-color: var(--line-strong); }

.header-progress { width: 158px; flex: 0 0 auto; }
.progress-copy { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.progress-copy span { color: var(--muted); font-size: 0.62rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.progress-copy strong { font-size: 0.72rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.progress-track {
  display: block;
  width: 100%;
  height: 5px;
  border: 0;
  border-radius: 999px;
  background: rgba(29, 42, 50, 0.1);
  overflow: hidden;
  -webkit-appearance: none;
  appearance: none;
}
.progress-track::-webkit-progress-bar { background: rgba(29, 42, 50, 0.1); border-radius: 999px; }
.progress-track::-webkit-progress-value { background: linear-gradient(90deg, var(--terra), var(--gold)); border-radius: 999px; transition: width 500ms var(--ease); }
.progress-track::-moz-progress-bar { background: linear-gradient(90deg, var(--terra), var(--gold)); border-radius: 999px; }

/* --------------------------------------------------------------------------
   Héros
   -------------------------------------------------------------------------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr);
  gap: clamp(30px, 6vw, 78px);
  align-items: center;
  padding-top: clamp(56px, 8vw, 94px);
  padding-bottom: clamp(42px, 6vw, 74px);
}

.hero-copy h1 {
  max-width: 12ch;
  margin-bottom: 22px;
  font-family: var(--font-serif);
  font-size: clamp(3.2rem, 6.2vw, 5.6rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 0.92;
}
.hero-copy h1 em { color: var(--terra); font-weight: 500; }

.lede {
  max-width: 57ch;
  color: var(--ink-soft);
  font-size: clamp(1rem, 1.2vw, 1.12rem);
  line-height: 1.7;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.objectives {
  display: grid;
  gap: 9px;
  margin-top: 34px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.objectives li {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 9px;
  align-items: baseline;
  color: var(--ink-soft);
  font-size: 0.87rem;
  line-height: 1.5;
}
.objectives li span {
  color: var(--terra);
  font-family: var(--font-serif);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}
.objective-text { min-width: 0; }
.objectives strong { color: var(--ink); }

.hero-art {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 500px;
  isolation: isolate;
}

.art-halo {
  position: absolute;
  width: min(440px, 94%);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(217, 164, 65, 0.22), rgba(217, 164, 65, 0) 68%);
  z-index: -1;
}
.art-halo::after {
  content: "";
  position: absolute;
  inset: 12%;
  border: 1px dashed rgba(196, 85, 61, 0.25);
  border-radius: inherit;
}

.id-card {
  position: relative;
  width: min(350px, 100%);
  padding: 17px 20px 21px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transform: rotate(-2.2deg);
}
.id-card::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(29, 42, 50, 0.06);
  border-radius: 21px;
  pointer-events: none;
}

.id-card-top {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 750;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.id-portrait {
  width: 174px;
  height: 174px;
  margin: 16px auto 10px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--paper-deep);
  box-shadow: inset 0 0 0 1px rgba(29, 42, 50, 0.08);
}
.id-portrait .avatar-svg { width: 100%; height: 100%; }

.id-name { text-align: center; }
.id-name h2 { font-family: var(--font-serif); font-size: 2rem; font-weight: 500; letter-spacing: -0.03em; line-height: 1.1; }
.id-name p { margin-top: 2px; color: var(--muted); font-size: 0.8rem; }

.id-tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; margin: 13px 0 16px; }
.id-tags span {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--paper-light);
  color: var(--ink-soft);
  font-size: 0.65rem;
  font-weight: 650;
}

.audio-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 750;
  transition: background 160ms ease, color 160ms ease;
}
.audio-pill:hover { background: var(--ink); color: var(--paper); }

.id-stamp {
  position: absolute;
  right: 18px;
  bottom: 16px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(196, 85, 61, 0.4);
  border-radius: 50%;
  color: var(--terra);
  font-family: var(--font-serif);
  font-size: 0.68rem;
  font-style: italic;
  transform: rotate(12deg);
}

.float-chip {
  position: absolute;
  z-index: 2;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 700;
  animation: floaty 5s ease-in-out infinite;
}
.chip-1 { top: 3%; left: -7%; transform: rotate(-4deg); }
.chip-2 { top: 32%; right: 0; animation-delay: -1.6s; transform: rotate(3deg); }
.chip-3 { bottom: 1%; left: 2%; animation-delay: -3.1s; transform: rotate(2deg); }

.art-note {
  position: absolute;
  bottom: -22px;
  right: 4%;
  max-width: 190px;
  color: var(--muted-light);
  font-size: 0.61rem;
  line-height: 1.45;
  text-align: right;
}

@keyframes floaty {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -7px; }
}

/* --------------------------------------------------------------------------
   Bandeau parcours
   -------------------------------------------------------------------------- */

.route-strip {
  scroll-margin-top: 96px;
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 54px;
  padding: 15px 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.65);
  box-shadow: var(--shadow-sm);
}
.route-step { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; color: inherit; text-decoration: none; }
.route-step:hover strong { color: var(--terra-dark); }
.route-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--paper-deep);
  color: var(--terra-dark);
  font-size: 0.7rem;
}
.route-step strong { display: block; font-size: 0.7rem; letter-spacing: 0.02em; }
.route-step small { display: block; color: var(--muted); font-size: 0.61rem; line-height: 1.3; }
.route-line { flex: 1 1 auto; height: 1px; border-top: 1px dashed var(--line-strong); }

/* --------------------------------------------------------------------------
   Mise en page leçon
   -------------------------------------------------------------------------- */

.lesson-layout {
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
  gap: clamp(30px, 4.5vw, 62px);
  align-items: start;
  padding-bottom: 70px;
}

.sidebar { position: sticky; top: 104px; }
.sidebar-inner { border-top: 2px solid var(--ink); padding-top: 17px; }
.sidebar-head { display: flex; justify-content: space-between; gap: 12px; align-items: end; margin-bottom: 12px; }
.sidebar-head .eyebrow { margin-bottom: 0; }
.sidebar-score { text-align: right; }
.sidebar-score strong { display: block; font-family: var(--font-serif); font-size: 1.2rem; font-weight: 500; font-variant-numeric: tabular-nums; line-height: 1.1; }
.sidebar-score span { color: var(--muted); font-size: 0.58rem; letter-spacing: 0.08em; text-transform: uppercase; }

.step-list { display: grid; }
.step-list li { border-bottom: 1px solid var(--line); }
.step-list a {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 16px;
  gap: 7px;
  align-items: center;
  padding: 10px 6px 10px 0;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color 160ms ease, padding 160ms ease;
}
.step-list a:hover { color: var(--terra-dark); padding-left: 4px; }
.step-num { color: var(--muted-light); font-family: var(--font-serif); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.step-label { display: grid; line-height: 1.2; }
.step-label { font-size: 0.79rem; font-weight: 700; }
.step-label small { margin-top: 2px; color: var(--muted); font-size: 0.61rem; font-weight: 500; }
.step-state {
  width: 12px;
  height: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  transition: background 160ms ease, border-color 160ms ease;
}
.step-list li.is-current a { color: var(--terra-dark); }
.step-list li.is-current .step-num { color: var(--terra); }
.step-list li.is-done .step-state { border-color: var(--teal); background: var(--teal); box-shadow: inset 0 0 0 2px var(--surface); }
.step-list li.is-partial .step-state { border-color: var(--gold); background: linear-gradient(90deg, var(--gold) 50%, transparent 50%); }

.sidebar-tip {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  padding: 14px;
  border-radius: var(--radius-xs);
  background: var(--teal-soft);
  color: var(--teal-dark);
}
.sidebar-tip .icon { margin-top: 2px; }
.sidebar-tip p { font-size: 0.72rem; line-height: 1.55; }
.sidebar-tip strong { display: block; margin-bottom: 2px; font-size: 0.65rem; letter-spacing: 0.08em; text-transform: uppercase; }

.reset-link {
  margin-top: 16px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: var(--muted-light);
  font-size: 0.62rem;
}
.reset-link:hover { color: var(--terra-dark); border-color: var(--terra); }

/* --------------------------------------------------------------------------
   Sections
   -------------------------------------------------------------------------- */

.lesson-content { min-width: 0; }
.lesson-section { padding-bottom: clamp(58px, 7vw, 92px); scroll-margin-top: 96px; }
.lesson-section:last-child { padding-bottom: 10px; }

.section-heading {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line-strong);
}
.section-no {
  color: var(--terra);
  font-family: var(--font-serif);
  font-size: 2.5rem;
  font-style: italic;
  font-weight: 400;
  line-height: 0.95;
}
.section-heading h2 {
  margin-bottom: 9px;
  font-family: var(--font-serif);
  font-size: clamp(1.8rem, 3.2vw, 2.65rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.05;
}
.section-heading p:last-child { max-width: 72ch; color: var(--ink-soft); font-size: 0.92rem; line-height: 1.68; }
.section-heading .eyebrow { margin-bottom: 7px; }

/* --------------------------------------------------------------------------
   Cartes d'écoute
   -------------------------------------------------------------------------- */

.listening-card {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.listening-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 22px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(160deg, rgba(217, 164, 65, 0.13), transparent 55%),
    var(--paper-light);
}
.portrait-large {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--paper-deep);
  box-shadow: 0 0 0 8px rgba(255, 253, 248, 0.72), 0 16px 36px rgba(63, 46, 30, 0.13);
}
.portrait-large .avatar-svg { width: 100%; height: 100%; }
.portrait-caption { display: grid; margin: 17px 0 18px; text-align: center; }
.portrait-caption strong { font-family: var(--font-serif); font-size: 1.15rem; font-weight: 500; }
.portrait-caption span { color: var(--muted); font-size: 0.67rem; }
.listening-side .micro-note { margin-top: 12px; text-align: center; }

.transcript-card { min-width: 0; padding: 25px 28px 18px; }
.transcript-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 12px; }
.transcript-head .tag { margin-bottom: 6px; }
.transcript-head h3 { font-family: var(--font-serif); font-size: 1.28rem; font-weight: 500; line-height: 1.2; }

.transcript { display: grid; }
.transcript-line {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  padding: 9px 7px;
  border-radius: 10px;
  transition: background 160ms ease;
  cursor: pointer;
}
.transcript-line:hover { background: var(--surface-2); }
.transcript-line.is-current { background: var(--terra-soft); }
.line-audio,
.story-line-audio {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-soft);
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}
.line-audio:hover,
.story-line-audio:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.line-audio.is-playing,
.story-line-audio.is-playing { background: var(--teal); border-color: var(--teal); color: #fff; animation: pulse 1.4s ease-in-out infinite; }
.line-audio .icon,
.story-line-audio .icon { width: 15px; height: 15px; }
.line-copy { min-width: 0; }
.line-fr { font-size: 0.94rem; font-weight: 560; line-height: 1.45; }
.line-note { margin-top: 2px; color: var(--muted); font-size: 0.68rem; line-height: 1.45; }
.line-en { margin-top: 3px; color: var(--teal-dark); font-size: 0.72rem; font-style: italic; line-height: 1.45; }
.transcript-foot { display: flex; justify-content: space-between; gap: 14px; align-items: center; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.voice-status { color: var(--muted); font-size: 0.66rem; }

.notice {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  margin-top: 18px;
  padding: 14px 17px;
  border: 1px solid var(--teal-soft);
  border-left: 3px solid var(--teal);
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  background: rgba(223, 238, 233, 0.52);
  color: var(--teal-dark);
}
.notice .icon { margin-top: 3px; }
.notice p { font-size: 0.78rem; line-height: 1.55; }
.notice-amber { border-color: var(--gold-soft); border-left-color: var(--gold); background: rgba(246, 234, 208, 0.55); color: #76551d; }
.notice-soft { background: var(--surface-2); border-color: var(--line); border-left-color: var(--line-strong); color: var(--ink-soft); }

.section-complete { display: flex; justify-content: flex-end; margin-top: 22px; }
.complete-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.75rem;
  font-weight: 700;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}
.complete-btn:hover { border-color: var(--teal); color: var(--teal-dark); }
.complete-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--paper-deep);
  color: var(--muted);
}
.complete-btn.is-done { border-color: var(--teal); background: var(--teal-soft); color: var(--teal-dark); }
.complete-btn.is-done .complete-icon { background: var(--teal); color: #fff; }

/* --------------------------------------------------------------------------
   Vocabulaire
   -------------------------------------------------------------------------- */

.filter-row { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 18px; }
.filter-chip {
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 700;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}
.filter-chip:hover { border-color: var(--line-strong); background: var(--surface); }
.filter-chip.is-active { border-color: var(--ink); background: var(--ink); color: var(--paper); }

.vocab-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.vocab-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 16px 16px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: 0 2px 0 rgba(29, 42, 50, 0.02);
  transition: transform 180ms var(--ease), box-shadow 180ms ease, border-color 180ms ease;
  cursor: pointer;
}
.vocab-card:hover { transform: translateY(-3px); border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.vocab-card.is-filtered { display: none; }
.vocab-top { display: flex; justify-content: space-between; align-items: start; gap: 8px; }
.vocab-icon { font-size: 1.55rem; line-height: 1; }
.mini-audio {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink-soft);
  transition: background 160ms ease, color 160ms ease;
}
.mini-audio:hover { background: var(--ink); color: var(--paper); }
.mini-audio.is-playing { background: var(--teal); border-color: var(--teal); color: #fff; }
.mini-audio .icon { width: 14px; height: 14px; }
.vocab-word { margin-top: 13px; font-family: var(--font-serif); font-size: 1.16rem; font-weight: 500; line-height: 1.15; }
.vocab-article { color: var(--muted); font-family: var(--font-sans); font-size: 0.65rem; font-weight: 600; letter-spacing: 0.03em; }
.vocab-en { margin-top: 2px; color: var(--terra-dark); font-size: 0.68rem; font-weight: 650; line-height: 1.35; }
.vocab-example { margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 0.75rem; font-style: italic; line-height: 1.5; }
.vocab-note { margin-top: 7px; color: var(--muted); font-size: 0.66rem; line-height: 1.45; }

.grammar-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 24px; }
.grammar-card { padding: 21px 22px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.grammar-card-head { margin-bottom: 12px; }
.grammar-kicker { color: var(--terra-dark); font-size: 0.61rem; font-weight: 750; letter-spacing: 0.12em; text-transform: uppercase; }
.grammar-card h3 { margin-top: 2px; font-family: var(--font-serif); font-size: 1.24rem; font-weight: 500; }
.mini-table { display: grid; gap: 6px; }
.mini-table li { display: flex; justify-content: space-between; gap: 14px; padding-bottom: 5px; border-bottom: 1px dotted var(--line-strong); font-size: 0.76rem; }
.mini-table li:last-child { border-bottom: 0; padding-bottom: 0; }
.mini-table span { font-weight: 650; }
.mini-table em { color: var(--muted); font-size: 0.65rem; font-style: normal; text-align: right; }

/* --------------------------------------------------------------------------
   Quiz
   -------------------------------------------------------------------------- */

.quiz-card {
  padding: clamp(20px, 3vw, 30px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.quiz-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding-bottom: 17px; border-bottom: 1px solid var(--line); }
.quiz-head .tag { margin-bottom: 6px; }
.quiz-head h3 { font-family: var(--font-serif); font-size: 1.45rem; font-weight: 500; line-height: 1.15; }
.score-badge { display: grid; justify-items: end; flex: 0 0 auto; }
.score-badge strong { font-family: var(--font-serif); font-size: 1.5rem; font-weight: 500; font-variant-numeric: tabular-nums; line-height: 1; }
.score-badge span { margin-top: 3px; color: var(--muted); font-size: 0.58rem; letter-spacing: 0.06em; text-transform: uppercase; }
.score-badge-small strong { font-size: 1.2rem; }

.quiz-item { padding: 18px 0; border-bottom: 1px solid var(--line); }
.quiz-item:last-child { border-bottom: 0; padding-bottom: 4px; }
.quiz-question { display: flex; gap: 10px; align-items: baseline; font-size: 0.9rem; font-weight: 650; line-height: 1.45; }
.quiz-number { color: var(--terra); font-family: var(--font-serif); font-size: 0.72rem; font-variant-numeric: tabular-nums; }
.quiz-options { display: grid; gap: 6px; margin-top: 9px; padding-left: 26px; }
.quiz-option {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 0.77rem;
  text-align: left;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}
.quiz-option:hover:not(:disabled) { border-color: var(--line-strong); background: var(--surface); }
.quiz-option:disabled { cursor: default; opacity: 1; }
.option-letter {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--muted);
  font-size: 0.59rem;
  font-weight: 700;
}
.quiz-option.is-correct { border-color: var(--success); background: var(--success-soft); color: var(--success); }
.quiz-option.is-correct .option-letter { border-color: var(--success); background: var(--success); color: #fff; }
.quiz-option.is-wrong { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.quiz-option.is-wrong .option-letter { border-color: var(--danger); background: var(--danger); color: #fff; }
.quiz-explain {
  margin-top: 9px;
  margin-left: 26px;
  padding: 8px 11px;
  border-radius: 7px;
  background: var(--gold-soft);
  color: #6d531e;
  font-size: 0.7rem;
  line-height: 1.5;
}
.quiz-actions { display: flex; justify-content: flex-end; margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--line); }

/* --------------------------------------------------------------------------
   Onglets et exercices
   -------------------------------------------------------------------------- */

.tabs { margin-top: 6px; }
.tab-list { display: flex; gap: 3px; margin-bottom: 22px; border-bottom: 1px solid var(--line-strong); overflow-x: auto; scrollbar-width: none; }
.tab-list::-webkit-scrollbar { display: none; }
.tab-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  padding: 11px 14px 13px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
  transition: color 160ms ease, border-color 160ms ease;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.is-active { color: var(--terra-dark); border-bottom-color: var(--terra); }
.tab-btn .icon { width: 16px; height: 16px; }
.tab-letter {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid currentColor;
  border-radius: 4px;
  font-family: var(--font-serif);
  font-size: 0.65rem;
}

.tab-panel { animation: panel-in 260ms var(--ease); }
@keyframes panel-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.exercise-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 16px; }
.exercise-head .eyebrow { margin-bottom: 5px; }
.exercise-head h3 { font-family: var(--font-serif); font-size: 1.55rem; font-weight: 500; line-height: 1.15; }
.exercise-intro { max-width: 64ch; margin-top: 6px; color: var(--ink-soft); font-size: 0.8rem; line-height: 1.6; }

.word-bank-wrap { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; padding: 13px 15px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); background: rgba(250, 245, 234, 0.65); }
.word-bank-label { flex: 0 0 auto; padding-top: 5px; color: var(--muted); font-size: 0.61rem; font-weight: 750; letter-spacing: 0.08em; text-transform: uppercase; }
.word-bank { display: flex; flex-wrap: wrap; gap: 6px; }
.word-chip {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 650;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}
.word-chip:hover { border-color: var(--terra); color: var(--terra-dark); background: var(--terra-soft); }
.word-chip.is-used { opacity: 0.55; }

.fill-list { display: grid; }
.fill-item { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 14px 4px; border-bottom: 1px solid var(--line); }
.fill-item:last-child { border-bottom: 0; }
.fill-copy { min-width: 0; }
.fill-sentence { font-size: 0.96rem; line-height: 2.55; }
.fill-input {
  display: inline-block;
  min-width: 4.5ch;
  margin: 0 3px;
  padding: 3px 7px;
  border: 0;
  border-bottom: 2px solid var(--line-strong);
  border-radius: 5px 5px 0 0;
  background: rgba(246, 227, 219, 0.35);
  color: var(--terra-dark);
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
  transition: background 150ms ease, border-color 150ms ease;
}
.fill-input:focus { outline: 0; border-bottom-color: var(--terra); background: var(--surface); }
.fill-input.is-correct { border-bottom-color: var(--success); background: var(--success-soft); color: var(--success); }
.fill-input.is-almost { border-bottom-color: var(--gold); background: var(--gold-soft); color: #7d5c1b; }
.fill-input.is-wrong { border-bottom-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.fill-input.is-revealed { border-bottom-color: var(--blue); background: var(--blue-soft); color: var(--blue); }
.fill-hint { margin-top: 3px; color: var(--teal-dark); font-size: 0.69rem; line-height: 1.45; }
.hint-btn {
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 700;
  white-space: nowrap;
}
.hint-btn:hover { color: var(--teal-dark); border-color: var(--teal); }

.exercise-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 18px; }
.feedback { margin-top: 14px; padding: 12px 15px; border-radius: 9px; background: var(--surface-2); color: var(--ink-soft); font-size: 0.78rem; line-height: 1.55; }
.feedback:empty { display: none; }
.feedback-success { color: var(--success); font-weight: 650; }
.feedback-note { margin-top: 6px; color: var(--terra-dark); }

/* Associations */
.match-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 10px;
  align-items: start;
  overflow-x: auto;
  padding-bottom: 4px;
}
.match-board-two { grid-template-columns: repeat(2, minmax(180px, 1fr)); }
.match-column { min-width: 0; }
.match-column h4 { margin-bottom: 7px; color: var(--muted); font-size: 0.62rem; font-weight: 750; letter-spacing: 0.1em; text-transform: uppercase; }
.match-items { display: grid; gap: 6px; }
.match-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 52px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.76rem;
  line-height: 1.3;
  text-align: left;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}
.match-card:hover:not(:disabled) { border-color: var(--line-strong); transform: translateY(-1px); }
.match-card.is-selected { border-color: var(--terra); background: var(--terra-soft); color: var(--terra-dark); box-shadow: 0 0 0 2px rgba(196, 85, 61, 0.13); }
.match-card.is-matched { border-color: var(--teal); background: var(--teal-soft); color: var(--teal-dark); cursor: default; }
.match-card.is-matched::after {
  content: "✓";
  position: absolute;
  top: 6px;
  right: 7px;
  color: var(--teal);
  font-size: 0.7rem;
  font-weight: 800;
}
.match-card.is-wrong { border-color: var(--danger); background: var(--danger-soft); animation: shake 380ms ease; }
.match-avatar { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 50%; overflow: hidden; }
.match-avatar .avatar-svg { width: 100%; height: 100%; }
.match-label { font-weight: 650; }
.match-sub { display: block; margin-top: 1px; color: var(--muted); font-size: 0.62rem; }
.match-footer { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-top: 14px; }
.match-status { color: var(--muted); font-size: 0.72rem; }
.match-actions { display: flex; gap: 7px; flex: 0 0 auto; }
.soft-rule { margin: 26px 0; border: 0; border-top: 1px solid var(--line); }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(40, 104, 94, 0.2); }
  50% { box-shadow: 0 0 0 5px rgba(40, 104, 94, 0); }
}

/* Mots croisés */
.crossword-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, 0.68fr); gap: 22px; align-items: start; }
.crossword-scroll { overflow-x: auto; padding: 4px 2px 10px; }
.crossword-grid {
  display: grid;
  grid-template-columns: repeat(10, 42px);
  grid-auto-rows: 42px;
  gap: 3px;
  width: max-content;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper-deep);
}
.crossword-cell { position: relative; border-radius: 4px; background: var(--surface); box-shadow: inset 0 0 0 1px rgba(29, 42, 50, 0.08); }
.crossword-cell.is-empty { background: transparent; box-shadow: none; }
.crossword-cell.is-active { background: var(--gold-soft); box-shadow: inset 0 0 0 1px rgba(217, 164, 65, 0.55); }
.crossword-cell input {
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 750;
  text-align: center;
  text-transform: uppercase;
  caret-color: var(--terra);
}
.crossword-cell input:focus { outline: 0; background: rgba(255, 253, 248, 0.7); }
.crossword-cell input.is-correct { color: var(--success); background: var(--success-soft); }
.crossword-cell input.is-wrong { color: var(--danger); background: var(--danger-soft); }
.crossword-cell input.is-revealed { color: var(--blue); background: var(--blue-soft); }
.crossword-number { position: absolute; top: 1px; left: 3px; z-index: 2; color: var(--muted); font-size: 0.48rem; font-weight: 700; line-height: 1; pointer-events: none; }
.crossword-clues { display: grid; gap: 18px; }
.clue-group h4 { margin-bottom: 7px; color: var(--terra-dark); font-size: 0.62rem; font-weight: 750; letter-spacing: 0.12em; text-transform: uppercase; }
.clue-group ul { display: grid; gap: 2px; }
.clue-btn {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 5px;
  width: 100%;
  padding: 6px 7px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.7rem;
  line-height: 1.4;
  text-align: left;
}
.clue-btn:hover { background: var(--surface-2); }
.clue-btn.is-active { background: var(--gold-soft); color: var(--ink); }
.clue-number { color: var(--terra); font-weight: 750; }

/* --------------------------------------------------------------------------
   Histoire
   -------------------------------------------------------------------------- */

.story-card {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.story-visual { position: relative; min-height: 440px; overflow: hidden; background: #efd6bc; }
.cafe-scene { position: absolute; inset: 0; background: linear-gradient(160deg, #f3ddc4 0%, #ecd0b3 55%, #ddb894 100%); }
.cafe-scene::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(120, 80, 48, 0.07) 1px, transparent 1px);
  background-size: 100% 38px;
  opacity: 0.6;
}
.cafe-window {
  position: absolute;
  top: 10%;
  left: 7%;
  width: 36%;
  height: 34%;
  border: 7px solid #fbf0df;
  border-radius: 4px;
  background: linear-gradient(170deg, #b9dce2, #8bbfc9 65%, #79aebb);
  box-shadow: 0 14px 30px rgba(70, 48, 30, 0.12);
}
.cafe-window::before,
.cafe-window::after { content: ""; position: absolute; background: #fbf0df; }
.cafe-window::before { top: 0; bottom: 0; left: 50%; width: 4px; transform: translateX(-50%); }
.cafe-window::after { left: 0; right: 0; top: 52%; height: 4px; }
.cafe-window span { position: absolute; bottom: 0; width: 38%; height: 35%; background: rgba(89, 146, 120, 0.55); border-radius: 40% 40% 0 0; }
.cafe-window span:first-child { left: 4%; }
.cafe-window span:last-child { right: 2%; height: 26%; background: rgba(75, 127, 105, 0.45); }
.cafe-shelf { position: absolute; top: 14%; right: 6%; display: flex; align-items: flex-end; gap: 4px; width: 25%; height: 8px; padding-bottom: 0; background: #8f5a3f; border-radius: 1px; }
.cafe-shelf i { display: block; width: 12%; height: 32px; background: #c4553d; border-radius: 2px 2px 0 0; transform: translateY(-100%); }
.cafe-shelf i:nth-child(2) { height: 26px; background: #d9a441; width: 9%; }
.cafe-shelf i:nth-child(3) { height: 36px; background: #28685e; width: 11%; }
.cafe-shelf i:nth-child(4) { height: 28px; background: #2d4b73; width: 8%; }
.cafe-plant { position: absolute; right: 4%; bottom: 15%; width: 16%; height: 26%; }
.cafe-plant::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 26%;
  width: 48%;
  height: 36%;
  border-radius: 4px 4px 10px 10px;
  background: #b6654a;
}
.cafe-plant span { position: absolute; bottom: 28%; left: 48%; width: 42%; height: 55%; border-radius: 60% 10% 60% 10%; background: #4c7d5e; transform-origin: bottom left; }
.cafe-plant span:first-child { transform: rotate(-32deg); left: 18%; }
.cafe-plant span:nth-child(2) { transform: rotate(9deg); height: 66%; background: #5d8e6c; }
.cafe-plant span:nth-child(3) { transform: rotate(42deg); left: 36%; height: 42%; background: #3e6c52; }
.cafe-table {
  position: absolute;
  left: 9%;
  right: 9%;
  bottom: -46px;
  height: 150px;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 18%, #c68b63, #a76d4c 68%);
  box-shadow: 0 -7px 0 rgba(255, 255, 255, 0.18) inset, 0 18px 40px rgba(85, 55, 35, 0.18);
  z-index: 1;
}
.cafe-cup { position: absolute; bottom: 105px; width: 30px; height: 20px; border-radius: 0 0 12px 12px; background: #fbf4e7; box-shadow: 0 5px 0 rgba(0, 0, 0, 0.06); z-index: 2; }
.cafe-cup::after { content: ""; position: absolute; right: -7px; top: 4px; width: 11px; height: 10px; border: 2px solid #fbf4e7; border-left: 0; border-radius: 0 8px 8px 0; }
.cup-a { left: 19%; }
.cup-b { left: 48%; bottom: 112px; }
.cup-c { right: 22%; }
.cafe-sign { position: absolute; top: 6%; left: 50%; transform: translateX(-50%); color: rgba(73, 47, 30, 0.58); font-family: var(--font-serif); font-size: 0.62rem; letter-spacing: 0.28em; }
.story-characters { position: absolute; left: 4%; right: 4%; bottom: 84px; z-index: 3; display: flex; justify-content: space-between; align-items: flex-end; gap: 4px; }
.story-person { display: grid; justify-items: center; gap: 4px; opacity: 0.5; transform: translateY(6px); transition: opacity 200ms ease, transform 320ms var(--ease); }
.story-person span { padding: 2px 6px; border-radius: 999px; background: rgba(255, 253, 248, 0.8); color: var(--ink-soft); font-size: 0.56rem; font-weight: 700; }
.story-person-avatar { width: 76px; height: 76px; border: 3px solid rgba(255, 253, 248, 0.92); border-radius: 50%; overflow: hidden; box-shadow: 0 8px 18px rgba(77, 49, 30, 0.18); }
.story-person-avatar .avatar-svg { width: 100%; height: 100%; }
.story-person.is-speaking { opacity: 1; transform: translateY(-8px) scale(1.06); }
.story-person.is-listening { opacity: 0.38; }
.story-bubble {
  position: absolute;
  top: 22px;
  left: 22px;
  right: 22px;
  z-index: 4;
  max-width: 78%;
  padding: 12px 15px;
  border: 1px solid rgba(29, 42, 50, 0.08);
  border-radius: 14px 14px 14px 4px;
  background: rgba(255, 253, 248, 0.94);
  box-shadow: 0 12px 26px rgba(77, 49, 30, 0.13);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.story-bubble.is-pop { animation: bubble-pop 320ms var(--ease); }
.bubble-speaker { display: block; margin-bottom: 2px; color: var(--terra-dark); font-size: 0.56rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.story-bubble p { color: var(--ink); font-family: var(--font-serif); font-size: 0.9rem; line-height: 1.42; }
.scene-badge { position: absolute; right: 16px; bottom: 16px; z-index: 4; padding: 4px 8px; border-radius: 999px; background: rgba(29, 42, 50, 0.78); color: #fff; font-size: 0.54rem; font-weight: 750; letter-spacing: 0.09em; text-transform: uppercase; }
@keyframes bubble-pop {
  0% { opacity: 0; transform: translateY(6px) scale(0.98); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.story-panel { display: flex; flex-direction: column; min-width: 0; padding: 25px 26px 22px; }
.story-meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; color: var(--muted); font-size: 0.62rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.story-dots { display: flex; gap: 4px; }
.story-dot { width: 13px; height: 3px; border-radius: 99px; background: var(--line-strong); }
.story-dot.is-active { background: var(--terra); }
.story-dot.is-seen { background: var(--teal); }
.story-panel h3 { margin-bottom: 12px; font-family: var(--font-serif); font-size: 1.45rem; font-weight: 500; line-height: 1.15; }
.story-lines { display: grid; gap: 2px; flex: 1; }
.story-line { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 8px; align-items: start; padding: 8px 6px; border-radius: 8px; transition: background 160ms ease; }
.story-line.is-current { background: var(--terra-soft); }
.story-line.is-past { opacity: 0.64; }
.story-line-copy { min-width: 0; }
.story-line-speaker { display: block; color: var(--terra-dark); font-size: 0.56rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.story-line p { font-size: 0.82rem; line-height: 1.5; }
.story-controls { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.story-controls #storyPrev { margin-left: auto; }

.story-quiz-card { margin-top: 20px; }

/* --------------------------------------------------------------------------
   Scènes vidéo / audio
   -------------------------------------------------------------------------- */

.media-tabs { margin-top: 0; }
.scene-player { padding: clamp(12px, 2vw, 18px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.scene-screen {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: #1c2a31;
  color: #fff;
  isolation: isolate;
}
.scene-campus { background: linear-gradient(150deg, #315b6f 0%, #284554 48%, #213641 100%); }
.scene-office { background: linear-gradient(150deg, #5b5147 0%, #3f4b4c 55%, #29383a 100%); }
.scene-phone { background: radial-gradient(circle at 50% 45%, #2f6f62 0%, #1d4a46 42%, #122c2c 100%); }
.scene-decor { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.scene-campus .decor-a {
  position: absolute; left: 0; right: 0; bottom: 0; height: 26%;
  background: linear-gradient(180deg, #3e4a50, #29343a);
  border-top: 7px solid #d9b98d;
}
.scene-campus .decor-b {
  position: absolute; left: 6%; top: 16%; width: 18%; height: 58%;
  border: 5px solid rgba(255, 255, 255, 0.13); border-radius: 5px;
  background: repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0 3px, transparent 3px 13px);
}
.scene-campus .decor-c {
  position: absolute; right: 7%; top: 18%; width: 26%; height: 30%;
  background: linear-gradient(150deg, rgba(188, 222, 229, 0.4), rgba(122, 180, 190, 0.18));
  border: 5px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}
.scene-campus .decor-d { position: absolute; left: 8%; bottom: 26%; width: 44%; height: 2px; background: rgba(255, 255, 255, 0.14); }
.scene-office .decor-a {
  position: absolute; inset: 0 0 24% 0;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 52px);
}
.scene-office .decor-b {
  position: absolute; right: 8%; top: 12%; width: 30%; height: 38%;
  background: linear-gradient(160deg, rgba(199, 226, 230, 0.34), rgba(140, 190, 199, 0.12));
  border: 6px solid rgba(255, 255, 255, 0.13);
}
.scene-office .decor-c {
  position: absolute; left: 8%; bottom: 21%; width: 34%; height: 22%;
  border-radius: 5px 5px 0 0;
  background: rgba(230, 214, 190, 0.2);
  border: 3px solid rgba(255, 255, 255, 0.12);
}
.scene-office .decor-d { position: absolute; left: 0; right: 0; bottom: 0; height: 22%; background: rgba(22, 31, 34, 0.5); }
.scene-phone .decor-a {
  position: absolute; left: 50%; top: 48%; width: 58%; aspect-ratio: 1; transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 50%;
}
.scene-phone .decor-b {
  position: absolute; left: 50%; top: 48%; width: 40%; aspect-ratio: 1; transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 50%;
}
.scene-phone .decor-c {
  position: absolute; left: 50%; top: 48%; width: 22%; aspect-ratio: 1; transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 50%;
}
.scene-phone .decor-d { position: absolute; inset: 0; background: radial-gradient(circle, transparent 45%, rgba(0, 0, 0, 0.24)); }
.phone-wave { position: absolute; left: 50%; top: 48%; width: 3px; height: 34%; background: linear-gradient(180deg, transparent, rgba(217, 164, 65, 0.8), transparent); transform: translate(-50%, -50%); opacity: 0.35; }
.phone-wave::before,
.phone-wave::after { content: ""; position: absolute; top: 50%; width: 3px; height: 60%; background: inherit; transform: translateY(-50%); }
.phone-wave::before { left: -18px; height: 42%; }
.phone-wave::after { left: 18px; height: 52%; }
.wave-two { transform: translate(-50%, -50%) rotate(90deg); opacity: 0.16; }

.scene-topline { position: absolute; top: 14px; left: 16px; right: 16px; z-index: 3; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.scene-kind { padding: 4px 8px; border-radius: 999px; background: rgba(0, 0, 0, 0.28); color: #f0e7d8; font-size: 0.52rem; font-weight: 750; letter-spacing: 0.11em; text-transform: uppercase; }
.scene-kind::first-letter { color: var(--terra); }
.scene-title-mini { color: rgba(255, 255, 255, 0.58); font-size: 0.58rem; letter-spacing: 0.04em; }
.scene-characters { position: absolute; left: 6%; right: 6%; bottom: 28%; z-index: 2; display: flex; justify-content: space-between; align-items: end; }
.scene-person { display: grid; justify-items: center; gap: 4px; opacity: 0.55; transform: translateY(4px); transition: opacity 220ms ease, transform 300ms var(--ease); }
.scene-person.is-speaking { opacity: 1; transform: translateY(-7px) scale(1.05); }
.scene-person.is-listening { opacity: 0.34; }
.scene-avatar { width: clamp(58px, 9vw, 92px); aspect-ratio: 1; border: 3px solid rgba(255, 255, 255, 0.75); border-radius: 50%; overflow: hidden; box-shadow: 0 10px 24px rgba(0, 0, 0, 0.26); }
.scene-avatar .avatar-svg { width: 100%; height: 100%; }
.scene-name { padding: 2px 7px; border-radius: 999px; background: rgba(0, 0, 0, 0.25); color: rgba(255, 255, 255, 0.86); font-size: 0.55rem; font-weight: 700; }
.scene-dialogue {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  padding: 42px 20px 17px;
  background: linear-gradient(180deg, transparent, rgba(8, 15, 19, 0.92));
}
.scene-speaker { display: block; margin-bottom: 2px; color: var(--gold); font-size: 0.56rem; font-weight: 800; letter-spacing: 0.11em; text-transform: uppercase; }
.scene-text { max-width: 78ch; color: #fff; font-family: var(--font-serif); font-size: clamp(0.86rem, 1.4vw, 1.05rem); line-height: 1.4; }
.scene-big-play {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  background: rgba(255, 253, 248, 0.92);
  color: var(--ink);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
  transform: translate(-50%, -50%);
  transition: opacity 180ms ease, transform 180ms ease;
}
.scene-big-play:hover { transform: translate(-50%, -50%) scale(1.06); }
.scene-big-play .icon { width: 24px; height: 24px; margin-left: 2px; }
.scene-big-play.is-hidden { opacity: 0; pointer-events: none; }
.scene-controls { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: 12px; }
.scene-counter { margin-left: 2px; color: var(--muted); font-size: 0.64rem; font-variant-numeric: tabular-nums; }
.scene-transcript-btn { margin-left: auto; }
.scene-progress { height: 3px; margin-top: 10px; border-radius: 99px; background: var(--line); overflow: hidden; }
.scene-progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--terra); transition: width 220ms ease; }
.scene-transcript { display: grid; gap: 2px; margin-top: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); }
.scene-transcript-line { display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 8px; width: 100%; padding: 5px 6px; border: 0; border-radius: 5px; background: transparent; text-align: left; }
.scene-transcript-line:hover { background: var(--surface); }
.scene-transcript-line.is-current { background: var(--terra-soft); }
.scene-transcript-line span { color: var(--terra-dark); font-size: 0.58rem; font-weight: 750; text-transform: uppercase; }
.scene-transcript-line p { color: var(--ink-soft); font-size: 0.72rem; line-height: 1.4; }
.scene-questions { margin-top: 18px; padding-top: 17px; border-top: 1px solid var(--line); }
.scene-questions-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 15px; margin-bottom: 8px; }
.scene-questions-head .tag { margin-bottom: 5px; }
.scene-questions-head h3 { font-family: var(--font-serif); font-size: 1.25rem; font-weight: 500; line-height: 1.15; }
.scene-score { color: var(--muted); font-size: 0.7rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.scene-quiz .quiz-item { padding: 12px 0; }
.scene-quiz .quiz-question { font-size: 0.82rem; }
.scene-quiz .quiz-options { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.scene-quiz .quiz-option { font-size: 0.72rem; }

.media-note { margin-top: 18px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.media-note summary { padding: 13px 16px; cursor: pointer; color: var(--ink-soft); font-size: 0.76rem; font-weight: 700; }
.media-note summary:hover { color: var(--terra-dark); }
.media-note-body { padding: 0 16px 15px; color: var(--ink-soft); font-size: 0.75rem; line-height: 1.6; }
.media-note-body p + p { margin-top: 7px; }
.media-note code { padding: 1px 4px; border-radius: 4px; background: var(--paper-deep); font-size: 0.9em; }

/* --------------------------------------------------------------------------
   Production
   -------------------------------------------------------------------------- */

.production-section { padding-bottom: 20px; }
.output-layout { display: grid; grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr); gap: 20px; align-items: start; }
.output-form { padding: 4px 22px 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.form-section { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.form-section:last-of-type { border-bottom: 0; }
.form-step { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 50%; background: var(--paper-deep); color: var(--terra-dark); font-family: var(--font-serif); font-size: 0.68rem; }
.form-section-body { min-width: 0; }
.form-section-body h3 { margin-bottom: 13px; font-family: var(--font-serif); font-size: 1.28rem; font-weight: 500; }
.form-grid { display: grid; gap: 11px; }
.form-grid-two { grid-template-columns: 1fr 1fr; }
.field { display: grid; gap: 5px; min-width: 0; margin-bottom: 11px; }
.field > span, .field legend { color: var(--ink-soft); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.02em; }
.field input[type="text"],
.field input[type="number"],
.field select {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 0.8rem;
  transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}
.field input:focus,
.field select:focus { outline: 0; border-color: var(--terra); background: var(--surface); box-shadow: 0 0 0 3px rgba(196, 85, 61, 0.1); }
.field-radio, .field-checks { padding: 0; border: 0; }
.field-radio legend, .field-checks legend { margin-bottom: 5px; }
.field-radio label { display: inline-flex; align-items: center; gap: 5px; margin-right: 15px; color: var(--ink-soft); font-size: 0.77rem; }
.field-radio input, .field-checks input { accent-color: var(--terra); }
.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 8px; }
.check-grid label { display: flex; align-items: center; gap: 5px; color: var(--ink-soft); font-size: 0.74rem; }
.inline-input { margin-top: 6px; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding-top: 18px; }

.output-result { display: grid; gap: 16px; }
.preview-card { padding: 21px 22px 18px; border-radius: var(--radius); background: var(--ink); color: var(--paper); box-shadow: var(--shadow); }
.preview-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 15px; padding-bottom: 13px; border-bottom: 1px solid rgba(246, 240, 228, 0.18); }
.preview-head .tag { border-color: rgba(246, 240, 228, 0.2); background: rgba(255, 255, 255, 0.06); color: rgba(246, 240, 228, 0.7); }
.preview-head h3 { margin-top: 4px; font-family: var(--font-serif); font-size: 1.35rem; font-weight: 500; }
.preview-level { color: var(--gold); font-family: var(--font-serif); font-size: 0.78rem; font-style: italic; }
.preview-text { display: grid; gap: 7px; min-height: 150px; padding: 15px 0 12px; }
.preview-text p { color: rgba(246, 240, 228, 0.92); font-size: 0.83rem; line-height: 1.58; }
.preview-placeholder { color: rgba(246, 240, 228, 0.55) !important; font-style: italic; }
.preview-actions { display: flex; flex-wrap: wrap; gap: 7px; padding-top: 12px; border-top: 1px solid rgba(246, 240, 228, 0.18); }
.preview-actions .btn-soft { border-color: rgba(246, 240, 228, 0.22); background: rgba(255, 255, 255, 0.07); color: var(--paper); }
.preview-actions .btn-soft:hover { background: rgba(255, 255, 255, 0.15); }
.preview-actions .btn-dark { background: var(--paper); color: var(--ink); }

.recorder-card, .checklist-card, .challenge-card { padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow-sm); }
.recorder-head, .checklist-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 6px; }
.recorder-head .tag, .checklist-head .tag { margin-bottom: 4px; }
.recorder-head h3, .checklist-head h3, .challenge-card h3 { font-family: var(--font-serif); font-size: 1.2rem; font-weight: 500; }
.rec-dot { width: 9px; height: 9px; margin-top: 5px; border-radius: 50%; background: var(--line-strong); }
.recorder-controls { display: flex; align-items: center; gap: 11px; margin-top: 11px; }
.rec-timer { color: var(--muted); font-family: var(--font-serif); font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.recorder-card audio { width: 100%; margin-top: 12px; }
.rec-status { min-height: 1.2em; margin-top: 7px; color: var(--muted); font-size: 0.68rem; }
#recordBtn.is-recording { background: var(--danger); animation: pulse-red 1.4s ease-in-out infinite; }
@keyframes pulse-red { 0%, 100% { box-shadow: 0 0 0 0 rgba(178, 58, 46, 0.25); } 50% { box-shadow: 0 0 0 7px rgba(178, 58, 46, 0); } }

.checklist { display: grid; gap: 3px; margin-top: 8px; }
.check-item { display: flex; align-items: flex-start; gap: 8px; padding: 5px 0; color: var(--ink-soft); font-size: 0.74rem; line-height: 1.45; cursor: pointer; }
.check-item input { margin-top: 3px; accent-color: var(--teal); }
.checklist-head > span { color: var(--muted); font-size: 0.68rem; font-variant-numeric: tabular-nums; }

.challenge-card { background: var(--gold-soft); border-color: rgba(217, 164, 65, 0.35); }
.challenge-card h3 { margin: 4px 0 4px; }
.challenge-card p { color: #6b501b; font-size: 0.76rem; }
.question-bank { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.question-bank li { padding: 4px 8px; border-radius: 999px; background: rgba(255, 253, 248, 0.7); color: #5d4719; font-size: 0.67rem; }

/* --------------------------------------------------------------------------
   Espace enseignant
   -------------------------------------------------------------------------- */

body.dialog-open { overflow: hidden; }
.teacher-dialog {
  width: min(780px, 96vw);
  max-width: 780px;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0 0 0 auto;
  padding: 0;
  border: 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: -24px 0 70px rgba(23, 31, 35, 0.22);
}
.teacher-dialog::backdrop { background: rgba(18, 27, 32, 0.46); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.teacher-shell { display: flex; flex-direction: column; height: 100%; }
.teacher-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; padding: 24px 25px 18px; border-bottom: 1px solid var(--line); background: var(--paper-light); }
.teacher-head .tag { margin-bottom: 5px; }
.teacher-head h2 { font-family: var(--font-serif); font-size: 1.65rem; font-weight: 500; line-height: 1.1; }
.teacher-head p { margin-top: 3px; color: var(--muted); font-size: 0.72rem; }
.teacher-tabs { display: flex; flex-direction: column; flex: 1; min-height: 0; margin-top: 0; }
.teacher-tabs .tab-list { flex: 0 0 auto; margin: 0; padding: 0 25px; background: var(--paper-light); }
.teacher-tabs .tab-btn { font-size: 0.72rem; padding: 10px 11px 12px; }
.teacher-panel { flex: 1; overflow-y: auto; padding: 22px 25px 34px; }
.teacher-intro { margin-bottom: 16px; }
.teacher-lead { color: var(--ink-soft); font-size: 0.82rem; line-height: 1.62; }
.teacher-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.teacher-chips span { padding: 3px 8px; border-radius: 999px; background: var(--paper-deep); color: var(--ink-soft); font-size: 0.6rem; font-weight: 700; }
.teacher-timeline { display: grid; gap: 0; }
.teacher-timeline li { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.teacher-timeline li:last-child { border-bottom: 0; }
.teacher-time { color: var(--terra-dark); font-family: var(--font-serif); font-size: 0.72rem; font-variant-numeric: tabular-nums; }
.teacher-timeline strong { display: block; font-size: 0.78rem; }
.teacher-timeline p { margin-top: 2px; color: var(--ink-soft); font-size: 0.73rem; line-height: 1.55; }
.answer-block { padding: 14px 0; border-bottom: 1px solid var(--line); }
.answer-block:last-child { border-bottom: 0; }
.answer-block h3 { margin-bottom: 6px; font-family: var(--font-serif); font-size: 1.05rem; font-weight: 500; }
.answer-block ul { display: grid; gap: 3px; }
.answer-block li { position: relative; padding-left: 13px; color: var(--ink-soft); font-size: 0.75rem; line-height: 1.5; }
.answer-block li::before { content: "—"; position: absolute; left: 0; color: var(--terra); }
.answer-block p { color: var(--ink-soft); font-size: 0.76rem; line-height: 1.6; }
.answer-block p + p { margin-top: 6px; }
.feedback-table { width: 100%; border-collapse: collapse; font-size: 0.69rem; line-height: 1.45; }
.feedback-table th { padding: 7px 8px; border-bottom: 2px solid var(--line-strong); color: var(--muted); font-size: 0.57rem; letter-spacing: 0.07em; text-align: left; text-transform: uppercase; }
.feedback-table td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--ink-soft); }
.feedback-type { display: inline-block; padding: 2px 6px; border-radius: 999px; background: var(--paper-deep); color: var(--ink-soft); font-size: 0.55rem; font-weight: 750; white-space: nowrap; }
.type-erreur { background: var(--danger-soft); color: var(--danger); }
.type-prcision { background: var(--gold-soft); color: #72531c; }
.type-style { background: var(--blue-soft); color: var(--blue); }
.feedback-original { color: var(--danger); text-decoration: line-through; text-decoration-color: rgba(178, 58, 46, 0.35); }
.feedback-correction { color: var(--success); font-weight: 650; }
.table-scroll { overflow-x: auto; }
.recording-script { display: grid; gap: 3px; counter-reset: script; }
.recording-script li { padding-left: 24px; counter-increment: script; }
.recording-script li::before { content: counter(script) "."; position: absolute; left: 0; }
.code-block { overflow-x: auto; padding: 10px 12px; border-radius: 7px; background: var(--ink); color: var(--paper); font-size: 0.65rem; line-height: 1.5; }
.teacher-panel .notice { margin-top: 15px; }

/* --------------------------------------------------------------------------
   Pied de page
   -------------------------------------------------------------------------- */

.site-footer { margin-top: 40px; padding: 38px 0 30px; background: var(--ink); color: var(--paper); }
.footer-inner { display: grid; grid-template-columns: 1fr auto; gap: 18px 26px; align-items: start; }
.footer-brand { display: flex; align-items: center; gap: 12px; }
.footer-brand .brand-mark { background: var(--paper); color: var(--ink); box-shadow: none; }
.footer-brand strong { font-family: var(--font-serif); font-size: 1.1rem; font-weight: 500; }
.footer-brand p { margin-top: 1px; color: rgba(246, 240, 228, 0.58); font-size: 0.68rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 14px; justify-content: flex-end; }
.footer-links a, .footer-links button { padding: 0; border: 0; border-bottom: 1px solid transparent; background: transparent; color: rgba(246, 240, 228, 0.7); font-size: 0.68rem; text-decoration: none; }
.footer-links a:hover, .footer-links button:hover { color: var(--gold); border-color: var(--gold); }
.footer-credit { grid-column: 1 / -1; padding-top: 14px; border-top: 1px solid rgba(246, 240, 228, 0.14); color: rgba(246, 240, 228, 0.45); font-size: 0.62rem; }

.back-to-top {
  position: fixed;
  right: 20px;
  bottom: 22px;
  z-index: 70;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px) rotate(90deg);
  transition: opacity 180ms ease, transform 180ms var(--ease);
}
.back-to-top .icon { width: 17px; height: 17px; }
.back-to-top.is-visible { opacity: 1; pointer-events: auto; transform: translateY(0) rotate(90deg); }
.back-to-top:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* --------------------------------------------------------------------------
   Toast et no-script
   -------------------------------------------------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 300;
  max-width: min(90vw, 480px);
  padding: 11px 17px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.76rem;
  line-height: 1.4;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 14px);
  transition: opacity 220ms ease, transform 220ms var(--ease);
  box-shadow: 0 12px 30px rgba(19, 27, 32, 0.25);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

.noscript { padding: 16px 20px; background: var(--danger-soft); color: var(--danger); font-size: 0.8rem; text-align: center; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1100px) {
  .vocab-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .crossword-layout { grid-template-columns: minmax(0, 1fr); }
  .crossword-clues { grid-template-columns: 1fr 1fr; }
  .output-layout { grid-template-columns: 1fr; }
  .output-result { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .preview-card { grid-column: 1 / -1; }
}

@media (max-width: 980px) {
  .shell { width: min(calc(100% - 36px), var(--max-width)); }
  .header-inner { gap: 16px; min-height: 70px; }
  .header-nav { gap: 14px; }
  .header-progress { width: 128px; }
  .progress-copy span { display: none; }
  .progress-copy { justify-content: flex-end; }
  .float-chip { display: none; }
  .hero { grid-template-columns: 1fr; padding-top: 50px; }
  .hero-copy h1 { max-width: 14ch; }
  .hero-art { min-height: 440px; margin-top: 6px; }
  .id-card { width: min(330px, 92%); }
  .lesson-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .route-strip { gap: 10px; overflow-x: auto; border-radius: 20px; scrollbar-width: none; }
  .route-strip::-webkit-scrollbar { display: none; }
  .route-line { display: none; }
  .route-step { padding-right: 6px; }
  .story-card { grid-template-columns: 1fr; }
  .story-visual { min-height: 360px; }
  .story-panel { padding: 21px 20px 19px; }
  .story-person-avatar { width: 64px; height: 64px; }
  .story-characters { bottom: 68px; }
  .cafe-table { height: 120px; bottom: -54px; }
  .story-bubble { max-width: 86%; }
}

@media (max-width: 760px) {
  .header-nav > a { display: none; }
  .header-progress { width: 116px; }
  .teacher-link span { display: none; }
  .hero-copy h1 { font-size: clamp(3rem, 12vw, 4.4rem); }
  .listening-card { grid-template-columns: 1fr; }
  .listening-side { border-right: 0; border-bottom: 1px solid var(--line); }
  .portrait-large { width: 130px; height: 130px; }
  .transcript-card { padding: 21px 18px 16px; }
  .section-heading { grid-template-columns: 38px minmax(0, 1fr); gap: 10px; }
  .section-no { font-size: 2rem; }
  .grammar-grid { grid-template-columns: 1fr; }
  .quiz-head { align-items: flex-start; }
  .output-result { grid-template-columns: 1fr; }
  .preview-card { grid-column: auto; }
  .form-grid-two { grid-template-columns: 1fr; }
  .match-board { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
  .match-board-two { grid-template-columns: repeat(2, minmax(160px, 1fr)); }
  .footer-inner { grid-template-columns: 1fr; }
  .footer-links { justify-content: flex-start; }
  .teacher-dialog { width: 100vw; max-width: 100vw; }
}

@media (max-width: 560px) {
  .shell { width: calc(100% - 28px); }
  .brand-text small { display: none; }
  .brand-text strong { font-size: 0.95rem; }
  .header-inner { min-height: 64px; gap: 10px; }
  .header-progress { width: 92px; }
  .progress-copy span { display: none; }
  .progress-copy { justify-content: flex-end; }
  .teacher-link { padding: 7px 9px; }
  .hero { padding-top: 38px; padding-bottom: 38px; }
  .hero-copy h1 { font-size: clamp(2.75rem, 14vw, 3.8rem); }
  .hero-actions .btn { width: 100%; }
  .objectives { margin-top: 26px; }
  .hero-art { min-height: 390px; }
  .id-card { width: min(310px, 96%); }
  .id-portrait { width: 150px; height: 150px; }
  .id-card { transform: rotate(-1deg); }
  .chip-1 { display: none; }
  .chip-2 { display: block; top: 42%; right: 4%; }
  .chip-3 { display: none; }
  .art-note { bottom: -27px; right: 0; left: 0; max-width: none; text-align: center; }
  .route-strip { margin-bottom: 36px; padding: 12px 14px; }
  .route-step small { display: none; }
  .lesson-section { padding-bottom: 56px; }
  .section-heading { grid-template-columns: 1fr; gap: 2px; }
  .section-no { font-size: 1.55rem; margin-bottom: 3px; }
  .section-heading h2 { font-size: 1.9rem; }
  .transcript-head { flex-direction: column; gap: 7px; }
  .transcript-foot { flex-direction: column; align-items: flex-start; gap: 5px; }
  .vocab-grid { grid-template-columns: 1fr; }
  .word-bank-wrap { flex-direction: column; gap: 7px; }
  .fill-item { grid-template-columns: 30px minmax(0, 1fr); }
  .fill-item .hint-btn { grid-column: 2; justify-self: start; }
  .fill-sentence { font-size: 0.89rem; line-height: 2.7; }
  .exercise-head { flex-direction: column; gap: 8px; }
  .exercise-actions .btn { flex: 1 1 auto; }
  .match-footer { flex-direction: column; align-items: flex-start; }
  .crossword-grid { grid-template-columns: repeat(10, 34px); grid-auto-rows: 34px; gap: 2px; padding: 6px; }
  .crossword-cell input { font-size: 0.8rem; }
  .crossword-clues { grid-template-columns: 1fr; }
  .scene-controls .scene-transcript-btn { margin-left: 0; }
  .scene-screen { aspect-ratio: 4 / 3; }
  .scene-dialogue { padding: 36px 14px 13px; }
  .scene-topline { left: 11px; right: 11px; top: 10px; }
  .scene-title-mini { display: none; }
  .scene-avatar { width: 56px; }
  .scene-name { display: none; }
  .scene-characters { bottom: 34%; }
  .scene-person.is-speaking { transform: translateY(-4px) scale(1.03); }
  .story-visual { min-height: 330px; }
  .story-characters { bottom: 58px; left: 2%; right: 2%; }
  .story-person-avatar { width: 54px; height: 54px; border-width: 2px; }
  .story-person span { font-size: 0.48rem; padding: 1px 4px; }
  .story-characters { bottom: 44px; }
  .cafe-table { height: 96px; bottom: -42px; left: 4%; right: 4%; }
  .cafe-cup { bottom: 66px; }
  .cup-b { bottom: 74px; }
  .story-bubble { top: 13px; left: 13px; right: 13px; max-width: none; }
  .story-bubble p { font-size: 0.8rem; }
  .story-panel { padding: 18px 16px 16px; }
  .story-controls #storyPrev { margin-left: 0; }
  .story-controls .btn { flex: 1 1 auto; }
  .output-form { padding: 4px 15px 16px; }
  .form-section { grid-template-columns: 1fr; }
  .form-step { width: 24px; height: 24px; }
  .check-grid { grid-template-columns: 1fr 1fr; }
  .teacher-head { padding: 19px 18px 15px; }
  .teacher-tabs .tab-list { padding: 0 12px; }
  .teacher-panel { padding: 18px 18px 28px; }
  .teacher-timeline li { grid-template-columns: 64px minmax(0, 1fr); gap: 8px; }
  .toast { bottom: 16px; border-radius: 14px; }
}

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

/* --------------------------------------------------------------------------
   Impression
   -------------------------------------------------------------------------- */

@media print {
  html { scroll-behavior: auto; }
  body { background: #fff; color: #111; font-size: 11pt; }
  .site-header, .sidebar, .site-footer, .route-strip, .section-complete,
  .hero-actions, .hero-art, .filter-row, .tab-list, .exercise-actions,
  .match-actions, .toast, .teacher-dialog, .scene-controls, .story-controls,
  .preview-actions, .recorder-card, .challenge-card, .hint-btn, .mini-audio,
  .line-audio, .story-line-audio, .scene-big-play, .media-note, .quiz-actions {
    display: none !important;
  }
  .shell { width: 100%; max-width: none; }
  .hero { display: block; padding: 0 0 20pt; }
  .hero-copy h1 { font-size: 34pt; }
  .lesson-layout { display: block; }
  .lesson-section { padding-bottom: 22pt; break-inside: avoid; }
  .section-heading { border-top: 1px solid #bbb; padding-top: 10pt; }
  .listening-card, .quiz-card, .story-card, .scene-player, .output-form, .preview-card {
    border: 1px solid #bbb; box-shadow: none; background: #fff; color: #111;
  }
  .story-visual, .scene-screen { display: none; }
  .preview-text p { color: #111; }
  .tab-panel[hidden] { display: block !important; }
  .tab-panel { page-break-inside: avoid; }
  a { text-decoration: none; color: #111; }
}
