/* ═══════════════════════════════════════════════════════════════════════════
   Docker Ops Race — feuille de style unique.
   Thème sombre « arène », palette cyan/ambre/émeraude pour séparer les deux
   modes (compétitif = ambre, normal = émeraude).
   Aucune dépendance externe : pas de CDN, pas de webfont, fonctionne hors ligne.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --bg: #070b12;
  --bg-2: #0b1220;
  --panel: #0f1725;
  --panel-2: #131e30;
  --line: #1e2b42;
  --line-soft: #17233a;

  --fg: #e6edf7;
  --fg-dim: #8ba0bd;
  --fg-faint: #5d7192;

  --cyan: #22d3ee;
  --amber: #fbbf24;
  --emerald: #34d399;
  --rose: #fb7185;
  --violet: #a78bfa;

  --radius: 14px;
  --radius-sm: 9px;
  --mono: ui-monospace, "JetBrains Mono", "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;

  --shadow: 0 18px 50px -22px rgb(0 0 0 / 0.9);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 620px at 12% -8%, #0d2b3d 0%, transparent 60%),
    radial-gradient(900px 520px at 92% 4%, #2a1f0b 0%, transparent 58%),
    var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { line-height: 1.2; margin: 0; letter-spacing: -0.02em; }
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: var(--mono); }

.wrap { width: min(1240px, 100% - 2.5rem); margin-inline: auto; }
.dim { color: var(--fg-dim); }

/* ───────────────────────────────────────────────────────────────── boutons */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--fg);
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .08s, box-shadow .15s;
  white-space: nowrap;
}
.btn:hover { border-color: #2f4568; background: #182437; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.btn-primary {
  background: linear-gradient(135deg, #0e7490, #0891b2);
  border-color: #155e75;
  color: #ecfeff;
  box-shadow: 0 10px 26px -14px #0891b2;
}
.btn-primary:hover { background: linear-gradient(135deg, #0891b2, #06b6d4); border-color: #0e7490; }

.btn-ghost { background: transparent; }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
.btn-lg { padding: 0.8rem 1.6rem; font-size: 1rem; width: 100%; justify-content: center; }

.linkish {
  background: none; border: 0; padding: 0;
  color: var(--fg-dim); font: inherit; font-size: 0.8rem;
  cursor: pointer; text-decoration: underline dotted;
}
.linkish:hover { color: var(--cyan); }

/* ═══════════════════════════════════════════════════════════════ PORTAL */

.portal-head {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgb(11 18 32 / .96), rgb(11 18 32 / .72));
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.head-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.5rem; padding: 1.1rem 0; flex-wrap: wrap;
}

.brand {
  font-family: var(--mono);
  font-size: clamp(1.1rem, 2.4vw, 1.7rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}
.brand .bolt { filter: saturate(1.3); }
.brand .sep { color: #2f4568; }
.brand .thin { color: var(--fg-dim); font-weight: 500; font-size: 0.72em; letter-spacing: .1em; }

.tagline { margin: 0.2rem 0 0; color: var(--fg-dim); font-size: 0.85rem; }
.head-actions { display: flex; align-items: center; gap: 0.75rem; }

.live-dot {
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-size: 0.72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--emerald);
  background: rgb(52 211 153 / .1);
  border: 1px solid rgb(52 211 153 / .25);
  padding: 0.3rem 0.7rem; border-radius: 999px;
}
/* L'animation ne tourne que si la connexion est vraiment vivante : un point
   qui clignote en permanence ne distingue plus « connecté » de « bloqué ». */
.live-dot i {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--emerald);
  animation: pulse 2s infinite;
}
.live-dot.off { color: var(--amber); background: rgb(251 191 36 / .1); border-color: rgb(251 191 36 / .25); }
.live-dot.off i { background: var(--amber); animation: none; opacity: .85; }
.live-dot.pending i { animation: pulse 1.1s infinite; }
.live-dot.pending { color: var(--cyan); background: rgb(34 211 238 / .1); border-color: rgb(34 211 238 / .25); }
.live-dot.pending i { background: var(--cyan); }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.portal-body { padding: 2rem 0 3rem; display: grid; gap: 1.6rem; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-amber { border-color: rgb(251 191 36 / .22); }
.panel-emerald { border-color: rgb(52 211 153 / .22); }
.panel-cyan { border-color: rgb(34 211 238 / .22); }

.panel-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line-soft);
  flex-wrap: wrap;
}
.panel-head h2 { font-size: 1.02rem; letter-spacing: .04em; text-transform: uppercase; }
.panel-amber .panel-head h2 { color: var(--amber); }
.panel-emerald .panel-head h2 { color: var(--emerald); }
.panel-cyan .panel-head h2 { color: var(--cyan); }
.panel-head .ico { margin-right: 0.3rem; }
.panel-sub { color: var(--fg-dim); font-size: 0.78rem; }

/* ── podium */

.podium {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: end;
  gap: 0.75rem;
  padding: 1.5rem 1.25rem 0;
}
.podium-empty { grid-column: 1 / -1; text-align: center; color: var(--fg-dim); padding: 1rem; }
.podium-step { display: grid; justify-items: center; gap: 0.15rem; text-align: center; }
.podium-ico { font-size: 1.6rem; }
.podium-team { font-weight: 700; font-size: 0.95rem; }
.podium-score { font-family: var(--mono); color: var(--amber); font-size: 0.85rem; }
.podium-bar {
  width: 100%; margin-top: 0.5rem; border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, rgb(251 191 36 / .28), rgb(251 191 36 / .04));
  border: 1px solid rgb(251 191 36 / .28); border-bottom: 0;
  height: 34px;
}
.podium-step.is-first .podium-bar {
  height: 68px;
  background: linear-gradient(180deg, rgb(251 191 36 / .5), rgb(251 191 36 / .08));
}
.podium-foot {
  grid-column: 1 / -1; display: flex; justify-content: center; gap: 1.25rem;
  color: var(--fg-dim); font-size: 0.8rem; padding: 0.75rem 0 0;
}

