/* EPSO Trainer, Design system (refonte "claude design") */

:root {
  --bg: #EDE9E1;
  --surface: #F6F4EF;
  --card: #ffffff;
  --card-alt: #FAF8F3;

  --text: #1C2438;
  --text-muted: #6B7385;
  --text-light: #9A9384;

  --accent: #2F6BFF;
  --accent-dark: #1E52D8;
  --accent-light: #EAF0FF;

  --purple: #7A5AF8;
  --purple-light: #F0ECFF;

  --success: #12B76A;
  --success-light: #E7F8EF;
  --error: #F04438;
  --error-light: #FDECEC;
  --streak: #FF7A3D;
  --streak-text: #EA6A34;
  --streak-light: #FFF0E8;

  --border: #ECE7DE;
  --border-strong: #E0DBD1;
  --track: #EAE6DE;

  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 20px;
  --r-xl: 24px;

  --shadow-sm: 0 6px 18px rgba(28,36,56,.05);
  --shadow-md: 0 6px 20px rgba(28,36,56,.06);
  --shadow-accent: 0 12px 22px rgba(47,107,255,.26);

  --maxw: 430px;
  --nav-h: 74px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: 'Poppins', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; font-weight: 700; }
a:hover { color: var(--accent-dark); }
button { font-family: inherit; }
::selection { background: var(--accent-light); }
.recap, .correction, .theory, .q-stem, .card, .rule-box, .step .t, .answer-line {
  -webkit-user-select: text; user-select: text;
}

/* ---- Layout shell ---- */
#app { min-height: 100vh; }

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100vh;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 60px rgba(28,36,56,.06);
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
}
.screen.has-nav { padding-bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom)); }

