/* ============ Tokens ============ */
:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --fill: #f5f5f7;
  --fill-2: #e8e8ed;
  --fill-3: #d2d2d7;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #86868b;
  --line: rgba(0, 0, 0, .08);
  --line-2: rgba(0, 0, 0, .14);
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-text: #0066cc;
  --accent-soft: rgba(0, 113, 227, .08);
  --green: #1a7f37;
  --green-mark: #34c759;
  --green-soft: rgba(52, 199, 89, .12);
  --red: #d70015;
  --red-mark: #ff3b30;
  --red-soft: rgba(255, 59, 48, .09);
  --orange: #b25000;
  --orange-mark: #ff9f0a;
  --orange-soft: rgba(255, 159, 10, .13);
  --indigo: #5856d6;
  --indigo-soft: rgba(88, 86, 214, .10);
  --teal: #0b7a8a;
  --teal-mark: #30b0c7;
  --teal-soft: rgba(48, 176, 199, .12);
  --r-xl: 1.5rem;
  --r-lg: 1.25rem;
  --r-md: 0.875rem;
  --r-sm: 0.625rem;
  --shadow: 0 1px 1px rgba(0, 0, 0, .02), 0 2px 0.75rem rgba(0, 0, 0, .045);
  --shadow-lg: 0 0.25rem 0.625rem rgba(0, 0, 0, .04), 0 1.5rem 3.75rem rgba(0, 0, 0, .14);
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --serif: "Newsreader", "New York", "Iowan Old Style", Georgia, serif;
  --topbar: 4rem;
  --ease: cubic-bezier(.25, .1, .25, 1);
}

/* ============ Base ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { font-size: clamp(15px, min(calc(0.36vw + 12px), calc(1.15vh + 8.2px)), 20px); }
html, body { height: 100%; }
body {
  font-family: var(--font);
  font-feature-settings: "cv11", "ss01";
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.45;
  letter-spacing: -.011em;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; letter-spacing: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 0.1875rem solid rgba(0, 113, 227, .35); outline-offset: 2px; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
input { font: inherit; color: inherit; }
kbd {
  font: 500 0.6875rem/1 var(--font); padding: 0.1875rem 0.3125rem; border-radius: 0.3125rem; margin-left: 0.25rem;
  background: rgba(0, 0, 0, .06); color: inherit; opacity: .8;
}
.btn.primary kbd { background: rgba(255, 255, 255, .22); }
.tabnum { font-variant-numeric: tabular-nums; }

/* ============ Top bar ============ */
.topbar {
  height: var(--topbar); flex: none; position: relative; z-index: 20;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 0 1.5rem;
  background: rgba(245, 245, 247, .8);
  backdrop-filter: saturate(180%) blur(1.25rem);
  -webkit-backdrop-filter: saturate(180%) blur(1.25rem);
  border-bottom: 1px solid var(--line);
}
.brand-wrap { display: flex; align-items: center; gap: 0.625rem; min-width: 0; white-space: nowrap; }
.brand { display: inline-flex; align-items: center; gap: 0.4375rem; color: var(--text); text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand b { font-size: 1.375rem; font-weight: 700; letter-spacing: -.045em; line-height: 1; }
.logo { width: 1.75rem; height: 1.75rem; flex: none; }
.logo .logo-card { fill: var(--text); }
.logo .logo-fold { fill: var(--accent); }
.top-icons { display: inline-flex; gap: 0.25rem; margin-left: 0.25rem; }
.top-icon { width: 2.5rem; height: 2.5rem; border-radius: 0.75rem; display: grid; place-items: center; color: var(--text-2); transition: background .15s, color .15s; }
.top-icon:hover { background: var(--fill-2); color: var(--text); text-decoration: none; }
.top-icon.on { background: var(--text); color: #fff; }
.top-icon svg { width: 1.375rem; height: 1.375rem; }
.crumb { display: inline-flex; align-items: center; gap: 0.625rem; min-width: 0; font-size: 0.8125rem; color: var(--text-2); }
.crumb a { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; }
.crumb a:hover { color: var(--text); text-decoration: none; }
.crumb .sep { width: 1px; height: 0.875rem; background: var(--line-2); }
.seg { display: flex; gap: 2px; padding: 0.1875rem; border-radius: 0.6875rem; background: var(--fill-2); }
.seg button {
  padding: 0.5rem 1.125rem; border-radius: 0.5rem; font-size: 0.875rem; font-weight: 500; color: var(--text-2);
  transition: background .2s var(--ease), color .2s var(--ease), box-shadow .2s var(--ease);
}
.seg button:hover { color: var(--text); }
.seg button.on { background: #fff; color: var(--text); box-shadow: 0 1px 0.1875rem rgba(0, 0, 0, .1), 0 0 0 .5px rgba(0, 0, 0, .04); }
.top-right { grid-column: 3; justify-self: end; display: flex; align-items: center; gap: 0.5rem; }
.top-right .link { font-size: 0.8125rem; }

.pill {
  display: inline-flex; align-items: center; gap: 0.625rem; height: 2.125rem; padding: 0 0.75rem 0 0.75rem; position: relative; overflow: hidden;
  border-radius: 61.25rem; background: #fff; box-shadow: 0 0 0 1px var(--line), 0 1px 0.1875rem rgba(0, 0, 0, .06);
  font-size: 0.8125rem; font-weight: 500; max-width: 27.5rem;
}
.pill-left { font-size: 0.75rem; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.pill-prog { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--accent); transform-origin: left; transition: transform 1s linear; }
.pill.late .pill-prog { background: var(--orange-mark); }
.pill-dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--green-mark); box-shadow: 0 0 0 0.1875rem var(--green-soft); flex: none; animation: pulse 2s infinite; }
.pill.late .pill-dot { background: var(--orange-mark); box-shadow: 0 0 0 0.1875rem var(--orange-soft); }
.pill-txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.pill-time { font-variant-numeric: tabular-nums; padding: 0.1875rem 0.5rem; border-radius: 61.25rem; background: var(--fill); }
.pill.late .pill-time { background: var(--orange-soft); color: var(--orange); }
@keyframes pulse { 50% { opacity: .45; } }

/* ============ Layout ============ */
main#app { flex: 1; min-height: 0; padding: 1.25rem 1.5rem 1.5rem; width: 100%; max-width: 102.5rem; margin: 0 auto; }
.view { height: 100%; min-height: 0; display: grid; gap: 1.125rem; }
.card {
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow);
  padding: 1.75rem; min-height: 0; min-width: 0; position: relative;
}
.scroll { overflow: auto; scrollbar-width: thin; }
.eyebrow { font-size: 0.8125rem; font-weight: 600; letter-spacing: .01em; color: var(--text-3); }
.eyebrow.accent { color: var(--accent-text); }
.eyebrow.orange { color: var(--orange); }
.muted { color: var(--text-2); }
.small { font-size: 0.8125rem; }
.grow { flex: 1; }
h1, h2, h3, h4 { font-weight: 600; letter-spacing: -.022em; line-height: 1.15; }
h1 { font-size: 2.25rem; letter-spacing: -.035em; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.1875rem; letter-spacing: -.02em; }
h4 { font-size: 0.875rem; letter-spacing: -.005em; color: var(--text-2); font-weight: 600; }
.serif { font-family: var(--serif); }
.quote { font-family: var(--serif); font-style: italic; font-size: 1.1875rem; line-height: 1.4; letter-spacing: 0; color: var(--text); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.375rem;
  height: 2.625rem; padding: 0 1.25rem; border-radius: 61.25rem; font-size: 0.9375rem; font-weight: 500; white-space: nowrap;
  transition: background .15s var(--ease), color .15s, transform .1s, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); text-decoration: none; }
