/* ==========================================================================
   MOOC SLI — Programme Albatros
   Identité « poste de commandement » : sombre par défaut, thème clair disponible.
   ========================================================================== */

:root,
:root[data-theme="dark"] {
  --bg: #0a111c;
  --bg-2: #0e1726;
  --panel: #111c2d;
  --panel-2: #16243a;
  --line: #22324b;
  --line-2: #2c3f5d;
  --text: #e6edf7;
  --muted: #93a7c4;
  --faint: #62779a;
  --accent: #4fb3ff;
  --accent-2: #2b8fe0;
  --accent-ink: #04111f;
  --ok: #3ecf8e;
  --ok-bg: rgba(62, 207, 142, .12);
  --warn: #f2b84b;
  --warn-bg: rgba(242, 184, 75, .14);
  --bad: #ef6b6b;
  --bad-bg: rgba(239, 107, 107, .12);
  --xp: #b99cff;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --glow: 0 0 0 1px rgba(79, 179, 255, .25), 0 8px 24px rgba(79, 179, 255, .12);
  --grid: rgba(79, 179, 255, .045);
}

:root[data-theme="light"] {
  --bg: #f3f6fa;
  --bg-2: #eaf0f7;
  --panel: #ffffff;
  --panel-2: #f5f8fc;
  --line: #d7e0ec;
  --line-2: #c5d2e3;
  --text: #0f1b2d;
  --muted: #4b5f7c;
  --faint: #7a8ca6;
  --accent: #0b6fc2;
  --accent-2: #085a9f;
  --accent-ink: #ffffff;
  --ok: #13865a;
  --ok-bg: rgba(19, 134, 90, .1);
  --warn: #9a6400;
  --warn-bg: rgba(242, 184, 75, .22);
  --bad: #c43b3b;
  --bad-bg: rgba(196, 59, 59, .09);
  --xp: #6b46d6;
  --shadow: 0 8px 24px rgba(15, 27, 45, .08);
  --glow: 0 0 0 1px rgba(11, 111, 194, .25), 0 8px 20px rgba(11, 111, 194, .08);
  --grid: rgba(11, 111, 194, .04);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 32px 32px,
    var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 .9em; }
