:root {
  --bg: #f7f7f5; --card: #fff; --fg: #1a1a1a; --muted: #6b6b6b; --line: #e4e4e0;
  --accent: #2456d6; --ok: #15803d; --ok-bg: #e9f7ee; --ko: #c2410c; --ko-bg: #fdf0e9;
  --radius: 12px; --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.04); --edge: rgba(0,0,0,.18);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #131416; --card: #1c1d20; --fg: #e8e8e6; --muted: #9a9a96; --line: #2d2e32;
    --accent: #7aa2ff; --ok: #4ade80; --ok-bg: #16281d; --ko: #fb923c; --ko-bg: #2c1c12; --shadow: none; --edge: rgba(255,255,255,.22); }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: .2em 0 .3em; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
kbd { font: 11px/1 ui-monospace, monospace; border: 1px solid currentColor; border-radius: 4px; padding: 2px 4px; margin-left: 8px; opacity: .55; }

.top { max-width: 760px; margin: 0 auto; padding: 18px 20px 6px; display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap; }
.brand { font-weight: 700; color: var(--fg); }
#crumbs { font-size: .875rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; }
#crumbs a { color: var(--muted); }
#crumbs .sep { opacity: .5; }
main { max-width: 760px; margin: 0 auto; padding: 8px 20px 28px; }
.credit { text-align: center; font-size: .75rem; color: var(--muted); padding: 0 20px 24px; }

.hero { padding: 28px 0 18px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.tile { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; color: var(--fg); box-shadow: var(--shadow); position: relative; }
.tile p { margin: .4em 0 0; color: var(--muted); font-size: .92rem; }
a.tile:hover { border-color: var(--accent); text-decoration: none; }
.tile.soon { opacity: .55; box-shadow: none; }
.tile.soon h2 { padding-right: 70px; }
.tag { position: absolute; top: 16px; right: 16px; font-size: .75rem; border: 1px solid var(--line); border-radius: 99px; padding: 1px 8px; color: var(--muted); }

.list { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 0; }
.row { display: flex; gap: 16px; align-items: center; justify-content: space-between; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 16px; color: var(--fg); }
.row:hover { border-color: var(--accent); text-decoration: none; }
.row-main { display: flex; flex-direction: column; min-width: 0; }
.row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; min-width: 110px; }
.row-side .bar { width: 110px; }
.group { margin-top: 26px; }
.group-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }

.bar { height: 5px; border-radius: 99px; background: var(--line); overflow: hidden; display: flex; margin-top: 8px; }
.bar i { display: block; height: 100%; }
.bar .k { background: var(--ok); }
.bar .u { background: var(--ko); }

.stats { display: flex; gap: 10px; margin: 18px 0 6px; flex-wrap: wrap; }
.stats div { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; min-width: 96px; display: flex; flex-direction: column; }
.stats b { font-size: 1.35rem; }
.stats span { font-size: .8rem; color: var(--muted); }
.stats .ok b { color: var(--ok); }
.stats .ko b { color: var(--ko); }
.modes { display: flex; flex-direction: column; gap: 8px; margin: 22px 0 12px; max-width: 440px; }
.opts { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; font-size: .92rem; }
.opts input { margin-right: 6px; }