.btn.primary:disabled { background: var(--fill-3); color: #fff; cursor: default; transform: none; }
.btn.secondary { background: var(--fill-2); color: var(--text); }
.btn.secondary:hover { background: #dedee3; text-decoration: none; }
.btn.ghost { color: var(--accent-text); padding: 0 0.625rem; }
.btn.ghost:hover { background: var(--accent-soft); text-decoration: none; }
.btn.ghost.gray { color: var(--text-2); }
.btn.ghost.gray:hover { background: var(--fill); }
.btn.lg { height: 3.125rem; padding: 0 1.625rem; font-size: 1rem; }
.btn.xl { height: 3.5rem; padding: 0 1.875rem; font-size: 1.0625rem; font-weight: 600; }
.btn.sm { height: 2.125rem; padding: 0 0.875rem; font-size: 0.8438rem; }
.btn svg { width: 0.9375rem; height: 0.9375rem; flex: none; }
.icon-btn { width: 1.875rem; height: 1.875rem; border-radius: 50%; display: grid; place-items: center; color: var(--text-2); background: var(--fill); }
.icon-btn:hover { background: var(--fill-2); color: var(--text); }
.icon-btn svg { width: 0.875rem; height: 0.875rem; }
.link { color: var(--accent-text); font-weight: 500; font-size: 0.875rem; display: inline-flex; align-items: center; gap: 0.25rem; }
.link svg { width: 0.75rem; height: 0.75rem; }

/* Tags & chips */
.tag { display: inline-flex; align-items: center; height: 1.5rem; padding: 0 0.625rem; border-radius: 61.25rem; font-size: 0.75rem; font-weight: 600; background: var(--accent-soft); color: var(--accent-text); }
.tag.ghost { background: var(--fill); color: var(--text-2); font-weight: 500; }
.chip {
  display: inline-flex; align-items: center; gap: 0.375rem; height: 2rem; padding: 0 0.875rem; border-radius: 61.25rem;
  font-size: 0.8125rem; font-weight: 500; background: var(--fill); color: var(--text); transition: background .15s, color .15s, box-shadow .15s;
}
.chip:hover { background: var(--fill-2); }
.chip.on { background: var(--text); color: #fff; }
.chip .n { color: var(--text-3); font-variant-numeric: tabular-nums; font-weight: 500; }
.chip.on .n { color: rgba(255, 255, 255, .6); }
.chip:disabled { opacity: .4; cursor: default; background: var(--fill); }

/* Status dots */
.dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; flex: none; background: var(--fill-3); }
.dot.weak { background: var(--red-mark); }
.dot.mid { background: var(--orange-mark); }
.dot.good { background: var(--green-mark); }

/* Bars */
.bar { height: 0.375rem; border-radius: 0.1875rem; background: var(--fill-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 0.1875rem; background: var(--accent); transition: width .6s var(--ease); }
.bar.weak > i { background: var(--red-mark); }
.bar.mid > i { background: var(--orange-mark); }
.bar.good > i { background: var(--green-mark); }

/* Toggle switch */
.switch { display: inline-flex; align-items: center; gap: 0.625rem; font-size: 0.875rem; cursor: pointer; user-select: none; }
.switch i { width: 2.375rem; height: 1.4375rem; border-radius: 61.25rem; background: var(--fill-3); position: relative; transition: background .2s; flex: none; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 1.1875rem; height: 1.1875rem; border-radius: 50%; background: #fff; box-shadow: 0 1px 0.1875rem rgba(0, 0, 0, .2); transition: transform .2s var(--ease); }
.switch.on i { background: var(--green-mark); }
.switch.on i::after { transform: translateX(0.9375rem); }

.segmented { display: inline-flex; padding: 2px; border-radius: 0.5625rem; background: var(--fill-2); }
.segmented button { padding: 0.25rem 0.875rem; border-radius: 0.4375rem; font-size: 0.8125rem; font-weight: 500; color: var(--text-2); font-variant-numeric: tabular-nums; }
.segmented button.on { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }

/* ============ PLAN ============ */
.plan { grid-template-columns: 21.25rem minmax(0, 1fr) minmax(0, 1.05fr); }
.plan-ctrl { display: flex; flex-direction: column; }
.plan-ctrl .display { font-size: 3.5rem; font-weight: 600; letter-spacing: -.045em; line-height: 1; margin-top: 0.625rem; font-variant-numeric: tabular-nums; }
.plan-ctrl .sub { color: var(--text-2); margin-top: 0.375rem; font-size: 0.875rem; }
.range { margin-top: 1.375rem; position: relative; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 1.375rem; background: transparent; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 0.25rem; border-radius: 2px; background: linear-gradient(to right, var(--accent) var(--p, 20%), var(--fill-2) var(--p, 20%)); }
input[type=range]::-moz-range-track { height: 0.25rem; border-radius: 2px; background: var(--fill-2); }
input[type=range]::-moz-range-progress { height: 0.25rem; border-radius: 2px; background: var(--accent); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 1.375rem; height: 1.375rem; border-radius: 50%; background: #fff; margin-top: -0.5625rem; box-shadow: 0 0 0 .5px rgba(0, 0, 0, .08), 0 2px 0.375rem rgba(0, 0, 0, .2); }
input[type=range]::-moz-range-thumb { width: 1.375rem; height: 1.375rem; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 0 0 .5px rgba(0, 0, 0, .08), 0 2px 0.375rem rgba(0, 0, 0, .2); }
input[type=range]:disabled { opacity: .45; cursor: default; }
.range-scale { position: relative; height: 1rem; margin-top: 0.25rem; font-size: 0.6875rem; color: var(--text-3); font-variant-numeric: tabular-nums; }
.range-scale span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.range-scale span:first-child { transform: none; }
.range-scale span:last-child { transform: translateX(-100%); }
.ctrl-label { margin-top: 1.375rem; margin-bottom: 0.5rem; font-size: 0.8125rem; font-weight: 600; color: var(--text-2); display: flex; justify-content: space-between; }
.ctrl-label span { font-weight: 400; color: var(--text-3); }
.part-toggles { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.375rem; }
.ptog { height: 2.375rem; border-radius: 0.625rem; background: var(--fill); font-weight: 600; font-size: 0.875rem; color: var(--text-2); transition: all .15s; font-family: var(--serif); letter-spacing: .02em; }
.ptog:hover { background: var(--fill-2); }
.ptog.on { background: var(--text); color: #fff; }
.ptog:disabled { opacity: .5; cursor: default; }
.mix { margin-top: 1.375rem; }
.mix-bar { display: flex; height: 0.625rem; border-radius: 0.3125rem; overflow: hidden; gap: 2px; }
.mix-bar i { display: block; height: 100%; transition: flex-grow .4s var(--ease); }
.mix-legend { display: grid; grid-template-columns: 1fr; gap: 0.3125rem; margin-top: 0.75rem; font-size: 0.7813rem; color: var(--text-2); }
.mix-legend div { display: flex; align-items: center; gap: 0.4375rem; }
.mix-legend b { margin-left: auto; font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums; }
.sw { width: 0.5rem; height: 0.5rem; border-radius: 2px; flex: none; }
.c-read { background: var(--indigo); }
.c-ex { background: var(--accent); }
.c-refl { background: var(--teal-mark); }
.c-weak { background: var(--orange-mark); }
.c-rest { background: var(--fill-3); }
.ctrl-foot { margin-top: auto; padding-top: 1.125rem; display: flex; flex-direction: column; gap: 0.5rem; }
.ctrl-foot .btn { width: 100%; }
.note { font-size: 0.7813rem; color: var(--text-2); line-height: 1.4; }
.note.warn { color: var(--orange); }

.plan-tl { display: flex; flex-direction: column; padding: 1.375rem 0.75rem 0.875rem; }
.tl-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 0.75rem 0.75rem; }
.tl-head span { font-size: 0.8125rem; color: var(--text-3); font-variant-numeric: tabular-nums; }
.tl { list-style: none; flex: 1; min-height: 0; overflow: auto; scrollbar-width: thin; }
.tl-row {
  display: grid; grid-template-columns: 2.875rem 0.875rem 1fr auto; align-items: center; gap: 0.5rem;
  height: 2.625rem; padding: 0 0.75rem; border-radius: 0.625rem; cursor: pointer; transition: background .12s;
  font-size: 0.9375rem;
}
.tl-row:hover { background: var(--fill); }
.tl-row.sel { background: var(--accent-soft); }
.tl-time { font-size: 0.75rem; color: var(--text-3); font-variant-numeric: tabular-nums; }
.tl-dot { width: 0.625rem; height: 0.625rem; border-radius: 0.1875rem; justify-self: center; }
.tl-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.tl-min { font-size: 0.7813rem; color: var(--text-2); font-variant-numeric: tabular-nums; }
.tl-row.done .tl-title { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--fill-3); }
.tl-row.done .tl-dot { opacity: .35; }
.tl-row.now { box-shadow: inset 0 0 0 1.5px var(--accent); }
.tl-row.pause .tl-title { color: var(--text-2); font-weight: 400; }

.plan-detail { display: flex; flex-direction: column; padding: 1.75rem; }
.pd-top { display: flex; align-items: center; gap: 0.5rem; }
.pd-title { font-size: 1.75rem; letter-spacing: -.03em; margin-top: 0.625rem; }
.pd-when { color: var(--text-3); font-size: 0.8125rem; margin-top: 0.375rem; font-variant-numeric: tabular-nums; }
.pd-desc { margin-top: 1.125rem; font-size: 0.9688rem; line-height: 1.5; color: var(--text); max-width: 60ch; }
.pd-why { margin-top: 1rem; padding: 0.875rem 1rem; border-radius: var(--r-md); background: var(--fill); font-size: 0.8438rem; color: var(--text-2); line-height: 1.45; }
.pd-why b { color: var(--text); font-weight: 600; }
.pd-list { margin-top: 1rem; list-style: none; display: grid; gap: 0.4375rem; font-size: 0.8438rem; color: var(--text-2); }
.pd-list li { display: flex; gap: 0.5625rem; }
.pd-list li::before { content: ""; width: 0.3125rem; height: 0.3125rem; border-radius: 50%; background: var(--fill-3); margin-top: 0.4375rem; flex: none; }
.pd-foot { margin-top: auto; padding-top: 1.25rem; display: flex; align-items: center; gap: 0.625rem; flex-wrap: wrap; }
.countdown { font-size: 2.75rem; font-weight: 600; letter-spacing: -.04em; font-variant-numeric: tabular-nums; line-height: 1; }
.countdown.late { color: var(--orange); }
.pd-run { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; padding: 1rem 1.125rem; border-radius: var(--r-md); background: var(--accent-soft); margin-top: 1.125rem; }
.pd-run .small { color: var(--accent-text); font-weight: 500; }

/* ============ CARTE ============ */
.carte { grid-template-columns: 15.625rem minmax(0, 1fr); }
.c-nav { padding: 0.75rem; display: flex; flex-direction: column; gap: 2px; }
.c-nav-item {
  display: grid; grid-template-columns: 2.125rem 1fr; align-items: center; gap: 0.375rem 0.625rem; text-align: left;
  padding: 0.625rem 0.75rem; border-radius: 0.75rem; transition: background .12s;
}
.c-nav-item:hover { background: var(--fill); }
.c-nav-item.on { background: var(--accent-soft); }
.c-nav-item .r { font-family: var(--serif); font-size: 1.125rem; font-weight: 500; color: var(--text-2); text-align: center; grid-row: span 2; }
.c-nav-item.on .r { color: var(--accent-text); }
.c-nav-item .t { font-size: 0.875rem; font-weight: 500; line-height: 1.2; }
.c-nav-item .bar { height: 0.25rem; }
.c-nav-sep { height: 1px; background: var(--line); margin: 0.375rem 0.75rem; }
.c-main { padding: 1.75rem 2rem; display: flex; flex-direction: column; overflow: hidden; }

.ov-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1.25rem; }
.ov-head p { color: var(--text-2); font-size: 0.875rem; max-width: 58ch; margin-top: 0.375rem; }
.frise { flex: 1; min-height: 0; margin-top: 1.375rem; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0.75rem; align-content: start; }
.fr-col { display: flex; flex-direction: column; border-radius: var(--r-md); background: var(--fill); padding: 1rem 0.875rem; text-align: left; position: relative; transition: background .15s, transform .15s; min-height: 0; }
.fr-col:hover { background: var(--fill-2); }
.fr-col .r { font-family: var(--serif); font-size: 1.875rem; line-height: 1; color: var(--text); }
.fr-col .m { margin-top: 0.75rem; font-size: 0.7188rem; font-weight: 600; color: var(--accent-text); letter-spacing: .01em; }
.fr-col .t { margin-top: 0.25rem; font-size: 0.875rem; font-weight: 600; line-height: 1.2; }
.fr-col .e { margin-top: 0.625rem; font-size: 0.8125rem; color: var(--text-2); line-height: 1.4; flex: 1; }
.fr-col .bar { margin-top: 0.875rem; height: 0.25rem; }
.fr-col:not(:last-child)::after {
  content: ""; position: absolute; right: -0.625rem; top: 1.625rem; width: 0.5rem; height: 0.5rem;
  border-top: 1.5px solid var(--fill-3); border-right: 1.5px solid var(--fill-3); transform: rotate(45deg);
}
.ov-foot { margin-top: 1.125rem; display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.ov-box { border-radius: var(--r-md); padding: 1rem 1.125rem; background: var(--fill); font-size: 0.8438rem; color: var(--text-2); line-height: 1.45; }
.ov-box b { color: var(--text); font-weight: 600; display: block; margin-bottom: 0.25rem; font-size: 0.8125rem; }

.part-head { display: flex; gap: 1.25rem; align-items: flex-start; }
.part-head .r { font-family: var(--serif); font-size: 4rem; line-height: .85; color: var(--text); min-width: 4rem; }
.part-head h1 { font-size: 1.75rem; }
.part-head p { color: var(--text-2); margin-top: 0.5rem; max-width: 64ch; font-size: 0.9375rem; }
.n-grid { margin-top: 1.5rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(13.75rem, 1fr)); gap: 0.625rem; align-content: start; flex: 1; min-height: 0; overflow: auto; }
.n-tile { text-align: left; padding: 1rem; border-radius: var(--r-md); background: var(--fill); display: flex; flex-direction: column; gap: 0.625rem; transition: background .15s; min-height: 5.75rem; }
.n-tile:hover { background: var(--fill-2); }
.n-tile .t { font-weight: 600; font-size: 0.9063rem; line-height: 1.25; }
.n-tile .s { margin-top: auto; display: flex; align-items: center; gap: 0.4375rem; font-size: 0.75rem; color: var(--text-2); }
.part-actions { margin-top: 1.125rem; display: flex; gap: 0.625rem; }

/* Fiche */
.fiche { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 1.75rem; min-height: 0; flex: 1; }
.fiche-l, .fiche-r { min-height: 0; display: flex; flex-direction: column; }
.fiche .back { align-self: flex-start; margin-left: -0.625rem; margin-bottom: 0.5rem; }
.fiche h1 { font-size: 1.875rem; }
.fiche .lead { margin-top: 0.875rem; font-size: 1rem; line-height: 1.5; }
.fiche ul { margin-top: 1.125rem; list-style: none; display: grid; gap: 0.625rem; }
.fiche li { display: flex; gap: 0.625rem; font-size: 0.875rem; line-height: 1.45; color: var(--text); }
.fiche li::before { content: ""; width: 0.375rem; height: 0.375rem; border-radius: 50%; background: var(--accent); margin-top: 0.4375rem; flex: none; }
.fiche-quote { padding: 1.375rem 1.5rem; border-radius: var(--r-md); background: var(--fill); }
.fiche-quote .quote { font-size: 1.125rem; }
.fiche-quote .src { margin-top: 0.625rem; font-size: 0.75rem; color: var(--text-3); }
.fiche-trap { margin-top: 0.75rem; padding: 1rem 1.125rem; border-radius: var(--r-md); background: var(--orange-soft); font-size: 0.8438rem; line-height: 1.45; }
.fiche-trap b { color: var(--orange); display: block; font-size: 0.75rem; margin-bottom: 0.25rem; }
.fiche-stat { margin-top: 0.75rem; display: flex; align-items: center; gap: 0.625rem; font-size: 0.8125rem; color: var(--text-2); }
.fiche-stat .bar { flex: 1; }
.fiche-links { margin-top: auto; padding-top: 1rem; display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* ============ LECTURE ============ */
.lecture { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
.l-main { padding: 2.25rem; display: flex; flex-direction: column; }
.l-main .r { font-family: var(--serif); font-size: 5.5rem; line-height: .9; margin-top: 0.875rem; }
.l-main h1 { margin-top: 0.75rem; font-size: 1.875rem; max-width: 22ch; }
.l-modes { margin-top: 1.375rem; }
.l-what { margin-top: 1.375rem; font-size: 1rem; line-height: 1.55; max-width: 56ch; }
.l-actions { margin-top: auto; padding-top: 1.5rem; display: flex; gap: 0.625rem; flex-wrap: wrap; }
.l-look { padding: 1.875rem; display: flex; flex-direction: column; }
.checks { list-style: none; margin-top: 1rem; display: grid; gap: 0.25rem; }
.checks label { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.625rem 0.75rem; border-radius: 0.75rem; cursor: pointer; font-size: 0.9063rem; line-height: 1.4; transition: background .12s; }
.checks label:hover { background: var(--fill); }
.checks input { position: absolute; opacity: 0; pointer-events: none; }
.checks .box { width: 1.25rem; height: 1.25rem; border-radius: 50%; border: 1.5px solid var(--fill-3); flex: none; display: grid; place-items: center; transition: all .15s; margin-top: 0; }
.checks .box svg { width: 0.6875rem; height: 0.6875rem; color: #fff; opacity: 0; }
.checks input:checked + .box { background: var(--green-mark); border-color: var(--green-mark); }
.checks input:checked + .box svg { opacity: 1; }
.checks input:checked ~ span { color: var(--text-3); }

/* ============ TRAIN ============ */
.train { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
.t-smart { grid-row: 1 / 3; display: flex; flex-direction: column; padding: 1.875rem; overflow: auto; scrollbar-width: thin; }
.t-set { margin-top: 1.375rem; padding-top: 1.125rem; border-top: 1px solid var(--line); display: grid; gap: 0.75rem; }
.t-set-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.t-set-row .lbl { font-size: 0.875rem; color: var(--text); }
.t-smart .note { max-width: 48ch; }
.t-smart h1 { font-size: 2.125rem; margin-top: 0.625rem; }
.t-smart p { margin-top: 0.625rem; color: var(--text-2); max-width: 46ch; }
.t-stats { display: flex; gap: 1.75rem; margin-top: 1.375rem; }
.t-stats div { display: flex; flex-direction: column; }
.t-stats b { font-size: 1.75rem; font-weight: 600; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.t-stats span { font-size: 0.7813rem; color: var(--text-2); }
.t-smart .btn { margin-top: auto; align-self: flex-start; }
.t-mini { display: flex; flex-direction: column; padding: 1.25rem 1.375rem; }
.t-mini p { margin-top: 0.25rem; color: var(--text-2); font-size: 0.8438rem; }
.t-mini .big { font-size: 1.875rem; font-weight: 600; letter-spacing: -.04em; line-height: 1; margin-top: 0.5rem; font-variant-numeric: tabular-nums; }
.t-mini .btn { margin-top: auto; align-self: flex-start; }
.t-mini .gap { height: 0.75rem; }
.t-mini .head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.t-pick { grid-column: 2 / 4; display: flex; flex-direction: column; padding: 1.5rem 1.625rem; overflow: auto; scrollbar-width: thin; }
.t-pick-foot { margin-top: auto; padding-top: 1.125rem; }
.t-pick .chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.125rem; }
.t-pick .chip { height: 2.25rem; padding: 0 0.875rem; font-size: 0.875rem; }
.t-pick .row { display: flex; align-items: flex-end; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.t-format { grid-column: 2 / 4; display: flex; flex-direction: column; padding: 1.25rem 1.375rem; overflow: auto; scrollbar-width: thin; }
.t-format .row { display: flex; align-items: center; justify-content: space-between; }
.t-settings { grid-column: 1 / 4; display: flex; align-items: center; gap: 1.75rem; padding: 0.875rem 1.375rem; }
.t-settings .lbl { font-size: 0.8125rem; color: var(--text-2); margin-right: 0.625rem; }
.t-settings .note { margin-left: auto; }

/* ============ RÉFLEXION ============ */
.reflexion { grid-template-rows: auto minmax(0, 1fr); }
.refl-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; padding: 0.25rem 0.25rem 0; }
.refl-head p { color: var(--text-2); margin-top: 0.5rem; max-width: 70ch; font-size: 0.9063rem; }
.refl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); grid-auto-rows: minmax(0, 1fr); gap: 0.75rem; min-height: 0; overflow: auto; }
.q-card { text-align: left; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 1rem 1.25rem; display: flex; flex-direction: column; gap: 0.5rem; transition: transform .15s var(--ease), box-shadow .15s; min-height: 6.5rem; }
.q-card:hover { transform: translateY(-2px); box-shadow: 0 2px 0.25rem rgba(0, 0, 0, .04), 0 0.75rem 1.875rem rgba(0, 0, 0, .08); }
.q-card .top { display: flex; justify-content: space-between; align-items: center; }
.q-card .r { font-family: var(--serif); font-size: 0.9375rem; color: var(--text-3); }
.q-card .t { font-size: 0.9063rem; font-weight: 500; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.score-badge { font-size: 0.75rem; font-weight: 600; padding: 0.1875rem 0.5625rem; border-radius: 61.25rem; background: var(--fill); color: var(--text-2); font-variant-numeric: tabular-nums; }
.score-badge.good { background: var(--green-soft); color: var(--green); }
.score-badge.mid { background: var(--orange-soft); color: var(--orange); }
.score-badge.weak { background: var(--red-soft); color: var(--red); }

/* ============ PLAYER ============ */
.player { grid-template-columns: minmax(0, 1fr) 23.75rem; }
.player-main { display: flex; flex-direction: column; padding: 1.125rem 1.75rem 1.25rem; }
.player-head { display: flex; align-items: center; gap: 0.875rem; }
.segs { flex: 1; display: flex; gap: 0.1875rem; }
.segs i { flex: 1; height: 0.25rem; border-radius: 2px; background: var(--fill-2); transition: background .3s; }
.segs i.cur { background: var(--text); }
.segs i.ok { background: var(--green-mark); }
.segs i.mid { background: var(--orange-mark); }
.segs i.ko { background: var(--red-mark); }
.count { font-size: 0.8125rem; color: var(--text-3); font-variant-numeric: tabular-nums; min-width: 2.75rem; text-align: right; }
.ex-meta { display: flex; align-items: center; gap: 0.375rem; margin-top: 1.125rem; }
.ex-meta .sess { margin-left: auto; font-size: 0.7813rem; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ex-q { margin-top: 0.875rem; font-size: 1.6875rem; line-height: 1.25; letter-spacing: -.025em; max-width: 52ch; }
.ex-body { flex: 1; min-height: 0; margin-top: 1.125rem; position: relative; overflow: auto; scrollbar-width: thin; padding: 2px; }
.ex-foot { display: flex; align-items: center; gap: 0.5rem; padding-top: 0.875rem; border-top: 1px solid var(--line); margin-top: 0.75rem; }

.player-side { display: flex; flex-direction: column; padding: 1.5rem; overflow: auto; scrollbar-width: thin; }
.side-intro h4 { margin-bottom: 0.5rem; }
.side-intro p { font-size: 0.9375rem; line-height: 1.5; color: var(--text); }
.side-keys { margin-top: 1rem; font-size: 0.7813rem; color: var(--text-3); line-height: 1.6; }
.side-sep { height: 1px; background: var(--line); margin: 1.125rem 0; }
.verdict { display: flex; align-items: center; gap: 0.875rem; }
.v-icon { width: 2.75rem; height: 2.75rem; border-radius: 50%; display: grid; place-items: center; flex: none; }
.v-icon svg { width: 1.25rem; height: 1.25rem; }
.verdict.ok .v-icon { background: var(--green-soft); color: var(--green); }
.verdict.mid .v-icon { background: var(--orange-soft); color: var(--orange); }
.verdict.ko .v-icon { background: var(--red-soft); color: var(--red); }
.v-title { font-size: 1.25rem; font-weight: 600; letter-spacing: -.02em; }
.v-sub { font-size: 0.8125rem; color: var(--text-2); }
.side-block { margin-top: 1.125rem; }
.side-block h4 { margin-bottom: 0.375rem; }
.side-block p, .side-block li { font-size: 0.9375rem; line-height: 1.5; }
.side-block ol, .side-block ul { padding-left: 1.125rem; display: grid; gap: 0.375rem; }
.side-block .quote { font-size: 1rem; }
.side-links { margin-top: auto; padding-top: 1.125rem; display: flex; flex-direction: column; gap: 0.375rem; }
.fiche-link { display: flex; align-items: center; gap: 0.625rem; padding: 0.625rem 0.75rem; border-radius: 0.75rem; background: var(--fill); text-align: left; font-size: 0.8438rem; transition: background .12s; }
.fiche-link:hover { background: var(--fill-2); }
.fiche-link .t { flex: 1; font-weight: 500; }
.fiche-link svg { width: 0.75rem; height: 0.75rem; color: var(--text-3); }

/* Recall overlay */
.recall-wrap { position: relative; }
.recall-wrap.hidden .recall-target { filter: blur(0.4375rem); opacity: .5; pointer-events: none; user-select: none; }
.recall-cover { position: absolute; inset: 0; display: none; place-items: center; z-index: 2; }
.recall-wrap.hidden .recall-cover { display: grid; }
.recall-box { background: rgba(255, 255, 255, .92); backdrop-filter: blur(0.375rem); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 1.375rem 1.625rem; text-align: center; max-width: 23.75rem; }
.recall-box p { font-size: 0.875rem; color: var(--text-2); margin-bottom: 0.875rem; line-height: 1.45; }
.recall-box b { display: block; color: var(--text); font-size: 0.9375rem; margin-bottom: 0.25rem; }

/* QCM */
.opts { display: grid; gap: 0.5rem; }
.opt {
  display: flex; align-items: center; gap: 0.875rem; text-align: left; padding: 1rem 1.125rem; border-radius: var(--r-md);
  background: var(--fill); font-size: 1.0313rem; line-height: 1.35; transition: background .12s, box-shadow .12s;
}
.opt:hover { background: var(--fill-2); }
.opt .k { width: 1.625rem; height: 1.625rem; border-radius: 0.5rem; display: grid; place-items: center; font-size: 0.75rem; font-weight: 600; background: #fff; color: var(--text-2); flex: none; box-shadow: 0 0 0 1px var(--line); }
.opt.sel { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }
.opt.sel .k { background: var(--accent); color: #fff; box-shadow: none; }
.opt.correct { background: var(--green-soft); box-shadow: inset 0 0 0 1.5px var(--green-mark); }
.opt.correct .k { background: var(--green-mark); color: #fff; box-shadow: none; }
.opt.wrong { background: var(--red-soft); box-shadow: inset 0 0 0 1.5px var(--red-mark); }
.opt.wrong .k { background: var(--red-mark); color: #fff; box-shadow: none; }
.locked .opt, .locked .vf-btn, .locked .part-btn { cursor: default; }
.multi-hint { font-size: 0.8125rem; color: var(--accent-text); font-weight: 500; margin-bottom: 0.625rem; }

/* Vrai / faux */
.vf { display: flex; flex-direction: column; height: 100%; justify-content: center; gap: 1.75rem; }
.vf-s { font-size: 1.375rem; line-height: 1.4; letter-spacing: -.02em; max-width: 40ch; }
.vf-btns { display: flex; gap: 0.75rem; }
.vf-btn { flex: 1; max-width: 15rem; height: 4rem; border-radius: var(--r-md); background: var(--fill); font-size: 1.0625rem; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 0.5rem; transition: background .12s, box-shadow .12s; }
.vf-btn:hover { background: var(--fill-2); }
.vf-btn.correct { background: var(--green-soft); color: var(--green); box-shadow: inset 0 0 0 1.5px var(--green-mark); }
.vf-btn.wrong { background: var(--red-soft); color: var(--red); box-shadow: inset 0 0 0 1.5px var(--red-mark); }

/* Texte à trous */
.fill-text { font-family: var(--serif); font-size: 1.3125rem; line-height: 2.05; letter-spacing: 0; max-width: 60ch; }
.blank {
  font-family: var(--font); font-size: 1rem; font-weight: 500; letter-spacing: -.01em;
  border: 0; border-radius: 0.5rem; background: var(--fill); padding: 0.25rem 0.5rem; margin: 0 2px; min-width: 5ch;
  box-shadow: inset 0 -2px 0 var(--fill-3); text-align: center; transition: box-shadow .12s, background .12s; vertical-align: 2px;
}
.blank:focus { outline: none; background: var(--accent-soft); box-shadow: inset 0 -2px 0 var(--accent); }
.blank.correct { background: var(--green-soft); box-shadow: inset 0 -2px 0 var(--green-mark); color: var(--green); }
.blank.wrong { background: var(--red-soft); box-shadow: inset 0 -2px 0 var(--red-mark); color: var(--red); text-decoration: line-through; }
.fix { font-family: var(--font); font-size: 0.875rem; font-weight: 600; color: var(--green); margin: 0 0.25rem 0 2px; }
.fill-note { margin-top: 0.875rem; font-size: 0.8125rem; color: var(--text-3); }

/* Quelle partie */
.pq { display: flex; flex-direction: column; justify-content: center; height: 100%; gap: 1.875rem; }
.pq .quote { font-size: 1.625rem; line-height: 1.35; max-width: 34ch; }
.pq .quote::before { content: "« "; color: var(--text-3); }
.pq .quote::after { content: " »"; color: var(--text-3); }
.part-btns { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.5rem; }
.part-btn { padding: 0.75rem 0.5rem; border-radius: var(--r-md); background: var(--fill); display: flex; flex-direction: column; align-items: center; gap: 0.25rem; transition: background .12s, box-shadow .12s; }
.part-btn:hover { background: var(--fill-2); }
.part-btn .r { font-family: var(--serif); font-size: 1.5rem; line-height: 1; }
.part-btn .l { font-size: 0.7188rem; color: var(--text-2); }
.part-btn.correct { background: var(--green-soft); box-shadow: inset 0 0 0 1.5px var(--green-mark); }
.part-btn.wrong { background: var(--red-soft); box-shadow: inset 0 0 0 1.5px var(--red-mark); }

/* Ordre */
.sortable { list-style: none; display: grid; gap: 0.375rem; max-width: 45rem; counter-reset: s; }
.s-item {
  display: grid; grid-template-columns: 1.125rem 1.625rem 1fr auto; align-items: center; gap: 0.625rem;
  padding: 0.375rem 0.5rem 0.375rem 0.625rem; border-radius: 0.75rem; background: var(--fill); font-size: 0.875rem; line-height: 1.3; min-height: 2.5rem;
  cursor: grab; user-select: none; touch-action: none; position: relative; transition: background .12s, box-shadow .15s;
}
.s-item:hover { background: var(--fill-2); }
.s-item.dragging { cursor: grabbing; z-index: 5; background: #fff; box-shadow: var(--shadow-lg); transition: none; }
.s-item .grip { color: var(--fill-3); display: grid; place-items: center; }
.s-item .grip svg { width: 0.875rem; height: 0.875rem; }
.s-item .num { width: 1.5rem; height: 1.5rem; border-radius: 0.4375rem; background: #fff; display: grid; place-items: center; font-size: 0.75rem; font-weight: 600; color: var(--text-2); box-shadow: 0 0 0 1px var(--line); font-variant-numeric: tabular-nums; }
.s-item .num::before { counter-increment: s; content: counter(s); }
.s-item .arrows { display: flex; gap: 2px; }
.s-item .arrows button { width: 1.625rem; height: 1.625rem; border-radius: 0.4375rem; display: grid; place-items: center; color: var(--text-3); }
.s-item .arrows button:hover { background: #fff; color: var(--text); }
.s-item .arrows svg { width: 0.75rem; height: 0.75rem; }
.s-item.correct { background: var(--green-soft); }
.s-item.correct .num { background: var(--green-mark); color: #fff; box-shadow: none; }
.s-item.wrong { background: var(--red-soft); }
.s-item.wrong .num { background: var(--red-mark); color: #fff; box-shadow: none; }
.s-item .should { font-size: 0.75rem; font-weight: 600; color: var(--red); white-space: nowrap; }
.locked .s-item { cursor: default; }

/* Associer */
.match { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 4.75rem minmax(0, 1fr); align-items: start; }
.match .col { display: grid; gap: 0.375rem; position: relative; z-index: 1; }
.match .col.l { grid-column: 1; }
.match .col.r { grid-column: 3; }
.m-item {
  display: flex; align-items: center; gap: 0.625rem; min-height: 2.75rem; padding: 0.375rem 0.75rem; border-radius: 0.75rem;
  background: var(--fill); font-size: 0.8438rem; line-height: 1.28; text-align: left; transition: background .12s, box-shadow .12s;
}
.col.r .m-item { flex-direction: row-reverse; text-align: right; justify-content: flex-start; }
.col.r .m-item span:not(.badge) { flex: 1; text-align: left; }
.m-item:hover { background: var(--fill-2); }
.m-item.sel { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }
.m-item .badge { width: 1.25rem; height: 1.25rem; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 0.6875rem; font-weight: 700; color: #fff; background: var(--fill-3); opacity: 0; transition: opacity .15s; }
.m-item.paired .badge { opacity: 1; }
.m-item.correct { box-shadow: inset 0 0 0 1.5px var(--green-mark); }
.m-item.wrong { box-shadow: inset 0 0 0 1.5px var(--red-mark); }
.match svg.lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; z-index: 0; }
.match svg.lines path { fill: none; stroke-width: 2; stroke-linecap: round; }

/* Classer */
.sort-wrap { display: flex; flex-direction: column; gap: 0.875rem; height: 100%; }
.pool { display: flex; flex-wrap: wrap; gap: 0.5rem; min-height: 2.75rem; padding: 0.625rem; border-radius: var(--r-md); background: var(--fill); align-content: flex-start; transition: background .12s, box-shadow .12s; }
.pool:empty::before { content: "Toutes les étiquettes sont placées."; font-size: 0.8125rem; color: var(--text-3); padding: 0.375rem 0.25rem; }
.buckets { display: grid; gap: 0.625rem; flex: 1; min-height: 0; }
.bucket { border-radius: var(--r-md); border: 1.5px dashed var(--fill-3); padding: 0.5rem; display: flex; flex-direction: column; gap: 0.375rem; min-height: 6rem; cursor: pointer; transition: background .12s, border-color .12s; }
.sort-wrap .token { font-size: 0.8125rem; padding: 0.375rem 0.625rem; }
.sort-wrap { gap: 0.625rem; }
.pool { padding: 0.5rem; gap: 0.375rem; }
.bucket h5 { font-size: 0.7813rem; font-weight: 600; color: var(--text-2); padding: 2px 0.25rem; }
.bucket .drop { display: flex; flex-direction: column; gap: 0.375rem; }
.bucket.over, .pool.over, .bucket.target { border-color: var(--accent); background: var(--accent-soft); }
.token {
  display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.5rem 0.75rem; border-radius: 0.625rem; background: #fff; font-size: 0.8438rem; line-height: 1.3; text-align: left;
  box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(0, 0, 0, .05); cursor: grab; transition: box-shadow .12s, background .12s, transform .1s;
}
.token:hover { box-shadow: 0 0 0 1px var(--line-2), 0 2px 0.375rem rgba(0, 0, 0, .08); }
.token.sel { box-shadow: 0 0 0 2px var(--accent); background: #fff; }
.token.dragging { opacity: .4; }
.token.correct { background: var(--green-soft); box-shadow: 0 0 0 1px rgba(52, 199, 89, .5); cursor: default; }
.token.wrong { background: var(--red-soft); box-shadow: 0 0 0 1px rgba(255, 59, 48, .45); cursor: default; }
.token .should { font-size: 0.7188rem; font-weight: 600; color: var(--red); }
.token.wrong { flex-direction: column; align-items: flex-start; gap: 2px; }
.locked .token, .locked .bucket { cursor: default; }

/* Schéma */
.schema { display: flex; flex-direction: column; gap: 0.875rem; }
.sch-canvas { position: relative; flex: none; }
.sch-canvas svg.lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.sch-canvas svg.lines path { fill: none; stroke: var(--fill-3); stroke-width: 1.5; }
.flow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.625rem 1.875rem; position: relative; z-index: 1; }
.flow.n6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.node { border-radius: var(--r-md); background: var(--fill); padding: 0.625rem 0.75rem; font-size: 0.8125rem; line-height: 1.32; min-height: 4.25rem; display: flex; flex-direction: column; gap: 0.3125rem; position: relative; }
.node .cap { font-family: var(--serif); font-size: 0.9375rem; color: var(--text-3); line-height: 1; }
.slot {
  border: 1.5px dashed var(--fill-3); background: #fff; border-radius: 0.625rem; min-height: 2.375rem; display: flex; align-items: center; justify-content: center;
  padding: 0.3125rem 0.375rem; font-size: 0.7813rem; line-height: 1.3; color: var(--text-3); cursor: pointer; text-align: center; transition: border-color .12s, background .12s; flex: 1;
}
.slot:empty::before { content: "Case vide"; }
.slot:hover, .slot.over, .slot.target:empty { border-color: var(--accent); background: var(--accent-soft); }
.slot .token { box-shadow: none; background: transparent; padding: 2px 0.25rem; font-weight: 500; color: var(--text); justify-content: center; cursor: pointer; }
.slot.correct .token { color: var(--green); background: transparent; box-shadow: none; }
.slot.wrong .token { color: var(--red); background: transparent; box-shadow: none; text-decoration: line-through; }
.slot.wrong { flex-direction: column; }
.slot.filled { border-style: solid; border-color: var(--accent); background: var(--accent-soft); color: var(--text); font-weight: 500; }
.slot.correct { border-color: var(--green-mark); background: var(--green-soft); color: var(--green); }
.slot.wrong { border-color: var(--red-mark); background: var(--red-soft); color: var(--red); }
.slot .fixline { display: block; font-size: 0.7188rem; color: var(--green); font-weight: 600; margin-top: 0.1875rem; }
.node.given { background: var(--fill); }
.tree { display: flex; flex-direction: column; align-items: center; gap: 1.875rem; position: relative; z-index: 1; }
.tree-root { padding: 0.75rem 1.375rem; border-radius: 61.25rem; background: var(--text); color: #fff; font-weight: 600; font-size: 0.875rem; }
.tree-branches { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; width: 100%; }
.tree-col { display: flex; flex-direction: column; gap: 1.25rem; }
.tree-col .node { min-height: 3.5rem; }
.pictos { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.875rem; position: relative; z-index: 1; }
.picto { border-radius: var(--r-md); background: var(--fill); padding: 1rem; display: flex; flex-direction: column; align-items: center; gap: 0.625rem; }
.picto svg { width: 4rem; height: 4rem; color: var(--text); }
.picto .cap { font-size: 0.7813rem; color: var(--text-2); }
.picto .slot { width: 100%; min-height: 2.75rem; }
.bank { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0.625rem; border-radius: var(--r-md); background: var(--fill); min-height: 3.125rem; }
.bank:empty::before { content: "Toutes les étiquettes sont placées."; font-size: 0.8125rem; color: var(--text-3); padding: 0.375rem 0.25rem; }

/* Tableau */
.grid-ex { border-collapse: separate; border-spacing: 0 0.375rem; width: 100%; max-width: 47.5rem; }
.grid-ex th { font-size: 0.7813rem; font-weight: 600; color: var(--text-2); padding: 0 0.375rem 0.25rem; text-align: center; }
.grid-ex th:first-child { text-align: left; }
.grid-ex td { padding: 0 0.25rem; }
.grid-ex td.t { font-size: 0.875rem; line-height: 1.35; padding: 0.5rem 0.875rem; background: var(--fill); border-radius: 0.75rem 0 0 0.75rem; }
.grid-ex td.c { background: var(--fill); text-align: center; width: 6.875rem; }
.grid-ex td.c:last-child { border-radius: 0 0.75rem 0.75rem 0; }
.cell { width: 2.5rem; height: 2.125rem; border-radius: 0.5625rem; background: #fff; box-shadow: 0 0 0 1px var(--line); display: inline-grid; place-items: center; font-weight: 700; font-size: 0.9375rem; transition: background .12s, box-shadow .12s; margin: 0.3125rem 0; }
.cell:hover { box-shadow: 0 0 0 1px var(--line-2); }
.cell.yes { color: var(--green); }
.cell.no { color: var(--red); }
.cell.correct { background: var(--green-soft); box-shadow: 0 0 0 1.5px var(--green-mark); }
.cell.wrong { background: var(--red-soft); box-shadow: 0 0 0 1.5px var(--red-mark); }
.cell .fx { font-size: 0.625rem; color: var(--green); margin-left: 2px; }

/* Carte mémoire */
.flash { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; gap: 1.375rem; }
.flash-card { width: min(38.75rem, 100%); min-height: 13.75rem; border-radius: var(--r-xl); background: var(--fill); padding: 2.125rem 2.375rem; display: flex; flex-direction: column; justify-content: center; gap: 1.125rem; box-shadow: inset 0 0 0 1px var(--line); }
.flash-card .f { font-size: 1.5rem; font-weight: 600; letter-spacing: -.025em; line-height: 1.25; }
.flash-card .b { font-size: 1.0625rem; line-height: 1.5; padding-top: 1.125rem; border-top: 1px solid var(--line); animation: enter .3s var(--ease); }
.flash-rate { display: flex; gap: 0.5rem; }
.flash-rate .btn { height: 2.625rem; }
.rate-0 { background: var(--red-soft) !important; color: var(--red) !important; }
.rate-1 { background: var(--orange-soft) !important; color: var(--orange) !important; }
.rate-2 { background: var(--green-soft) !important; color: var(--green) !important; }

/* Construire la réponse */
.build-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.el {
  display: flex; gap: 0.75rem; align-items: flex-start; text-align: left; padding: 0.75rem 0.875rem; border-radius: var(--r-md);
  background: var(--fill); font-size: 0.875rem; line-height: 1.38; transition: background .12s, box-shadow .12s;
}
.el:hover { background: var(--fill-2); }
.el .ck { width: 1.25rem; height: 1.25rem; border-radius: 0.375rem; flex: none; background: #fff; box-shadow: 0 0 0 1.5px var(--fill-3); display: grid; place-items: center; margin-top: 0; }
.el .ck svg { width: 0.6875rem; height: 0.6875rem; color: #fff; opacity: 0; }
.el.sel { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }
.el.sel .ck { background: var(--accent); box-shadow: none; }
.el.sel .ck svg { opacity: 1; }
.el.correct { background: var(--green-soft); box-shadow: inset 0 0 0 1.5px var(--green-mark); }
.el.correct .ck { background: var(--green-mark); box-shadow: none; }
.el.correct .ck svg { opacity: 1; }
.el.missed { background: #fff; box-shadow: inset 0 0 0 1.5px var(--green-mark); }
.el.wrong { background: var(--red-soft); box-shadow: inset 0 0 0 1.5px var(--red-mark); }
.el.wrong .ck { background: var(--red-mark); box-shadow: none; }
.el.wrong .ck svg { opacity: 1; }
.el.dim { opacity: .45; }
.el .why { display: block; font-size: 0.7813rem; color: var(--red); margin-top: 0.25rem; }
.el .miss { display: block; font-size: 0.75rem; color: var(--green); font-weight: 600; margin-top: 0.25rem; }
.build-hint { font-size: 0.8125rem; color: var(--text-2); margin-bottom: 0.75rem; }

/* End of session */
.end { align-items: center; justify-content: center; text-align: center; }
.ring { width: 9.375rem; height: 9.375rem; position: relative; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; }
.ring .bg { stroke: var(--fill-2); }
.ring .fg { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 1s var(--ease); }
.ring.good .fg { stroke: var(--green-mark); }
.ring.mid .fg { stroke: var(--orange-mark); }
.ring.weak .fg { stroke: var(--red-mark); }
.ring .lbl { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 2.25rem; font-weight: 600; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.ring .lbl small { font-size: 1rem; font-weight: 500; color: var(--text-2); margin-left: 2px; }
.end h2 { margin-top: 1.375rem; font-size: 1.75rem; }
.end p { color: var(--text-2); margin-top: 0.375rem; }
.end-chips { display: flex; flex-wrap: wrap; gap: 0.375rem; justify-content: center; margin-top: 1.375rem; max-width: 40rem; }
.end-chip { display: inline-flex; align-items: center; gap: 0.4375rem; height: 1.875rem; padding: 0 0.75rem; border-radius: 61.25rem; background: var(--fill); font-size: 0.8125rem; }
.end-actions { display: flex; gap: 0.625rem; margin-top: 1.75rem; flex-wrap: wrap; justify-content: center; }

/* ============ BILAN ============ */
.bilan { grid-template-columns: 18.75rem minmax(0, 1fr) minmax(0, 1.25fr); }
.b-over { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 1.875rem 1.5rem; }
.b-over .ring { width: 10.625rem; height: 10.625rem; margin-top: 1rem; }
.b-over .ring .lbl { font-size: 2.625rem; }
.b-over .caption { margin-top: 0.875rem; font-size: 0.875rem; color: var(--text-2); max-width: 24ch; line-height: 1.4; }
.b-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.25rem; width: 100%; margin-top: 1.375rem; padding-top: 1.125rem; border-top: 1px solid var(--line); }
.b-stats b { display: block; font-size: 1.375rem; font-weight: 600; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.b-stats span { font-size: 0.7188rem; color: var(--text-2); }
.b-actions { margin-top: auto; padding-top: 1.25rem; display: flex; flex-direction: column; gap: 0.5rem; width: 100%; }
.b-actions .btn { width: 100%; }
.b-parts { display: flex; flex-direction: column; }
.bp-list { margin-top: 1.125rem; display: flex; flex-direction: column; gap: 0.875rem; flex: 1; justify-content: space-around; }
.bp-row { display: grid; grid-template-columns: 2.125rem 1fr 2.75rem; align-items: center; gap: 0.75rem; text-align: left; padding: 0.25rem 0.375rem; margin: -0.25rem -0.375rem; border-radius: 0.625rem; transition: background .12s; }
.bp-row:hover { background: var(--fill); }
.bp-row .r { font-family: var(--serif); font-size: 1.1875rem; color: var(--text-2); text-align: center; }
.bp-row .t { font-size: 0.8438rem; font-weight: 500; margin-bottom: 0.375rem; display: flex; justify-content: space-between; }
.bp-row .t span { font-weight: 400; color: var(--text-3); font-size: 0.75rem; }
.bp-row .p { font-size: 0.8125rem; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.b-weak { display: flex; flex-direction: column; }
.bw-list { list-style: none; margin-top: 0.875rem; display: flex; flex-direction: column; gap: 0.375rem; flex: 1; min-height: 0; overflow: auto; scrollbar-width: thin; }
.bw-row { display: grid; grid-template-columns: 0.625rem minmax(0, 1fr) auto; align-items: center; gap: 0.75rem; padding: 0.625rem 0.75rem; border-radius: 0.75rem; background: var(--fill); }
.bw-row .t { font-size: 0.875rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bw-row .s { font-size: 0.75rem; color: var(--text-2); }
.bw-row .acts { display: flex; gap: 2px; }
.bw-row .acts .btn { height: 1.75rem; padding: 0 0.625rem; font-size: 0.7813rem; }
.empty { flex: 1; display: grid; place-items: center; text-align: center; color: var(--text-2); font-size: 0.875rem; }
.empty > div { max-width: 34ch; display: flex; flex-direction: column; align-items: center; gap: 0.875rem; }

/* ============ Plan : session en cours ============ */
.run-bar { margin-top: 1.375rem; height: 0.375rem; border-radius: 0.1875rem; background: var(--fill-2); overflow: hidden; }
.run-bar i { display: block; height: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0); transition: transform 1s linear; }
.set-line { margin-top: 1rem; display: flex; align-items: center; justify-content: space-between; font-size: 0.8125rem; font-weight: 600; color: var(--text-2); }

/* ============ ACCUEIL ============ */
.home { grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.hero { display: flex; flex-direction: column; justify-content: center; padding: 2.5rem 3.5rem; overflow: hidden; min-width: 0; }
.hero-t { margin-top: 1rem; font-size: clamp(2.75rem, min(5.4vw, 9vh), 6rem); line-height: .98; letter-spacing: -.055em; font-weight: 700; }
.hero-t .hl { color: var(--accent); }
.hero-p { margin-top: 1.375rem; font-size: 1.125rem; line-height: 1.5; color: var(--text-2); max-width: 40ch; }
.hero-cta { margin-top: 1.75rem; display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; }
.hero-prog { margin-top: 1.5rem; max-width: 26rem; }
.hero-prog .hp-top { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; font-size: 0.875rem; color: var(--text-2); margin-bottom: 0.5rem; }
.hero-prog .hp-top b { font-size: 1.125rem; color: var(--text); font-variant-numeric: tabular-nums; }
.hero-prog .bar { height: 0.5rem; border-radius: 0.25rem; }
.hero-prog p { margin-top: 0.5rem; font-size: 0.8125rem; }
.resume-run { font-size: 0.875rem; color: var(--accent-text); font-weight: 600; font-variant-numeric: tabular-nums; }
.hero-facts { margin-top: 2rem; display: flex; gap: 2.25rem; flex-wrap: wrap; }
.hero-facts b { display: block; font-size: 2rem; font-weight: 700; letter-spacing: -.045em; font-variant-numeric: tabular-nums; line-height: 1; }
.hero-facts span { display: block; margin-top: 0.25rem; font-size: 0.8125rem; color: var(--text-2); }
.row-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.row-head .link { font-size: 0.9375rem; }
.shelf { display: flex; flex-direction: column; padding: 1.5rem 1.75rem 1.75rem; min-height: 0; overflow: auto; scrollbar-width: thin; }
.covers { margin-top: 1.25rem; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.125rem; align-content: start; }
.covers.two { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 34rem; }
.covers .cover { aspect-ratio: 3 / 4; }
.how { list-style: none; counter-reset: how; margin-top: auto; padding-top: 1.5rem; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.how li { counter-increment: how; display: flex; flex-direction: column; gap: 0.25rem; padding-top: 0.875rem; border-top: 1px solid var(--line); }
.how li::before { content: "0" counter(how); font-size: 0.75rem; font-weight: 700; color: var(--accent-text); font-variant-numeric: tabular-nums; }
.how b { font-size: 1rem; letter-spacing: -.015em; }
.how span { font-size: 0.8125rem; color: var(--text-2); line-height: 1.4; }
.covers.two .cv-title { font-size: 1.875rem; }
.cover {
  --tone: #1d1d1f;
  position: relative; display: flex; flex-direction: column; text-align: left; border-radius: 1.125rem; padding: 1.25rem 1.25rem 1rem 1.5rem; min-height: 0; overflow: hidden;
  background-color: var(--tone); color: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .1), inset 0 0 0 1px rgba(255, 255, 255, .06);
  background-image: linear-gradient(160deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, 0) 45%), linear-gradient(0deg, rgba(0, 0, 0, .2), rgba(0, 0, 0, 0) 60%);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.cover::before { content: ""; position: absolute; left: 0.75rem; top: 0; bottom: 0; width: 1px; background: rgba(255, 255, 255, .16); }
button.cover:hover { transform: translateY(-0.1875rem); box-shadow: 0 2px 0.375rem rgba(0, 0, 0, .12), 0 1.125rem 2.25rem rgba(0, 0, 0, .16); }
.cv-kind { position: absolute; top: 1rem; right: 1rem; font-size: 0.6875rem; font-weight: 600; padding: 0.1875rem 0.625rem; border-radius: 61.25rem; background: rgba(255, 255, 255, .16); color: rgba(255, 255, 255, .92); }
.cv-top { font-size: 0.75rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: rgba(255, 255, 255, .65); padding-right: 4rem; }
.cv-title { margin-top: 0.75rem; font-family: var(--serif); font-size: 1.5625rem; line-height: 1.1; letter-spacing: -.01em; }
.cv-author { margin-top: 0.5rem; font-size: 0.875rem; color: rgba(255, 255, 255, .75); }
.cv-foot { margin-top: auto; padding-top: 0.875rem; display: flex; align-items: center; gap: 0.625rem; font-size: 0.8125rem; color: rgba(255, 255, 255, .85); font-variant-numeric: tabular-nums; }
.cv-bar { flex: 1; height: 0.1875rem; border-radius: 2px; background: rgba(255, 255, 255, .2); overflow: hidden; }
.cv-bar i { display: block; height: 100%; background: #fff; border-radius: 2px; }
.cover.lesson { color: var(--text); background-color: #fff; background-image: linear-gradient(160deg, color-mix(in srgb, var(--tone) 16%, #fff), #fff 72%); box-shadow: inset 0 0 0 1px var(--line), 0 1px 2px rgba(0, 0, 0, .05); }
.cover.lesson::before { left: 0; width: 0.3125rem; background: var(--tone); }
.cover.lesson .cv-top { color: var(--tone); }
.cover.lesson .cv-title { font-family: var(--font); font-weight: 700; letter-spacing: -.035em; }
.cover.lesson .cv-author, .cover.lesson .cv-foot { color: var(--text-2); }
.cover.lesson .cv-bar { background: var(--fill-2); }
.cover.lesson .cv-bar i { background: var(--tone); }
.cover.lesson .cv-kind { background: var(--fill); color: var(--text-2); }
.cover.soon { background: transparent; background-image: none; color: var(--text-2); border: 1.5px dashed var(--fill-3); box-shadow: none; justify-content: center; padding: 1.375rem; }
.cover.soon::before { display: none; }
.cover.soon .cv-title { font-family: var(--font); font-size: 1.0625rem; font-weight: 700; color: var(--text); margin-top: 0; letter-spacing: -.02em; }
.cover.soon .cv-author { color: var(--text-2); line-height: 1.45; font-size: 0.875rem; }
.segmented.big { padding: 0.1875rem; border-radius: 0.75rem; }
.segmented.big button { padding: 0.5rem 1.25rem; font-size: 0.9375rem; border-radius: 0.5625rem; }
.segmented .n { color: var(--text-3); margin-left: 0.25rem; font-weight: 500; }

/* ============ BIBLIOTHÈQUE ============ */
.library { grid-template-rows: auto minmax(0, 1fr); }
.lib-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; padding: 0.375rem 0.375rem 0; }
.lib-head h1 { font-size: 2.75rem; letter-spacing: -.045em; }
.lib-head p { margin-top: 0.625rem; max-width: 58ch; font-size: 1rem; }
.lib-filters { display: flex; flex-direction: column; align-items: flex-end; gap: 0.75rem; }
.lib-filters .chips { display: flex; gap: 0.375rem; flex-wrap: wrap; justify-content: flex-end; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 1.75rem; align-content: start; min-height: 0; overflow: auto; padding: 0.375rem; }
.lib-item { display: flex; flex-direction: column; gap: 0.875rem; }
.lib-item .cover { aspect-ratio: 3 / 4; }
.cover.big .cv-title { font-size: 1.875rem; }
.lib-meta b { display: block; font-size: 1.125rem; letter-spacing: -.02em; }
.lib-meta span { font-size: 0.875rem; color: var(--text-2); }
.lib-meta p { font-size: 0.9063rem; color: var(--text-2); margin-top: 0.375rem; line-height: 1.4; }

/* ============ Modal & toast ============ */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 2rem; background: rgba(0, 0, 0, .28); backdrop-filter: blur(0.25rem); animation: fadein .2s; }
.modal[hidden] { display: none; }
@keyframes fadein { from { opacity: 0; } }
.modal-card { width: min(61.25rem, 100%); max-height: 100%; background: #fff; border-radius: var(--r-xl); box-shadow: var(--shadow-lg); padding: 1.875rem 2.125rem; display: flex; flex-direction: column; animation: pop .28s var(--ease); overflow: auto; }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(0.5rem); } }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.625rem; }
.modal-card .fiche { min-height: 23.75rem; }
.toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 1.25rem); opacity: 0; z-index: 60; pointer-events: none; padding: 0.6875rem 1.125rem; border-radius: 61.25rem; background: rgba(29, 29, 31, .92); color: #fff; font-size: 0.875rem; font-weight: 500; transition: all .3s var(--ease); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ============ EFFETS ET STYLES VALIDÉS ============ */
/* FX-19 : transition entre vues (fondu + léger zoom) ; aucune entre deux exercices (FX-20 refusé) */
@keyframes enter { from { opacity: 0; transform: scale(.985); } }
@keyframes enterFade { from { opacity: 0; } }
.view { animation: enter .3s var(--ease); }
.view.still { animation: none; }
body.fx-reduce .view { animation-name: enterFade; }
body.fx-off .view { animation: none; }

/* ST-02 : bouton principal en relief */
.btn.primary { background: linear-gradient(180deg, #1a86ff, #0071e3); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 1px 2px rgba(0, 60, 140, .3); position: relative; overflow: hidden; }
.btn.primary:hover { background: linear-gradient(180deg, #2b91ff, #077ae8); }
.btn.primary:disabled { background: var(--fill-3); box-shadow: none; }
/* FX-21 : boutons vivants (soulèvement, enfoncement, reflet au survol) */
.btn { transition: background .15s var(--ease), color .15s, transform .18s var(--ease), box-shadow .18s, opacity .15s; }
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0) scale(.97); }
.btn.primary::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .38) 50%, transparent 65%); transform: translateX(-120%); }
.btn.primary:hover:not(:disabled)::after { transform: translateX(120%); transition: transform .85s cubic-bezier(.4, 0, .2, 1); }
body.fx-off .btn:hover, body.fx-reduce .btn:hover { transform: none; }
body.fx-off .btn.primary::after, body.fx-reduce .btn.primary::after { display: none; }

/* ST-03 (revu) : couvertures de livres texturées, bien visibles */
.cover:not(.lesson):not(.soon) {
  background-image:
    linear-gradient(160deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, 0) 45%),
    linear-gradient(0deg, rgba(0, 0, 0, .22), rgba(0, 0, 0, 0) 60%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .07) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, .12) 0 1px, transparent 1px 3px);
  box-shadow: inset 0.75rem 0 0.875rem -0.5rem rgba(0, 0, 0, .6), inset -1px 0 0 rgba(255, 255, 255, .08), 0 1px 2px rgba(0, 0, 0, .12);
}
.cover:not(.lesson):not(.soon)::before { left: 0.875rem; width: 2px; background: linear-gradient(90deg, rgba(0, 0, 0, .35), rgba(255, 255, 255, .14)); }

/* ST-04 : mode concentration (le panneau de droite s'estompe tant qu'on répond) */
.player-side { transition: opacity .35s var(--ease); }
.player-side.dim { opacity: .42; }

/* FX-08 à FX-10, MC-04 : pastille de série */
.streak { display: inline-flex; align-items: center; height: 1.625rem; max-width: 0; padding: 0; overflow: hidden; border-radius: 980px; font-size: 0.8125rem; font-weight: 600; color: #fff; white-space: nowrap; background: linear-gradient(135deg, #ff9f0a, #ff6b00); opacity: 0; position: relative; }
.streak.show { max-width: 16rem; padding: 0 0.75rem; opacity: 1; }
.streak.gold { background: linear-gradient(135deg, #ffd60a, #ff9f0a); color: #4a3200; }
/* MC-02 (revu) : objectif du bloc, discret */
.goal { display: inline-flex; align-items: center; gap: 0.375rem; font-size: 0.75rem; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.goal svg { width: 1rem; height: 1rem; transform: rotate(-90deg); }
.goal circle { fill: none; stroke-width: 2.6; }
.goal .bg { stroke: var(--fill-2); }
.goal .fg { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .5s var(--ease); }

/* FX-13 : série parfaite */
.end h2.perfect { font-size: 3rem; font-weight: 700; letter-spacing: -.045em; background: linear-gradient(100deg, #1d1d1f 35%, #0071e3 50%, #1d1d1f 65%); background-size: 250% 100%; background-position: 180% 0; -webkit-background-clip: text; background-clip: text; color: transparent; }

/* FX-29 : « Retiens. » qui s'allume */
.hero-t .hl { color: var(--accent); position: relative; }
.hero-t .hl .fx-w { background: linear-gradient(100deg, var(--accent) 35%, #7cc0ff 50%, var(--accent) 65%); background-size: 250% 100%; background-position: 180% 0; -webkit-background-clip: text; background-clip: text; color: transparent; }

/* MC-05 (revu) : jours de suite */
.fact-days { display: flex; flex-direction: column; }
.fact-days b { color: var(--orange); display: inline-block; }
.hero-facts .days-dots, .days-dots { display: flex; gap: 0.25rem; margin-top: 0.5rem; }
.days-dots i { display: block; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--fill-2); }
.days-dots i.on { background: linear-gradient(135deg, #ff9f0a, #ff6b00); }
.days-dots i.today:not(.on) { box-shadow: inset 0 0 0 1.5px var(--orange-mark); background: transparent; }

/* FX-23 (revu) : la fiche du logo se retourne */
.logo-flip { width: 1.75rem; height: 1.75rem; perspective: 12rem; display: inline-block; flex: none; }
.flip-in { position: relative; display: block; width: 100%; height: 100%; transform-style: preserve-3d; }
.flip-in .face { position: absolute; inset: 0; width: 100%; height: 100%; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.flip-in .back { transform: rotateY(180deg); }
.logo .logo-back { fill: var(--fill-3); }
.logo .logo-lines { fill: none; stroke: #fff; stroke-width: 1.3; stroke-linecap: round; }

/* MC-01 : succès (texte seul) */
.ach { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.ach h4 { margin-bottom: 0.625rem; }
.ach-list { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.ach-chip { font-size: 0.75rem; font-weight: 500; padding: 0.25rem 0.625rem; border-radius: 980px; background: var(--fill); color: var(--text-3); }
.ach-chip.on { background: linear-gradient(135deg, rgba(255, 214, 10, .28), rgba(255, 159, 10, .22)); color: #6b4a00; font-weight: 600; }

/* IM-01 / IM-02 : onglet réglages */
.top-icons button.top-icon { background: none; }
.modal-card.settings { width: min(36rem, 100%); padding: 1.75rem 2rem; }
.modal-card.settings .modal-head { margin-bottom: 0.5rem; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; padding: 0.875rem 0; border-bottom: 1px solid var(--line); }
.set-row b { display: block; font-size: 1rem; letter-spacing: -.015em; }
.set-row span { display: block; font-size: 0.8125rem; color: var(--text-2); margin-top: 0.125rem; line-height: 1.4; }
.set-row .segmented, .set-row .switch { flex: none; }
.set-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1rem; }

/* MC-03 : gain de la soirée */
.modal-card.gain { width: min(30rem, 100%); padding: 2rem 2.25rem; display: flex; flex-direction: column; gap: 1rem; text-align: left; }
.gain-t { font-size: 1.75rem; letter-spacing: -.035em; line-height: 1.15; }
.gain-n { color: var(--green); display: inline-block; font-variant-numeric: tabular-nums; }
.gain-bars { display: grid; gap: 0.75rem; }
.gain-bars > div { display: grid; grid-template-columns: 3.5rem 1fr 3rem; align-items: center; gap: 0.75rem; font-size: 0.875rem; color: var(--text-2); }
.gain-bars .bar { height: 0.625rem; border-radius: 0.3125rem; }
.gain-bars b { color: var(--text); text-align: right; font-variant-numeric: tabular-nums; }
.modal-card.gain .btn { align-self: flex-start; margin-top: 0.25rem; }

/* ============ Fenêtres étroites : une colonne de plus en moins, défilement autorisé ============ */
@media (max-width: 1080px), (max-height: 600px) {
  body { overflow: auto; display: block; }
  main#app { height: auto; padding: 1.25rem; }
  .view { height: auto; min-height: calc(100vh - var(--topbar) - 2.5rem); }
  .topbar { position: sticky; top: 0; padding: 0 1rem; }
}
@media (max-width: 1080px) {
  .topbar { grid-template-columns: 1fr auto; height: auto; min-height: var(--topbar); padding: 0.625rem 1.25rem; gap: 0.625rem 0.75rem; }
  .seg { grid-column: 1 / -1; grid-row: 2; overflow-x: auto; justify-self: center; max-width: 100%; }
  .seg button { flex: none; }
  .top-right { grid-column: 2; grid-row: 1; }
  .crumb { display: none; }
  .pill-left { display: none; }
  .home { grid-template-columns: 1fr; grid-template-rows: auto auto; }
  .hero { padding: 2.25rem 2rem; }
  .shelf { overflow: visible; }
  .hero-t { font-size: clamp(2.75rem, 9vw, 4.5rem); }
  .covers { grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); }
  .plan { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .plan-detail { grid-column: 1 / -1; }
  .carte { grid-template-columns: 1fr; }
  .c-nav { flex-direction: row; flex-wrap: wrap; }
  .c-nav-item { grid-template-columns: auto; }
  .c-nav-item .bar, .c-nav-sep { display: none; }
  .fiche { grid-template-columns: 1fr; }
  .lecture { grid-template-columns: 1fr; }
  .train { grid-template-columns: 1fr 1fr; grid-template-rows: auto; }
  .t-smart { grid-column: 1 / -1; grid-row: auto; }
  .t-pick { grid-column: 1 / -1; }
  .bilan { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .b-weak { grid-column: 1 / -1; }
  .player { grid-template-columns: 1fr; }
  .player-main { min-height: 32rem; }
  .frise { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .fr-col:nth-child(3)::after { display: none; }
  .ov-foot { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .seg button { padding: 0.375rem 0.75rem; }
  main#app { padding: 1rem; }
  .plan, .bilan, .train, .home { grid-template-columns: 1fr; }
  .hero { padding: 1.75rem 1.5rem; }
  .hero-facts { gap: 1.25rem; }
  .lib-head { flex-direction: column; align-items: flex-start; }
  .lib-filters { align-items: flex-start; }
  .frise, .flow, .pictos, .tree-branches, .build-grid, .part-btns { grid-template-columns: 1fr 1fr; }
  .match { grid-template-columns: 1fr 1.875rem 1fr; }
}

/* ============ Impression / PDF ============ */
.print-root { display: none; }
@media print {
  @page { size: A4; margin: 16mm 15mm; }
  html, body { height: auto; overflow: visible; background: #fff; display: block; }
  body > *:not(#print) { display: none !important; }
  #print { display: block !important; color: #000; font-family: var(--font); font-size: 10.5pt; line-height: 1.45; }
  .pr-head { border-bottom: 2px solid #000; padding-bottom: 8pt; margin-bottom: 12pt; }
  .pr-head h1 { font-size: 20pt; letter-spacing: -.02em; }
  .pr-head p { color: #555; font-size: 10pt; margin-top: 3pt; }
  .pr-stats { display: flex; gap: 24pt; margin: 10pt 0 16pt; }
  .pr-stats div b { display: block; font-size: 16pt; }
  .pr-stats div span { font-size: 9pt; color: #555; }
  #print h2 { font-size: 13pt; margin: 16pt 0 6pt; break-after: avoid; }
  #print table { width: 100%; border-collapse: collapse; font-size: 9.5pt; }
  #print th, #print td { border-bottom: .5pt solid #ccc; padding: 4pt 5pt; text-align: left; vertical-align: top; }
  #print th { font-size: 8.5pt; color: #555; text-transform: uppercase; letter-spacing: .03em; }
  .pr-notion { break-inside: avoid; border: .75pt solid #ccc; border-radius: 6pt; padding: 8pt 10pt; margin-bottom: 8pt; }
  .pr-notion h3 { font-size: 11pt; display: flex; justify-content: space-between; }
  .pr-notion p { margin-top: 3pt; font-size: 9.5pt; }
  .pr-err { margin-top: 5pt; padding-left: 8pt; border-left: 2pt solid #d70015; font-size: 9pt; }
  .pr-err .q { font-weight: 600; }
  .pr-err .g { color: #a00; }
  .pr-err .e { color: #1a7f37; }
  .pr-prompt { border: 1pt solid #000; border-radius: 6pt; padding: 10pt 12pt; white-space: pre-wrap; font-size: 9.5pt; break-inside: avoid; }
  .pr-brand { font-size: 10pt; font-weight: 600; letter-spacing: -.02em; color: #0071e3; margin-bottom: 4pt; }
  .pr-notion ul { margin: 4pt 0 0 14pt; font-size: 9.5pt; }
  .pr-trap { color: #8a4200; }
  .pr-cit { font-family: var(--serif); font-style: italic; }
  .pr-tips { margin-left: 14pt; display: grid; gap: 3pt; }
  .pr-small { font-size: 9pt; color: #555; margin-bottom: 5pt; }
}