a { color: var(--accent); }
img, svg { max-width: 100%; }
code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .9em; background: var(--panel-2); padding: .05em .35em; border-radius: 4px; }
.num { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.hidden, [hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip-link:focus { left: 8px; }

/* ---------- Barre supérieure ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 20px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: url("/assets/favicon.svg") center / cover; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { letter-spacing: .12em; font-size: .95rem; }
.brand-sub { font-size: .75rem; color: var(--muted); }
.mainnav { display: flex; gap: 4px; margin-left: 8px; }
.mainnav a {
  color: var(--muted); text-decoration: none; padding: 7px 12px; border-radius: 8px; font-size: .92rem; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
}
.mainnav a:hover { color: var(--text); background: var(--panel); }
.mainnav a.active { color: var(--text); background: var(--panel-2); box-shadow: inset 0 -2px 0 var(--accent); }
.hud { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.topbar-actions { display: flex; gap: 6px; }
.icon-btn {
  width: 36px; height: 36px; display: inline-grid; place-items: center;
  border-radius: 9px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); cursor: pointer;
}
.icon-btn:hover { color: var(--text); border-color: var(--line-2); }
.icon-btn svg { width: 18px; height: 18px; }

.i { width: 1.15em; height: 1.15em; vertical-align: -0.2em; flex: none; }
.hud-item { white-space: nowrap; display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--muted); }
.hud-item strong { color: var(--text); }
.hud-ao { display: flex; align-items: center; gap: 8px; }
.hud-ao .bar { width: 90px; height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.hud-ao .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--warn), var(--ok)); border-radius: 99px; transition: width .8s ease; }
.hud-xp .bar i { background: linear-gradient(90deg, var(--xp), var(--accent)); }
.streak { color: var(--warn); }
.pill { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 99px; background: var(--accent); color: var(--accent-ink); font-size: .72rem; font-weight: 700; line-height: 18px; text-align: center; }

/* ---------- Mise en page ---------- */
main { outline: none; }
.page { max-width: 1120px; margin: 0 auto; padding: 28px 20px 80px; }
.page-narrow { max-width: 820px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 16px; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px;
  box-shadow: var(--shadow);
}
.card-2 { background: var(--panel-2); }
.card h2, .card h3 { margin-top: 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .72rem; color: var(--accent); font-weight: 700; margin-bottom: 6px; }
.divider { height: 1px; background: var(--line); margin: 16px 0; border: 0; }

/* ---------- Boutons et formulaires ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--panel-2); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: transform .08s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); border-color: var(--line); }
.btn-danger { border-color: var(--bad); color: var(--bad); background: transparent; }
.btn-sm { padding: 6px 10px; font-size: .85rem; border-radius: 8px; }
.btn svg { width: 16px; height: 16px; }

label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.field { margin-bottom: 14px; }
.field small { display: block; color: var(--muted); margin-top: 4px; font-weight: 400; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="search"], select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--bg-2); color: var(--text); font: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--glow); }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.form-error { color: var(--bad); background: var(--bad-bg); border: 1px solid color-mix(in srgb, var(--bad) 40%, transparent); padding: 10px 12px; border-radius: 10px; margin-bottom: 14px; }
.form-ok { color: var(--ok); background: var(--ok-bg); border: 1px solid color-mix(in srgb, var(--ok) 40%, transparent); padding: 10px 12px; border-radius: 10px; margin-bottom: 14px; }

/* ---------- Authentification ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero {
  position: relative; padding: 48px; display: flex; flex-direction: column; justify-content: flex-end;
  background: radial-gradient(1200px 600px at 10% 10%, rgba(79, 179, 255, .18), transparent 60%), var(--bg-2);
  border-right: 1px solid var(--line); overflow: hidden;
}
.auth-hero svg.ship { position: absolute; right: -40px; top: 18%; width: 80%; opacity: .9; }
.auth-hero h1 { font-size: clamp(1.8rem, 3.4vw, 2.8rem); max-width: 14ch; }
.auth-hero p { max-width: 46ch; color: var(--muted); }
.auth-panel { display: grid; place-items: center; padding: 32px 20px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .card { padding: 28px; }
.auth-links { display: flex; justify-content: space-between; margin-top: 14px; font-size: .9rem; }

/* ---------- Tableau de bord ---------- */
.dash-hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; margin-bottom: 20px; }
.gauge-card { display: flex; gap: 20px; align-items: center; }
.gauge { width: 220px; flex: none; }
.gauge text { fill: var(--text); }
.gauge .track { stroke: var(--line); }
.gauge .gg-a { stop-color: var(--bad); }
.gauge .gg-b { stop-color: var(--warn); }
.gauge .gg-c { stop-color: var(--ok); }
.gauge .target-tick { stroke: var(--text); }
.gauge .needle-line { stroke: var(--text); }
.gauge .needle-hub { fill: var(--text); }
.gauge .g-label { fill: var(--muted); }
.gauge .needle { transition: transform 1.2s cubic-bezier(.2, .8, .2, 1); transform-origin: 110px 110px; }
.gauge-legend { font-size: .9rem; color: var(--muted); }
.gauge-legend strong { color: var(--text); font-size: 2rem; display: block; line-height: 1; margin-bottom: 6px; }
.level-card .xpbar { height: 12px; border-radius: 99px; background: var(--line); overflow: hidden; margin: 10px 0 6px; }
.level-card .xpbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--xp), var(--accent)); transition: width 1s ease; }
.stat-row { display: flex; gap: 10px; margin-top: 14px; }
.stat { flex: 1; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.stat b { display: block; font-size: 1.3rem; }
.stat span { font-size: .78rem; color: var(--muted); }

.missions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.mission {
  position: relative; display: flex; flex-direction: column; gap: 6px; min-height: 150px;
  padding: 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel);
  color: var(--text); text-decoration: none; transition: transform .12s ease, border-color .15s ease, box-shadow .15s ease;
}
.mission:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--glow); }
.mission .m-num { font-size: .75rem; letter-spacing: .12em; color: var(--muted); font-weight: 700; }
.mission .m-title { font-weight: 700; font-size: 1.02rem; }
.mission .m-meta { margin-top: auto; display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); }
.mission .m-state { position: absolute; top: 14px; right: 14px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-2); border: 1px solid var(--line); }
.mission .m-state svg { width: 14px; height: 14px; }
.mission.done { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.mission.done .m-state { background: var(--ok); color: var(--accent-ink); border-color: var(--ok); }
.mission.current { border-color: var(--accent); box-shadow: var(--glow); }
.mission.current .m-state { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.mission.locked, .mission.soon { opacity: .55; pointer-events: none; }
.mission.soon { border-style: dashed; box-shadow: none; }

.badges-strip { display: flex; gap: 10px; flex-wrap: wrap; }
.badge {
  display: flex; flex-direction: column; align-items: center; gap: 6px; width: 104px; text-align: center;
  font-size: .78rem; color: var(--muted);
}
.badge .medal {
  width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 30% 30%, color-mix(in srgb, var(--warn) 70%, #fff), var(--warn));
  color: #3a2600; box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 30%, transparent);
}
.badge .medal svg { width: 26px; height: 26px; }
.badge.locked .medal { background: var(--panel-2); color: var(--faint); box-shadow: 0 0 0 1px var(--line); }
.badge b { color: var(--text); font-size: .8rem; }

/* ---------- Lecteur de mission ---------- */
.player { max-width: 860px; margin: 0 auto; padding: 20px 20px 100px; }
.player-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.player-head h1 { font-size: 1.3rem; margin: 0; }
.steps { display: flex; gap: 4px; margin: 0 0 22px; }
.steps i { flex: 1; height: 5px; border-radius: 99px; background: var(--line); }
.steps i.done { background: var(--accent); }
.steps i.current { background: linear-gradient(90deg, var(--accent), var(--xp)); }
.step-label { font-size: .8rem; color: var(--muted); margin-bottom: 6px; }
.player-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--line); }
.player-nav .inner { max-width: 860px; margin: 0 auto; padding: 12px 20px; display: flex; gap: 10px; align-items: center; }

.speaker { display: flex; gap: 14px; align-items: flex-start; }
.avatar {
  flex: none; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; color: #04111f; font-size: 1rem; letter-spacing: .02em;
}
.bubble { flex: 1; background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px 14px 14px 14px; padding: 14px 16px; }
.bubble .who { font-size: .8rem; color: var(--muted); margin-bottom: 4px; }
.bubble .who b { color: var(--text); }
.objectives { list-style: none; padding: 0; margin: 0; }
.objectives li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.objectives li:last-child { border-bottom: 0; }
.objectives svg { flex: none; width: 18px; height: 18px; color: var(--accent); margin-top: 3px; }

.concept .block { border-left: 3px solid var(--line-2); padding: 4px 0 4px 16px; margin: 0 0 18px; }
.concept .block h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); margin-bottom: 6px; }
.concept .hook { border-color: var(--warn); }
.concept .hook h3 { color: var(--warn); }
.concept .explain { border-color: var(--accent); }
.concept .example { border-color: var(--xp); background: color-mix(in srgb, var(--xp) 7%, transparent); border-radius: 0 10px 10px 0; padding: 12px 16px; }
.concept .example h3 { color: var(--xp); }
.keypoints { background: var(--ok-bg); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); border-radius: 12px; padding: 14px 16px; }
.keypoints h3 { color: var(--ok); font-size: .78rem; text-transform: uppercase; letter-spacing: .14em; margin-bottom: 8px; }
.keypoints ol { margin: 0; padding-left: 20px; }
.keypoints li + li { margin-top: 4px; }
.rich ul { margin: 0 0 .9em; padding-left: 20px; }
.rich li + li { margin-top: 3px; }