.btn { font: inherit; font-size: .95rem; display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--fg); cursor: pointer; text-align: center; }
.btn:hover:not(:disabled) { border-color: var(--accent); text-decoration: none; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.linkish { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; text-decoration: underline; }
.data { margin-top: 36px; font-size: .92rem; }
.data summary { cursor: pointer; color: var(--muted); }

/* session */
.session-top { display: flex; justify-content: space-between; align-items: baseline; }
.progress { height: 3px; background: var(--line); border-radius: 99px; margin: 8px 0 16px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); transition: width .2s; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 22px 24px; min-height: 280px; box-shadow: var(--shadow); display: flex; flex-direction: column; outline: none; transition: transform .14s ease-in; overflow-wrap: anywhere; }
.card.method, .card.vocab { cursor: pointer; }
.card.turn { transform: scaleX(.02); }
.label { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 12px; }
.card .q, .card .a { font-size: 1.02rem; }
.card .q p:first-child, .card .a p:first-child { margin-top: 0; }
.card .foot { margin-top: auto; padding-top: 14px; text-align: center; }
.card .center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 18px 0; }
.word { font-size: 2rem; font-weight: 600; letter-spacing: -.01em; }
.word-small { font-size: .95rem; margin-bottom: 8px; }
.trans { font-size: 1.6rem; font-weight: 600; }
.example { font-size: .9rem; color: var(--muted); font-style: italic; text-align: center; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 8px; }
.recall { font-size: .88rem; color: var(--muted); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; margin-bottom: 14px; }
.recall summary { cursor: pointer; }
.recall > div { padding-top: 6px; }
.a ul, .a ol, .q ul, .q ol, .exp ul, .exp ol { padding-left: 1.3em; }
.note { background: var(--bg); border-left: 3px solid var(--accent); padding: 8px 12px; border-radius: 4px; margin: 12px 0; font-size: .95rem; }
.katex-display { overflow-x: auto; overflow-y: hidden; padding: 2px 0;
  /* ombre sur le bord quand la formule déborde (indique qu'on peut la faire défiler) */
  background:
    linear-gradient(to right, var(--card) 30%, transparent) left center / 24px 100% no-repeat local,
    linear-gradient(to left, var(--card) 30%, transparent) right center / 24px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, var(--edge), transparent) left center / 10px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, var(--edge), transparent) right center / 10px 100% no-repeat scroll; }
.note .katex-display { background: none; }

.blank { display: inline-block; min-width: 4.5em; border-bottom: 2px solid var(--accent); margin: 0 2px; vertical-align: baseline; height: 1.1em; }
.blank.filled { min-width: 0; height: auto; padding: 0 3px; font-weight: 600; color: var(--ok); background: var(--ok-bg); border-radius: 4px 4px 0 0; border-bottom-color: var(--ok); }
.card.qcm .q { line-height: 1.75; }
.opts-list { display: flex; flex-direction: column; gap: 7px; margin: 16px 0 10px; }
.opt { font: inherit; display: flex; align-items: center; gap: 12px; text-align: left; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--fg); cursor: pointer; }
.opt:hover:not(:disabled) { border-color: var(--accent); }
.opt .letter { font-weight: 700; font-size: .85rem; width: 24px; height: 24px; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; background: var(--bg); }
.opt.right { border-color: var(--ok); background: var(--ok-bg); }
.opt.wrong { border-color: var(--ko); background: var(--ko-bg); }
.opt.dim { opacity: .6; }
.opt:disabled { cursor: default; }
#idk { align-self: flex-start; margin-top: 4px; }
.exp { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 12px; font-size: .95rem; }
.verdict { font-weight: 600; margin-bottom: 6px; }
.verdict.ok { color: var(--ok); }
.verdict.ko { color: var(--ko); }
.exp p { margin: .4em 0; }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.actions .btn { padding: 13px; }
.btn.ok { color: var(--ok); }
.btn.ko { color: var(--ko); }
.btn.ok.suggest { border-color: var(--ok); background: var(--ok-bg); }
.btn.ko.suggest { border-color: var(--ko); background: var(--ko-bg); }
.hint { text-align: center; }
.end { text-align: center; padding-top: 30px; }
.end .stats { justify-content: center; }
.end .modes { margin: 22px auto; }

@media (max-width: 520px) {
  .row { flex-direction: column; align-items: stretch; gap: 8px; }
  .row-side { align-items: stretch; }
  .row-side .bar { width: 100%; }
  .card { padding: 18px 16px; min-height: 240px; }
  .word { font-size: 1.7rem; }
  .katex-display > .katex { font-size: 1em; }
  kbd { display: none; }
}
