/* Thor : style commun (élèves et enseignant). Thème sombre par défaut, clair avec data-theme="light". */

@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url("/vendor/polices/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url("/vendor/polices/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url("/vendor/polices/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 700; font-display: swap; src: url("/vendor/polices/inter-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Cinzel"; font-weight: 700; font-display: swap; src: url("/vendor/polices/cinzel-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-display: swap; src: url("/vendor/polices/jetbrains-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 600; font-display: swap; src: url("/vendor/polices/jetbrains-mono-latin-600-normal.woff2") format("woff2"); }

:root {
  color-scheme: dark;
  --fond: #090d18;
  --fond-2: #0d1322;
  --surface: #121a2d;
  --surface-2: #18223a;
  --surface-3: #202b48;
  --bord: #24304f;
  --bord-fort: #33426b;
  --texte: #e8ecf8;
  --texte-2: #a5b0cc;
  --texte-3: #6e7a9a;
  --accent: #6e8dff;
  --accent-fort: #8aa3ff;
  --accent-doux: rgba(110, 141, 255, .14);
  --violet: #a78bfa;
  --or: #f6c350;
  --or-2: #ff8c42;
  --or-doux: rgba(246, 195, 80, .14);
  --ok: #34d399;
  --ok-doux: rgba(52, 211, 153, .13);
  --ko: #f87171;
  --ko-doux: rgba(248, 113, 113, .13);
  --attention: #fbbf24;
  --ombre: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.28);
  --ombre-forte: 0 24px 64px rgba(0,0,0,.55);
  --rayon: 12px;
  --rayon-petit: 8px;
  --police: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --police-titre: "Cinzel", Georgia, serif;
  --police-code: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --eclair: linear-gradient(135deg, #6e8dff 0%, #a78bfa 100%);
  --or-degrade: linear-gradient(135deg, #f6c350 0%, #ff8c42 100%);
}
:root[data-theme="light"] {
  color-scheme: light;
  --fond: #f3f5fb;
  --fond-2: #eaeef8;
  --surface: #ffffff;
  --surface-2: #f5f7fc;
  --surface-3: #eaeef7;
  --bord: #dfe4ef;
  --bord-fort: #c7cfe1;
  --texte: #141a2e;
  --texte-2: #4a5473;
  --texte-3: #8790ab;
  --accent: #4361ee;
  --accent-fort: #3049c9;
  --accent-doux: rgba(67, 97, 238, .1);
  --violet: #7c3aed;
  --or: #d99a06;
  --or-2: #ea6a12;
  --or-doux: rgba(217, 154, 6, .12);
  --ok: #16a34a;
  --ok-doux: rgba(22, 163, 74, .1);
  --ko: #dc2626;
  --ko-doux: rgba(220, 38, 38, .08);
  --attention: #b45309;
  --ombre: 0 1px 2px rgba(20,26,46,.06), 0 6px 20px rgba(20,26,46,.07);
  --ombre-forte: 0 24px 64px rgba(20,26,46,.22);
  --eclair: linear-gradient(135deg, #4361ee 0%, #7c3aed 100%);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--fond); color: var(--texte);
  font: 14px/1.55 var(--police); -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
code, pre, kbd { font-family: var(--police-code); }
[hidden] { display: none !important; }
::selection { background: var(--accent-doux); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--bord); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--bord-fort); background-clip: padding-box; }

/* ------------------------------------------------------------ marque */
.marque { display: flex; align-items: center; gap: 10px; font-family: var(--police-titre); font-weight: 700; letter-spacing: .12em; font-size: 19px; }
.marque .logo { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--eclair); color: #fff; box-shadow: 0 6px 18px rgba(110,141,255,.35); flex: none; }
.marque .logo svg { width: 20px; height: 20px; }
.marque small { display: block; font-family: var(--police); font-size: 11px; letter-spacing: .02em; font-weight: 500; color: var(--texte-3); }

/* ------------------------------------------------------------ boutons et champs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: var(--rayon-petit); border: 1px solid var(--bord);
  background: var(--surface-2); color: var(--texte); font: 500 13.5px/1 var(--police); cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s, box-shadow .15s; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--surface-3); border-color: var(--bord-fort); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .champ:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-primaire { background: var(--accent); border-color: transparent; color: #fff; box-shadow: 0 4px 14px rgba(110,141,255,.28); }
.btn-primaire:hover { background: var(--accent-fort); border-color: transparent; }
.btn-or { background: var(--or-degrade); border-color: transparent; color: #1b1300; font-weight: 650; box-shadow: 0 4px 16px rgba(246,160,66,.3); }
.btn-or:hover { filter: brightness(1.06); border-color: transparent; background: var(--or-degrade); }
.btn-fantome { background: transparent; border-color: transparent; color: var(--texte-2); }
.btn-fantome:hover { background: var(--surface-2); color: var(--texte); border-color: transparent; }
.btn-danger { color: var(--ko); }
.btn-danger:hover { background: var(--ko-doux); border-color: var(--ko); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-lg { height: 46px; padding: 0 20px; font-size: 15px; border-radius: 10px; }
.btn-icone { width: 36px; padding: 0; }
.btn-sm.btn-icone { width: 30px; }

.champ, select.champ, textarea.champ {
  width: 100%; height: 38px; padding: 0 12px; border-radius: var(--rayon-petit); border: 1px solid var(--bord);
  background: var(--surface-2); color: var(--texte); font: 14px var(--police); transition: border-color .15s, box-shadow .15s;
}
textarea.champ { height: auto; padding: 10px 12px; line-height: 1.5; resize: vertical; }
.champ:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-doux); outline: none; }
.champ::placeholder { color: var(--texte-3); }
label.etiquette { display: block; font-size: 12.5px; font-weight: 600; color: var(--texte-2); margin-bottom: 6px; }
.aide { font-size: 12.5px; color: var(--texte-3); margin-top: 6px; }
.groupe { margin-bottom: 16px; }
.grille-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grille-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

/* interrupteur */
.interrupteur { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-size: 13.5px; }
.interrupteur input { position: absolute; opacity: 0; pointer-events: none; }
.interrupteur .piste { width: 36px; height: 20px; border-radius: 20px; background: var(--surface-3); border: 1px solid var(--bord-fort); position: relative; transition: background .2s; flex: none; }
.interrupteur .piste::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--texte-2); transition: transform .2s, background .2s; }
.interrupteur input:checked + .piste { background: var(--ok); border-color: var(--ok); }
.interrupteur input:checked + .piste::after { transform: translateX(16px); background: #fff; }
.interrupteur input:focus-visible + .piste { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ------------------------------------------------------------ cartes, badges */
.carte { background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon); box-shadow: var(--ombre); }
.carte-tete { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 0; }
.carte-tete h3 { font-size: 14.5px; }
.carte-corps { padding: 16px 18px 18px; }

.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 11.5px; font-weight: 600; letter-spacing: .01em; background: var(--surface-3); color: var(--texte-2); white-space: nowrap; }
.badge svg { width: 12px; height: 12px; }
.badge-deboguer { background: var(--ko-doux); color: var(--ko); }
.badge-creer { background: var(--accent-doux); color: var(--accent); }
.badge-ok { background: var(--ok-doux); color: var(--ok); }
.badge-ko { background: var(--ko-doux); color: var(--ko); }
.badge-or { background: var(--or-doux); color: var(--or); }
.badge-gris { background: var(--surface-3); color: var(--texte-3); }

.etoiles { color: var(--or); letter-spacing: 1px; font-size: 12px; }
.etoiles .eteinte { color: var(--bord-fort); }

/* ------------------------------------------------------------ onglets */
.onglets { display: flex; gap: 2px; border-bottom: 1px solid var(--bord); overflow-x: auto; scrollbar-width: none; }
.onglets::-webkit-scrollbar { display: none; }
.onglet { display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; border: 0; background: none; color: var(--texte-3); font: 500 13px var(--police); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.onglet:hover { color: var(--texte); }
.onglet.actif { color: var(--texte); border-bottom-color: var(--accent); }
.onglet svg { width: 14px; height: 14px; }
.onglet .compte { font-size: 11px; padding: 1px 6px; border-radius: 10px; background: var(--surface-3); color: var(--texte-2); }

/* ------------------------------------------------------------ tableaux */
.tableau { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tableau th { text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--texte-3); padding: 10px 14px; border-bottom: 1px solid var(--bord); background: var(--surface); position: sticky; top: 0; z-index: 1; }
.tableau td { padding: 11px 14px; border-bottom: 1px solid var(--bord); vertical-align: middle; }
.tableau tr:last-child td { border-bottom: 0; }
.tableau tbody tr { transition: background .1s; }
.tableau tbody tr.cliquable { cursor: pointer; }
.tableau tbody tr.cliquable:hover { background: var(--surface-2); }
.tableau .num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: var(--police-code); font-size: 12.5px; }
.doux { color: var(--texte-2); }
.tres-doux { color: var(--texte-3); }
.ok { color: var(--ok); } .ko { color: var(--ko); }

/* ------------------------------------------------------------ jauge XP, avatar */
.jauge { height: 8px; border-radius: 8px; background: var(--surface-3); overflow: hidden; }
.jauge > i { display: block; height: 100%; width: 0; border-radius: 8px; background: var(--or-degrade); transition: width 1s cubic-bezier(.2,.8,.2,1); box-shadow: 0 0 12px rgba(246,195,80,.5); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; background: var(--eclair); flex: none; }
.niveau-blason { position: relative; width: 44px; height: 44px; display: grid; place-items: center; flex: none; }
.niveau-blason svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.niveau-blason b { position: relative; font: 700 16px var(--police); color: #1b1300; }

/* ------------------------------------------------------------ modales, toasts, menus */
.voile { position: fixed; inset: 0; background: rgba(5, 8, 16, .62); backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 100; padding: 16px; animation: apparaitre .18s ease; }
.modale { background: var(--surface); border: 1px solid var(--bord); border-radius: 16px; box-shadow: var(--ombre-forte); width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; animation: monter .22s cubic-bezier(.2,.8,.2,1); }
.modale.large { width: min(1100px, 100%); }
.modale-tete { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--bord); }
.modale-tete h2 { font-size: 16px; }
.modale-corps { padding: 20px; overflow: auto; }
.modale-pied { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--bord); }
@keyframes apparaitre { from { opacity: 0; } }
@keyframes monter { from { opacity: 0; transform: translateY(12px) scale(.98); } }

.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 200; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--bord-fort); box-shadow: var(--ombre-forte); font-weight: 500; animation: monter .25s cubic-bezier(.2,.8,.2,1); max-width: 380px; }
.toast svg { width: 18px; height: 18px; flex: none; }
.toast.ok svg { color: var(--ok); } .toast.ko svg { color: var(--ko); } .toast.xp { border-color: var(--or); } .toast.xp svg { color: var(--or); }
.toast.part { opacity: 0; transform: translateY(8px); transition: all .3s; }