/* ── tableaux */

.table-scroll { overflow-x: auto; }
.board { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.board th {
  text-align: left; font-size: 0.68rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--fg-dim); font-weight: 600; padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--line);
  background: rgb(0 0 0 / .18);
}
.board td { padding: 0.7rem 1rem; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.board tbody tr:last-child td { border-bottom: 0; }
.board tbody tr { transition: background .12s; }
.board tbody tr:hover { background: rgb(255 255 255 / .022); }
.board.compact td { padding: 0.45rem 0.8rem; font-size: 0.82rem; }

.c-rank { width: 62px; text-align: center !important; font-family: var(--mono); }
.c-mid { text-align: center !important; }
.c-right { text-align: right !important; }
.team-cell { font-weight: 600; }
.score-cell { font-family: var(--mono); font-weight: 700; color: var(--amber); font-size: 1rem; }
.empty { text-align: center; color: var(--fg-dim); padding: 2rem !important; font-style: italic; }

/* Poste du dernier appel : monospace, discret, aligné à droite. */
.ip-cell { font-family: var(--mono); font-size: 0.78rem; color: var(--fg-dim); white-space: nowrap; }

.badge {
  display: inline-block; margin-left: 0.5rem; padding: 0.1rem 0.5rem;
  border-radius: 999px; font-size: 0.66rem; font-weight: 700; letter-spacing: .06em;
}
.badge-done { background: rgb(52 211 153 / .14); color: var(--emerald); border: 1px solid rgb(52 211 153 / .3); }
.badge-run { background: rgb(251 191 36 / .12); color: var(--amber); border: 1px solid rgb(251 191 36 / .25); }

/* pastilles de quête */
.qbadges { display: inline-flex; flex-wrap: wrap; gap: 3px; justify-content: center; max-width: 340px; }
.qdot {
  display: inline-grid; place-items: center; width: 21px; height: 21px;
  border-radius: 5px; font-size: 0.63rem; font-style: normal;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--fg-faint);
}
.qdot.on { background: rgb(52 211 153 / .18); border-color: rgb(52 211 153 / .45); color: var(--emerald); font-weight: 700; }
.progress-text { display: block; color: var(--fg-dim); font-size: 0.75rem; margin-top: 0.3rem; font-family: var(--mono); }

/* ── inscription express */

