/* Latéral
   Idée : une fiche d'animateur sur fond sombre, avec un numéro d'épisode écrit de côté
   dans la marge (latéral). Ombres franches décalées, réponse surlignée au marqueur. */

:root {
  --paper: #111318;
  --card: #191C23;
  --ink: #E7E9E2;
  --muted: #9BA0AA;
  --line-strong: #4A505C;
  --accent: #8296FF;
  --accent-ink: #0E1016;
  --mark: #FFD93A;
  --mark-ink: #111318;
  --shadow: #2D47D6;
  --dot: rgba(231, 233, 226, .06);

  --f-display: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --f-ui: "Schibsted Grotesk", "Helvetica Neue", Arial, system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  background-color: var(--paper);
  background-image: radial-gradient(var(--dot) 1px, transparent 1.3px);
  background-size: 22px 22px;
  color: var(--ink);
  font-family: var(--f-ui);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 3px; }

/* ---------- En-tête ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding-top: 26px; padding-bottom: 22px;
}
.wordmark { display: flex; align-items: baseline; gap: 12px; color: var(--ink); text-decoration: none; }
.wm-main {
  font-family: var(--f-display); font-style: italic; font-weight: 500;
  font-size: 2rem; line-height: 1; letter-spacing: -0.02em;
  display: inline-block; transform: skewX(-6deg) translateX(0);
  transition: transform .3s cubic-bezier(.2, .8, .2, 1);
}
.wordmark:hover .wm-main { transform: skewX(-6deg) translateX(6px); }
.top-tools { display: flex; align-items: center; gap: 12px; }

.seg { display: inline-flex; border: 1.5px solid var(--ink); border-radius: 6px; overflow: hidden; }
.seg-btn {
  font: 600 .8rem/1 var(--f-mono); letter-spacing: .08em;
  padding: .7em .9em; border: 0; background: var(--card); color: var(--ink); cursor: pointer;
}
.seg-btn + .seg-btn { border-left: 1.5px solid var(--ink); }
.seg-btn[aria-pressed="true"] { background: var(--ink); color: var(--card); }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55em;
  font: 600 .95rem/1 var(--f-ui);
  padding: .85em 1.15em;
  border: 1.5px solid var(--ink); border-radius: 6px;
  background: var(--card); color: var(--ink);
  box-shadow: 3px 3px 0 var(--shadow);
  cursor: pointer;
  transition: transform .14s ease, box-shadow .14s ease, background-color .14s ease;
}
.btn:hover:not(:disabled) { transform: translateX(-2px); box-shadow: 6px 3px 0 var(--shadow); }
.btn:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--shadow); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-quiet { box-shadow: none; border-color: var(--line-strong); background: transparent; }
.btn-quiet:hover:not(:disabled) { border-color: var(--ink); }
.btn-small { font-size: .82rem; padding: .7em .95em; }
@media (hover: none) { .keys { display: none; } }

/* ---------- Scène : marge latérale + fiche ---------- */
.stage {
  flex: 1;
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  padding-bottom: 28px;
}
.rail {
  position: sticky; top: 24px;
  writing-mode: vertical-rl; transform: rotate(180deg);
  display: flex; align-items: center; gap: 14px;
  justify-self: center;
  padding-top: 8px;
}
.rail-label, .rail-q {
  font-family: var(--f-mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .16em; color: var(--muted);
}
.rail-ep {
  font-family: var(--f-mono); font-weight: 600;
  font-size: 5.6rem; line-height: .9; letter-spacing: -0.04em;
  color: transparent; -webkit-text-stroke: 1.5px var(--ink);
  font-variant-numeric: tabular-nums;
}
.rail-q { color: var(--accent); font-weight: 600; }

.card {
  background: var(--card);
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  box-shadow: 10px 10px 0 var(--shadow);
  padding: clamp(22px, 4vw, 48px);
  display: grid;
  gap: 26px;
}
.card.enter > * { animation: slide-in .38s cubic-bezier(.2, .8, .2, 1) both; }
.card.enter > *:nth-child(2) { animation-delay: .04s; }
.card.enter > *:nth-child(3) { animation-delay: .08s; }
@keyframes slide-in { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }

.meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 16px; }
.pill {
  font: 600 .68rem/1 var(--f-mono); text-transform: uppercase; letter-spacing: .14em;
  padding: .5em .7em; border: 1.5px solid var(--ink); border-radius: 4px;
  align-self: center;
}
.pill.is-opener { background: var(--mark); color: var(--mark-ink); border-color: var(--mark-ink); }
.ep-title { font-family: var(--f-display); font-style: italic; font-size: 1.15rem; }
.credits { font-size: .85rem; color: var(--muted); }

