/* To the Moon! : habillage Lunaris Space (fond de nuit, ambre pour l'action, vert/rouge pour le résultat). */
:root {
  --bg: #0a0f1f;
  --bg2: #10183a;
  --panel: #131c3c;
  --panel2: #1a2550;
  --line: #2a3769;
  --ink: #eef1fb;
  --muted: #a3aed0;
  --accent: #ffb454;
  --accent-ink: #1b1204;
  --ok: #6fdc9a;
  --bad: #ff8a8a;
  --info: #7cc4ff;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(1.2px 1.2px at 12% 18%, #ffffffaa, transparent 60%),
    radial-gradient(1px 1px at 78% 12%, #ffffff88, transparent 60%),
    radial-gradient(1.4px 1.4px at 44% 72%, #ffffff77, transparent 60%),
    radial-gradient(1px 1px at 90% 66%, #ffffff66, transparent 60%),
    radial-gradient(1px 1px at 22% 88%, #ffffff77, transparent 60%),
    radial-gradient(ellipse at 50% -10%, #1b2a66 0%, transparent 55%),
    linear-gradient(180deg, var(--bg2), var(--bg) 60%);
  background-attachment: fixed;
  min-height: 100vh;
}
a { color: var(--info); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); letter-spacing: .01em; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
.wrap { max-width: 920px; margin: 0 auto; padding: 0 16px 48px; }
.narrow { max-width: 460px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; max-width: 920px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .02em; text-decoration: none; color: var(--ink); }
.brand svg { width: 30px; height: 30px; }
.who { color: var(--muted); font-size: .92rem; }

.card { background: color-mix(in srgb, var(--panel) 92%, transparent); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.card.mail { border-left: 4px solid var(--accent); }
.card.marcel { border-left: 4px solid var(--info); }
.who-line { color: var(--muted); font-size: .9rem; margin-bottom: .5em; }
blockquote { margin: 0; font-style: italic; }

.btn {
  display: inline-block; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; text-align: center;
  background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 999px; padding: 11px 22px; min-height: 44px;
}
.btn:hover { filter: brightness(1.08); }
.btn:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--info); outline-offset: 2px; }
.btn.secondary { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

input[type=password], input[type=text], input[type=file] {
  font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; min-height: 44px;
}
label { display: block; font-weight: 600; margin-bottom: 6px; }
.field { margin-bottom: 16px; }
.hint { color: var(--muted); font-size: .92rem; }
.msg { min-height: 1.4em; margin: 10px 0; font-weight: 600; }
.msg.err { color: var(--bad); }
.msg.good { color: var(--ok); }

/* Carte Terre-Lune */
.map { width: 100%; height: auto; display: block; }
.map .orbit { fill: none; stroke: var(--line); stroke-width: 2; stroke-dasharray: 3 7; }
.map .stop { fill: var(--panel2); stroke: var(--line); stroke-width: 2; }
.map .stop.done { fill: var(--ok); stroke: var(--ok); }
.map .stop.open { fill: var(--accent); stroke: var(--accent); }
.map .label { fill: var(--muted); font-size: 12px; font-family: var(--font); text-anchor: middle; }
.map .earth { fill: #2b6cd4; }
.map .moon { fill: #d8dbe6; }
.map .crater { fill: #b9bdd0; }

.missions { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.mission { display: flex; align-items: center; gap: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; text-decoration: none; color: var(--ink); }
.mission .num { flex: 0 0 38px; height: 38px; border-radius: 50%; background: var(--panel2); border: 2px solid var(--line); display: grid; place-items: center; font-weight: 700; }
.mission.open .num { border-color: var(--accent); color: var(--accent); }
.mission.done .num { background: var(--ok); border-color: var(--ok); color: #06210f; }
.mission .t { flex: 1; font-weight: 600; }
.mission .s { color: var(--muted); font-size: .9rem; }
a.mission:hover { border-color: var(--accent); }
.mission.locked { opacity: .55; }

/* Mission */
table { width: 100%; border-collapse: collapse; font-size: .96rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; }
td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lotrow td { background: var(--panel2); font-weight: 700; }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.25rem; letter-spacing: .08em; background: var(--bg); border: 1px dashed var(--accent); border-radius: 10px; padding: 8px 14px; display: inline-block; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.badge { display: inline-block; border-radius: 999px; padding: 3px 12px; font-weight: 700; font-size: .9rem; }
.badge.ok { background: #123d27; color: var(--ok); border: 1px solid var(--ok); }
.badge.ko { background: #451a1a; color: var(--bad); border: 1px solid var(--bad); }
.rules { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.rules li { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.rules li.ok { border-color: #1d5a3a; }
.rules li.ko { border-color: #6a2b2b; }
.rules .pts { float: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.rules .marcel { display: block; margin-top: 4px; color: var(--info); font-style: italic; }
ol.steps { padding-left: 1.2em; }
ol.steps li { margin-bottom: .5em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 560px) { .mission .s { display: none; } th:nth-child(3), td:nth-child(3) { display: none; } }
@media (prefers-reduced-motion: no-preference) { .rocket { transition: transform .8s ease; } }

/* Gantt simulé */
.stepper { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; counter-reset: st; }
.stepper li { counter-increment: st; font-size: .82rem; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 3px 11px; }
.stepper li::before { content: counter(st) ". "; }
.stepper li.done { color: var(--ok); border-color: #1d5a3a; }
.stepper li.current { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); font-weight: 700; }
.gauge-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.gauge { flex: 1 1 200px; height: 12px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); overflow: hidden; }
.gauge-fill { height: 100%; background: linear-gradient(90deg, #ff8a8a, var(--accent), var(--ok)); transition: width .5s ease; }
.stars { color: var(--accent); font-size: 1.3rem; letter-spacing: .1em; }
.controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px 16px; align-items: end; margin-bottom: 8px; }
.controls .field { margin-bottom: 8px; }
.controls label { font-weight: 600; font-size: .9rem; }
.controls .btn { width: 100%; }
select { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; min-height: 44px; max-width: 100%; }
input[type=date] { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; min-height: 44px; width: 100%; color-scheme: dark; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); margin-right: 8px; vertical-align: middle; }
.sim-grid { display: grid; grid-template-columns: minmax(230px, 300px) 1fr; gap: 16px; margin: 10px 0 14px; }
@media (max-width: 760px) { .sim-grid { grid-template-columns: 1fr; } }
.inbox, .plan { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; min-width: 0; }
.items { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; max-height: 420px; overflow: auto; }
.item { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--panel); cursor: grab; }
.it-name { display: block; font-weight: 600; font-size: .95rem; }
.it-meta { display: block; color: var(--muted); font-size: .8rem; margin-bottom: 4px; }
.it-actions { display: flex; gap: 6px; }
.mini { font: inherit; font-size: .8rem; font-weight: 700; cursor: pointer; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 999px; padding: 4px 11px; min-height: 30px; }
.mini.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); padding: 3px 8px; }
.mini[disabled] { opacity: .45; cursor: not-allowed; }
.trash { border: 2px dashed var(--line); border-radius: 10px; padding: 12px; text-align: center; color: var(--muted); }
.over { border-color: var(--accent) !important; background: #1f2a55; }
.tablewrap { overflow-x: auto; }
table.gantt { font-size: .86rem; min-width: 640px; }
table.gantt th, table.gantt td { padding: 5px 6px; }
table.gantt tr.lot td { background: var(--panel2); font-weight: 700; }
table.gantt tr.projrow td { background: #22306a; font-weight: 800; }
table.gantt tr.lvl2 .nmtxt { padding-left: 18px; }
input.dur { font: inherit; font-size: .85rem; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 3px 6px; width: 74px; text-align: right; }
input.dur.calc { opacity: .75; font-style: italic; }
td.acts { white-space: nowrap; }
.gbar { width: 120px; height: 14px; display: block; }
.barrect { fill: var(--info); }
.diamond { fill: var(--accent); }
.marcel-box { min-height: 24px; margin-bottom: 8px; }
.marcel-line { border-left: 3px solid var(--info); padding: 4px 10px; margin: 0 0 8px; font-style: italic; }
.marcel-line.trap { border-color: var(--accent); }
.gesture { color: var(--muted); font-size: .9rem; background: var(--bg); border-radius: 8px; padding: 6px 10px; }
.committee { margin-top: 14px; border-left: 4px solid var(--accent); }
.cliff { font-style: italic; border-top: 1px solid var(--line); padding-top: 12px; }
.gauge-fill.w0 { width: 0%; }
.gauge-fill.w5 { width: 5%; }
.gauge-fill.w10 { width: 10%; }
.gauge-fill.w15 { width: 15%; }
.gauge-fill.w20 { width: 20%; }
.gauge-fill.w25 { width: 25%; }
.gauge-fill.w30 { width: 30%; }
.gauge-fill.w35 { width: 35%; }
.gauge-fill.w40 { width: 40%; }
.gauge-fill.w45 { width: 45%; }
.gauge-fill.w50 { width: 50%; }
.gauge-fill.w55 { width: 55%; }
.gauge-fill.w60 { width: 60%; }
.gauge-fill.w65 { width: 65%; }
.gauge-fill.w70 { width: 70%; }
.gauge-fill.w75 { width: 75%; }
.gauge-fill.w80 { width: 80%; }
.gauge-fill.w85 { width: 85%; }
.gauge-fill.w90 { width: 90%; }
.gauge-fill.w95 { width: 95%; }
.gauge-fill.w100 { width: 100%; }

[hidden] { display: none !important; }

/* Mission 2 */
.gbar.wide { width: 240px; }
.barsum { fill: var(--muted); }
.msgs { max-height: 560px; }
.item.msg label { display: block; cursor: pointer; font-weight: normal; margin: 0; }
.item.msg input { margin-right: 8px; }
.item.msg.read { opacity: .6; }
input.preds { width: 130px; text-align: left; }
input.datecell { width: 128px; padding: 2px 4px; font-size: .8rem; color-scheme: dark; }
.tools { margin: 10px 0; }
code { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; font-size: .9em; }

/* Mission 3 */
.datebox { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 16px; margin-bottom: 12px; }
.bigdate { font-size: 1.15rem; font-weight: 700; margin: 4px 0; }
.panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; margin-bottom: 12px; }
.panel { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.panel h3 { margin-bottom: .6em; }
.checks { display: grid; gap: 6px; }
.checks label, .panel label { font-weight: normal; }
.panel .row { margin-bottom: 8px; }

/* Mission 4 */
.levers { display: grid; gap: 8px; }
.lever { display: grid; grid-template-columns: auto 1fr auto; gap: 2px 10px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-weight: normal; cursor: pointer; }
.lever input { grid-row: span 2; }
.lv-t { font-weight: 600; }
.lv-d { color: var(--muted); font-size: .85rem; grid-column: 2; }
.lv-c { color: var(--accent); font-weight: 700; grid-row: 1 / span 2; grid-column: 3; }
.crit { color: #ff8a8a; font-weight: 700; }
.fl { color: var(--muted); font-size: .82rem; }

/* Mission 5 */
.panel.wide { grid-column: 1 / -1; }
.alist { margin-top: 10px; }
.achips { margin-bottom: 6px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { font: inherit; font-size: .82rem; color: var(--ink); background: var(--panel2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; cursor: pointer; }
.msglist { max-height: 240px; overflow: auto; font-size: .88rem; }

/* Mission 6 */
.bench { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.bcase { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.bopt { display: block; font-weight: normal; padding: 3px 6px; border-radius: 6px; cursor: pointer; }
.bopt.good { background: #123d27; color: var(--ok); }
.bopt.bad { background: #451a1a; color: var(--bad); }

/* Certificat */
.certbox { text-align: center; padding: 32px 24px; border: 2px solid var(--accent); }
.certbox table { text-align: left; margin: 18px 0; }
@media print { body { background: #fff; color: #000; } .noprint, .topbar { display: none !important; } .card { border: 2px solid #000; background: #fff; } .stars, .num { color: #000; } }

/* Espace enseignant */
.tablewrap { overflow-x: auto; }
td.ok { color: var(--accent, #4aa3ff); white-space: nowrap; }
td.wip { color: #888; }
td.alert { color: #d9534f; }