/* Termes du glossaire */
.term { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: help; border-bottom: 1px dotted var(--accent); }
.term:hover, .term:focus-visible { color: var(--accent); }
.popover {
  position: absolute; z-index: 50; max-width: 340px; padding: 12px 14px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line-2); box-shadow: var(--shadow); font-size: .9rem;
}
.popover b { display: block; margin-bottom: 2px; }
.popover .en { color: var(--muted); font-size: .8rem; margin-bottom: 6px; }

/* Marqueurs de contenu à valider */
mark.marker { background: var(--warn-bg); color: var(--warn); border: 1px dashed var(--warn); border-radius: 6px; padding: 0 5px; font-weight: 600; font-size: .9em; }

/* ---------- Activités ---------- */
.activity { border: 1px solid var(--line); border-radius: 14px; padding: 18px; background: var(--panel); }
.activity + .activity { margin-top: 16px; }
.activity-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.activity-type { font-size: .72rem; text-transform: uppercase; letter-spacing: .14em; color: var(--accent); font-weight: 700; }
.xp-tag { margin-left: auto; font-size: .78rem; color: var(--xp); font-weight: 700; }
.solved-tag { font-size: .78rem; color: var(--ok); font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.solved-tag svg { width: 14px; height: 14px; }
.question { font-weight: 600; margin-bottom: 12px; }
.context { background: var(--panel-2); border-left: 3px solid var(--warn); border-radius: 0 10px 10px 0; padding: 10px 14px; margin-bottom: 12px; }

.choices { display: grid; gap: 8px; }
.choice {
  display: flex; gap: 12px; align-items: flex-start; text-align: left; width: 100%;
  padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text);
  font: inherit; cursor: pointer;
}
.choice:hover { border-color: var(--accent); }
.choice .key { flex: none; width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--line-2); display: grid; place-items: center; font-size: .8rem; font-weight: 700; color: var(--muted); }
.choice[aria-pressed="true"] { border-color: var(--accent); box-shadow: var(--glow); }
.choice[aria-pressed="true"] .key { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.choice.is-right { border-color: var(--ok); background: var(--ok-bg); }
.choice.is-wrong { border-color: var(--bad); background: var(--bad-bg); }
.choice .expl { display: block; font-size: .85rem; color: var(--muted); margin-top: 4px; }

.tf-row { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.tf-row:last-child { border-bottom: 0; }
.tf-row .txt { flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; flex: none; }
.seg button { border: 0; background: var(--bg-2); color: var(--muted); padding: 7px 14px; font: inherit; font-weight: 600; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.tf-expl { font-size: .85rem; margin-top: 6px; padding: 8px 10px; border-radius: 8px; }
.tf-expl.ok { background: var(--ok-bg); }
.tf-expl.ko { background: var(--bad-bg); }

.order-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.order-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--bg-2); cursor: grab;
}
.order-item.dragging { opacity: .5; }
.order-item .pos { width: 26px; height: 26px; flex: none; border-radius: 50%; background: var(--panel-2); display: grid; place-items: center; font-weight: 700; font-size: .85rem; }
.order-item .txt { flex: 1; }
.order-item .mv { display: flex; gap: 4px; }
.order-item .mv button { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel); color: var(--text); cursor: pointer; }
.order-item.is-right { border-color: var(--ok); background: var(--ok-bg); }
.order-item.is-wrong { border-color: var(--bad); background: var(--bad-bg); }