.reg-row { display: grid; grid-template-columns: 1fr 260px auto; gap: 0.7rem; padding: 1.1rem 1.25rem 0; }
.reg-msg { margin: 0.7rem 1.25rem 0; font-size: 0.82rem; min-height: 1.2rem; word-break: break-word; }
.reg-err { color: var(--rose); }

input[type="text"], select {
  background: var(--bg-2); border: 1px solid var(--line); color: var(--fg);
  padding: 0.55rem 0.8rem; border-radius: var(--radius-sm); font: inherit; font-size: 0.9rem;
  width: 100%;
}
input:focus, select:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgb(34 211 238 / .14); }
input::placeholder { color: var(--fg-faint); }

.curl-help { padding: 0 1.25rem 1.1rem; }
.curl-help summary { cursor: pointer; color: var(--fg-dim); font-size: 0.82rem; }
.curl-help summary:hover { color: var(--cyan); }
.curl-help pre {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 0.9rem; overflow-x: auto; margin: 0.7rem 0 0; font-size: 0.78rem; line-height: 1.5;
  color: #bfe9f5;
}

.portal-foot {
  display: flex; gap: 0.6rem; justify-content: center; color: var(--fg-faint);
  font-size: 0.8rem; padding-top: 0.4rem;
}

/* ═══════════════════════════════════════════════════════ JEU : inscription */

.gate { min-height: calc(100vh - 0px); display: grid; place-items: center; padding: 2.5rem 1.25rem; }
.gate-card { width: min(1000px, 100%); }

.gate-brand {
  font-family: var(--mono); font-size: clamp(1.5rem, 4vw, 2.4rem); font-weight: 800;
  text-align: center; letter-spacing: -0.02em;
}
.gate-brand span { filter: saturate(1.3); }
.gate-sub { text-align: center; color: var(--fg-dim); margin: 0.5rem auto 2rem; max-width: 60ch; }

.mode-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.2rem; }

.mode {
  text-align: left; font: inherit; color: var(--fg); cursor: pointer;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.4rem;
  display: grid; gap: 0.75rem; align-content: start;
  transition: border-color .16s, transform .12s, box-shadow .16s;
}
.mode:hover { transform: translateY(-3px); }
.mode-comp:hover { border-color: rgb(251 191 36 / .55); box-shadow: 0 20px 50px -26px rgb(251 191 36 / .5); }
.mode-norm:hover { border-color: rgb(52 211 153 / .55); box-shadow: 0 20px 50px -26px rgb(52 211 153 / .5); }
.mode:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.mode-top { display: flex; align-items: center; justify-content: space-between; }
.mode-ico { font-size: 1.7rem; }
.mode-badge {
  font-family: var(--mono); font-size: 0.66rem; font-weight: 700; letter-spacing: .14em;
  padding: 0.2rem 0.6rem; border-radius: 999px;
}
.mode-comp .mode-badge { background: rgb(251 191 36 / .14); color: var(--amber); border: 1px solid rgb(251 191 36 / .3); }
.mode-norm .mode-badge { background: rgb(52 211 153 / .14); color: var(--emerald); border: 1px solid rgb(52 211 153 / .3); }
.mode h3 { font-size: 1.15rem; }
.mode ul { margin: 0; padding-left: 1.1rem; color: var(--fg-dim); font-size: 0.88rem; display: grid; gap: 0.3rem; }
.mode ul b { color: var(--fg); }
.mode-go { font-weight: 700; font-size: 0.88rem; margin-top: 0.3rem; }
.mode-comp .mode-go { color: var(--amber); }
.mode-norm .mode-go { color: var(--emerald); }

.gate-form {
  margin: 1.5rem auto 0; max-width: 440px; display: grid; gap: 0.5rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem;
}
.gate-form label { font-size: 0.8rem; color: var(--fg-dim); font-weight: 600; }
.gate-form .opt { font-weight: 400; color: var(--fg-faint); }
.gate-form input { margin-bottom: 0.3rem; }
.gate-mode { font-size: 0.84rem; color: var(--fg-dim); margin: 0.2rem 0 0.6rem; }
.gate-mode b { color: var(--fg); }
.gate-form .reg-msg { margin: 0.4rem 0 0; }

