:root {
  --bg: #0e1117;
  --bg-soft: #161b24;
  --bg-card: #1c2230;
  --bg-card-2: #232b3b;
  --border: #2b3344;
  --text: #e6e9ef;
  --text-dim: #9aa4b2;
  --primary: #5b8cff;
  --good: #22c55e;
  --bad: #ef4444;
  --warn: #f59e0b;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(0,0,0,.35);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body { line-height: 1.5; }

#app { min-height: 100vh; display: flex; flex-direction: column; }

/* ===== TOPBAR ===== */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; background: var(--bg-soft);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.logo { font-size: 26px; }
.brand-name { font-weight: 800; font-size: 20px; letter-spacing: .3px; }
.topbar-right { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: flex-end; }
.stats { display: flex; align-items: center; gap: 18px; }
.auth-bar { display: flex; align-items: center; gap: 8px; }
.auth-user { font-size: 13px; font-weight: 700; color: var(--text-dim); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth-offline { font-size: 12px; color: var(--text-dim); font-weight: 600; }
.auth-btn { flex: none; padding: 7px 12px; font-size: 12px; max-width: none; }
.auth-btn-primary { background: var(--primary); border-color: transparent; color: #fff; }
.auth-card { max-width: 440px; margin: 0 auto; }
.auth-form { display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }
.auth-label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; color: var(--text-dim); }
.auth-input {
  border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px;
  background: var(--bg-soft); color: var(--text); font: inherit; font-weight: 500;
}
.auth-input:focus { outline: 2px solid rgba(91,140,255,.45); border-color: var(--primary); }
.auth-error { color: var(--bad); font-size: 14px; font-weight: 600; min-height: 20px; }
.auth-warn { background: rgba(245,158,11,.12); border: 1px solid rgba(245,158,11,.35); border-radius: 10px; padding: 12px 14px; font-size: 14px; margin: 12px 0; }
.auth-switch { text-align: center; color: var(--text-dim); font-size: 14px; margin-top: 8px; }
.stat { font-weight: 700; font-size: 15px; white-space: nowrap; }
.xpbar-wrap { display: flex; flex-direction: column; gap: 4px; min-width: 150px; }
.xpbar { height: 8px; background: var(--bg-card-2); border-radius: 99px; overflow: hidden; }
.xpfill { height: 100%; width: 0%; background: linear-gradient(90deg,#5b8cff,#a855f7); transition: width .5s; }
.xptext { font-size: 11px; color: var(--text-dim); font-weight: 600; }

main#view { flex: 1; max-width: 980px; width: 100%; margin: 0 auto; padding: 28px 20px 60px; }

.footer { text-align: center; padding: 16px; color: var(--text-dim); font-size: 13px; border-top: 1px solid var(--border); }
.linklike { background: none; border: none; color: var(--primary); cursor: pointer; font: inherit; text-decoration: underline; padding: 0; }

/* ===== HOME ===== */
.hero { text-align: center; margin-bottom: 28px; }
.hero h1 { font-size: 30px; margin: 0 0 6px; }
.hero p { color: var(--text-dim); margin: 0; }

.cta-row { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; margin: 24px 0 34px; }
.btn {
  border: none; border-radius: var(--radius); padding: 14px 22px; font-size: 15px; font-weight: 700;
  cursor: pointer; transition: transform .08s, filter .15s; color: #fff; background: var(--bg-card-2);
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(90deg,#5b8cff,#7c6bff); box-shadow: var(--shadow); }
.btn-ghost { background: var(--bg-card); border: 1px solid var(--border); }
.btn-lg { font-size: 17px; padding: 16px 28px; }

.section-title { font-size: 14px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--text-dim); margin: 26px 0 12px; font-weight: 700; }

/* ===== WORLD CARDS ===== */
.worlds { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 16px; }
.world {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; cursor: pointer; position: relative; overflow: hidden; transition: transform .1s, border-color .15s;
}
.world:hover { transform: translateY(-3px); border-color: var(--accent, var(--primary)); }
.world .wtop { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.world .wemoji { font-size: 28px; }
.world h3 { margin: 0; font-size: 18px; }
.world .wsub { color: var(--text-dim); font-size: 13px; min-height: 34px; }
.world .wbar { height: 7px; background: var(--bg-card-2); border-radius: 99px; overflow: hidden; margin-top: 12px; }
.world .wfill { height: 100%; width: 0%; border-radius: 99px; transition: width .5s; }
.world .wmeta { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-dim); margin-top: 7px; font-weight: 600; }
.world .badge-done { position: absolute; top: 10px; right: 12px; font-size: 20px; }

.world .wactions { display: flex; gap: 8px; margin-top: 13px; }
.wbtn { flex: 1; border: 1px solid var(--border); background: var(--bg-card-2); color: var(--text);
  border-radius: 9px; padding: 9px 8px; font-size: 13px; font-weight: 700; cursor: pointer; transition: filter .12s, border-color .12s; }
.wbtn:hover { filter: brightness(1.15); border-color: var(--accent, var(--primary)); }
.wbtn-learn { background: rgba(255,255,255,.04); }
.wbtn-test { background: var(--accent, var(--primary)); border-color: transparent; color: #0e1117; }

/* ===== ROADMAP ===== */
.roadmap-cta { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  background: linear-gradient(135deg, rgba(91,140,255,.22), rgba(168,85,247,.18));
  border: 1px solid var(--primary); border-radius: var(--radius); padding: 22px; margin-bottom: 22px; }
.roadmap-cta h2 { margin: 0 0 4px; font-size: 21px; }
.roadmap-cta p { margin: 0; color: var(--text-dim); font-size: 14px; }

.rchapter { margin-bottom: 22px; }
.rchapter-h { font-size: 15px; margin: 0 0 10px; color: var(--text); }
.rsteps { display: flex; flex-direction: column; gap: 8px; }
.rstep { display: flex; align-items: center; gap: 12px; text-align: left; width: 100%;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 13px 16px;
  color: var(--text); font-size: 15px; font-weight: 600; cursor: pointer; transition: border-color .12s, transform .08s; }
.rstep.open { border-color: var(--primary); }
.rstep.open:hover, .rstep.done:hover { transform: translateX(3px); }
.rstep.done { color: var(--text-dim); }
.rstep.locked { opacity: .5; cursor: not-allowed; }
.rstep-icon { font-size: 17px; }
.rstep-titre { flex: 1; }
.rstep-tag { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px;
  background: rgba(245,158,11,.15); color: var(--warn); border-radius: 99px; padding: 2px 9px; }

/* étape : "pourquoi" */
.step-why { background: rgba(91,140,255,.1); border-left: 3px solid var(--primary); border-radius: 8px;
  padding: 10px 14px; margin-bottom: 16px; font-size: 14px; }

/* entrée glossaire dans une étape */
.glos-entry { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 15px; }
.glos-entry:last-child { border-bottom: none; }

/* exercice guidé */
.exo { margin-top: 20px; border: 1px solid var(--border); border-radius: 12px; padding: 16px; background: var(--bg-soft); }
.exo-label { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; color: var(--primary); margin-bottom: 8px; }
.exo-enonce { margin: 0 0 12px; font-size: 14.5px; color: var(--text-dim); }
.exo-probleme-wrap { margin-bottom: 12px; }
.exo-probleme { margin: 0; padding: 12px 14px; background: rgba(239,68,68,.08); border: 1px solid rgba(239,68,68,.35); border-radius: 10px; font-size: 14.5px; line-height: 1.45; }
.exo-part-bad { color: #f87171; }
.exo-bad-wrap { margin-bottom: 14px; }
.exo-bad { background: rgba(239,68,68,.06); border: 1px solid rgba(239,68,68,.4); border-radius: 8px; padding: 14px; overflow-x: auto; margin: 0; }
.exo-bad code { font-size: 13px; line-height: 1.55; white-space: pre; color: #fca5a5; }
.exo-mission { background: rgba(91,140,255,.1); border: 1px solid rgba(91,140,255,.35); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; }
.exo-mission-label { display: block; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; color: var(--primary); margin-bottom: 6px; }
.exo-mission p { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.45; }
.exo-part-label { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: var(--text-dim); margin-bottom: 6px; }
.exo-part-edit { color: var(--warn); margin-top: 4px; }
.exo-starter-wrap { margin-bottom: 12px; }
.exo-starter { background: var(--bg); border: 1px dashed var(--border); border-radius: 8px; padding: 14px; overflow-x: auto; margin: 0; opacity: .85; }
.exo-starter code { font-size: 13px; line-height: 1.55; white-space: pre; color: var(--text-dim); }
.exo-tip { margin: 0 0 12px; font-size: 13px; color: var(--text-dim); font-style: italic; }
.exo-guide { margin-top: 12px; background: rgba(91,140,255,.08); border-left: 3px solid var(--primary); border-radius: 8px; padding: 12px 14px 12px 16px; }
.exo-guide.hidden { display: none; }
.exo-guide-label { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; color: var(--primary); margin-bottom: 8px; }
.exo-guide ol { margin: 0; padding-left: 20px; font-size: 14px; }
.exo-guide li { margin-bottom: 6px; }
.exo-guide li strong { color: var(--primary); }
.exo-code { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 14px; overflow-x: auto; margin: 0 0 12px; }
.exo-code code, .exo-sol pre code { font-size: 13px; line-height: 1.55; white-space: pre; }
.exo-editor-wrap { margin: 0 0 12px; border: 1.5px solid var(--border); border-radius: 8px; overflow: hidden; }
.exo-editor-wrap:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(91,140,255,.15); }
.exo-editor { display: none; }
.exo-controls { display: flex; flex-wrap: wrap; gap: 8px; }

/* CodeMirror — thème RevQuest */
.cm-s-revquest.CodeMirror {
  background: var(--bg); color: var(--text); font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 13px; line-height: 1.55; height: auto;
}
.cm-s-revquest .CodeMirror-gutters { background: var(--bg-soft); border-right: 1px solid var(--border); }
.cm-s-revquest .CodeMirror-linenumber { color: var(--text-dim); padding: 0 8px 0 4px; }
.cm-s-revquest .CodeMirror-cursor { border-left: 2px solid var(--primary); }
.cm-s-revquest .CodeMirror-selected { background: rgba(91,140,255,.22); }
.cm-s-revquest .CodeMirror-activeline-background { background: rgba(91,140,255,.07); }
.cm-s-revquest .cm-keyword { color: #c792ea; }
.cm-s-revquest .cm-def { color: #82aaff; }
.cm-s-revquest .cm-variable { color: #e6e9ef; }
.cm-s-revquest .cm-variable-2 { color: #f07178; }
.cm-s-revquest .cm-property { color: #ffcb6b; }
.cm-s-revquest .cm-operator { color: #89ddff; }
.cm-s-revquest .cm-string { color: #c3e88d; }
.cm-s-revquest .cm-string-2 { color: #c3e88d; }
.cm-s-revquest .cm-number { color: #f78c6c; }
.cm-s-revquest .cm-comment { color: #697386; font-style: italic; }
.cm-s-revquest .cm-atom { color: #f78c6c; }
.cm-s-revquest .cm-meta { color: #ffcb6b; }
.cm-s-revquest .cm-builtin { color: #82aaff; }
.cm-s-revquest .cm-tag { color: #f07178; }
.cm-s-revquest .cm-attribute { color: #ffcb6b; }
.cm-s-revquest .cm-type { color: #ffcb6b; }
.exo-controls .wbtn { flex: 0 0 auto; max-width: none; }
.exo-run-btn { background: rgba(34,197,94,.15); border-color: var(--good); color: var(--good); font-weight: 800; }
.exo-output { margin-top: 12px; border-radius: 10px; padding: 12px 14px; }
.exo-output-label { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }
.exo-output-pre { margin: 0; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 13px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.exo-output-ok { background: rgba(34,197,94,.08); border: 1px solid rgba(34,197,94,.35); }
.exo-output-ok .exo-output-label { color: var(--good); }
.exo-output-err { background: rgba(239,68,68,.08); border: 1px solid rgba(239,68,68,.35); }
.exo-output-err .exo-output-label { color: var(--bad); }
.exo-output-info { background: rgba(91,140,255,.08); border: 1px solid rgba(91,140,255,.35); }
.exo-output-info .exo-output-label { color: var(--primary); }
.exo-output-info p { margin: 0; font-size: 14px; }
.exo-output-verdict { margin: 10px 0 0; font-size: 14px; font-weight: 600; }
.exo-output-verdict.ok { color: var(--good); }
.exo-output-verdict.warn { color: var(--warn); }
.exo-hint { margin-top: 10px; background: rgba(245,158,11,.1); border-left: 3px solid var(--warn); border-radius: 8px; padding: 10px 14px; font-size: 14px; }
.exo-sol { margin-top: 12px; }
.exo-sol-label { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; color: var(--good); margin-bottom: 6px; }
.exo-sol pre { background: var(--bg); border: 1px solid var(--good); border-radius: 8px; padding: 14px; overflow-x: auto; margin: 0; }

/* mémo des mots de code (dépliable) */
.code-memo { margin-top: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-soft); overflow: hidden; }
.code-memo summary { cursor: pointer; padding: 11px 15px; font-size: 13.5px; font-weight: 700; color: var(--primary); user-select: none; list-style: none; }
.code-memo summary::-webkit-details-marker { display: none; }
.code-memo summary::before { content: "▸ "; }
.code-memo[open] summary::before { content: "▾ "; }
.code-memo .cm-hint { color: var(--text-dim); font-weight: 400; font-style: italic; }
.code-memo ul { margin: 0; padding: 0 18px 14px 34px; }
.code-memo li { margin-bottom: 7px; font-size: 13.5px; color: var(--text); }
.code-memo li code { background: var(--bg); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; font-size: 12.5px; color: var(--text); }

/* note à recopier */
.note-box { margin-top: 20px; background: rgba(34,197,94,.08); border: 1px dashed var(--good); border-radius: 10px; padding: 13px 16px; font-size: 14.5px; font-weight: 600; }
.note-label { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--good); margin-bottom: 4px; }

/* cahier */
.cahier-list { margin: 0 0 8px; padding-left: 20px; }
.cahier-list li { margin-bottom: 9px; font-size: 14.5px; }
.cahier-list li.noted-done { color: var(--text-dim); }

/* ===== MÉTHODE GUIDÉE ===== */
.method { background: var(--bg-card); border: 1px solid var(--border); border-left: 4px solid var(--primary);
  border-radius: var(--radius); padding: 16px 20px; margin-bottom: 22px; }
.method strong { display: block; margin-bottom: 8px; }
.method ol { margin: 0; padding-left: 20px; color: var(--text-dim); font-size: 14px; }
.method li { margin-bottom: 5px; }
.method li strong { display: inline; color: var(--text); }

/* ===== COURS (lesson) ===== */
.tag.letter { margin-left: 8px; }
.lesson-h { font-size: 22px; margin: 4px 0 14px; }
.lesson-body { font-size: 15.5px; color: var(--text); }
.lesson-body p { margin: 0 0 12px; }
.lesson-body ul, .lesson-body ol { margin: 0 0 12px; padding-left: 22px; }
.lesson-body li { margin-bottom: 6px; }
.lesson-body code { background: var(--bg); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; font-size: 13.5px; }
.lesson-body pre { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 14px; overflow-x: auto; margin: 0 0 12px; }
.lesson-body pre code { border: none; padding: 0; background: none; font-size: 13px; line-height: 1.55; white-space: pre; }
.lesson-body em { color: var(--text-dim); font-style: italic; }
.lesson-key { margin-top: 18px; background: rgba(245,158,11,.1); border: 1px solid var(--warn); border-radius: 10px;
  padding: 13px 16px; font-size: 14.5px; font-weight: 600; }
.lesson-key .key-label { display: block; color: var(--warn); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; margin-bottom: 4px; }

.wbtn-fiche { background: rgba(255,255,255,.04); }

/* ===== FICHE DE RÉVISION ===== */
.fiche-head { display: flex; gap: 14px; align-items: flex-start; border-bottom: 1px solid var(--border);
  padding-bottom: 16px; margin-bottom: 18px; }
.fiche-emoji { font-size: 36px; line-height: 1; }
.fiche-title { margin: 0 0 4px; font-size: 24px; }
.fiche-intro { margin: 0; color: var(--text-dim); font-size: 14px; }
.fiche-th { font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--accent, var(--primary));
  margin: 24px 0 10px; font-weight: 800; }
.fiche-essentiel { margin: 0; padding-left: 20px; }
.fiche-essentiel li { margin-bottom: 8px; font-size: 14.5px; }
.fiche-table-wrap { overflow-x: auto; }
.fiche-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.fiche-table th, .fiche-table td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.fiche-table th { color: var(--text-dim); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.fiche-table tbody tr:hover { background: var(--bg-card-2); }
.fiche-table td.cell-term { font-weight: 700; white-space: nowrap; color: var(--text); vertical-align: top; width: 1%; }
.fiche-ex { display: block; margin-top: 6px; color: var(--text-dim); font-size: 13px; font-style: italic; }
.glos-code { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 11px 13px;
  margin: 9px 0 2px; overflow-x: auto; }
.glos-code code { font-size: 12.5px; line-height: 1.55; white-space: pre; color: var(--text); }
.fiche-hint { margin-top: 18px; color: var(--text-dim); font-size: 13px; font-style: italic; }

/* exemple concret dans le feedback des exos */
.ex-line { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--border); font-size: 13.5px; font-style: italic; color: var(--text-dim); }

/* certificat & correction d'examen */
.cert-note { color: var(--good); font-weight: 700; margin-top: 12px; }
.cert-badge { display: inline-block; background: rgba(34,197,94,.15); border: 1px solid var(--good); color: var(--good);
  font-weight: 800; padding: 10px 20px; border-radius: 99px; margin-top: 14px; }
.review-item { border-left: 3px solid var(--bad); padding: 10px 14px; margin-bottom: 14px; background: rgba(239,68,68,.06); border-radius: 8px; }
.review-q { font-weight: 700; margin-bottom: 6px; }
.review-a { color: var(--good); font-size: 14px; margin-bottom: 4px; }
.review-e { color: var(--text-dim); font-size: 13.5px; }

/* mode révision : masquer la colonne réponse */
.fiche.masked .maskable { background: var(--bg-card-2); color: transparent; border-radius: 5px;
  cursor: pointer; user-select: none; filter: blur(.4px); transition: color .15s, background .15s; box-shadow: inset 0 0 0 1px var(--border); }
.fiche.masked .maskable::after { content: "?"; color: var(--text-dim); font-weight: 700; }
.fiche.masked .maskable.revealed { background: rgba(34,197,94,.12); color: var(--text); filter: none; }
.fiche.masked .maskable.revealed::after { content: ""; }

/* impression */
@media print {
  .topbar, .footer, .no-print { display: none !important; }
  body, .card { background: #fff !important; color: #000 !important; box-shadow: none !important; border: none !important; }
  main#view { padding: 0; max-width: none; }
  .fiche-table th, .fiche-table td { border-bottom: 1px solid #ccc; }
  .fiche-th, .fiche-title { color: #000 !important; }
  .fiche.masked .maskable { color: #000 !important; background: none !important; filter: none !important; box-shadow: none !important; }
  .fiche.masked .maskable::after { content: "" !important; }
}

/* ===== DAILY CARD ===== */
.daily {
  background: linear-gradient(135deg, rgba(91,140,255,.18), rgba(168,85,247,.14));
  border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 22px;
  display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
}
.daily .dleft h2 { margin: 0 0 4px; font-size: 20px; }
.daily .dleft p { margin: 0; color: var(--text-dim); font-size: 14px; }
.due-count { color: var(--primary); font-weight: 800; }

/* ===== QUIZ ===== */
.quiz-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; }
.quiz-head .qprogress { flex: 1; height: 9px; background: var(--bg-card-2); border-radius: 99px; overflow: hidden; }
.quiz-head .qfill { height: 100%; width: 0%; background: var(--primary); transition: width .35s; }
.quiz-head .qcount { font-size: 13px; color: var(--text-dim); font-weight: 700; white-space: nowrap; }
.quiz-exit { background: none; border: 1px solid var(--border); color: var(--text-dim); border-radius: 8px; padding: 6px 10px; cursor: pointer; font-size: 13px; }

.card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px; box-shadow: var(--shadow); animation: pop .25s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }

.card .tag { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase;
  color: var(--text-dim); border: 1px solid var(--border); border-radius: 99px; padding: 3px 10px; margin-bottom: 14px; }
.card .qtext { font-size: 20px; font-weight: 700; margin: 0 0 20px; }

.options { display: flex; flex-direction: column; gap: 10px; }
.opt {
  text-align: left; background: var(--bg-card-2); border: 1.5px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 14px 16px; cursor: pointer; font-size: 15px; transition: border-color .12s, background .12s;
}
.opt:hover:not(.locked) { border-color: var(--primary); }
.opt.locked { cursor: default; }
.opt.correct { border-color: var(--good); background: rgba(34,197,94,.14); }
.opt.wrong { border-color: var(--bad); background: rgba(239,68,68,.14); }
.opt .mark { float: right; font-weight: 800; }

/* flashcard */
.flash-answer { background: var(--bg-card-2); border: 1px dashed var(--border); border-radius: 10px; padding: 16px; margin: 6px 0 16px; }
.flash-answer h4 { margin: 0 0 6px; font-size: 13px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .6px; }
.flash-answer p { margin: 0; font-size: 15px; }
.self-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* explication / feedback */
.explain { margin-top: 18px; padding: 14px 16px; border-radius: 10px; border-left: 4px solid var(--primary);
  background: rgba(91,140,255,.08); font-size: 14px; color: var(--text); animation: pop .2s ease; }
.explain.good { border-left-color: var(--good); background: rgba(34,197,94,.08); }
.explain.bad  { border-left-color: var(--bad);  background: rgba(239,68,68,.08); }
.explain strong { display: block; margin-bottom: 4px; }

.card-actions { margin-top: 22px; display: flex; justify-content: flex-end; gap: 10px; }

/* ===== RESULTS ===== */
.results { text-align: center; }
.results .big { font-size: 56px; margin: 6px 0; }
.results .score { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.results .sub { color: var(--text-dim); margin-bottom: 22px; }
.results .earned { display: inline-block; background: rgba(245,158,11,.15); border: 1px solid var(--warn);
  color: var(--warn); font-weight: 800; padding: 8px 16px; border-radius: 99px; margin-bottom: 22px; }

.empty { text-align: center; color: var(--text-dim); padding: 30px; }

@media (max-width: 560px) {
  .stats { gap: 10px; }
  .xpbar-wrap { display: none; }
  .card .qtext { font-size: 18px; }
}