.cat-pool { display: flex; flex-wrap: wrap; gap: 8px; min-height: 48px; padding: 10px; border-radius: 12px; border: 1px dashed var(--line-2); margin-bottom: 12px; }
.cat-bins { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.cat-bin { border: 1px solid var(--line-2); border-radius: 12px; padding: 10px; min-height: 90px; background: var(--bg-2); }
.cat-bin.over { border-color: var(--accent); box-shadow: var(--glow); }
.cat-bin h4 { font-size: .82rem; margin: 0 0 8px; color: var(--muted); }
.cat-bin .chips { display: flex; flex-direction: column; gap: 6px; }
.chip {
  display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding: 8px 10px; border-radius: 9px;
  background: var(--panel-2); border: 1px solid var(--line-2); font-size: .88rem; cursor: grab;
}
.chip select { width: 100%; padding: 4px 6px; font-size: .78rem; border-radius: 6px; }
.cat-pool .chip { width: 230px; }
.chip button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 2px; }
.chip.is-right { border-color: var(--ok); background: var(--ok-bg); }
.chip.is-wrong { border-color: var(--bad); background: var(--bad-bg); }

.calc { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.calc .inputs .field { margin-bottom: 12px; }
.calc .inputs label { display: flex; justify-content: space-between; }
.calc .readouts { display: grid; gap: 10px; align-content: start; }
.readout { background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 14px; }
.readout span { display: block; font-size: .78rem; color: var(--muted); }
.readout b { font-size: 1.6rem; }
.readout.main { border-color: var(--accent); box-shadow: var(--glow); }
.calc-answer { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.calc-answer input { max-width: 160px; }

.fill-text { line-height: 2.2; }
.fill-text select { width: auto; display: inline-block; padding: 4px 8px; margin: 0 2px; font-weight: 600; }
.fill-text select.is-right { border-color: var(--ok); background: var(--ok-bg); }
.fill-text select.is-wrong { border-color: var(--bad); background: var(--bad-bg); }

.feedback { margin-top: 14px; padding: 12px 14px; border-radius: 10px; border: 1px solid; display: flex; gap: 10px; align-items: flex-start; }
.feedback svg { flex: none; width: 20px; height: 20px; margin-top: 2px; }
.feedback.neutral { background: var(--panel-2); border-color: var(--line-2); }
.feedback.ok { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.feedback.ok svg { color: var(--ok); }
.feedback.ko { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.feedback.ko svg { color: var(--bad); }
.activity-actions { display: flex; gap: 10px; margin-top: 14px; align-items: center; }

/* ---------- Boss ---------- */
.boss-banner {
  position: relative; overflow: hidden; border-radius: 16px; padding: 24px; margin-bottom: 18px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--bad) 22%, var(--panel)), var(--panel));
  border: 1px solid color-mix(in srgb, var(--bad) 40%, var(--line));
}
.boss-banner .eyebrow { color: var(--bad); }
.boss-q-num { font-size: .75rem; color: var(--muted); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.score-big { font-size: 3rem; font-weight: 800; line-height: 1; }
.score-big.ok { color: var(--ok); }
.score-big.ko { color: var(--bad); }
.hint { background: var(--warn-bg); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); color: var(--text); padding: 12px 14px; border-radius: 10px; }

/* ---------- Dialogue ---------- */
.dialogue { display: grid; gap: 14px; }
.persuasion { display: flex; align-items: center; gap: 12px; }
.persuasion .meter { flex: 1; height: 14px; border-radius: 99px; background: var(--line); position: relative; overflow: hidden; }
.persuasion .meter i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--bad), var(--warn), var(--ok)); transition: width .6s ease; }
.persuasion .meter .target { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); }
.chat { display: grid; gap: 12px; }
.chat .me { display: flex; justify-content: flex-end; }
.chat .me .bubble { flex: 0 1 auto; max-width: 80%; background: color-mix(in srgb, var(--accent) 14%, var(--panel)); border-radius: 14px 4px 14px 14px; }
.delta { font-weight: 800; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--bad); }
.delta.flat { color: var(--muted); }
.tag-chip { display: inline-block; font-size: .72rem; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line-2); color: var(--muted); margin-bottom: 6px; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); background: var(--panel-2); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
tr.me td { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.dots { display: flex; gap: 3px; }
.dots i { width: 10px; height: 10px; border-radius: 3px; background: var(--line); }
.dots i.done { background: var(--ok); }
.dots i.open { background: var(--warn); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button { background: none; border: 0; color: var(--muted); font: inherit; font-weight: 600; padding: 10px 14px; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }

/* ---------- Glossaire et flashcards ---------- */
.gloss-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.gloss-item h3 { margin-bottom: 2px; }
.gloss-item .en { color: var(--muted); font-size: .82rem; margin-bottom: 8px; }
.flashcard { perspective: 1200px; max-width: 560px; margin: 0 auto; cursor: pointer; }
.flashcard .inner { position: relative; min-height: 240px; transition: transform .5s ease; transform-style: preserve-3d; }
.flashcard.flipped .inner { transform: rotateY(180deg); }
.flashcard .face {
  position: absolute; inset: 0; backface-visibility: hidden; border-radius: 16px; padding: 28px;
  display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center;
  background: var(--panel); border: 1px solid var(--line-2); box-shadow: var(--shadow); font-size: 1.15rem;
}
.flashcard .back { transform: rotateY(180deg); background: var(--panel-2); border-color: var(--accent); }
.flashcard .face small { position: absolute; top: 14px; left: 18px; font-size: .75rem; color: var(--muted); }

/* ---------- Toasts et modales ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: grid; gap: 8px; }
.toast {
  min-width: 240px; max-width: 360px; padding: 12px 14px; border-radius: 12px; background: var(--panel);
  border: 1px solid var(--line-2); box-shadow: var(--shadow); animation: slidein .25s ease;
  display: flex; gap: 10px; align-items: center;
}
.toast.xp { border-color: var(--xp); }
.toast.xp b { color: var(--xp); }
.toast.bad { border-color: var(--bad); }
@keyframes slidein { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.xp-float { position: fixed; z-index: 70; pointer-events: none; font-weight: 800; color: var(--xp); font-size: 1.3rem; animation: floatup 1.2s ease forwards; }
@keyframes floatup { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-60px); opacity: 0; } }

.modal-root:empty { display: none; }
.modal-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(3, 8, 16, .66); display: grid; place-items: center; padding: 20px; }
.modal { width: 100%; max-width: 520px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 18px; padding: 26px; box-shadow: var(--shadow); animation: pop .3s cubic-bezier(.2, .9, .3, 1.3); }
@keyframes pop { from { transform: scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }
.modal .celebrate { text-align: center; }
.modal .celebrate .badge { margin: 0 auto 12px; width: auto; }
.modal .celebrate .medal { width: 88px; height: 88px; }
.modal .celebrate .medal svg { width: 40px; height: 40px; }

.boot, .noscript { padding: 60px; text-align: center; color: var(--muted); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.copybox { display: flex; gap: 8px; }
.copybox input { font-family: ui-monospace, Consolas, monospace; font-size: .82rem; }
.banner { padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; border: 1px solid; }
.banner.warn { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }

/* ---------- Fiche mémo (impression) ---------- */
.memo { background: #fff; color: #0f1b2d; max-width: 800px; margin: 24px auto; padding: 40px; border-radius: 12px; }
.memo h1 { font-size: 1.6rem; color: #0b3b66; border-bottom: 3px solid #0b6fc2; padding-bottom: 8px; }
.memo h2 { font-size: 1.05rem; color: #0b6fc2; margin-top: 22px; text-transform: uppercase; letter-spacing: .06em; }
.memo ul { padding-left: 20px; }
.memo .foot { margin-top: 30px; font-size: .8rem; color: #5b6b82; border-top: 1px solid #d7e0ec; padding-top: 10px; }

@media print {
  body { background: #fff; }
  .topbar, .toasts, .modal-root, .no-print, .skip-link { display: none !important; }
  .memo { margin: 0; padding: 0; max-width: none; box-shadow: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .missions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-hero { grid-template-columns: 1fr; }
  .hud .hud-xp { display: none; }
}
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; padding: 10px 16px; gap: 10px; }
  .mainnav { order: 3; width: 100%; margin: 0; overflow-x: auto; }
  .hud { margin-left: auto; }
  .hud .hud-ao .bar { width: 60px; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { min-height: 260px; padding: 28px 20px; border-right: 0; border-bottom: 1px solid var(--line); }
  .grid-2, .grid-3, .gloss-list, .calc { grid-template-columns: 1fr; }
  .gauge-card { flex-direction: column; align-items: flex-start; }
  .page, .player { padding-left: 16px; padding-right: 16px; }
  .tf-row { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 480px) {
  .missions { grid-template-columns: 1fr; }
  .brand-sub { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Illustration du patrouilleur (écrans publics) */
.ship .sea path { fill: color-mix(in srgb, var(--accent) 16%, transparent); }
.ship .hull-a { stop-color: var(--panel-2); }
.ship .hull-b { stop-color: var(--line-2); }
.ship .hull { stroke: var(--accent); stroke-width: 1.5; }
.ship .deck { fill: var(--panel); stroke: var(--accent); stroke-width: 1.5; }
.ship .radar { stroke: var(--accent); stroke-width: 3; stroke-linecap: round; }
.ship .light { fill: var(--warn); }
.ship .hullno { fill: var(--muted); font: 700 16px ui-monospace, Consolas, monospace; letter-spacing: .1em; }