/* ═══════════════════════════════════════════════════════ JEU : parcours */

.play-head {
  position: sticky; top: 0; z-index: 20;
  background: rgb(7 11 18 / .94); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.play-id { display: flex; align-items: center; gap: 0.7rem; }
.team-name { font-family: var(--mono); font-weight: 700; font-size: 1.05rem; }
.chip { font-size: 0.7rem; font-weight: 700; letter-spacing: .08em; padding: 0.22rem 0.6rem; border-radius: 999px; }
.chip-amber { background: rgb(251 191 36 / .14); color: var(--amber); border: 1px solid rgb(251 191 36 / .3); }
.chip-emerald { background: rgb(52 211 153 / .14); color: var(--emerald); border: 1px solid rgb(52 211 153 / .3); }
.since { font-size: 0.72rem; color: var(--fg-faint); font-family: var(--mono); }

/* Jeton : toujours visible, copiable en un clic. */
.token-chip {
  background: rgb(167 139 250 / .1); border: 1px solid rgb(167 139 250 / .3);
  color: #c4b5fd; border-radius: 999px; padding: 0.22rem 0.7rem;
  font-family: var(--mono); font-size: 0.72rem; cursor: pointer;
  transition: background .12s, color .12s;
}
.token-chip:hover { background: rgb(167 139 250 / .2); }
.token-chip.ok { background: rgb(52 211 153 / .18); border-color: rgb(52 211 153 / .45); color: var(--emerald); }
.token-chip:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.play-stats { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.stat { display: grid; }
.stat-k { font-size: 0.63rem; letter-spacing: .1em; text-transform: uppercase; color: var(--fg-dim); }
.stat-v { font-family: var(--mono); font-weight: 700; font-size: 1.05rem; }
#scoreVal { color: var(--amber); }
#rankVal { color: var(--cyan); }

.progress-rail { height: 3px; background: var(--line-soft); }
#rail { display: flex; height: 100%; }
.rail-seg { flex: 1; border-right: 1px solid var(--bg); }
.rail-seg.on { background: var(--emerald); }
.rail-seg.next { background: var(--amber); animation: pulse 2.4s infinite; }

.play-body {
  display: grid; grid-template-columns: 320px 1fr; gap: 1.4rem;
  padding: 1.5rem 0 3rem; align-items: start;
}

.side-col {
  position: sticky; top: 5.5rem;
  display: grid; gap: 0.8rem;
  max-height: calc(100vh - 7rem); overflow-y: auto; padding-right: 0.3rem;
}

/* ── historique */

.history { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.9rem; }
.history-title { font-size: 0.8rem; margin-bottom: 0.6rem; color: var(--fg-dim); }
.history-list { display: grid; gap: 2px; }
.history-row {
  display: grid; grid-template-columns: 1.6em 1fr auto; gap: 0.45rem; align-items: baseline;
  font-size: 0.76rem; padding: 0.28rem 0.3rem; border-radius: 5px;
}
.history-row:nth-child(odd) { background: rgb(0 0 0 / .16); }
.h-num { font-family: var(--mono); color: var(--fg-faint); }
.h-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-time { font-family: var(--mono); color: var(--cyan); font-size: 0.72rem; }
.h-pts { font-family: var(--mono); color: var(--amber); font-weight: 700; }
.h-plain { color: var(--emerald); font-family: var(--sans); font-weight: 400; }
.history-foot {
  display: flex; justify-content: space-between; gap: 1rem;
  margin-top: 0.7rem; padding-top: 0.6rem; border-top: 1px solid var(--line-soft);
  font-family: var(--mono); font-size: 0.8rem; font-weight: 700; color: var(--amber);
}

/* ── plan */

.quest-map { display: grid; gap: 0.6rem; }
.map-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 0.3rem; }
.map-head h3 { font-size: 0.72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--fg-dim); }
.map-count { margin: 0; font-family: var(--mono); font-size: 0.75rem; color: var(--cyan); }

