* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5; }
a { color: var(--link); }
code, .mono { font-family: var(--mono); font-size: 13px; }
button, input, textarea { font: inherit; color: inherit; }

.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1200px; margin: 0 auto; padding: 10px var(--gutter); display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: -0.02em; color: var(--ink); text-decoration: none; }
.brand::before { content: ""; width: 12px; height: 12px; border-radius: 3px; background: var(--accent); }
.nav { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 8px 14px; border-radius: 999px; text-decoration: none; color: var(--ink); background: var(--chip); font-weight: 500; border: 0; cursor: pointer; min-height: 40px; display: inline-flex; align-items: center; }
.chip[aria-current="page"] { background: var(--chip-active); color: var(--chip-active-ink); }
.topbar-end { margin-left: auto; display: flex; gap: 6px; }

main { max-width: 1200px; margin: 0 auto; padding: 24px var(--gutter) 48px; }
h1 { margin: 0; font-size: clamp(22px, 5vw, 28px); line-height: 1.25; }
h2 { margin: 0 0 8px; font-size: 18px; }
.kicker { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.muted { color: var(--muted); }
.error { color: var(--accent); font-weight: 500; white-space: pre-wrap; }
.error:empty { display: none; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card.focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.layout { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.layout > aside { flex: 1 1 280px; min-width: 0; }
.layout > section { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }

.progress { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 8px; }
progress { flex: 0 1 320px; height: 4px; appearance: none; border: 0; border-radius: 2px; background: var(--track); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--track); }
progress::-webkit-progress-value { background: var(--accent); }
progress::-moz-progress-bar { background: var(--accent); }

.phase { font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 12px 8px 6px; }
.step { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.step:hover, .step.selected { background: var(--chip); }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.s-done .dot { background: var(--done-dot); }
.s-todo .dot { box-shadow: inset 0 0 0 2px var(--todo-ring); }
.s-proposed { background: var(--accent-soft); font-weight: 500; }
.s-proposed .dot { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.s-stale .dot { background: var(--warn); }
.s-skipped .dot { box-shadow: inset 0 0 0 2px var(--todo-ring); background: linear-gradient(45deg, transparent 45%, var(--todo-ring) 45% 55%, transparent 55%); }
.s-skipped .label { color: var(--muted); text-decoration: line-through; }
.gate { font-size: 13px; }

.proof { list-style: none; padding: 0; margin: 12px 0; display: flex; flex-direction: column; gap: 8px; }
.proof li { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.tag { font-family: var(--mono); font-size: 13px; background: var(--chip); border-radius: 6px; padding: 2px 8px; }
.finding { background: var(--warn-soft); border-radius: 8px; padding: 8px 12px; margin: 6px 0; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; }
.btn { min-height: 44px; padding: 0 20px; border: 0; border-radius: 999px; background: var(--chip); font-weight: 500; cursor: pointer; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.link { background: transparent; color: var(--link); padding: 0 12px; }
.btn:disabled { opacity: 0.5; cursor: wait; }
.field { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; }
.field input, .field textarea { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; min-height: 44px; }

.episodes { display: flex; flex-direction: column; gap: 12px; }
.episode-row { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: baseline; text-decoration: none; color: var(--ink); }
.episode-row .name { font-weight: 700; }
.counts { display: flex; gap: 16px; flex-wrap: wrap; }
.counts .hot { color: var(--accent); font-weight: 500; }

.login { max-width: 380px; margin: 12vh auto; }

@media (max-width: 720px) {
  .topbar-end { margin-left: 0; }
}

a.card { text-decoration: none; color: inherit; display: block; }
a.card:hover { border-color: var(--muted); }
#head { margin-bottom: 24px; }
main > h1 { margin-bottom: 16px; }
@media (max-width: 720px) {
  .layout > section { order: -1; }
}

/* Script */
.part { margin: 28px 0 12px; }
.scene { margin-bottom: 12px; }
.narration { font-size: 17px; margin: 8px 0; white-space: pre-line; }
.narration::selection { background: var(--accent-ring); }
.notes { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.note { border-left: 3px solid var(--accent); padding: 4px 10px; }
.note.resolved { border-color: var(--line); color: var(--muted); }
.note.detached { border-color: var(--warn); background: var(--warn-soft); }
.annotate { position: fixed; left: var(--gutter); right: var(--gutter); bottom: var(--gutter); max-width: 720px; margin: 0 auto; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25); z-index: 10; }
.annotate[hidden] { display: none; }
.annotate blockquote { margin: 8px 0; font-style: italic; }

/* Prompteur : fond noir quel que soit le thème */
body.prompter { background: #000000; color: #ffffff; height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.prompter-top { display: flex; align-items: center; gap: 16px; padding: 8px var(--gutter); }
.prompter-where { color: #aaaaaa; font-family: var(--mono); font-size: 13px; }
.prompter-stage { flex: 1; overflow: hidden; padding: 4vh 6vw; cursor: pointer; outline: none; }
.prompter-text { font-weight: 500; line-height: 1.35; white-space: pre-line; }
.prompter-tone { color: #ffb54d; font-size: 20px; margin-bottom: 16px; }
.prompter-tone[hidden] { display: none; }
.prompter-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; padding: 10px var(--gutter) 16px; background: #0f0f0f; }
.prompter-group { display: inline-flex; gap: 6px; align-items: center; color: #aaaaaa; font-size: 14px; }
.prompter-btn { min-height: 44px; min-width: 44px; padding: 0 14px; border: 0; border-radius: 999px; background: #272727; color: #ffffff; font-weight: 500; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.prompter-btn.play { background: #e60023; }
.prompter-btn[aria-pressed="true"] { background: #f1f1f1; color: #0f0f0f; }
body.prompter .error { padding: 0 var(--gutter); color: #ff8a8a; }

/* Skills */
textarea.code { width: 100%; min-height: 60vh; font-family: var(--mono); font-size: 13px; line-height: 1.5; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px; resize: vertical; tab-size: 2; }
pre.error { font-family: var(--mono); font-size: 13px; overflow-x: auto; margin: 12px 0 0; }
form[hidden], p[hidden] { display: none; }

/* Interrupteur clair / sombre : soleil à gauche, lune à droite, le rond glisse vers le mode actif */
.theme-switch { background: none; border: 0; padding: 0; cursor: pointer; min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; }
.theme-switch-track { position: relative; width: 56px; height: 30px; border-radius: 999px; background: var(--chip); border: 1px solid var(--line); display: block; }
.theme-switch-track::before, .theme-switch-track::after { position: absolute; top: 50%; transform: translateY(-50%); font-size: 14px; line-height: 1; color: var(--muted); }
.theme-switch-track::before { content: "☀"; left: 7px; }
.theme-switch-track::after { content: "☾"; right: 8px; }
.theme-switch-thumb { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.18s ease; z-index: 1; display: flex; align-items: center; justify-content: center; font-size: 13px; line-height: 1; }
.theme-switch-thumb::before { content: "☀"; }
.theme-switch[aria-checked="true"] .theme-switch-thumb { transform: translateX(26px); background: var(--ink); color: var(--bg); }
.theme-switch[aria-checked="true"] .theme-switch-thumb::before { content: "☾"; }
.theme-switch:focus-visible .theme-switch-track { outline: 2px solid var(--link); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .theme-switch-thumb { transition: none; } }