.menu { position: absolute; min-width: 200px; background: var(--surface); border: 1px solid var(--bord-fort); border-radius: 10px; box-shadow: var(--ombre-forte); padding: 6px; z-index: 150; animation: apparaitre .12s; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; color: var(--texte); font: 13.5px var(--police); border-radius: 6px; cursor: pointer; text-align: left; }
.menu button:hover { background: var(--surface-2); }
.menu button svg { width: 15px; height: 15px; color: var(--texte-2); }
.menu button.danger { color: var(--ko); } .menu button.danger svg { color: var(--ko); }
.menu hr { border: 0; border-top: 1px solid var(--bord); margin: 6px 0; }

/* ------------------------------------------------------------ états vides, chargement */
.vide { text-align: center; padding: 48px 24px; color: var(--texte-3); }
.vide svg { width: 40px; height: 40px; margin-bottom: 10px; opacity: .6; }
.vide h3 { color: var(--texte-2); font-size: 15px; margin-bottom: 4px; }
.roue { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: tourner .7s linear infinite; display: inline-block; flex: none; }
@keyframes tourner { to { transform: rotate(360deg); } }
.squelette { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: lueur 1.4s infinite; border-radius: 6px; }
@keyframes lueur { to { background-position: -200% 0; } }

/* ------------------------------------------------------------ Markdown (énoncés) */
.md { font-size: 14.5px; line-height: 1.7; color: var(--texte); }
.md > :first-child { margin-top: 0; }
.md h1 { font-size: 22px; margin: 0 0 14px; }
.md h2 { font-size: 17px; margin: 26px 0 10px; }
.md h3 { font-size: 15px; margin: 20px 0 8px; }
.md p, .md ul, .md ol { margin: 0 0 12px; }
.md ul, .md ol { padding-left: 22px; }
.md li { margin: 3px 0; }
.md code { font-size: 12.5px; padding: 2px 6px; border-radius: 5px; background: var(--surface-3); color: var(--accent-fort); }
:root[data-theme="light"] .md code { color: var(--violet); }
.md pre { background: var(--fond-2); border: 1px solid var(--bord); border-radius: 10px; padding: 14px 16px; overflow: auto; margin: 0 0 14px; }
.md pre code { background: none; padding: 0; color: var(--texte); font-size: 12.5px; line-height: 1.6; }
.md blockquote { margin: 0 0 14px; padding: 10px 14px; border-left: 3px solid var(--accent); background: var(--accent-doux); border-radius: 0 8px 8px 0; color: var(--texte-2); }
.md blockquote p:last-child { margin: 0; }
.md table { border-collapse: collapse; margin: 0 0 14px; font-size: 13.5px; width: 100%; }
.md th, .md td { border: 1px solid var(--bord); padding: 7px 10px; text-align: left; }
.md th { background: var(--surface-2); }
.md img { max-width: 100%; border-radius: 8px; }
.md hr { border: 0; border-top: 1px solid var(--bord); margin: 20px 0; }