.question {
  margin: 0;
  font-family: var(--f-display); font-weight: 450;
  font-size: clamp(1.55rem, 1.3vw + 1.05rem, 2.4rem);
  line-height: 1.24; letter-spacing: -0.012em;
  max-width: 42ch;
  text-wrap: pretty;
}

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.actions-gap { flex: 1; }

.block-title {
  margin: 0 0 12px;
  font: 600 .7rem/1 var(--f-mono); text-transform: uppercase; letter-spacing: .16em; color: var(--muted);
}

/* ---------- Indices ---------- */
.hints { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.hint {
  display: grid; grid-template-columns: 2.6ch minmax(0, 1fr); gap: 14px; align-items: baseline;
  padding: 14px 16px;
  font: 500 1rem/1.45 var(--f-ui); color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--ink); border-radius: 6px;
}
.hint.is-new { animation: slide-in .32s cubic-bezier(.2, .8, .2, 1); }
.hint-num { font-family: var(--f-mono); font-weight: 600; font-size: .85rem; color: var(--accent); }
[hidden] { display: none !important; }

/* ---------- Réponse ---------- */
.answer { border-top: 1.5px solid var(--ink); padding-top: 24px; animation: slide-in .32s cubic-bezier(.2, .8, .2, 1); }
.answer-text {
  margin: 0 0 14px;
  font-family: var(--f-display); font-weight: 500;
  font-size: clamp(1.3rem, .9vw + 1rem, 1.85rem); line-height: 1.32;
  max-width: 44ch;
}
.answer-text mark {
  color: var(--ink);
  background-color: transparent;
  background-image: linear-gradient(var(--mark), var(--mark));
  background-repeat: no-repeat;
  background-size: 0% 100%;
  padding: .02em .18em;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  transition: background-size .7s cubic-bezier(.6, 0, .2, 1), color .3s ease .25s;
}
.answer.is-marked .answer-text mark { background-size: 100% 100%; color: var(--mark-ink); }
.explanation { margin: 0; max-width: 66ch; color: var(--ink); opacity: .85; }
.explanation:empty { display: none; }

/* ---------- Navigation ---------- */
.nav {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding-top: 8px; padding-bottom: 14px;
}
.jump { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
.jump label { font: 600 .72rem/1 var(--f-mono); text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }
.jump input, .jump select {
  font: 600 .95rem/1 var(--f-mono);
  color: var(--ink); background: var(--card);
  border: 1.5px solid var(--ink); border-radius: 6px;
  padding: .6em .7em;
}
.jump input { width: 6.5ch; text-align: center; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.jump input::-webkit-outer-spin-button, .jump input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.jump select { font-family: var(--f-ui); font-weight: 500; font-size: .9rem; max-width: 280px; }
.jump-total { font-family: var(--f-mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.keys { margin: 0 auto; padding-bottom: 30px; text-align: center; font: 500 .74rem/1.4 var(--f-mono); color: var(--muted); letter-spacing: .04em; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--card);
  font: 600 .88rem/1 var(--f-ui);
  padding: .9em 1.2em; border-radius: 6px;
  transition: opacity .2s, transform .2s;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Téléphone ---------- */
@media (max-width: 760px) {
  .stage { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .rail {
    position: static; writing-mode: horizontal-tb; transform: none;
    justify-self: start; align-items: baseline; gap: 12px; padding-top: 0;
  }
  .rail-ep { font-size: 2.6rem; -webkit-text-stroke-width: 1.2px; }
  .card { box-shadow: 6px 6px 0 var(--shadow); gap: 22px; }
  .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .actions-gap { display: none; }
  .actions .btn { padding-left: .6em; padding-right: .6em; }
  .nav { justify-content: center; }
  .nav-arrow { flex: 1 1 calc(50% - 14px); order: 2; }
  .jump { order: 1; width: 100%; }
  .jump select { max-width: 100%; flex: 1 1 100%; }
}
@media (max-width: 400px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  .actions .btn { font-size: .88rem; }
}

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