.map-next {
  display: grid; gap: 0.3rem;
  background: linear-gradient(135deg, rgb(251 191 36 / .1), rgb(34 211 238 / .06));
  border: 1px solid rgb(251 191 36 / .28);
  border-radius: var(--radius-sm); padding: 0.7rem;
}
.map-next-k { font-size: 0.65rem; letter-spacing: .1em; text-transform: uppercase; color: var(--amber); font-weight: 700; }
.map-next-t { font-size: 0.88rem; font-weight: 600; }
.map-next-p { font-family: var(--mono); font-size: 0.72rem; color: var(--fg-dim); }
.map-next .btn { justify-self: start; margin-top: 0.2rem; }

.map-mod { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.map-mod-head {
  display: flex; align-items: center; gap: 0.5rem; width: 100%;
  background: rgb(0 0 0 / .2); border: 0; color: var(--fg);
  padding: 0.55rem 0.7rem; font: inherit; font-size: 0.83rem; cursor: default; text-align: left;
}
.mod-ico { font-size: 0.95rem; }
.mod-title { font-weight: 600; flex: 1; }
.mod-pts { font-family: var(--mono); font-size: 0.68rem; color: var(--fg-dim); }

.mod-quests { list-style: none; margin: 0; padding: 0; }
.qitem {
  display: flex; align-items: center; gap: 0.5rem; width: 100%;
  background: none; border: 0; border-top: 1px solid var(--line-soft);
  color: var(--fg); font: inherit; font-size: 0.82rem; text-align: left;
  padding: 0.45rem 0.7rem; cursor: pointer; transition: background .12s;
}
.qitem:hover:not(:disabled) { background: rgb(255 255 255 / .03); }
.qitem:focus-visible { outline: 2px solid var(--cyan); outline-offset: -2px; }
.qitem.locked { opacity: .42; cursor: not-allowed; }
.qitem.done .qname { color: var(--fg-dim); text-decoration: line-through; text-decoration-color: rgb(52 211 153 / .5); }
.qitem.active { background: rgb(34 211 238 / .1); box-shadow: inset 3px 0 0 var(--cyan); }
.qnum { font-family: var(--mono); font-size: 0.7rem; color: var(--fg-faint); min-width: 1.4em; }
.qname { flex: 1; }
.qpts, .qlock, .qok { font-size: 0.72rem; color: var(--fg-dim); font-family: var(--mono); }
.qok { color: var(--emerald); }

/* ── panneau de quête */

.quest-panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.6rem; box-shadow: var(--shadow); min-width: 0;
}

.quest-head { border-bottom: 1px solid var(--line-soft); padding-bottom: 1rem; margin-bottom: 1.1rem; }
.quest-mod { font-size: 0.72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--cyan); font-weight: 700; }
.quest-head h2 { font-size: clamp(1.25rem, 2.6vw, 1.7rem); margin: 0.3rem 0 0.6rem; }
.quest-tags { display: flex; gap: 0.45rem; flex-wrap: wrap; }
.tag { font-size: 0.72rem; font-family: var(--mono); padding: 0.2rem 0.6rem; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); color: var(--fg-dim); }
.tag-pts { color: var(--amber); border-color: rgb(251 191 36 / .3); }
.tag-flagship { color: var(--amber); background: rgb(251 191 36 / .12); border-color: rgb(251 191 36 / .45); font-weight: 700; }
.tag-done { color: var(--emerald); border-color: rgb(52 211 153 / .3); }

.teaches { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.teaches-k { font-size: 0.7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--fg-faint); }
.teach {
  font-size: 0.74rem; font-family: var(--mono); padding: 0.15rem 0.55rem;
  border-radius: 999px; background: rgb(167 139 250 / .1); color: #c4b5fd; border: 1px solid rgb(167 139 250 / .25);
}