/* ---- Typographic helpers ---- */
.eyebrow { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.h1 { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.h2 { font-size: 18px; font-weight: 800; letter-spacing: -.01em; }
.muted { color: var(--text-muted); }
.section-label { font-size: 12px; font-weight: 800; letter-spacing: .06em; color: var(--text-light); text-transform: uppercase; }

/* ---- Top bar ---- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.streak-badge {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--streak-light); color: var(--streak-text);
  padding: 7px 13px; border-radius: 999px;
  font-weight: 700; font-size: 13px; white-space: nowrap;
}
.streak-badge .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--streak); }

/* ---- Cards ---- */
.card {
  background: var(--card);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.card-soft { background: var(--card); border-radius: 18px; padding: 14px 16px; box-shadow: var(--shadow-sm); }

/* countdown */
.countdown { display: flex; flex-direction: column; gap: 8px; }
.countdown .row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.countdown .row .lbl { color: var(--text-muted); font-weight: 500; }
.countdown .row .val { font-weight: 700; }

.track { height: 9px; background: var(--track); border-radius: 999px; overflow: hidden; }
.track > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .35s ease; }

/* ---- Week switcher ---- */
.week-switch { display: flex; justify-content: space-between; align-items: center; }
.week-switch .label { font-size: 15px; font-weight: 800; }
.round-btn {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1.5px solid var(--border-strong); background: var(--card);
  color: var(--text-muted); font-size: 16px; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.round-btn:hover:not(:disabled) { background: var(--accent-light); color: var(--accent); }
.round-btn:disabled { opacity: .4; cursor: default; }

/* ---- Parcours timeline ---- */
.timeline { position: relative; display: flex; flex-direction: column; gap: 20px; padding: 4px 2px; }
.timeline .rail { position: absolute; left: 39px; top: 24px; bottom: 24px; width: 3px; background: #E7E3DB; border-radius: 2px; }

.node { position: relative; display: flex; align-items: flex-start; gap: 14px; }
.node .bullet {
  width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; font-weight: 800; flex: none; z-index: 1;
}
.bullet.done { background: var(--success); color: #fff; }
.bullet.today { background: #fff; color: var(--accent); border: 3px solid var(--accent); box-shadow: 0 0 0 6px rgba(47,107,255,.14); }
.bullet.locked { background: #ECE9E2; color: #B7B2A7; }

.node-reg { padding-top: 5px; }
.node-reg.clickable { cursor: pointer; }
.node-reg .t { font-weight: 700; font-size: 14px; color: var(--text); }
.node-reg.locked .t { color: var(--text-muted); }
.node-reg.locked { opacity: .55; }
.node-reg .s { font-size: 12px; color: var(--text-light); }

.today-card {
  flex: 1; background: var(--accent); border-radius: var(--r-lg);
  padding: 16px; color: #fff; box-shadow: 0 14px 26px rgba(47,107,255,.28);
}
.today-card .kicker { font-size: 11px; font-weight: 700; letter-spacing: .08em; opacity: .85; }
.today-card .t { font-size: 16px; font-weight: 800; margin: 4px 0 3px; line-height: 1.3; }
.today-card .s { font-size: 12px; opacity: .9; }
.today-card .go {
  margin-top: 12px; width: 100%; background: #fff; color: var(--accent);
  border: none; border-radius: 13px; padding: 12px; font-weight: 700; font-size: 15px; cursor: pointer;
  transition: background .15s;
}
.today-card .go:hover { background: var(--accent-light); }

.empty-note {
  background: var(--card); border: 1.5px dashed var(--border-strong);
  border-radius: var(--r-md); padding: 22px 16px; text-align: center;
  color: var(--text-muted); font-size: 14px; font-weight: 500;
}

/* ---- Bottom nav ---- */
.bottom-nav {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(14px + env(safe-area-inset-bottom));
  width: min(calc(var(--maxw) - 24px), calc(100vw - 24px));
  display: flex; justify-content: space-around; align-items: center;
  background: #fff; border-radius: 22px; padding: 11px 8px;
  box-shadow: 0 8px 28px rgba(28,36,56,.12); z-index: 50;
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  color: var(--text-light); background: none; border: none; cursor: pointer;
  font-weight: 600; font-size: 11px; padding: 2px 10px; flex: 1;
}
.nav-item.active { color: var(--accent); }
.nav-item .ico { width: 20px; height: 20px; font-size: 18px; line-height: 20px; }

/* ---- Question / session ---- */
.q-topbar { display: flex; align-items: center; gap: 12px; }
.q-count { font-size: 13px; font-weight: 700; color: var(--text-muted); white-space: nowrap; }
.q-progress { flex: 1; height: 9px; background: var(--track); border-radius: 999px; overflow: hidden; }
.q-progress > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .3s; }

.pill {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 700;
}
.pill.num { background: var(--accent-light); color: var(--accent); }
.pill.abs { background: var(--purple-light); color: var(--purple); }
.pill.mix { background: var(--streak-light); color: var(--streak-text); }

.timer {
  align-self: flex-start; font-weight: 800; font-size: 14px;
  padding: 6px 12px; border-radius: 999px; background: var(--accent-light); color: var(--accent);
}
.timer.warning { background: var(--streak-light); color: var(--streak-text); }
.timer.danger { background: var(--error-light); color: var(--error); }

.q-stem { font-size: 18px; font-weight: 700; line-height: 1.4; }

/* data table */
.data-table-wrap { background: #fff; border: 1.5px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.data-table-wrap .cap { padding: 9px 14px; font-size: 12px; font-weight: 700; color: var(--text-muted); border-bottom: 1.5px solid #F2EEE6; }
.data-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; padding: 9px 14px; font-weight: 700; color: var(--text); background: var(--card-alt); white-space: nowrap; }
.data-table td { padding: 9px 14px; border-top: 1px solid #F2EEE6; color: #4A5061; font-weight: 500; white-space: nowrap; }

.recap {
  background: var(--accent-light); border-radius: var(--r-md); padding: 14px 16px;
  font-size: 13px; color: #35407a; line-height: 1.65;
}
.recap strong { font-weight: 700; display: inline-block; margin-top: 8px; }
.recap strong:first-child { margin-top: 0; }
.recap p { margin: 0 0 10px; }
.recap p:last-child { margin-bottom: 0; }
.recap-calc {
  background: #fff; border: 2px solid var(--accent); border-radius: 10px;
  padding: 14px 16px; margin: 8px 0; font-size: 13px; font-weight: 600;
  color: var(--accent); text-align: center; line-height: 2.2;
}
.recap-calc::before { display: none; }
.recap-calc-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; margin-bottom: 10px; display: block;
}
.recap-calc .frac {
  display: inline-flex; flex-direction: column; align-items: center;
  vertical-align: middle; margin: 0 4px;
}
.recap-calc .frac-top, .recap-calc .frac-bot {
  padding: 2px 8px; font-size: 12px;
}
.recap-calc .frac-bar {
  width: 100%; height: 2px; background: var(--accent); border-radius: 1px;
}

.rule-box .frac {
  display: inline-flex; flex-direction: column; align-items: center;
  vertical-align: middle; margin: 0 4px;
}
.rule-box .frac-top, .rule-box .frac-bot { padding: 2px 8px; font-size: 12px; font-weight: 700; color: #2563eb; }
.rule-box .frac-bar { width: 100%; height: 2px; background: #2563eb; border-radius: 1px; }
.rule-box .recap-calc {
  background: #fff; border: 2px solid #2563eb; border-radius: 10px;
  padding: 14px 16px; margin: 8px 0; font-size: 13px; font-weight: 600;
  color: #2563eb; text-align: center; line-height: 2.2;
}
.recap-video { margin: 8px 0; border-radius: 10px; overflow: hidden; border: 1.5px solid var(--accent); }
.recap-video iframe { display: block; width: 100%; }
.ratio-simplify { display: flex; flex-direction: column; gap: 0; margin: 10px 0; }
.rs-step { display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
.rs-step:nth-child(odd) { background: #fff; border-radius: 8px; }
.rs-label { font-size: 12px; font-weight: 600; color: var(--accent); min-width: 130px; flex: none; }
.rs-frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; }
.rs-frac .rs-top, .rs-frac .rs-bot { padding: 4px 14px; font-size: 18px; font-weight: 800; color: var(--accent); position: relative; min-width: 40px; text-align: center; }
.rs-frac .rs-bar { width: 100%; min-width: 50px; height: 2.5px; background: var(--accent); border-radius: 2px; }
.rs-op { font-size: 13px; color: #4A5061; font-weight: 500; }
.rs-frac .rs-strike { text-decoration: line-through; text-decoration-color: #e53e3e; text-decoration-thickness: 2.5px; opacity: 0.55; }
.rs-arrow { font-size: 20px; color: var(--accent); font-weight: 800; }
.cross-apps { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.ca-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--accent-light); border-radius: 8px; font-size: 13px; color: #4A5061; }
.ca-tag { background: var(--accent); color: #fff; border-radius: 6px; padding: 3px 8px; font-size: 11px; font-weight: 700; white-space: nowrap; flex: none; }
.cross-schema { display: flex; flex-direction: column; gap: 14px; margin: 10px 0; }
.cs-title { font-size: 13px; font-weight: 700; color: var(--accent); text-align: center; }
.cs-examples { display: flex; flex-direction: column; gap: 12px; }
.cs-ex { background: #fff; border: 1.5px solid var(--border, #E8E4DA); border-radius: 10px; padding: 12px; display: flex; align-items: center; gap: 14px; }
.cs-ex-label { font-size: 12px; font-weight: 700; color: var(--accent); min-width: 90px; flex: none; }
.cs-cross { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; flex: none; }
.cs-cell { padding: 6px 14px; font-size: 13px; font-weight: 700; text-align: center; border-radius: 6px; min-width: 56px; }
.cs-cell.known { background: var(--accent-light); color: var(--accent); }
.cs-cell.unknown { background: #fff; border: 2px dashed var(--accent); color: var(--accent); }
.cs-calc { font-size: 12px; font-weight: 700; color: #4A5061; flex: 1; line-height: 1.6; }
.cs-calc-result { color: var(--success, #16a34a); font-weight: 800; }
.cs-rule { background: var(--accent); color: #fff; border-radius: 10px; padding: 14px 16px; margin-top: 4px; }
.cs-rule-title { font-weight: 800; font-size: 13px; margin-bottom: 8px; }
.cs-rule ol { margin: 0; padding-left: 18px; font-size: 12.5px; line-height: 1.7; }
.cs-rule .cs-eq { display: block; background: rgba(255,255,255,0.18); border-radius: 6px; padding: 6px 10px; margin-top: 8px; font-weight: 800; font-size: 13px; text-align: center; }
.pct-compare { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.pct-row { background: var(--accent-light); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.pct-label { font-size: 13px; font-weight: 700; color: var(--accent); }
.pct-calc { font-size: 16px; font-weight: 800; color: #4A5061; }
.pct-calc strong { color: var(--accent); }
.pct-note { font-size: 12px; color: #4A5061; font-weight: 500; font-style: italic; }
.pct-formula { background: #fff; border: 2px solid var(--accent); border-radius: 12px; padding: 16px 18px; margin: 10px 0; }
.pf-title { font-weight: 800; font-size: 14px; color: var(--accent); margin-bottom: 12px; }
.pf-eq { text-align: center; margin-bottom: 14px; }
.pf-eq .pf-pct { font-weight: 800; font-size: 16px; color: var(--accent); }
.pf-frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; margin: 0 6px; }
.pf-top, .pf-bot { padding: 2px 10px; font-size: 14px; font-weight: 700; color: #4A5061; }
.pf-bar { width: 100%; min-width: 40px; height: 2.5px; background: var(--accent); border-radius: 2px; }
.pf-example { background: var(--accent-light); border-radius: 10px; padding: 14px 16px; }
.pf-ex-label { font-size: 13px; font-weight: 700; color: var(--accent); margin-bottom: 8px; }
.pf-ex-line { font-size: 13px; color: #4A5061; margin: 4px 0; }
.pf-ex-line strong { color: var(--accent); }
.pf-ex-result { display: block; background: var(--accent); color: #fff; border-radius: 8px; padding: 8px 14px; margin-top: 8px; font-weight: 800; font-size: 14px; text-align: center; }
.cm-schema { margin: 10px 0; display: flex; flex-direction: column; gap: 12px; }
.cm-pairs { display: flex; gap: 10px; }
.cm-card { flex: 1; background: #fff; border: 2px solid var(--border, #E8E4DA); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.cm-card.cm-down { border-color: #e53e3e; }
.cm-card.cm-up { border-color: var(--success, #16a34a); }
.cm-card-title { font-weight: 800; font-size: 13px; text-align: center; }
.cm-card.cm-down .cm-card-title { color: #e53e3e; }
.cm-card.cm-up .cm-card-title { color: var(--success, #16a34a); }
.cm-card-line { font-size: 12.5px; color: #4A5061; line-height: 1.5; }
.cm-card-cm { font-size: 20px; font-weight: 800; text-align: center; padding: 6px 0; }
.cm-card.cm-down .cm-card-cm { color: #e53e3e; }
.cm-card.cm-up .cm-card-cm { color: var(--success, #16a34a); }
.cm-ex { background: var(--accent-light); border-radius: 10px; padding: 14px 16px; display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.cm-ex-box { background: #fff; border-radius: 8px; padding: 8px 14px; text-align: center; }
.cm-ex-val { font-size: 18px; font-weight: 800; color: var(--accent); }
.cm-ex-lbl { font-size: 10.5px; font-weight: 600; color: #4A5061; }
.cm-ex-op { font-size: 22px; font-weight: 800; color: var(--accent); }
.cm-ex-result { background: var(--accent); color: #fff; border-radius: 8px; padding: 8px 14px; }
.cm-ex-result .cm-ex-val { color: #fff; }
.cm-summary { background: #fff; border: 2px solid var(--accent); border-radius: 10px; padding: 12px 16px; }
.cm-summary-title { font-weight: 700; font-size: 12px; color: var(--accent); margin-bottom: 8px; text-align: center; text-transform: uppercase; letter-spacing: 0.04em; }
.cm-summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; font-size: 13px; }
.cm-summary-grid span:nth-child(odd) { font-weight: 700; color: #e53e3e; }
.cm-summary-grid span:nth-child(even) { font-weight: 700; color: var(--success, #16a34a); }
.cm-summary-note { text-align: center; font-size: 12px; color: #4A5061; margin-top: 8px; font-weight: 600; }
.traps-box { margin-top: 12px; padding-top: 12px; border-top: 1px solid #F2EEE6; }
.traps-title { font-weight: 800; font-size: 13px; color: #e53e3e; margin-bottom: 8px; }
.trap-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 12px; background: #fef2f2; border-radius: 8px; margin-bottom: 6px; font-size: 12.5px; }
.trap-opt { font-weight: 800; color: #e53e3e; white-space: nowrap; flex: none; }
.trap-err { color: #4A5061; line-height: 1.5; }
.example-box { background: #fff; border: 2px solid var(--accent); border-radius: 12px; padding: 16px 18px; margin: 10px 0; }
.exb-title { font-weight: 800; font-size: 14px; color: var(--accent); margin-bottom: 10px; }
.exb-sub { font-size: 13px; color: #4A5061; margin-bottom: 10px; }
.exb-block { background: var(--accent-light); border-radius: 10px; padding: 14px 16px; margin: 8px 0; }
.exb-line { font-size: 13.5px; color: #4A5061; line-height: 1.7; }
.exb-line strong { color: var(--accent); }
.exb-highlight { font-weight: 800; color: var(--accent); }
.exb-result { display: block; background: var(--accent); color: #fff; border-radius: 8px; padding: 8px 14px; margin-top: 8px; font-weight: 800; font-size: 14px; text-align: center; }
.exb-warn { display: block; background: #fef2f2; border: 1px solid #e53e3e; border-radius: 8px; padding: 8px 14px; margin-top: 8px; font-size: 12.5px; color: #e53e3e; font-weight: 600; line-height: 1.5; }
.example-box-purple { border-color: var(--purple); }
.example-box-purple .exb-title { color: var(--purple); }
.example-box-purple .exb-block { background: var(--purple-light); }
.example-box-purple .exb-line strong { color: var(--purple); }
.example-box-purple .exb-highlight { color: var(--purple); }
.example-box-purple .exb-result { background: var(--purple); }
.example-box-purple .exb-warn { border-color: var(--purple); color: var(--purple); background: var(--purple-light); }

/* Règle mathématique dans la correction */
.rule-box {
  background: #f0f7ff; border-left: 4px solid #2563eb; border-radius: 8px;
  padding: 12px 16px; margin: 0 0 14px;
}
.rule-label {
  font-size: 11px; font-weight: 700; color: #2563eb;
  text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px;
}
.rule-text {
  font-size: 14px; color: #1e3a5f; line-height: 1.55; font-weight: 500;
}
.recap .section-label { color: var(--accent); margin-bottom: 6px; }

/* options */
.options { display: flex; flex-direction: column; gap: 10px; }
.option {
  display: flex; align-items: center; gap: 13px; width: 100%; text-align: left;
  background: #fff; border: 2px solid var(--border); border-radius: var(--r-md);
  padding: 14px; cursor: pointer; transition: background .12s, border-color .12s, opacity .12s;
}
.option:hover:not(.disabled) { border-color: #C9D6FF; }
.option .lab {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: #F2EEE6; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px;
}
.option .txt { flex: 1; font-weight: 600; font-size: 15px; color: var(--text); }
.option .mark { font-weight: 800; font-size: 16px; }
.option.disabled { cursor: default; }
.option.selected { background: var(--accent-light); border-color: var(--accent); }
.option.selected .lab { background: var(--accent); color: #fff; }
.option.correct { background: var(--success-light); border-color: var(--success); }
.option.correct .lab { background: var(--success); color: #fff; }
.option.correct .mark { color: var(--success); }
.option.wrong { background: var(--error-light); border-color: var(--error); }
.option.wrong .lab { background: var(--error); color: #fff; }
.option.wrong .mark { color: var(--error); }
.option.dim { opacity: .5; }

/* feedback + correction */
.feedback { display: flex; align-items: center; gap: 10px; border-radius: 14px; padding: 12px 14px; }
.feedback .fi { width: 26px; height: 26px; border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px; flex: none; }
.feedback .ft { font-weight: 700; font-size: 14px; }
.feedback.ok { background: var(--success-light); } .feedback.ok .fi { background: var(--success); } .feedback.ok .ft { color: var(--success); }
.feedback.ko { background: var(--error-light); } .feedback.ko .fi { background: var(--error); } .feedback.ko .ft { color: var(--error); }

.correction { background: #fff; border: 1.5px solid var(--border); border-radius: var(--r-md); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.step { display: flex; align-items: flex-start; gap: 11px; }
.step .n { width: 22px; height: 22px; border-radius: 50%; background: var(--accent-light); color: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 12px; flex: none; }
.step .t { font-size: 14px; line-height: 1.5; color: #4A5061; font-weight: 500; display: block; flex: 1; min-width: 0; }
.answer-line { border-top: 1px solid #F2EEE6; padding-top: 11px; font-weight: 800; font-size: 14px; color: var(--success); }

/* cross-multiplication visual schema (méthode singapore) */
.cross-mult { background: var(--accent-light); border-radius: 14px; padding: 16px 18px; margin: 8px 0 4px; display: flex; flex-direction: column; gap: 10px; }
.cm-rule-box { background: #fff; border: 2px solid var(--accent); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.cm-rule-title { font-weight: 800; font-size: 14px; color: var(--accent); display: flex; align-items: center; gap: 6px; }
.cm-rule-formula { background: var(--accent-light); border-radius: 8px; padding: 10px 14px; font-size: 14px; line-height: 1.6; color: #24337a; font-weight: 600; text-align: center; }
.cm-rule-proof { display: flex; align-items: center; gap: 16px; justify-content: center; }
.cm-rule-proof table { border-collapse: collapse; font-size: 12.5px; }
.cm-rule-proof td { padding: 3px 10px; color: #4A5061; font-weight: 600; }
.cm-rule-proof td:nth-child(2) { color: var(--accent); font-weight: 800; text-align: center; padding: 3px 4px; }
.cm-rule-proof tr:nth-child(2) td:first-child { border-top: 1px solid rgba(36,51,122,0.15); }
.cm-rule-eq { background: var(--accent); color: #fff; border-radius: 8px; padding: 8px 14px; font-weight: 800; font-size: 14px; white-space: nowrap; }
.cm-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cm-header { font-size: 10.5px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.04em; padding-bottom: 4px; border-bottom: 1px solid rgba(36,51,122,0.12); }
.cm-header span { flex: 1; text-align: center; }
.cm-known { background: #fff; border: 1.5px solid var(--accent); border-radius: 8px; padding: 6px 10px; font-weight: 700; font-size: 14px; color: var(--accent); flex: 1; text-align: center; }
.cm-unknown { background: #fff; border: 2px dashed var(--accent); border-radius: 8px; padding: 6px 10px; font-weight: 800; font-size: 14px; color: var(--accent); flex: 1; text-align: center; }
.cm-arrow { color: var(--accent); font-weight: 800; font-size: 16px; flex: none; }
.cm-rule { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 4px 0; }
.cm-box { background: #fff; border-radius: 8px; padding: 6px 12px; font-weight: 700; font-size: 13px; color: #4A5061; }
.cm-eq { font-weight: 800; font-size: 16px; color: var(--accent); }
.cm-logic { font-size: 13px; line-height: 1.5; color: #4A5061; text-align: center; margin: 2px 0; }
.cm-result { display: block; background: #fff; color: #24337a; border-radius: 10px; padding: 10px 14px; margin: 4px 0 0; font-weight: 700; font-size: 14px; text-align: center; }

/* rule highlight box (generic math rule card) */
.rule-highlight { background: var(--accent-light); border: 2px solid var(--accent); border-radius: 14px; padding: 16px 18px; margin: 8px 0 4px; display: flex; flex-direction: column; gap: 10px; }
.rh-title { font-weight: 800; font-size: 14px; color: var(--accent); }
.rh-formula { background: #fff; border-radius: 8px; padding: 10px 14px; font-size: 14px; line-height: 1.6; color: #24337a; font-weight: 700; text-align: center; }
.rh-logic { font-size: 13px; line-height: 1.5; color: #4A5061; }
.rh-apply { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.rh-box { background: #fff; border: 1.5px solid var(--accent); border-radius: 8px; padding: 6px 12px; font-weight: 700; font-size: 14px; color: var(--accent); }
.rh-box.rh-result { background: var(--accent); color: #fff; border-color: var(--accent); }
.rh-op { font-weight: 800; font-size: 16px; color: var(--accent); }

/* hermes chat */
.hermes-chat-box {
  background: var(--purple-light, #f3f0ff); border-radius: 14px; padding: 14px 16px;
  margin-top: 12px;
}
.hermes-chat-box .section-label { color: var(--purple, #7a5af8); margin-bottom: 10px; }
.hermes-chat-msgs {
  max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px;
  margin-bottom: 10px;
}
.hermes-msg { display: flex; }
.hermes-user { justify-content: flex-end; }
.hermes-bot { justify-content: flex-start; }
.hermes-msg-text {
  max-width: 85%; padding: 10px 14px; border-radius: 14px; font-size: 13px; line-height: 1.55;
}
.hermes-user .hermes-msg-text {
  background: var(--purple, #7a5af8); color: #fff; border-bottom-right-radius: 4px;
}
.hermes-bot .hermes-msg-text {
  background: #fff; color: #3b3466; border-bottom-left-radius: 4px;
}
.hermes-suggestions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.hermes-sugg {
  background: #fff; border: 1px solid var(--purple, #7a5af8); color: var(--purple, #7a5af8);
  border-radius: 999px; padding: 8px 14px; font-size: 12px; font-weight: 600;
  font-family: inherit; cursor: pointer;
}
.hermes-sugg:hover { background: var(--purple, #7a5af8); color: #fff; }
.hermes-chat-input { display: flex; gap: 8px; }
.hermes-chat-input input {
  flex: 1; border: 1.5px solid #ddd; border-radius: 12px; padding: 12px 14px;
  font-size: 14px; font-family: inherit; outline: none;
}
.hermes-chat-input input:focus { border-color: var(--purple, #7a5af8); }
.hermes-chat-input .btn { flex: none; width: auto; padding: 12px 20px; }
.spinner { width: 15px; height: 15px; border: 2px solid rgba(122,90,248,.3); border-top-color: var(--purple, #7a5af8); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; vertical-align: middle; margin-right: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }
/* ---- Buttons ---- */
.btn { border: none; border-radius: 15px; padding: 16px; font-weight: 700; font-size: 16px; cursor: pointer; width: 100%; transition: background .15s, opacity .15s; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-accent); }
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:disabled { background: #E4DFD5; color: #A9A395; box-shadow: none; cursor: not-allowed; }
.btn-ghost { background: #fff; color: var(--text); border: 1.5px solid var(--border-strong); box-shadow: none; }
.btn-ghost:hover { background: var(--card-alt); }
.btn-secondary { background: #fff; color: var(--text); border: 1.5px solid var(--border-strong); box-shadow: none; }
.btn-secondary:hover { background: var(--card-alt); }
.btn-danger { background: var(--error-light); color: var(--error); box-shadow: none; }
.btn-danger:hover { background: #f9dede; }
.btn-sm { padding: 10px 14px; font-size: 14px; border-radius: 12px; width: auto; }

.icon-btn {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  border: 1.5px solid var(--border-strong); background: #fff; color: var(--text-muted);
  font-size: 18px; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--card-alt); }

.footer-cta { margin-top: auto; padding-top: 8px; display: flex; gap: 10px; }
.footer-cta .btn { flex: 1; }

/* ---- Stats screen ---- */
.stat-grid { display: flex; gap: 12px; }
.stat-box { flex: 1; background: #fff; border-radius: 18px; padding: 16px; box-shadow: var(--shadow-sm); text-align: left; }
.stat-box .v { font-size: 26px; font-weight: 800; color: var(--accent); }
.stat-box .v.green { color: var(--success); }
.stat-box .l { font-size: 12px; color: var(--text-muted); }

/* ---- Done screen ---- */
.done { align-items: center; justify-content: center; text-align: center; gap: 20px; }
.done .checkmark { width: 96px; height: 96px; border-radius: 50%; background: var(--success-light); display: flex; align-items: center; justify-content: center; font-size: 46px; color: var(--success); font-weight: 800; }
.done .title { font-size: 26px; font-weight: 800; }
.done .sub { font-size: 15px; color: var(--text-muted); margin-top: 4px; }
.streak-card { width: 100%; display: flex; align-items: center; gap: 10px; background: var(--streak-light); border-radius: var(--r-md); padding: 14px 16px; }
.streak-card .num { width: 30px; height: 30px; border-radius: 50%; background: var(--streak); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; flex: none; }
.streak-card .txt { font-weight: 700; font-size: 14px; color: var(--streak-text); text-align: left; }

/* ---- Profil / settings ---- */
.list { display: flex; flex-direction: column; }
.list-row {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  background: none; border: none; cursor: pointer; padding: 14px 2px;
  border-bottom: 1px solid var(--border);
}
.list-row:last-child { border-bottom: none; }
.list-row .ico { width: 38px; height: 38px; border-radius: 11px; background: var(--accent-light); color: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 18px; flex: none; }
.list-row .lr-main { flex: 1; }
.list-row .lr-t { font-weight: 700; font-size: 15px; }
.list-row .lr-s { font-size: 12px; color: var(--text-muted); }
.list-row .chev { color: var(--text-light); font-size: 18px; font-weight: 700; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 700; color: var(--text-muted); }
.field input {
  font-family: inherit; font-size: 15px; padding: 12px 14px;
  border: 1.5px solid var(--border-strong); border-radius: 12px; background: #fff; color: var(--text);
}
.field input:focus { outline: none; border-color: var(--accent); }
.hint { font-size: 13px; color: var(--text-muted); line-height: 1.5; }

/* ---- Theory content ---- */
.theory { font-size: 14.5px; line-height: 1.65; color: #3a4152; }
.theory p { margin: 0 0 10px; }
.theory strong { color: var(--text); font-weight: 700; }
.theory .formula { display: block; background: var(--accent-light); color: #24337a; border-radius: 12px; padding: 12px 14px; margin: 10px 0; font-weight: 600; font-size: 14px; }
.theory .tip { display: block; background: var(--streak-light); color: var(--streak-text); border-radius: 12px; padding: 12px 14px; margin: 10px 0; font-weight: 500; font-size: 13.5px; }

.freq-tag { font-weight: 700; font-size: 13px; color: var(--accent); white-space: nowrap; }

/* ---- Filter chips (Numerical types) ---- */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 14px;
}
.filter-chip {
  padding: 7px 13px; border-radius: 999px; border: 1.5px solid var(--border);
  background: #fff; color: var(--text-muted); font-size: 12.5px; font-weight: 700;
  cursor: pointer; transition: all .15s ease; white-space: nowrap;
}
.filter-chip:hover { border-color: var(--accent); color: var(--accent); }
.filter-chip.active {
  background: var(--accent); border-color: var(--accent); color: #fff;
}

/* ---- Simple header (sub screens) ---- */
.subhead { display: flex; align-items: center; gap: 12px; }
.subhead .title { font-size: 18px; font-weight: 800; }
.subhead .meta { margin-left: auto; font-size: 13px; color: var(--text-muted); font-weight: 600; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 26px); transform: translateX(-50%);
  background: var(--text); color: #fff; padding: 11px 18px; border-radius: 999px;
  font-size: 13px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.25);
  z-index: 100; opacity: 0; animation: toast 2.4s ease forwards; pointer-events: none;
}
@keyframes toast { 10%,80% { opacity: 1; } 100% { opacity: 0; } }

/* Carousel (pièges) */
.carousel-card { position: relative; }
.carousel-header {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.carousel-header .section-label { flex: 1; text-align: center; }
.carousel-arrow {
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: var(--bg-surface, #f0ede5); color: var(--text);
  font-size: 22px; line-height: 1; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.carousel-arrow:hover { background: var(--bg-surface-hover, #e4e0d6); }
.carousel-arrow.hidden { visibility: hidden; }
.carousel-dots {
  display: flex; justify-content: center; gap: 8px; margin-top: 14px;
}
.carousel-dot {
  width: 8px; height: 8px; border-radius: 50%; border: none;
  background: rgba(0,0,0,.18); cursor: pointer; padding: 0;
  transition: background .15s, transform .15s;
}
.carousel-dot.active {
  background: var(--text); transform: scale(1.3);
}

/* Tabs */
.tab-bar {
  display: flex; gap: 6px; margin-bottom: 16px; padding: 0 2px;
}
.tab-chip {
  flex: 1; padding: 10px 8px; border-radius: 12px; border: none;
  background: var(--bg-surface, #f0ede5); color: var(--text-muted, #888);
  font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all .15s; text-align: center;
}
.tab-chip.active {
  background: var(--text); color: #fff;
}
