/* Salle de projection : fond terre sombre (la poussière de Sad Hill), ambre de la lampe du projecteur.
   Mise en page : une bande-film en tête, puis une table de découpage plan par plan. */
:root {
  --bg: #15110d;
  --surface: #1f1914;
  --surface-2: #2a221b;
  --line: #3a3027;
  --fg: #efe6da;
  --muted: #a8998a;
  --accent: #f2b134;
  --accent-ink: #1a1208;
  --good: #7fc28a;
  --bad: #e27a62;
  --near: #d9b25a;

  --f-display: "Big Shoulders Display", "Oswald", "Arial Narrow", sans-serif;
  --f-body: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;

  --radius: 6px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { background: var(--bg); color: var(--fg); }
body {
  margin: 0;
  font-family: var(--f-body);
  font-size: 1rem;
  line-height: 1.55;
  padding-inline: 16px;
  padding-block: 0 4rem;
}
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 800; letter-spacing: .01em; text-wrap: balance; margin: 0; line-height: 1.02; }
p { margin: 0; }
button, select, input { font: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: 1080px; margin-inline: auto; }

/* ---------- barre de score ---------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
  margin-inline: -16px; padding: .6rem 16px;
}
.topbar .wrap { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.brand { font-family: var(--f-mono); font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); flex: 1 1 14rem; min-width: 0; }
.brand b { color: var(--accent); font-weight: 600; }
.score {
  font-family: var(--f-mono); font-variant-numeric: tabular-nums;
  display: flex; align-items: baseline; gap: .35rem;
}
.score strong { font-family: var(--f-display); font-size: 1.9rem; color: var(--accent); line-height: 1; }
.score span { color: var(--muted); font-size: .85rem; }

/* ---------- en-tête ---------- */
header.intro { padding-block: 2.5rem 1.5rem; display: grid; gap: .9rem; }
.eyebrow { font-family: var(--f-mono); font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
header.intro h1 { font-size: clamp(2.6rem, 7vw, 4.6rem); text-transform: uppercase; }
header.intro p { color: var(--muted); max-width: 62ch; }
header.intro p em { color: var(--fg); }

/* ---------- visionneuse de séquence ---------- */
.viewer { display: grid; gap: .75rem; }
.screen {
  position: relative; background: #000; border-radius: var(--radius); overflow: hidden;
  aspect-ratio: 2.35 / 1; max-width: 100%;
}
.screen img { width: 100%; height: 100%; object-fit: contain; transition: opacity .18s ease; }
.screen .tc {
  position: absolute; left: .75rem; bottom: .6rem;
  font-family: var(--f-mono); font-size: .8rem; color: #fff; background: rgba(0,0,0,.55);
  padding: .1rem .45rem; border-radius: 3px; font-variant-numeric: tabular-nums;
}
.controls { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.controls .hint { color: var(--muted); font-size: .85rem; flex: 1 1 16rem; min-width: 0; }

/* bande-film avec perforations */
.strip {
  overflow-x: auto; background: #0b0907; border-radius: var(--radius);
  padding: 14px 10px; position: relative;
  --hole: radial-gradient(circle, transparent 0, transparent 0) ;
}
.strip-inner {
  display: flex; gap: 8px; width: max-content; position: relative; padding-block: 2px;
}
.strip::before, .strip::after {
  content: ""; position: absolute; left: 0; right: 0; height: 8px;
  background-image: linear-gradient(90deg, #3b3128 0 10px, transparent 10px 18px);
  background-size: 18px 8px; opacity: .9;
}
.strip::before { top: 3px; }
.strip::after { bottom: 3px; }
.frame {
  border: 0; padding: 0; background: none; cursor: pointer; display: grid; gap: 3px; width: 128px;
  color: var(--muted); font-family: var(--f-mono); font-size: .7rem; text-align: left;
}
.frame img { width: 128px; aspect-ratio: 2.35/1; object-fit: cover; border-radius: 2px; opacity: .65; transition: opacity .15s; }
.frame:hover img, .frame[aria-current="true"] img { opacity: 1; }
.frame[aria-current="true"] { color: var(--accent); }
.frame[aria-current="true"] img { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- boutons ---------- */
.btn {
  border: 1px solid var(--line); background: var(--surface-2); color: var(--fg);
  padding: .55rem 1rem; border-radius: var(--radius); cursor: pointer; font-weight: 500;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.07); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- consignes ---------- */
section.block { padding-block: 2.5rem 0; display: grid; gap: 1rem; }
section.block > h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); text-transform: uppercase; }
.rules { display: grid; gap: .5rem; color: var(--muted); max-width: 70ch; }
.rules li { padding-left: .2rem; }
.rules strong { color: var(--fg); }
.legend {
  display: flex; flex-wrap: wrap; gap: .4rem; font-family: var(--f-mono); font-size: .75rem;
}
.legend span { border: 1px solid var(--line); border-radius: 3px; padding: .15rem .45rem; color: var(--muted); }
.legend b { color: var(--accent); font-weight: 600; margin-right: .3rem; }

/* ---------- progression ---------- */
.progress { display: flex; gap: 6px; flex-wrap: wrap; }
.progress button {
  width: 2.2rem; height: 2.2rem; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); font-family: var(--f-mono); font-size: .8rem; cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.progress button[aria-current="step"] { border-color: var(--accent); color: var(--accent); }
.progress button.done { background: var(--surface-2); color: var(--fg); }
.progress button.ok { border-color: var(--good); }
.progress button.mid { border-color: var(--near); }
.progress button.ko { border-color: var(--bad); }
.progress button:disabled { cursor: default; opacity: .5; }

/* ---------- carte question ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: clamp(1rem, 3vw, 1.75rem); display: grid; gap: 1.5rem;
}
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.card-head h3 { font-size: 2rem; text-transform: uppercase; }
.card-head h3 small { font-family: var(--f-mono); font-size: .85rem; color: var(--muted); font-weight: 400; margin-left: .5rem; letter-spacing: 0; }

.shots { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2.4fr); gap: 1rem; align-items: end; }
.shot { display: grid; gap: .35rem; min-width: 0; }
.shot figcaption { font-family: var(--f-mono); font-size: .75rem; color: var(--muted); }
.shot img { width: 100%; aspect-ratio: 2.35/1; object-fit: contain; background: #000; border-radius: 4px; cursor: zoom-in; }
.shot.prev img { opacity: .8; }
.shot.first { grid-column: 1 / -1; }
.arrow { display: none; }

.questions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 1.5rem; }
fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: .6rem; min-width: 0; }
legend { font-weight: 600; padding: 0; margin-bottom: .6rem; }
legend .pts { font-family: var(--f-mono); font-weight: 400; font-size: .75rem; color: var(--muted); margin-left: .4rem; }
select {
  width: 100%; padding: .6rem .7rem; background: var(--surface-2); color: var(--fg);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.opt {
  display: grid; grid-template-columns: 1.2rem minmax(0, 1fr) auto; gap: .6rem; align-items: start;
  padding: .55rem .7rem; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer;
  background: var(--surface-2);
}
.opt input { margin: .25rem 0 0; accent-color: var(--accent); width: 1rem; height: 1rem; }
.opt .mark { font-family: var(--f-mono); font-size: .75rem; white-space: nowrap; }
.opt.right { border-color: var(--good); }
.opt.wrong { border-color: var(--bad); }
.opt.missed { border-style: dashed; border-color: var(--good); }
.opt .mark.r { color: var(--good); }
.opt .mark.w { color: var(--bad); }
.opt .mark.m { color: var(--good); opacity: .8; }
select.right { border-color: var(--good); }
select.near { border-color: var(--near); }
select.wrong { border-color: var(--bad); }

.feedback { border-top: 1px solid var(--line); padding-top: 1.1rem; display: grid; gap: .7rem; }
.verdict { display: flex; gap: .8rem; align-items: baseline; flex-wrap: wrap; }
.verdict .gain { font-family: var(--f-display); font-size: 1.8rem; color: var(--accent); }
.verdict .line { color: var(--muted); }
.verdict .line b { color: var(--fg); }
.explain { max-width: 70ch; }
.explain strong { color: var(--accent); font-weight: 600; }

.actions { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- bilan ---------- */
.result { display: grid; gap: 1.25rem; }
.big { font-family: var(--f-display); font-size: clamp(3.5rem, 12vw, 6rem); color: var(--accent); line-height: .9; font-variant-numeric: tabular-nums; }
.big small { font-size: .4em; color: var(--muted); }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-family: var(--f-mono); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
td.num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
td img { width: 96px; aspect-ratio: 2.35/1; object-fit: cover; border-radius: 2px; }

/* ---------- loupe ---------- */
.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,.92); display: grid; place-items: center; z-index: 50; padding: 16px; cursor: zoom-out;
}
.lightbox img { max-height: 90vh; width: auto; }

footer { padding-block: 3rem 0; color: var(--muted); font-size: .8rem; display: grid; gap: .3rem; max-width: 80ch; }

@media (max-width: 720px) {
  .shots { grid-template-columns: minmax(0, 1fr); }
  .questions { grid-template-columns: minmax(0, 1fr); }
  .frame, .frame img { width: 100px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