/* ------------------------------------------------------------ CodeMirror, thème Thor */
.CodeMirror { height: 100%; font-family: var(--police-code); font-size: 13.5px; line-height: 1.6; background: var(--fond-2); color: var(--texte); }
.CodeMirror-gutters { background: var(--fond-2); border-right: 1px solid var(--bord); }
.CodeMirror-linenumber { color: var(--texte-3); padding: 0 10px 0 6px; }
.CodeMirror-cursor { border-left: 2px solid var(--accent); }
.CodeMirror-selected, .CodeMirror-focused .CodeMirror-selected { background: rgba(110,141,255,.22) !important; }
.CodeMirror-activeline-background { background: rgba(110,141,255,.06); }
.CodeMirror-matchingbracket { color: var(--or) !important; text-decoration: underline; }
.CodeMirror .cm-keyword { color: #c792ea; }
.CodeMirror .cm-type, .CodeMirror .cm-variable-3 { color: #ffcb6b; }
.CodeMirror .cm-def { color: #82aaff; }
.CodeMirror .cm-variable { color: var(--texte); }
.CodeMirror .cm-variable-2 { color: #eeffff; }
.CodeMirror .cm-string { color: #c3e88d; }
.CodeMirror .cm-number { color: #f78c6c; }
.CodeMirror .cm-comment { color: #6b7799; font-style: italic; }
.CodeMirror .cm-meta { color: #89ddff; }
.CodeMirror .cm-atom { color: #f78c6c; }
.CodeMirror .cm-operator { color: #89ddff; }
.CodeMirror .cm-builtin { color: #82aaff; }
:root[data-theme="light"] .CodeMirror .cm-keyword { color: #7c3aed; }
:root[data-theme="light"] .CodeMirror .cm-type, :root[data-theme="light"] .CodeMirror .cm-variable-3 { color: #b45309; }
:root[data-theme="light"] .CodeMirror .cm-def { color: #2563eb; }
:root[data-theme="light"] .CodeMirror .cm-variable-2 { color: #0f172a; }
:root[data-theme="light"] .CodeMirror .cm-string { color: #15803d; }
:root[data-theme="light"] .CodeMirror .cm-number, :root[data-theme="light"] .CodeMirror .cm-atom { color: #c2410c; }
:root[data-theme="light"] .CodeMirror .cm-comment { color: #8790ab; }
:root[data-theme="light"] .CodeMirror .cm-meta, :root[data-theme="light"] .CodeMirror .cm-operator { color: #0e7490; }
.CodeMirror.lecture-seule { background: var(--surface-2); }
.CodeMirror.lecture-seule .CodeMirror-gutters { background: var(--surface-2); }
.ligne-erreur { background: var(--ko-doux); }

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

/* ------------------------------------------------------------ complétion (show-hint) */
.CodeMirror-hints { background: var(--surface); border: 1px solid var(--bord-fort); border-radius: var(--rayon-petit); box-shadow: var(--ombre-forte);
  font-family: var(--police-code); font-size: 12.5px; padding: 4px; max-height: 18em; z-index: 1000; }
.CodeMirror-hint { color: var(--texte); padding: 3px 10px 3px 26px; border-radius: 6px; position: relative; white-space: pre; }
li.CodeMirror-hint-active { background: var(--accent-doux); color: var(--texte); }
.thor-hint::before { position: absolute; left: 7px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; border-radius: 4px;
  font: 600 9.5px/14px var(--police); text-align: center; color: #fff; }
.thor-hint-methode::before { content: "m"; background: #8b6cf0; }
.thor-hint-champ::before, .thor-hint-local::before { content: "v"; background: #2f9e80; }
.thor-hint-classe::before, .thor-hint-biblio::before { content: "C"; background: #d08a2c; }
.thor-hint-paquet::before { content: "p"; background: #5a6787; }
.thor-hint-cle::before { content: "k"; background: #4a6fe0; }
.thor-hint-statique { font-style: italic; }