/* énoncé (markdown rendu) */
.brief { font-size: 0.96rem; }
.brief h3 { font-size: 1.05rem; margin: 1.2rem 0 0.5rem; color: var(--fg); }
.brief h3:first-child { margin-top: 0; }
.brief p { margin: 0.6rem 0; }
.brief ul, .brief ol { margin: 0.6rem 0; padding-left: 1.4rem; display: grid; gap: 0.35rem; }
.brief li::marker { color: var(--cyan); }
.brief code {
  background: rgb(34 211 238 / .1); color: #a5f3fc;
  padding: 0.1rem 0.35rem; border-radius: 4px; font-size: 0.86em;
}
.brief pre {
  background: #060a11; border: 1px solid var(--line); border-left: 3px solid var(--cyan);
  border-radius: var(--radius-sm); padding: 0.85rem 1rem; overflow-x: auto;
  margin: 0.8rem 0; font-size: 0.86rem; line-height: 1.55;
}
.brief pre code { background: none; color: #d6f7ff; padding: 0; }

.aid { margin: 1.4rem 0 0; padding-top: 1.1rem; border-top: 1px dashed var(--line); }
.hint-box { display: grid; gap: 0.6rem; margin-top: 0.8rem; }
.hint {
  background: rgb(251 191 36 / .07); border: 1px solid rgb(251 191 36 / .22);
  border-radius: var(--radius-sm); padding: 0.7rem 0.9rem;
}
.hint-n { display: block; font-size: 0.68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--amber); font-weight: 700; margin-bottom: 0.3rem; }
.hint p { margin: 0; font-size: 0.9rem; }
.hint pre { margin: 0.5rem 0 0; }

.checkpoint {
  margin-top: 1.2rem; padding: 0.9rem 1.1rem;
  background: rgb(52 211 153 / .06); border: 1px solid rgb(52 211 153 / .2);
  border-radius: var(--radius-sm);
}
.cp-k { font-size: 0.72rem; letter-spacing: .06em; color: var(--emerald); font-weight: 700; }
.checkpoint p { margin: 0.3rem 0 0; font-size: 0.9rem; }

/* soumission */
.submit-box {
  margin-top: 1.5rem; padding: 1.2rem;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  border-color: rgb(251 191 36 / .3);
}
.submit-title { font-size: 0.95rem; margin-bottom: 0.3rem; }
.submit-sub { margin: 0 0 0.9rem; font-size: 0.82rem; color: var(--fg-dim); }

/* Commande de récupération du mot de passe : c'est le cœur du jeu, elle
   mérite d'être mise en avant plutôt que noyée dans l'énoncé. */
.fetch-hint {
  display: grid; gap: 0.5rem; justify-items: start;
  background: rgb(251 191 36 / .07); border: 1px solid rgb(251 191 36 / .28);
  border-radius: var(--radius-sm); padding: 0.75rem 0.9rem; margin-bottom: 0.9rem;
}
.fetch-hint-k {
  font-size: 0.68rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--amber); font-weight: 700;
}
.fetch-hint-code {
  background: #060a11; border: 1px solid rgb(251 191 36 / .3); border-left: 3px solid var(--amber);
  border-radius: 6px; padding: 0.55rem 0.7rem; margin: 0;
  font-size: 0.82rem; overflow-x: auto; max-width: 100%;
}
.fetch-hint-code code { background: none; color: #fde68a; padding: 0; white-space: pre; }
.copy-hint { margin-top: 0.1rem; }

/* Champ de saisie du mot de passe : il doit être immédiatement visible et
   étiqueté. La question « où je tape ? » ne doit pas exister. */
.submit-field { display: grid; gap: 0.3rem; flex: 1; min-width: 0; }
.submit-field-k {
  font-size: 0.68rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--fg-dim); font-weight: 700;
}
.submit-field input { font-family: var(--mono); letter-spacing: 0.03em; font-size: 0.95rem; }
.submit-row { align-items: end; }
.submit-row { display: grid; grid-template-columns: 1fr auto; gap: 0.6rem; }
.submit-row input { font-family: var(--mono); letter-spacing: 0.04em; }
.copy-flag { display: block; margin-top: 0.5rem; }

.submit-msg { margin-top: 0.9rem; font-size: 0.86rem; }
.submit-err { color: var(--rose); }
.submit-warn { color: var(--amber); }

