:root {
  --ink: #17352d;
  --muted: #60736d;
  --forest: #173f36;
  --forest-2: #286653;
  --mint: #d9ece4;
  --mint-2: #edf5f0;
  --cream: #f7f4ec;
  --paper: #fffdf8;
  --coral: #b94f3d;
  --coral-bright: #e66f58;
  --yellow: #f5c85b;
  --blue: #6aa9c8;
  --line: #dfe5df;
  --focus: #0e7560;
  --shadow: 0 18px 48px rgba(23, 63, 54, 0.12);
  --radius: 16px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scrollbar-color: #a8bdb4 var(--cream); }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--cream);
  font-family: "DM Sans", system-ui, sans-serif;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}

button, input, textarea { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
button, a { touch-action: manipulation; -webkit-tap-highlight-color: rgba(23,63,54,.12); }
::selection { color: #fff; background: var(--forest-2); }
*:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.skip-link { position: fixed; left: 18px; top: 12px; z-index: 2000; padding: 10px 14px; border-radius: 8px; color: #fff; background: var(--forest); transform: translateY(-150%); transition: transform .18s ease-out; }
.skip-link:focus { transform: none; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 270px 1fr; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 270px;
  padding: 30px 24px 22px;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border-right: 1px solid var(--line);
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: -0.4px; }
.brand-mark {
  width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: 9px; background: var(--forest); color: #fff;
  font-family: "Playfair Display", serif; font-size: 24px; line-height: 1;
}

.nav-list { margin-top: 46px; display: grid; gap: 6px; }
.nav-item {
  min-height: 48px; padding: 0 14px; display: flex; align-items: center; gap: 13px;
  border-radius: 10px; color: var(--muted); font-weight: 600; transition: color .18s ease, background-color .18s ease, transform .18s ease;
}
.nav-item:hover { background: var(--mint-2); color: var(--forest); transform: translateX(2px); }
.nav-item.active { background: var(--mint); color: var(--forest); }
.nav-icon { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.daily-goal { margin-top: auto; padding: 17px; border-radius: 12px; background: var(--mint-2); }
.goal-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.goal-top strong { color: var(--forest-2); }
.goal-track { height: 7px; margin: 12px 0 8px; overflow: hidden; border-radius: 99px; background: #d5e5de; }
.goal-track span { display:block; width:100%; height:100%; border-radius:inherit; background:var(--coral); transform:scaleX(var(--goal-value,0)); transform-origin:left; transition:transform .6s cubic-bezier(.16,1,.3,1); }
.daily-goal small { color: var(--muted); }

.sidebar-profile {
  width: 100%; margin-top: 14px; padding: 10px 8px; display: flex; gap: 10px; align-items: center;
  border: 0; border-radius: 10px; background: transparent; text-align: left; cursor: pointer;
}
.sidebar-profile:hover { background: #f4f5f2; }
.profile-avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: #f3d7c7; font-size: 12px; font-weight: 700; }
.sidebar-profile > span:nth-child(2) { flex: 1; display: grid; gap: 2px; }
.sidebar-profile small { color: var(--muted); }
.chevron { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; color: var(--muted); }

.main-content { grid-column: 2; min-width: 0; }
.mobile-header { display: none; }
.sidebar-scrim { display:none; }
.page { width: min(1160px, calc(100% - 72px)); margin: 0 auto; padding: 50px 0 76px; animation: appear .38s cubic-bezier(.16,1,.3,1) both; }
@keyframes appear { from { opacity: .01; transform: translateY(9px); filter: blur(3px); } to { opacity: 1; transform: none; filter: blur(0); } }

.eyebrow { margin: 0 0 8px; color: var(--coral); font-size: 12px; font-weight: 700; letter-spacing: 1.6px; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { scroll-margin-top: 90px; overflow-wrap:anywhere; }
h1, h2, .french-display { font-family: "Playfair Display", Georgia, serif; }
h1 { margin-bottom: 12px; max-width: 16ch; font-size: clamp(38px, 5vw, 72px); line-height: .99; letter-spacing: -.03em; text-wrap: balance; }
h2 { margin-bottom: 8px; font-size: 31px; letter-spacing: -1px; }
h3 { margin-bottom: 8px; text-wrap: balance; }
.lead { max-width: 66ch; color: var(--muted); font-size: 17px; line-height: 1.68; text-wrap: pretty; }

.hero {
  position: relative; min-height: 390px; padding: 58px; overflow: hidden;
  display: flex; align-items: center; border-radius: 24px; color: white; background: var(--forest); box-shadow: var(--shadow);
}
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; }
.hero::before { width: 430px; height: 430px; right: -65px; top: -150px; border: 82px solid rgba(255,255,255,.055); }
.hero::after { width: 180px; height: 180px; right: 160px; bottom: -112px; background: var(--coral-bright); opacity: .94; }
.hero-content { position: relative; z-index: 2; max-width: 650px; }
.hero h1 em { color: #f5cf72; font-style: normal; }
.hero p { max-width: 540px; color: #cfe0da; }
.hero-meta { margin: 21px 0 0; color: #9ed1bd !important; font-size: 12px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.hero-meta span { padding: 0 5px; color: var(--coral); }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }

.button {
  min-height: 48px; padding: 0 21px; display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  border: 1px solid transparent; border-radius: 10px; background: var(--forest); color: #fff; font-weight: 700; cursor: pointer; transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease, border-color .18s ease;
}
.button:hover { transform: translateY(-2px); box-shadow: 0 9px 22px rgba(23,63,54,.16); }
.button:active { transform: translateY(0); box-shadow: none; }
.button.primary { background: var(--coral); }
.button.light { background: #fff; color: var(--forest); }
.button.ghost { border-color: rgba(255,255,255,.25); background: rgba(255,255,255,.08); }
.button.outline { border-color: var(--line); background: transparent; color: var(--forest); }
.button:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

.stats-row { margin: 26px 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border-block: 1px solid var(--line); }
.stat-card { min-width: 0; padding: 19px 22px; display: flex; align-items: center; gap: 14px; border-right: 1px solid var(--line); }
.stat-card:last-child { border-right: 0; }
.stat-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: var(--mint); }
.stat-icon svg { width: 20px; height: 20px; fill: none; stroke: var(--forest); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.stat-card strong { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.stat-card small { color: var(--muted); }

.section-head { margin: 46px 0 17px; display: flex; justify-content: space-between; align-items: end; gap: 18px; }
.section-head p { margin: 0; color: var(--muted); }
.text-link { min-height: 44px; padding: 0 3px; border: 0; background: none; color: var(--forest-2); font-weight: 700; cursor: pointer; text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 4px; transition: color .18s ease, text-decoration-color .18s ease; }
.text-link:hover { text-decoration-color: currentColor; }

.lesson-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.lesson-card {
  min-height: 250px; padding: 25px; display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); transition: transform .25s ease, box-shadow .25s ease;
}
.lesson-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); }
.lesson-number { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 12px; color: var(--forest); background: var(--mint); font-weight: 700; }
.lesson-card:nth-child(2) .lesson-number { background: #f9e3c3; }
.lesson-card:nth-child(3) .lesson-number { background: #dbeaf2; }
.lesson-card h3 { margin-top: 26px; font-size: 20px; }
.lesson-card p { color: var(--muted); line-height: 1.55; }
.lesson-meta { margin-top: auto; display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); }
.lesson-status { color: var(--forest-2); font-weight: 700; }

.quote-card { margin-top: 22px; padding: 24px 28px; display: flex; align-items: center; gap: 18px; border-radius: 20px; background: #f6ead9; }
.quote-mark { font-family: Georgia, serif; font-size: 52px; line-height: .5; color: var(--coral); }
.quote-card p { margin: 0; font-family: "Playfair Display", serif; font-size: 18px; }
.quote-card small { margin-left: auto; color: var(--muted); white-space: nowrap; }

.page-header { margin-bottom: 28px; display: flex; justify-content: space-between; align-items: end; gap: 20px; }
.page-header h1 { font-size: clamp(36px, 4vw, 50px); }

.path-list { display: grid; gap: 16px; }
.path-card {
  display: grid; grid-template-columns: 70px 1fr auto; gap: 22px; align-items: center;
  padding: 23px 25px; border: 1px solid var(--line); border-radius: 20px; background: var(--paper);
}
.path-badge { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 17px; background: var(--mint); font-size: 22px; font-weight: 700; }
.path-card p { margin: 0; color: var(--muted); }
.progress-mini { width: 120px; height: 6px; margin-top: 12px; overflow: hidden; border-radius: 99px; background: var(--line); }
.progress-mini span { display: block; height: 100%; background: var(--coral); }

.lesson-layout { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 22px; }
.lesson-sheet { padding: 36px; border: 1px solid var(--line); border-radius: 24px; background: var(--paper); }
.lesson-sheet h2 { font-size: 39px; }
.lesson-sheet .translation { color: var(--muted); font-size: 18px; }
.phrase-box { margin: 28px 0; padding: 25px; border: 1px solid var(--line); border-radius: 14px; background: var(--mint-2); }
.phrase-row { display: flex; justify-content: space-between; gap: 14px; align-items: center; }
.french-display { font-size: 30px; }
.speak-button { width: 46px; height: 46px; flex:0 0 auto; display:grid; place-items:center; border: 0; border-radius: 50%; background: var(--forest); color: white; cursor: pointer; }
.note { padding: 18px; border-radius: 15px; background: #fff4df; line-height: 1.6; }
.lesson-nav { margin-top: 30px; display: flex; justify-content: space-between; }
.lesson-index { padding: 22px; align-self: start; border-radius: 20px; background: var(--forest); color: white; }
.lesson-index h3 { margin-bottom: 18px; }
.lesson-index button { width: 100%; padding: 11px 12px; border: 0; border-radius: 10px; background: transparent; color: #bcd1ca; text-align: left; cursor: pointer; }
.lesson-index button.active { background: rgba(255,255,255,.12); color: white; }

.practice-tabs { display: flex; gap: 8px; margin-bottom: 25px; padding: 5px; width: fit-content; border-radius: 14px; background: #e8ebe6; }
.practice-tabs button { padding: 9px 17px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 700; cursor: pointer; }
.practice-tabs button.active { background: var(--paper); color: var(--forest); box-shadow: 0 3px 12px rgba(0,0,0,.06); }

.flash-wrap { max-width: 700px; margin: 0 auto; text-align: center; }
.flashcard { height: 365px; perspective: 1000px; cursor: pointer; }
.flash-inner { position: relative; width: 100%; height: 100%; transition: transform .55s cubic-bezier(.16,1,.3,1); transform-style: preserve-3d; }
.flashcard.flipped .flash-inner { transform: rotateY(180deg); }
.flash-face {
  position: absolute; inset: 0; padding: 34px; display: flex; flex-direction: column; justify-content: center; align-items: center;
  border-radius: 16px; backface-visibility: hidden; background: var(--paper); box-shadow: var(--shadow);
}
.flash-face.back { transform: rotateY(180deg); background: var(--forest); color: white; }
.flash-label { position: absolute; top: 25px; left: 27px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 1.3px; text-transform: uppercase; }
.back .flash-label { color: #9bbab0; }
.flash-face .french-display { font-size: clamp(38px, 6vw, 62px); }
.flash-face p { color: var(--muted); }
.back p { color: #c4d8d1; }
.flash-actions { margin-top: 22px; display: flex; justify-content: center; align-items: center; gap: 14px; }
.round-button { width: 48px; height: 48px; display:grid; place-items:center; border: 1px solid var(--line); border-radius: 50%; background: var(--paper); cursor: pointer; transition:border-color .18s ease, background-color .18s ease; }
.round-button:hover { border-color:var(--forest-2); background:var(--mint-2); }
.round-button svg, .speak-button svg { width:21px; height:21px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
.card-count { min-width: 80px; color: var(--muted); font-variant-numeric:tabular-nums; }

.quiz-card { max-width: 760px; margin: 0 auto; padding: 36px; border: 1px solid var(--line); border-radius: 25px; background: var(--paper); box-shadow: var(--shadow); }
.quiz-progress { height: 8px; overflow: hidden; border-radius: 99px; background: var(--line); }
.quiz-progress span { display: block; height: 100%; background: var(--coral); }
.quiz-card h2 { margin: 32px 0 25px; }
.answer-list { display: grid; gap: 11px; }
.answer-button { padding: 16px 18px; border: 1px solid var(--line); border-radius: 13px; background: white; text-align: left; cursor: pointer; }
.answer-button:hover { border-color: var(--forest-2); background: var(--mint-2); }
.answer-button.correct { border-color: #4d9c78; background: #e0f3e9; }
.answer-button.wrong { border-color: #d86b5c; background: #fde8e5; }
.quiz-feedback { min-height: 28px; margin: 16px 0 0; font-weight: 700; }

.progress-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 20px; }
.panel { padding: 27px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.big-score { margin: 24px 0 4px; font-family: "Playfair Display", serif; font-size: 70px; line-height: 1; color: var(--forest); }
.bar-chart { height: 190px; padding-top: 24px; display: flex; align-items: end; gap: 13px; }
.bar-item { height: 100%; flex: 1; display: flex; flex-direction: column; justify-content: end; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.bar { width: min(34px, 80%); min-height: 8px; border-radius: 7px 7px 3px 3px; background: var(--mint); }
.bar.today { background: var(--coral); }
.achievement-list { display: grid; gap: 13px; margin-top: 18px; }
.achievement { padding: 14px; display: flex; gap: 12px; align-items: center; border-radius: 14px; background: var(--mint-2); }
.achievement-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: var(--yellow); }

.toast { position: fixed; right: 26px; bottom: 26px; padding: 13px 18px; border-radius: 12px; color: #fff; background: var(--ink); opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .25s ease, transform .25s ease; z-index: 50; }
.toast.show { opacity: 1; transform: none; }
.empty { padding: 50px 20px; text-align: center; color: var(--muted); }

@media (max-width: 950px) {
  .app-shell { display: block; }
  .main-content { min-width: 0; }
  .sidebar { width:min(270px,calc(100vw - 48px)); padding-left:max(24px,env(safe-area-inset-left)); transform: translateX(-105%); transition: transform .25s cubic-bezier(.16,1,.3,1); box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .sidebar-scrim { position:fixed; inset:0; z-index:19; display:block; border:0; background:rgba(18,40,34,.46); backdrop-filter:blur(2px); }
  .sidebar-scrim[hidden] { display:none; }
  .mobile-header { position:sticky; top:0; z-index:15; height:72px; padding:0 max(22px,env(safe-area-inset-right)) 0 max(22px,env(safe-area-inset-left)); display:flex; justify-content:space-between; align-items:center; background:rgba(255,253,248,.96); border-bottom:1px solid var(--line); backdrop-filter:blur(12px); }
  .menu-button { width:44px; height:44px; display:grid; place-items:center; border:0; border-radius:10px; background:var(--mint); cursor:pointer; }
  .menu-button svg { width:22px; height:22px; fill:none; stroke:var(--forest); stroke-width:1.8; stroke-linecap:round; }
  .page { width: min(100% - 38px, 760px); padding-top: 28px; }
  .lesson-grid { grid-template-columns: 1fr; }
  .lesson-card { min-height: 220px; }
  .lesson-layout, .progress-grid { grid-template-columns: 1fr; }
  .lesson-index { order: -1; display: flex; gap: 4px; overflow-x: auto; }
  .lesson-index h3 { display: none; }
  .lesson-index button { width: auto; min-width: max-content; }
}

@media (max-width: 620px) {
  .hero { min-height:0; padding:38px 25px 42px; border-radius:18px; }
  .hero h1 { font-size:clamp(40px,12vw,56px); }
  .hero::after { right: 45px; }
  .stats-row { grid-template-columns: 1fr; }
  .stat-card { border-right:0; border-bottom:1px solid var(--line); }
  .stat-card:last-child { border-bottom:0; }
  .section-head, .page-header { align-items: start; flex-direction: column; }
  .quote-card { align-items: flex-start; }
  .quote-card small { display: none; }
  .path-card { grid-template-columns: 54px 1fr; gap: 14px; }
  .path-card .button { grid-column: 1 / -1; }
  .path-badge { width: 50px; height: 50px; }
  .lesson-sheet { padding: 25px; }
  .flashcard { height: 390px; }
  .quiz-card { padding: 25px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* Source-led edition */
.archive-hero::after { width: 220px; height: 220px; right: 120px; bottom: -155px; }
.source-strip { margin: 22px 0 24px; padding: 16px 0; display: grid; grid-template-columns: repeat(4,1fr); gap: 0; border-block: 1px solid var(--line); }
.source-strip div { display: grid; gap: 2px; }
.source-strip div + div { padding-left: 22px; border-left: 1px solid var(--line); }
.source-strip strong { font-family: "Playfair Display",serif; font-size: 17px; }
.source-strip small { color: var(--muted); }
.authority-note { margin: 22px 0; padding: 18px 20px; display: flex; align-items: flex-start; gap: 14px; border-radius: 12px; background: #f3e8d4; }
.authority-note > span { width: 28px; height: 28px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: var(--coral); color: white; font-family: Georgia,serif; font-weight: 700; }
.authority-note p { margin: 2px 0 0; line-height: 1.55; }
.card-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-topline.compact { justify-content: flex-start; margin-bottom: 8px; }
.level-pill { padding: 5px 9px; border-radius: 99px; background: #edf0ec; color: var(--forest-2); font-size: 11px; font-weight: 700; }
.source-author { margin: 25px 0 4px !important; color: var(--coral) !important; font-size: 12px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; }
.compact .source-author { margin: 0 !important; }
.source-card h3 { margin-top: 4px; }
.media-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 18px; }
.media-grid .media-card:nth-child(1):nth-last-child(2), .media-grid .media-card:nth-child(2):last-child { grid-column: span 1; }
.media-card { min-height: 235px; padding: 25px; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.media-card h3 { margin-top: 28px; font-size: 20px; }
.media-card p { color: var(--muted); line-height: 1.55; }
.source-type { color: var(--coral); font-size: 11px; font-weight: 700; letter-spacing: .7px; text-transform: uppercase; }
.external-link { margin-top: auto; color: var(--forest-2); font-weight: 700; text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 4px; transition: text-decoration-color .18s ease; }
.external-link:hover { text-decoration-color: currentColor; }
.method-ribbon { margin-bottom: 22px; padding: 16px 20px; display: flex; gap: 24px; flex-wrap: wrap; border-radius: 15px; color: white; background: var(--forest); font-size: 13px; }
.method-ribbon span { color: #bad2ca; }
.reading-sheet { padding-top: 28px; }
.source-citation { margin-bottom: 24px; padding-bottom: 20px; display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; border-bottom: 1px solid var(--line); font-size: 13px; }
.source-citation > span { color: var(--coral); font-size: 10px; font-weight: 700; letter-spacing: 1px; }
.source-citation a { color: var(--forest-2); font-weight: 700; }
.excerpt-card { margin: 0 0 18px; padding: 32px; border-radius: 16px; color: white; background: var(--forest); }
.excerpt-card .eyebrow { color: #9ed1bd; }
.excerpt-card blockquote { margin: 22px 0 0; font-family: "Playfair Display",serif; font-size: clamp(24px,3.2vw,37px); line-height: 1.45; }
.excerpt-card .speak-button { background: var(--coral); }
.translation-panel { margin-bottom: 28px; padding: 24px 26px; border: 1px solid var(--line); border-radius: 14px; background: #faf7ef; }
.translation-panel p:not(.eyebrow) { font-size: 17px; line-height: 1.65; }
.translation-panel small { color: var(--muted); }
.reading-note { color: var(--muted); line-height: 1.7; }
.vocab-grid { margin: 18px 0 10px; display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; }
.vocab-item { padding: 13px 15px; display: flex; justify-content: space-between; gap: 12px; border-radius: 12px; background: var(--mint-2); }
.vocab-item span { color: var(--muted); text-align: right; }
.cefr-sequence { display: grid; gap: 10px; }
.cefr-stage { padding: 16px; display: flex; gap: 15px; border: 1px solid var(--line); border-radius: 14px; }
.cefr-stage > span { color: var(--coral); font-weight: 700; }
.cefr-stage p { margin: 4px 0 0; color: var(--muted); line-height: 1.5; }
.source-list { display: grid; gap: 12px; }
.source-entry { padding: 18px 20px; display: grid; grid-template-columns: 58px 1fr auto; gap: 18px; align-items: center; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.source-entry h3 { margin: 2px 0 4px; }
.source-entry p { margin: 0; color: var(--muted); overflow-wrap:anywhere; }
.source-manifesto { line-height: 1.7; }
.source-manifesto .external-link { display: inline-block; margin-top: 8px; }

@media (max-width: 950px) {
  .source-strip { grid-template-columns: repeat(2,1fr); }
  .media-grid { grid-template-columns: 1fr; }
  .source-citation { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .source-strip { grid-template-columns: 1fr 1fr; padding: 12px 0; gap:0; }
  .source-strip div { padding:10px 8px; }
  .source-strip div + div { padding-left:16px; }
  .source-strip div:nth-child(3) { padding-left:8px; border-left:0; border-top:1px solid var(--line); }
  .source-strip div:nth-child(4) { border-top:1px solid var(--line); }
  .source-strip strong { font-size: 14px; }
  .method-ribbon { gap: 10px 18px; }
  .method-ribbon strong { width: 100%; }
  .vocab-grid { grid-template-columns: 1fr; }
  .source-entry { grid-template-columns: 50px 1fr; }
  .source-entry .button { grid-column: 1/-1; }
  .excerpt-card { padding: 23px; }
  .lesson-nav { gap: 10px; flex-direction: column; }
}

/* Complete 24-week course */
.course-progress { margin: 28px 0; padding: 25px 0; display: grid; grid-template-columns: minmax(0,1fr) minmax(240px,.65fr); align-items: end; gap: 36px; border-block: 1px solid var(--line); }
.course-progress h2 { margin-bottom: 4px; }
.course-progress p:last-child { margin: 0; color: var(--muted); }
.progress-meter { display:grid; grid-template-columns:1fr auto; gap:12px; align-items:center; }
.progress-meter::before { content:""; grid-column:1; grid-row:1; height:8px; border-radius:99px; background:#dce5df; }
.progress-meter > span { grid-column:1; grid-row:1; z-index:1; width:100%; height:8px; border-radius:99px; background:var(--coral); transform:scaleX(var(--progress,0)); transform-origin:left; transition:transform .55s cubic-bezier(.16,1,.3,1); }
.progress-meter strong { grid-column:2; font-variant-numeric:tabular-nums; }
.level-route { display:grid; grid-template-columns:repeat(3,1fr); gap:0; margin:28px 0; border-block:1px solid var(--line); }
.level-card { position:relative; min-width:0; min-height:285px; padding:27px 28px 28px; overflow:hidden; border-right:1px solid var(--line); cursor:pointer; transition:background-color .2s ease, color .2s ease; }
.level-card:last-child { border-right:0; }
.level-card:hover { background:var(--paper); }
.level-index { width:48px; height:48px; display:grid; place-items:center; margin-bottom:26px; border-radius:12px; background:var(--mint); font-family:"Playfair Display",serif; font-size:20px; font-weight:700; }
.level-card:nth-child(2) .level-index { background:#f8e3bf; }
.level-card:nth-child(3) .level-index { background:#daeaf2; }
.level-card h3 { font-size:23px; }
.level-card .stage-meta { margin-bottom:10px; color:var(--coral); font-size:12px; font-weight:700; letter-spacing:.05em; text-transform:uppercase; }
.level-card p:not(.eyebrow):not(.stage-meta) { color:var(--muted); line-height:1.55; }
.level-card small { display:block; padding-right:20px; color:var(--forest-2); }
.level-arrow { position:absolute; right:24px; bottom:22px; font-size:22px; }
.week-feature { padding:27px; display:grid; grid-template-columns:72px 1.1fr 1fr; gap:22px; align-items:center; border:1px solid var(--line); border-radius:16px; background:var(--paper); }
.feature-number { font-family:"Playfair Display",serif; font-size:54px; color:var(--coral); }
.week-feature h3 { margin:12px 0 7px; font-size:22px; }
.week-feature p { color:var(--muted); line-height:1.5; }
.feature-units { display:grid; gap:8px; }
.mini-unit { width:100%; min-height:48px; padding:10px 13px; display:grid; grid-template-columns:30px 1fr auto; gap:10px; align-items:center; border:1px solid var(--line); border-radius:10px; background:#fff; text-align:left; cursor:pointer; transition:border-color .18s ease, background-color .18s ease; }
.mini-unit:hover { border-color:var(--forest-2); }
.mini-unit > span { width:26px; height:26px; display:grid; place-items:center; border-radius:50%; background:var(--mint); font-size:12px; font-weight:700; }
.mini-unit.done > span { color:white; background:var(--forest-2); }
.mini-unit small { color:var(--muted); }
.filter-tabs { width:fit-content; margin:0 0 25px; padding:4px; display:flex; gap:4px; overflow-x:auto; overscroll-behavior-inline:contain; border-radius:11px; background:#e5ebe6; }
.filter-tabs a { min-height:42px; padding:0 16px; display:grid; place-items:center; border-radius:8px; color:var(--muted); font-weight:700; }
.filter-tabs a.active { color:var(--forest); background:var(--paper); box-shadow:0 4px 12px rgba(23,63,54,.08); }
.completion-label { padding:8px 0; color:var(--forest-2); font-weight:700; font-variant-numeric:tabular-nums; white-space:nowrap; }
.week-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:17px; }
.week-card { min-width:0; min-height:245px; padding:23px; display:flex; flex-direction:column; border:1px solid var(--line); border-radius:14px; background:var(--paper); cursor:pointer; transition:transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.week-card:hover { transform:translateY(-3px); border-color:transparent; box-shadow:var(--shadow); }
.week-card-top { display:flex; justify-content:space-between; align-items:center; }
.week-no { font-family:"Playfair Display",serif; font-size:17px; font-weight:700; }
.week-card .source-author { margin-top:28px !important; }
.week-card h2 { margin-bottom:8px; font-size:20px; letter-spacing:-.02em; }
.week-card > p:not(.source-author) { color:var(--muted); line-height:1.5; }
.unit-dots { margin-top:auto; display:flex; align-items:center; gap:6px; }
.unit-dots span { width:24px; height:6px; border-radius:99px; background:var(--line); }
.unit-dots span.done { background:var(--coral); }
.unit-dots small { margin-left:auto; color:var(--muted); }
.week-overview-head { margin-bottom:25px; }
.week-context { margin:15px 0 13px; display:flex; align-items:center; gap:10px; color:var(--coral); font-weight:700; }
.week-overview-head h1 { font-size:clamp(42px,5vw,62px); }
.week-source-banner { padding:32px; display:grid; grid-template-columns:.7fr 1.3fr; gap:30px; align-items:center; border-radius:16px; color:white; background:var(--forest); }
.week-source-banner p:last-child { margin:0; color:#bcd1ca; }
.week-source-banner blockquote { margin:0; padding-left:25px; border-left:1px solid rgba(255,255,255,.38); font-family:"Playfair Display",serif; font-size:23px; line-height:1.5; }
.unit-list { display:grid; gap:12px; }
.unit-row { min-width:0; padding:19px 20px; display:grid; grid-template-columns:48px minmax(0,1fr) auto; gap:18px; align-items:center; border:1px solid var(--line); border-radius:14px; background:var(--paper); cursor:pointer; transition:border-color .18s ease, transform .18s ease, background-color .18s ease; }
.unit-row:hover { border-color:#9fbab0; transform:translateX(3px); }
.unit-row.completed { background:#f5faf7; }
.unit-kind-icon { width:44px; height:44px; display:grid; place-items:center; border-radius:11px; color:var(--forest); background:var(--mint); font-size:18px; font-weight:700; }
.unit-kind-icon svg { width:21px; height:21px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
.unit-row h3 { margin:3px 0 5px; }
.unit-row > div, .source-entry > div { min-width:0; }
.unit-row p:last-child { margin:0; color:var(--muted); }
.unit-meta { margin:0; color:var(--coral); font-size:11px; font-weight:700; letter-spacing:.05em; text-transform:uppercase; }
.unit-action { color:var(--forest-2); font-weight:700; white-space:nowrap; }
.week-nav { margin-top:25px; display:flex; justify-content:space-between; }
.unit-header { margin-bottom:24px; }
.unit-header > div { margin:25px 0 12px; display:flex; gap:10px; align-items:center; }
.unit-header h1 { max-width:920px; font-size:clamp(38px,4.5vw,58px); }
.unit-duration { color:var(--muted); font-size:13px; }
.unit-sheet { padding:31px; border:1px solid var(--line); border-radius:16px; background:var(--paper); }
.unit-columns { margin:30px 0 10px; display:grid; grid-template-columns:1fr 1fr; gap:30px; }
.unit-columns h2 { font-size:26px; }
.unit-footer { margin-top:18px; display:grid; grid-template-columns:1fr auto 1fr; gap:12px; }
.unit-footer button:last-child { justify-self:end; }
.official-source-mark { margin-bottom:22px; display:flex; gap:17px; align-items:center; }
.official-source-mark > span { width:64px; height:64px; display:grid; place-items:center; border-radius:12px; color:white; background:var(--forest); font-weight:700; }
.official-source-mark h2 { margin-bottom:3px; }
.official-source-mark p:last-child { margin:0; color:var(--muted); }
.media-launch { min-height:290px; padding:36px; display:grid; grid-template-columns:1fr 180px; gap:25px; align-items:center; border-radius:16px; color:white; background:var(--forest); }
.media-launch h2 { margin:18px 0 10px; font-size:35px; }
.media-launch p { max-width:630px; color:#c4d8d1; line-height:1.6; }
.media-launch .button { margin-top:10px; }
.media-symbol { width:150px; height:150px; display:grid; place-items:center; border:35px solid rgba(255,255,255,.07); border-radius:50%; color:var(--yellow); background:rgba(255,255,255,.05); }
.media-symbol svg { width:42px; height:42px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linejoin:round; }
.task-list { display:grid; gap:10px; }
.task-check { min-height:52px; padding:16px; display:flex; align-items:center; gap:14px; border:1px solid var(--line); border-radius:11px; cursor:pointer; transition:border-color .18s ease, background-color .18s ease; }
.task-check:focus-within { border-color:var(--focus); }
.task-check:has(input:checked) { background:var(--mint-2); }
.task-check input { width:18px; height:18px; accent-color:var(--forest-2); }
.task-check span { display:flex; gap:14px; align-items:center; }
.task-check strong { color:var(--coral); }
.lab-brief { padding:29px; display:grid; grid-template-columns:1fr 1fr; gap:30px; align-items:center; border-radius:16px; background:#f5ebd9; }
.lab-brief blockquote { margin:0; padding-left:22px; border-left:1px solid rgba(23,63,54,.3); font-family:"Playfair Display",serif; font-size:20px; line-height:1.55; }
.focus-chip { display:inline-block; padding:7px 10px; border-radius:99px; background:#fff8; color:var(--forest-2); font-size:12px; font-weight:700; }
.response-prompt { margin-top:25px; padding:25px; border:1px solid var(--line); border-radius:14px; }
.response-prompt h3 { line-height:1.5; }
.prompt-meta, .panel-meta, .dialog-kicker { margin:0 0 14px; color:var(--muted); font-size:13px; }
.response-prompt textarea { width:100%; min-height:150px; margin:12px 0; padding:16px; resize:vertical; border:1px solid var(--line); border-radius:13px; color:var(--ink); background:#fff; line-height:1.55; }
.response-prompt textarea:focus-visible { outline:3px solid var(--focus); outline-offset:2px; border-color:var(--focus); }
.self-check { margin-top:14px; padding:17px; border-radius:13px; background:var(--mint-2); }
.self-check p { margin:7px 0; }
.self-check a { color:var(--forest-2); font-weight:700; }
.review-layout { display:grid; grid-template-columns:minmax(0,1fr) 300px; gap:22px; align-items:start; }
.review-stats { position:sticky; top:25px; }
.review-stat { padding:16px 0; display:flex; justify-content:space-between; align-items:end; border-bottom:1px solid var(--line); }
.review-stat strong { font-family:"Playfair Display",serif; font-size:34px; }
.review-stat span { color:var(--muted); }
.review-stats .button { width:100%; margin-top:20px; }

@media (max-width:1100px) {
  .week-grid { grid-template-columns:repeat(2,1fr); }
  .week-feature { grid-template-columns:70px 1fr; }
  .feature-units { grid-column:1/-1; }
}
@media (max-width:950px) {
  .level-route { grid-template-columns:1fr; }
  .level-card { min-height:220px; }
  .week-source-banner, .unit-columns, .lab-brief { grid-template-columns:1fr; }
  .review-layout { grid-template-columns:1fr; }
  .review-stats { position:static; }
}
@media (max-width:620px) {
  .course-progress { grid-template-columns:1fr; align-items:start; gap:18px; }
  .week-feature { grid-template-columns:1fr; }
  .feature-number { font-size:40px; }
  .week-grid { grid-template-columns:1fr; }
  .filter-tabs { width:100%; overflow-x:auto; }
  .filter-tabs a { white-space:nowrap; }
  .week-source-banner { padding:24px; }
  .week-source-banner blockquote { font-size:19px; }
  .unit-row { grid-template-columns:44px 1fr; }
  .unit-action { grid-column:1/-1; min-height:42px; display:flex; align-items:center; justify-content:center; border-top:1px solid var(--line); }
  .unit-sheet { padding:20px; }
  .media-launch { grid-template-columns:1fr; padding:25px; }
  .media-symbol { display:none; }
  .unit-footer { grid-template-columns:1fr 1fr; }
  .unit-footer [data-complete-unit] { grid-column:1/-1; grid-row:1; }
  .unit-footer button:last-child { justify-self:stretch; }
  .source-citation { gap:7px; }
}

@media (max-width:460px) {
  .page { width:calc(100% - 28px); }
  .hero-actions { display:grid; grid-template-columns:1fr; }
  .hero-actions .button { width:100%; }
  .week-nav { display:grid; grid-template-columns:1fr; gap:10px; }
  .week-nav .button { width:100%; }
  .course-progress h2 { font-size:27px; }
}

@media (hover:none) {
  .week-card:hover, .button:hover, .unit-row:hover { transform:none; }
}

/* Account and cross-device sync */
body.modal-open, body.nav-open { overflow:hidden; }
.sidebar-profile.is-signed-in .profile-avatar { color:white; background:var(--forest-2); }
.account-modal[hidden] { display:none; }
.account-modal { position:fixed; inset:0; z-index:1000; display:grid; place-items:center; padding:22px; }
.modal-scrim { position:absolute; inset:0; width:100%; height:100%; border:0; background:rgba(16,35,30,.58); backdrop-filter:blur(5px); cursor:default; }
.account-dialog { position:relative; width:min(520px,100%); max-height:calc(100vh - 44px); overflow:auto; overscroll-behavior:contain; padding:30px; border-radius:16px; background:var(--paper); box-shadow:0 28px 80px rgba(16,35,30,.28); }
.account-dialog-head { margin-bottom:24px; display:flex; justify-content:space-between; gap:20px; align-items:flex-start; }
.account-dialog-head h2 { margin:0 0 5px; font-size:30px; }
.account-dialog-head .dialog-kicker { margin:0; }
.modal-close { width:42px; height:42px; flex:0 0 auto; border:1px solid var(--line); border-radius:50%; color:var(--ink); background:white; font-size:24px; line-height:1; cursor:pointer; transition:border-color .18s ease, background-color .18s ease; }
.modal-close:hover { border-color:var(--forest-2); background:var(--mint-2); }
.auth-tabs { margin-bottom:22px; padding:4px; display:grid; grid-template-columns:1fr 1fr; gap:4px; border-radius:11px; background:#e8ebe6; }
.auth-tabs button { padding:10px 12px; border:0; border-radius:9px; color:var(--muted); background:transparent; font-weight:700; cursor:pointer; }
.auth-tabs button.active { color:var(--forest); background:white; box-shadow:0 3px 10px rgba(0,0,0,.07); }
.auth-form { display:grid; gap:16px; }
.auth-form label { display:grid; gap:7px; color:var(--forest); font-size:13px; font-weight:700; }
.auth-form input { width:100%; padding:13px 14px; border:1px solid var(--line); border-radius:11px; color:var(--ink); background:white; font:inherit; }
.auth-form input:focus-visible { outline:3px solid var(--focus); outline-offset:2px; border-color:var(--focus); }
.auth-form .button { width:100%; margin-top:3px; }
.auth-form .button:disabled { opacity:.65; cursor:wait; }
.form-message { min-height:20px; margin:0; color:var(--coral); font-size:13px; line-height:1.45; }
.account-note { margin-top:19px; padding:14px 16px; display:grid; gap:3px; border-radius:11px; background:var(--mint-2); }
.account-note strong { color:var(--forest); font-size:13px; }
.account-note span { color:var(--muted); font-size:12px; line-height:1.45; }
.cloud-setup-card { padding:8px 2px 2px; text-align:center; }
.cloud-icon { width:62px; height:62px; margin:0 auto 16px; display:grid; place-items:center; border-radius:12px; color:white; background:var(--forest); font-size:25px; }
.cloud-icon svg { width:28px; height:28px; fill:none; stroke:currentColor; stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; }
.cloud-setup-card h3 { margin:0 0 9px; font-size:23px; }
.cloud-setup-card > p { margin:0; color:var(--muted); line-height:1.6; }
.cloud-setup-card .account-note { text-align:left; }
.account-identity { padding:18px; display:flex; gap:14px; align-items:center; border:1px solid var(--line); border-radius:12px; }
.account-identity > span { width:52px; height:52px; display:grid; place-items:center; border-radius:11px; color:white; background:var(--forest-2); font-weight:700; }
.account-identity h3 { margin:3px 0 0; font-size:17px; overflow-wrap:anywhere; }
.sync-summary { margin:16px 0; padding:17px 18px; display:flex; gap:12px; align-items:flex-start; border-radius:11px; background:var(--mint-2); }
.sync-dot { width:9px; height:9px; margin-top:5px; flex:0 0 auto; border-radius:50%; background:#45a478; box-shadow:0 0 0 4px rgba(69,164,120,.14); }
.sync-summary div { display:grid; gap:4px; }
.sync-summary small { color:var(--muted); line-height:1.45; }
.account-actions { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.danger-link { width:100%; min-height:44px; margin-top:18px; padding:8px; border:0; color:#a3483d; background:transparent; font-weight:700; cursor:pointer; text-decoration:underline; text-decoration-color:transparent; text-underline-offset:4px; }
.danger-link:hover { text-decoration-color:currentColor; }

@media (max-width:620px) {
  .account-modal { padding:0; align-items:end; }
  .account-dialog { width:100%; max-height:92vh; padding:24px 20px max(24px,env(safe-area-inset-bottom)); border-radius:18px 18px 0 0; }
  .account-dialog-head h2 { font-size:25px; }
  .account-actions { grid-template-columns:1fr; }
}
