:root {
  color-scheme: dark;
  --bg: #101915;
  --panel: #16221b;
  --panel-raised: #1d2c22;
  --panel-hover: #26362a;
  --line: #354438;
  --text: #f0f4e9;
  --muted: #b1c0b0;
  --quiet: #91a593;
  --accent: #d4ef9b;
  --accent-ink: #172412;
  --accent-fill: #263a23;
  --warning: #f4cb9c;
  --radius: 20px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  font-synthesis: none;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5ed;
  --panel: #fcfdf8;
  --panel-raised: #e8eee0;
  --panel-hover: #e0e8d9;
  --line: #c9d4c4;
  --text: #1b261b;
  --muted: #4c624c;
  --quiet: #536953;
  --accent: #355c24;
  --accent-ink: #fff;
  --accent-fill: #dcebd2;
  --warning: #824219;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button, summary { cursor: pointer; }
button { color: inherit; }
button:disabled { cursor: wait; opacity: .65; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2rem, 4.2vw, 3.1rem); line-height: 1.06; letter-spacing: -.052em; }
h2 { font-size: 1.45rem; line-height: 1.2; letter-spacing: -.025em; }
h3 { font-size: 1.05rem; line-height: 1.4; }
p { line-height: 1.55; }
img { max-width: 100%; display: block; }
progress { display: block; accent-color: var(--accent); width: 100%; height: 6px; }
video, audio { display: block; width: 100%; }
input, select, textarea {
  background: var(--bg); color: var(--text); border: 1px solid var(--line);
  border-radius: 9px; min-height: 44px; padding: .58rem .75rem; min-width: 0;
}
select { max-width: 100%; }
input[type="checkbox"] { min-height: 0; min-width: 1rem; accent-color: var(--accent); }
textarea { resize: vertical; line-height: 1.5; width: 100%; }
label { font-size: .84rem; color: var(--muted); }
form label, .shadow label, .filters label { display: grid; gap: .38rem; }
summary { min-height: 32px; display: list-item; align-content: center; }
.sr-only, .skip-link:not(:focus) {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap;
}
.skip-link { position: fixed; top: 1rem; left: 1rem; background: var(--panel); padding: .8rem; z-index: 30; }
.site-header {
  min-height: 72px; display: flex; align-items: center; gap: 2rem; padding: .7rem max(1.5rem, calc((100vw - 1320px) / 2));
  border-bottom: 1px solid var(--line); background: var(--bg);
}
.brand { display: inline-flex; align-items: center; gap: .7rem; font-weight: 750; font-size: 1.03rem; white-space: nowrap; letter-spacing: -.02em; }
.brand-mark {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  background: var(--accent); color: var(--accent-ink); font-size: 1.18rem; font-weight: 850;
}
.site-header nav { display: flex; align-items: center; gap: .2rem; }
.site-header nav a {
  color: var(--muted); font-size: .89rem; font-weight: 600; padding: .68rem .78rem; border-radius: 8px;
  min-height: 44px; display: inline-flex; align-items: center;
}
.site-header nav a:hover, .site-header nav a[aria-current] { background: var(--panel-raised); color: var(--text); }
.phone-link { margin-left: auto; }
main { max-width: 1368px; margin: auto; padding: 2.6rem 1.5rem 4rem; }
.page-head, .section-head, .lesson-top, .lesson-heading, .row {
  display: flex; justify-content: space-between; align-items: center; gap: .75rem;
}
.page-head { margin-bottom: 1.45rem; }
.section-head { margin: 2.15rem 0 1rem; align-items: baseline; }
.section-head a, .back, .card-links a { color: var(--accent); font-size: .89rem; font-weight: 640; }
.connection { color: var(--muted); font-size: .81rem; flex-shrink: 0; }
.connection::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: .45rem; border-radius: 50%; background: var(--accent); }
.muted, .hint { color: var(--muted); }
.hint { font-size: .85rem; line-height: 1.55; }
.eyebrow { color: var(--accent); font-size: .76rem; line-height: 1.5; font-weight: 700; letter-spacing: .065em; }
.button {
  display: inline-flex; justify-content: center; align-items: center; gap: .35rem;
  min-height: 44px; padding: .58rem .9rem; border: 1px solid var(--line);
  border-radius: 10px; background: var(--panel-raised); color: var(--text);
  font-size: .9rem; line-height: 1.3; font-weight: 650; text-align: center;
}
.button:hover { background: var(--panel-hover); }
.button.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.button.primary:hover { filter: brightness(.93); }
.button.quiet { background: transparent; color: var(--muted); }
.button.quiet:hover, .button.selected { background: var(--accent-fill); color: var(--accent); }
.button.compact { padding: .45rem .7rem; font-size: .81rem; }
.button.text-button { background: transparent; color: var(--accent); border-color: transparent; padding: .15rem .4rem; font-size: .78rem; min-height: 36px; }
.button.text-button:hover { background: var(--panel-hover); }
.wrap { flex-wrap: wrap; }
.notice, .loading { margin: .7rem 0 1.1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 1rem; color: var(--muted); }
.loading { min-height: 90px; display: grid; place-items: center; }
.hero {
  display: grid; grid-template-columns: 1.04fr 1fr; border-radius: 24px;
  border: 1px solid var(--line); overflow: hidden; min-height: 300px; background: var(--panel);
}
.hero-copy { padding: clamp(1.5rem, 3vw, 3.3rem); display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 1rem; }
.hero-copy h2 { font-size: clamp(2rem, 4.4vw, 4.1rem); letter-spacing: -.045em; line-height: 1.02; max-width: 15ch; }
.hero-copy > p:not(.eyebrow) { color: var(--muted); max-width: 46ch; }
.hero-copy .button { margin-top: .25rem; }
.hero-media { position: relative; background: var(--panel-raised); min-height: 230px; }
.hero-media .course-image { width: 100%; height: 100%; position: absolute; inset: 0; object-fit: cover; }
.hero-media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, var(--panel), transparent 35%); pointer-events: none; }
.study-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1.1rem; }
.action-card {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .9rem;
  padding: .9rem 1.1rem; border: 1px solid var(--line); border-radius: 15px; background: var(--panel);
}
.action-card:hover { background: var(--panel-hover); }
.action-card small { display: block; color: var(--muted); margin-top: .3rem; line-height: 1.4; }
.action-card > span:last-child { color: var(--accent); }
.action-symbol { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--accent-fill); color: var(--accent); font-size: 1.4rem; }
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(235px, 100%), 1fr)); gap: 1rem; }
.course-grid.featured { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 810px; }
.course-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; min-width: 0; }
.course-cover { display: block; position: relative; aspect-ratio: 16 / 8.3; background: var(--panel-raised); }
.course-image { width: 100%; height: 100%; object-fit: cover; }
.plain-cover { aspect-ratio: 16 / 4; background: linear-gradient(118deg, var(--accent-fill), var(--panel-raised)); }
.level, .duration {
  position: absolute; bottom: .65rem; border-radius: 6px; background: #132119ed; color: #f1f5eb;
  padding: .25rem .5rem; font-size: .75rem; font-weight: 700;
}
.level { left: .65rem; background: #d4ef9b; color: #172412; }
.duration { right: .65rem; }
.course-info { display: grid; gap: .5rem; padding: .85rem 1rem 1rem; }
.course-title { font-weight: 700; line-height: 1.35; letter-spacing: -.012em; }
.course-title:hover { color: var(--accent); }
.card-foot { display: flex; justify-content: space-between; gap: .5rem; color: var(--quiet); font-size: .77rem; }
.snippet { color: var(--muted); font-size: .85rem; }
.search-row { display: flex; gap: .65rem; }
.search-row input { flex: 1; }
.filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; margin: 1rem 0; }
.results-count { margin: 1.25rem 0 .7rem; color: var(--muted); font-size: .9rem; }
.lesson-top { margin-bottom: 1.2rem; }
.lesson-heading { margin-bottom: 1.45rem; align-items: end; }
.lesson-heading h1 { margin: .25rem 0 .25rem; font-size: clamp(1.7rem, 3vw, 2.8rem); }
.lesson-heading > div:first-child { min-width: 0; }
.source-title { font-size: .86rem; margin-top: .4rem; }
.lesson-grid { display: grid; grid-template-columns: 1.07fr 1fr; gap: 1.2rem; align-items: start; }
.media-column, .lesson-workspace { min-width: 0; }
.video-frame { background: #0a0d0b; border-radius: 16px; overflow: hidden; aspect-ratio: 16/9; border: 1px solid var(--line); }
.video-frame video { height: 100%; width: 100%; }
.audio-player { display: grid; gap: .6rem; padding: .9rem; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.audio-player audio { width: 100%; }
.media-preparation {
  min-height: 220px; display: grid; justify-items: start; align-content: center; gap: .85rem;
  padding: 1.25rem; border-radius: 16px; border: 1px solid var(--line); background: var(--panel);
}
.media-preparation p { color: var(--muted); }
.media-preparation .download-progress { width: min(100%, 320px); }
.media-controls { display: flex; gap: .55rem; align-items: center; margin-top: .45rem; }
.media-controls > span { color: var(--accent); font-variant-numeric: tabular-nums; }
#mobile-caption { display: none; }
.speed-label { display: flex; align-items: center; gap: .5rem; margin-left: auto; }
.source-line { color: var(--quiet); font-size: .78rem; padding: .5rem 0 1rem; }
.source-line span { margin: 0 .3rem; }
.chapters { border-top: 1px solid var(--line); padding-top: 1rem; }
.chapters h2 { margin-bottom: .5rem; font-size: 1.04rem; }
.chapters button { display: flex; gap: 1rem; width: 100%; border: 0; background: transparent; padding: .65rem .4rem; text-align: left; min-height: 44px; }
.chapters button:hover { background: var(--panel-raised); }
.chapters span, .stamp { color: var(--accent); font-size: .8rem; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.lesson-workspace { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; }
.lesson-tabs { display: flex; gap: .3rem; overflow-x: auto; padding: .65rem; border-bottom: 1px solid var(--line); scrollbar-width: thin; }
.lesson-tabs .tab { white-space: nowrap; font-size: .83rem; background: transparent; border-color: transparent; color: var(--muted); padding-inline: .65rem; }
.lesson-tabs .tab.selected, .lesson-tabs .tab:hover { color: var(--accent); background: var(--accent-fill); }
#lesson-panel { padding: 1rem; display: grid; gap: .8rem; min-width: 0; }
.panel-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; }
.panel-toolbar label { display: inline-flex; gap: .45rem; align-items: center; }
.check { min-height: 44px; }
.transcript-list { position: relative; max-height: clamp(250px, 53vh, 580px); overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; border: 1px solid var(--line); border-radius: 12px; }
.cue { border-bottom: 1px solid var(--line); padding: .45rem .65rem; }
.cue:last-child { border-bottom: 0; }
.cue.active { background: var(--accent-fill); box-shadow: inset 3px 0 var(--accent); }
.cue-line { display: flex; align-items: baseline; gap: .8rem; text-align: left; padding: .3rem 0; line-height: 1.45; background: none; border: 0; width: 100%; min-height: 36px; }
.cue-actions { display: flex; justify-content: flex-end; gap: .3rem; }
.translation { color: var(--muted); line-height: 1.5; font-size: .91rem; }
.cue .translation { padding: .25rem 0 .25rem 3.1rem; }
.panel-pager { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: .8rem; }
.french-text { border-top: 1px solid var(--line); padding-top: .35rem; color: var(--muted); }
.french-text > p:last-child { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 420px; overflow: auto; }
.stack { display: grid; gap: .65rem; }
.info-card, .settings-card, .answer-feedback, .recording {
  display: grid; gap: .55rem; padding: .85rem; border: 1px solid var(--line); background: var(--panel-raised); border-radius: 12px;
}
.info-card .row { justify-content: space-between; }
.summary { color: var(--muted); }
.quiz, .shadow, #notes-form, .answer-form, .pair-box form { display: grid; gap: .85rem; }
.quiz .row, .shadow .row, .settings-card .row, .flashcard .row { justify-content: flex-start; }
.quiz > .row:first-child { justify-content: space-between; }
.choice-list { display: grid; gap: .5rem; }
.choice-list .choice { text-align: left; justify-content: flex-start; }
.answer-feedback { border-color: var(--accent); background: var(--accent-fill); }
.answer-feedback.wrong { border-color: var(--warning); }
.answer-feedback.wrong .eyebrow { color: var(--warning); }
.word-pool, .order-line { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; padding: .55rem; }
.order-line { border: 1px dashed var(--line); border-radius: 10px; min-height: 60px; }
.shadow-settings { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; }
.recording { margin-top: .4rem; }
.recording audio { margin: .45rem 0; }
.downloaded { color: var(--accent); font-size: .8rem; padding-right: .4rem; }
.download-progress { display: flex; gap: .5rem; align-items: center; }
.download-progress progress { min-width: 70px; }
.download-progress span { white-space: nowrap; font-size: .82rem; color: var(--muted); }
.review-tabs { display: flex; gap: .55rem; margin-bottom: 1rem; }
.flashcard, .empty, .pair-box {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(1.15rem, 3vw, 2rem); display: grid; justify-items: start; gap: 1rem;
}
.flashcard { max-width: 770px; min-height: 235px; }
.flashcard h2 { font-size: clamp(1.6rem, 4vw, 2.65rem); }
.card-links { display: flex; align-items: center; flex-wrap: wrap; gap: 1rem; }
.flash-translation { color: var(--muted); font-size: 1.05rem; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.settings-card { background: var(--panel); padding: 1.2rem; align-content: start; }
.settings-card h2 { margin-bottom: .2rem; }
.settings-card p { color: var(--muted); }
.settings-card .address { color: var(--accent); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.pair-box { width: min(100%, 480px); margin: 2rem auto; }
.pair-box h1 { font-size: 2.1rem; }
.pair-box form { width: 100%; }
.settings-card .pair-number { color: var(--accent); font-size: 2rem; font-variant-numeric: tabular-nums; letter-spacing: .16em; }
.toast { position: fixed; z-index: 20; bottom: max(1.1rem, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 2rem); border: 1px solid var(--line); border-radius: 12px; padding: .85rem 1rem; background: var(--panel-raised); color: var(--text); box-shadow: 0 8px 28px #0004; font-size: .9rem; }
.button.floating-playback { display: none; }

@media (max-width: 920px) {
  .site-header { gap: .8rem; padding-inline: 1rem; }
  main { padding: 1.65rem 1rem 3rem; }
  .lesson-grid { grid-template-columns: 1fr; gap: .75rem; }
  .media-column { display: grid; grid-template-columns: 1fr; }
  .media-column .chapters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding-top: .5rem; }
  .chapters h2 { grid-column: 1 / -1; }
  .transcript-list { max-height: 400px; }
  .button.floating-playback {
    position: fixed; z-index: 15; display: inline-flex; min-height: 48px; min-width: 112px;
    right: calc(.85rem + env(safe-area-inset-right)); bottom: calc(.85rem + env(safe-area-inset-bottom));
    gap: .55rem; padding: .65rem 1rem; border-radius: 999px;
    box-shadow: 0 4px 18px #0005; touch-action: manipulation;
  }
  .floating-icon {
    display: block; width: 12px; height: 14px; flex: 0 0 auto;
    background: currentColor; clip-path: polygon(0 0, 100% 50%, 0 100%);
  }
  .floating-playback[data-playing="true"] .floating-icon {
    background: none; border-inline: 4px solid currentColor; clip-path: none;
  }
}

@media (max-width: 600px) {
  .site-header { display: grid; grid-template-columns: 1fr auto; min-height: 0; gap: .5rem; padding: .65rem .8rem .5rem; }
  .site-header nav { grid-column: 1 / -1; grid-row: 2; gap: .2rem; justify-content: space-between; }
  .site-header nav a { justify-content: center; flex: 1; padding: .55rem .4rem; font-size: .82rem; }
  .site-header .phone-link { grid-column: 2; grid-row: 1; }
  main { padding: 1.25rem .85rem 3rem; }
  .page-head { align-items: baseline; gap: .45rem; }
  .page-head .connection { font-size: .72rem; white-space: normal; text-align: right; }
  .hero { grid-template-columns: 1fr; min-height: 0; }
  .hero-copy { padding: 1.3rem; gap: .7rem; }
  .hero-media { min-height: 0; aspect-ratio: 16 / 8; grid-row: 1; }
  .hero-media::after { background: linear-gradient(0deg, var(--panel), transparent 45%); }
  .hero-copy h2 { font-size: clamp(1.9rem, 8vw, 2.6rem); }
  .study-actions { grid-template-columns: 1fr; gap: .65rem; }
  .section-head { align-items: start; }
  .section-head h2 { font-size: 1.2rem; }
  .section-head a { text-align: right; }
  .course-grid, .course-grid.featured { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
  .course-info { padding: .7rem; }
  .course-title { font-size: .88rem; overflow-wrap: anywhere; }
  .card-foot { font-size: .71rem; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
  .search-row { gap: .4rem; }
  .search-row .button { padding-inline: .55rem; }
  .lesson-heading { display: grid; gap: .55rem; }
  .lesson-heading h1 { overflow-wrap: anywhere; }
  .lesson-top { margin-bottom: .65rem; }
  .media-column .chapters { display: flex; overflow-x: auto; gap: .4rem; align-items: center; }
  .chapters h2 { font-size: .76rem; margin: 0; }
  .chapters button { border: 1px solid var(--line); border-radius: 8px; width: max-content; white-space: nowrap; font-size: .8rem; gap: .5rem; padding: .5rem; }
  #mobile-caption { display: block; margin-top: .55rem; padding: .65rem .75rem; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); font-size: .88rem; }
  #mobile-caption [lang=fr] { color: var(--muted); font-size: .81rem; }
  .lesson-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .2rem; padding: .4rem; }
  .lesson-tabs .tab { padding-inline: .2rem; white-space: normal; }
  #lesson-panel { padding: .7rem; }
  .cue-actions .button { min-height: 44px; }
  .transcript-list { max-height: min(43vh, 390px); }
  .shadow-settings, .settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-grid { grid-template-columns: 1fr; }
  input:not([type="checkbox"]), textarea, select { font-size: 16px; }
}