.success {
  background: rgb(52 211 153 / .08); border: 1px solid rgb(52 211 153 / .3);
  border-radius: var(--radius-sm); padding: 1rem 1.1rem; animation: pop .3s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.success-head { font-weight: 700; color: var(--emerald); margin-bottom: 0.7rem; }
.breakdown { list-style: none; margin: 0 0 0.7rem; padding: 0; display: grid; gap: 0.3rem; font-size: 0.86rem; }
.breakdown li { display: flex; justify-content: space-between; gap: 1rem; color: var(--fg-dim); }
.breakdown li b { font-family: var(--mono); color: var(--fg); }
.breakdown li.bonus b { color: var(--emerald); }
.breakdown li.malus b { color: var(--rose); }
.success-total { font-weight: 700; font-family: var(--mono); font-size: 0.92rem; border-top: 1px solid rgb(52 211 153 / .2); padding-top: 0.6rem; }
.success-rank { margin-top: 0.4rem; font-size: 0.85rem; color: var(--amber); font-weight: 600; }

.next-box {
  margin-top: 1.4rem; padding: 1.1rem;
  background: rgb(34 211 238 / .06); border: 1px solid rgb(34 211 238 / .22);
  border-radius: var(--radius); display: grid; gap: 0.6rem; justify-items: start;
}
.next-box p { margin: 0; font-size: 0.9rem; color: var(--fg-dim); }

.success { margin-top: 1.1rem; }
.solution {
  margin-top: 1.2rem; padding: 1.1rem;
  background: rgb(167 139 250 / .06); border: 1px solid rgb(167 139 250 / .22);
  border-radius: var(--radius-sm);
}
.solution h3 { font-size: 0.9rem; margin-bottom: 0.5rem; color: #c4b5fd; }
.solution pre { background: #060a11; border: 1px solid var(--line); border-left: 3px solid var(--violet); border-radius: var(--radius-sm); padding: 0.8rem; overflow-x: auto; font-size: 0.84rem; }

/* ── dialogue d'aide */

.dlg {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); color: var(--fg); padding: 0;
  width: min(820px, 92vw); max-height: 82vh;
}
.dlg::backdrop { background: rgb(0 0 0 / .68); backdrop-filter: blur(3px); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.3rem; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); }
.dlg-head h2 { font-size: 1rem; }
.dlg-body { padding: 1.1rem 1.3rem 1.4rem; overflow-y: auto; max-height: calc(82vh - 60px); }
.dlg-note { font-size: 0.84rem; color: var(--fg-dim); margin: 0 0 1rem; }
.cmd-action { color: var(--fg-dim); width: 32%; }
.cmd-code { display: flex; align-items: center; gap: 0.6rem; }
.cmd-code code { background: var(--bg); border: 1px solid var(--line); border-radius: 5px; padding: 0.15rem 0.45rem; font-size: 0.8rem; color: #a5f3fc; overflow-x: auto; white-space: nowrap; }

/* ── toast */

.toast {
  position: fixed; left: 50%; bottom: 1.6rem; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--line); color: var(--fg);
  padding: 0.65rem 1.1rem; border-radius: 999px; font-size: 0.88rem; font-weight: 600;
  box-shadow: 0 20px 45px -20px #000; z-index: 100; max-width: min(92vw, 640px);
  animation: pop .25s ease-out;
}
.toast-ok { border-color: rgb(52 211 153 / .5); color: var(--emerald); }
.toast-err { border-color: rgb(251 113 133 / .5); color: var(--rose); }
.toast-warn { border-color: rgb(251 191 36 / .5); color: var(--amber); }

/* ═══════════════════════════════════════════════════════════ responsive */

@media (max-width: 900px) {
  .play-body { grid-template-columns: 1fr; }
  .side-col { position: static; max-height: none; overflow: visible; }
  .reg-row { grid-template-columns: 1fr; }
  .podium { grid-template-columns: 1fr; align-items: start; }
  .podium-bar, .podium-step.is-first .podium-bar { height: 5px; border-radius: 5px; }
  .c-rank { width: 46px; }
  .qbadges { max-width: 190px; }
}

@media (max-width: 560px) {
  .wrap { width: min(100%, 100% - 1.6rem); }
  .quest-panel { padding: 1.1rem; }
  .submit-row { grid-template-columns: 1fr; }
  .head-row { gap: 0.8rem; }
  .play-stats { gap: 0.8rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* impression : la liste des missions reste lisible sur papier */
@media print {
  body { background: #fff; color: #000; }
  .play-head, .quest-map, .submit-box, .aid, .toast, .btn { display: none !important; }
  .quest-panel { border: 0; box-shadow: none; }
}