/* =========================================================
   Les Enquêtes de Jules — Ligne Claire style
   ========================================================= */
:root {
  --paper: #f3e5c3;
  --paper-2: #ead7a9;
  --cream: #fffaf0;
  --ink: #1b1a17;
  --red: #d2382b;
  --red-dark: #a8261c;
  --blue: #1f5aa6;
  --blue-dark: #163f78;
  --ochre: #e3a72f;
  --ochre-dark: #b9811a;
  --green: #2f8a4a;
  --night: #1a2b52;
  --line: 3px solid var(--ink);
  --shadow: 5px 5px 0 var(--ink);
  --font-comic: "Patrick Hand", "Segoe Print", "Comic Neue", "Comic Sans MS", "Chalkboard SE", cursive;
  --font-title: "Arial Black", "Helvetica Neue", Impact, sans-serif;
  --font-news: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-type: "Courier Prime", "Courier New", Courier, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  line-height: 1.45;
  background-color: var(--paper);
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .42  0 0 0 0 .32  0 0 0 0 .16  0 0 0 .10 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"),
    radial-gradient(ellipse at 50% 40%, transparent 55%, rgba(120, 80, 20, .18) 100%);
  background-attachment: fixed;
  min-height: 100vh;
}

button { font: inherit; color: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
  background: var(--cream);
  border: var(--line);
  border-radius: 6px;
  padding: .45em .8em;
  font-family: var(--font-comic);
  font-size: 1rem;
  font-weight: 700;
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform .08s, box-shadow .08s, background .15s;
  white-space: nowrap;
}
.btn:hover { background: #fff; transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn:focus-visible, .option:focus-visible, .tab:focus-visible, .en-btn:focus-visible { outline: 3px dashed var(--blue); outline-offset: 3px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; box-shadow: 2px 2px 0 var(--ink); }
.btn-icon { padding: .45em .6em; }
.btn-small { font-size: .9rem; padding: .25em .7em; }
.btn-big { font-size: 1.25rem; padding: .6em 1.2em; }
.btn-red { background: var(--red); color: #fff; }
.btn-red:hover { background: #e2483a; }
.btn-blue { background: var(--blue); color: #fff; }
.btn-blue:hover { background: #2a6cc0; }
.btn-ochre { background: var(--ochre); }
.btn-ochre:hover { background: #f0b843; }
.btn-reset { color: var(--red-dark); }

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 12px 22px;
  background: var(--blue);
  border-bottom: 4px solid var(--ink);
  box-shadow: 0 4px 0 var(--ochre);
  position: relative;
  z-index: 5;
}
.brand { line-height: 1; color: #fff; text-shadow: 2px 2px 0 var(--ink); }
.brand-kicker { font-family: var(--font-comic); font-size: 1rem; letter-spacing: .04em; }
.brand-title {
  font-family: var(--font-title);
  font-size: 2.3rem;
  color: var(--red);
  letter-spacing: .06em;
  -webkit-text-stroke: 2px var(--ink);
  text-shadow: 3px 3px 0 var(--ink);
  margin: 2px 0;
}
.brand-sub { font-family: var(--font-comic); font-size: 1.05rem; color: #ffe7a6; }

.stats { display: flex; gap: 10px; margin-left: auto; }
.stat {
  display: flex; flex-direction: column; align-items: center;
  min-width: 78px;
  background: var(--cream);
  border: var(--line);
  border-radius: 8px;
  padding: 4px 10px 3px;
  box-shadow: 3px 3px 0 var(--ink);
  font-family: var(--font-comic);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.1;
}
.stat small { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; opacity: .75; }
.stat-streak.hot { background: #ffd9a0; }
.stat.pop { animation: pop .45s ease; }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.25) rotate(-4deg); } 100% { transform: scale(1); } }

.tools { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Chapter tabs (notebook bookmarks) ---------- */
.tabs {
  display: flex;
  gap: 6px;
  padding: 18px 22px 0;
  overflow-x: auto;
  scrollbar-width: thin;
}
.tab {
  --tab: var(--red);
  flex: 0 0 auto;
  position: relative;
  min-width: 170px;
  max-width: 240px;
  text-align: left;
  border: var(--line);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  padding: 8px 14px 10px;
  background: var(--tab);
  color: #fff;
  font-family: var(--font-comic);
  transform: translateY(8px);
  transition: transform .15s;
  box-shadow: inset 0 -6px 0 rgba(0,0,0,.12);
}
.tab:nth-child(4n+2) { --tab: var(--blue); }
.tab:nth-child(4n+3) { --tab: var(--ochre); color: var(--ink); }
.tab:nth-child(4n+4) { --tab: var(--green); }
.tab:hover { transform: translateY(3px); }
.tab.active { transform: translateY(0); box-shadow: none; z-index: 2; }
.tab.locked { background: #b8ab8c; color: #4a4436; cursor: not-allowed; }
.tab-num { font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; opacity: .9; display: flex; justify-content: space-between; gap: 8px; }
.tab-title { display: block; font-size: 1.1rem; font-weight: 700; line-height: 1.15; }
.tab-en { display: block; font-size: .82rem; opacity: .85; }
.tab-dots { display: flex; gap: 4px; margin-top: 5px; }
.tab-dots i { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--ink); background: rgba(255,255,255,.35); }
.tab-dots i.on { background: #fff; }

/* ---------- Stage ---------- */
.stage {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 22px;
  padding: 0 22px 22px;
  position: relative;
}
.stage::before { /* page that the tabs attach to */
  content: "";
  position: absolute;
  inset: 0 22px 0 22px;
  border-top: var(--line);
  pointer-events: none;
}
.comic, .notebook { margin-top: 22px; }

/* ---------- Comic panel ---------- */
.panel {
  position: relative;
  min-height: 480px;
  height: 100%;
  border: 4px solid var(--ink);
  border-radius: 4px;
  box-shadow: 7px 7px 0 var(--ink);
  overflow: hidden;
  background: var(--night);
}
.panel.shake { animation: shake .4s; }
@keyframes shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }

.scenery { position: absolute; inset: 0; background: linear-gradient(#111f40 0%, #22386a 45%, #3a5590 62%); }
.stars {
  position: absolute; inset: 0 0 40% 0;
  background-image:
    radial-gradient(2px 2px at 20% 30%, #fff8d0 99%, transparent),
    radial-gradient(2px 2px at 70% 18%, #fff8d0 99%, transparent),
    radial-gradient(1.5px 1.5px at 45% 12%, #fff 99%, transparent),
    radial-gradient(1.5px 1.5px at 88% 40%, #fff 99%, transparent),
    radial-gradient(2px 2px at 33% 52%, #fff8d0 99%, transparent),
    radial-gradient(1.5px 1.5px at 60% 44%, #fff 99%, transparent);
}
.moon {
  position: absolute; top: 9%; right: 13%;
  width: 58px; height: 58px; border-radius: 50%;
  background: #fff1b8; border: 3px solid var(--ink);
  box-shadow: inset -12px -6px 0 #f0d77d;
}
.hills {
  position: absolute; left: 0; right: 0;
  background-repeat: repeat-x;
  animation: scroll linear infinite;
}
.hills-far {
  bottom: 36%; height: 26%;
  background-image: radial-gradient(ellipse 160px 70px at 50% 100%, #2a3f6b 98%, transparent 100%);
  background-size: 260px 100%;
  animation-duration: 40s;
}
.hills-near {
  bottom: 36%; height: 16%;
  background-image: radial-gradient(ellipse 110px 50px at 50% 100%, #172645 98%, transparent 100%);
  background-size: 208px 100%;
  animation-duration: 16s;
}
.poles {
  position: absolute; left: 0; right: 0; bottom: 36%; height: 46%;
  background-image:
    repeating-linear-gradient(90deg, transparent 0 230px, #0d1424 230px 236px),
    linear-gradient(transparent 14%, #0d1424 14%, #0d1424 calc(14% + 2px), transparent calc(14% + 2px));
  background-size: 236px 100%, 100% 100%;
  animation: scroll 2.6s linear infinite;
}
@keyframes scroll { from { background-position-x: 0; } to { background-position-x: -1040px; } }
.poles { animation-name: scrollPoles; }
@keyframes scrollPoles { from { background-position: 0 0, 0 0; } to { background-position: -236px 0, 0 0; } }

.curtain {
  position: absolute; top: 0; width: 9%; height: 66%;
  background: repeating-linear-gradient(90deg, var(--red) 0 10px, var(--red-dark) 10px 14px);
  border: 3px solid var(--ink); border-top: none;
  border-radius: 0 0 40% 40% / 0 0 14% 14%;
  z-index: 1;
}
.curtain-l { left: -3px; }
.curtain-r { right: -3px; }
.wall {
  position: absolute; left: 0; right: 0; bottom: 0; height: 36%;
  background:
    repeating-linear-gradient(90deg, transparent 0 46px, rgba(0,0,0,.15) 46px 48px),
    linear-gradient(#8a5524 0 10px, #c07d36 10px);
  border-top: 4px solid var(--ink);
  z-index: 1;
}

.caption {
  position: absolute; top: 12px; left: 12px;
  z-index: 3;
  max-width: 70%;
  background: var(--ochre);
  border: var(--line);
  box-shadow: 3px 3px 0 var(--ink);
  padding: 4px 10px;
  font-family: var(--font-comic);
  font-size: .98rem;
  font-weight: 700;
}
.caption:empty { display: none; }

/* Speech bubbles */
.bubble {
  position: absolute;
  z-index: 4;
  background: #fff;
  border: var(--line);
  border-radius: 26px;
  padding: 14px 52px 14px 20px;
  font-family: var(--font-comic);
  font-size: 1.28rem;
  line-height: 1.3;
  box-shadow: 4px 4px 0 rgba(0,0,0,.25);
  cursor: default;
}
.bubble .fr { margin: 0; min-height: 1.3em; }
.bubble .fr.typing::after { content: "▌"; animation: blink .7s steps(1) infinite; margin-left: 1px; color: var(--red); }
@keyframes blink { 50% { opacity: 0; } }
.bubble .en {
  margin: 8px 0 0;
  padding: 6px 10px;
  border-radius: 10px;
  background: #e5eefb;
  color: var(--blue-dark);
  font-size: 1rem;
  font-style: italic;
  font-family: Georgia, serif;
}
.speech { top: 56px; left: 6%; right: 6%; }
.speech::before, .speech::after {
  content: ""; position: absolute; left: 18%;
  border-style: solid; border-color: transparent;
}
.speech::before { bottom: -27px; border-width: 27px 22px 0 0; border-top-color: var(--ink); }
.speech::after { bottom: -20px; left: calc(18% + 4px); border-width: 21px 15px 0 0; border-top-color: #fff; }

.shout {
  right: 4%; bottom: 7%;
  max-width: 54%;
  border-color: var(--red);
  border-width: 4px;
  border-radius: 14px;
  background: #fff7d6;
  transform: rotate(-1.5deg);
  font-size: 1.12rem;
  animation: shoutIn .35s cubic-bezier(.3,1.6,.5,1);
}
.shout::before {
  content: "!";
  position: absolute; top: -18px; left: -14px;
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--red); color: #fff;
  border: var(--line);
  font-family: var(--font-title); font-size: 1.2rem;
}
@keyframes shoutIn { from { transform: scale(.4) rotate(-10deg); opacity: 0; } to { transform: scale(1) rotate(-1.5deg); opacity: 1; } }

.en-btn {
  position: absolute; top: 10px; right: 10px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--blue);
  color: #fff;
  font-family: var(--font-title);
  font-size: .72rem;
  padding: 3px 6px;
  letter-spacing: .05em;
}
.en-btn[aria-pressed="true"] { background: var(--ochre); color: var(--ink); }
.en-btn.inline { position: static; vertical-align: middle; margin-right: 8px; }

/* Portrait */
.portrait {
  position: absolute; left: 5%; bottom: 5%;
  z-index: 3;
  display: flex; flex-direction: column; align-items: center;
}
.portrait-frame {
  width: 150px; height: 150px;
  display: grid; place-items: center;
  background: var(--ochre);
  border: 4px solid var(--ink);
  border-radius: 6px;
  box-shadow: 6px 6px 0 var(--ink);
  font-size: 92px;
  line-height: 1;
  overflow: hidden;
}
.portrait-frame span { filter: drop-shadow(2px 2px 0 rgba(0,0,0,.25)); }
.portrait.enter .portrait-frame { animation: portraitIn .45s cubic-bezier(.3,1.5,.5,1); }
@keyframes portraitIn { from { transform: translateY(30px) scale(.8); opacity: 0; } to { transform: none; opacity: 1; } }
.portrait.angry .portrait-frame span { animation: wobble .5s; display: inline-block; }
@keyframes wobble { 25% { transform: rotate(-12deg); } 50% { transform: rotate(10deg); } 75% { transform: rotate(-6deg); } }
.nameplate {
  margin-top: -10px;
  position: relative;
  background: var(--cream);
  border: var(--line);
  box-shadow: 3px 3px 0 var(--ink);
  padding: 3px 12px;
  text-align: center;
  font-family: var(--font-title);
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  max-width: 220px;
}
.nameplate small { display: block; font-family: var(--font-comic); font-size: .8rem; text-transform: none; letter-spacing: 0; font-weight: 400; }
.nameplate small:empty { display: none; }

.flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 10; }
.flash.go { animation: flash .5s ease-out; }
@keyframes flash { 0% { opacity: .95; } 100% { opacity: 0; } }

/* ---------- Notebook (task) ---------- */
.notebook {
  position: relative;
  background-color: var(--cream);
  background-image:
    linear-gradient(90deg, transparent 52px, rgba(210,56,43,.55) 52px, rgba(210,56,43,.55) 54px, transparent 54px),
    repeating-linear-gradient(transparent 0 31px, rgba(31,90,166,.22) 31px 32px);
  background-position: 0 0, 0 14px;
  border: 4px solid var(--ink);
  border-radius: 4px 14px 14px 4px;
  box-shadow: 7px 7px 0 var(--ink);
  padding: 22px 24px 24px 72px;
  min-height: 480px;
  display: flex; flex-direction: column;
}
.notebook::before { /* spiral holes */
  content: "";
  position: absolute; left: 14px; top: 14px; bottom: 14px; width: 16px;
  background: radial-gradient(circle at 50% 50%, var(--paper-2) 5px, var(--ink) 5px 7px, transparent 7.5px) 0 0 / 16px 34px repeat-y;
}
.nb-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--ochre);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 2px 12px;
  font-family: var(--font-comic);
  font-size: .95rem;
  font-weight: 700;
}
.chip button { background: none; border: none; padding: 0; text-decoration: underline; text-underline-offset: 3px; font-weight: 700; }
.counter { font-family: var(--font-type); font-size: .9rem; font-weight: 700; }
.nb-chapter { font-family: var(--font-comic); font-size: 1.5rem; margin: 10px 0 2px; line-height: 1.15; color: var(--blue-dark); }
.nb-chapter small { display: block; font-size: 1rem; color: #6b604a; font-weight: 400; }
.nb-label { font-family: var(--font-type); font-size: .82rem; text-transform: uppercase; letter-spacing: .1em; margin: 18px 0 4px; color: #6b604a; }

.prompt {
  font-family: var(--font-type);
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.5;
  margin: 0;
}
.blank {
  display: inline-block;
  min-width: 3.2em;
  padding: 0 .25em;
  border-bottom: 3px solid var(--red);
  color: var(--red);
  text-align: center;
}
.blank.filled { color: var(--green); border-bottom-color: var(--green); background: rgba(47,138,74,.12); animation: pop .45s; }
.prompt-en { margin: 6px 0 0; font-size: .98rem; color: var(--blue-dark); font-style: italic; min-height: 1.6em; }

.options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 20px; }
.option {
  background: #fff;
  border: var(--line);
  border-radius: 10px;
  padding: 14px 8px;
  font-family: var(--font-type);
  font-size: 1.35rem;
  font-weight: 700;
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform .08s, box-shadow .08s, background .15s;
}
.option:hover:not([disabled]) { background: #fff4d4; transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); }
.option:active:not([disabled]) { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.option[disabled] { cursor: default; }
.option.correct { background: #bfe6c6; border-color: var(--green); color: #134d24; box-shadow: 4px 4px 0 var(--green); }
.option.wrong { background: #f7c9c3; color: var(--red-dark); text-decoration: line-through; box-shadow: 2px 2px 0 var(--ink); opacity: .8; }
.option.removed { opacity: .3; text-decoration: line-through; background: #e7e0cf; box-shadow: none; }
.option.dim { opacity: .55; }

.tools-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 18px; }
.lens-btn b { background: var(--ink); color: #fff; border-radius: 999px; padding: 0 7px; margin-left: 4px; font-size: .85rem; }
.lens-hint { font-size: .85rem; color: #6b604a; font-style: italic; }

.note {
  margin-top: 14px;
  padding: 10px 14px;
  border: 3px solid var(--blue);
  border-radius: 8px;
  background: #e5eefb;
  font-size: 1rem;
  position: relative;
}
.note strong { color: var(--blue-dark); }
.note.glow { animation: glow 1.6s ease 2; }
@keyframes glow { 0%,100% { box-shadow: 0 0 0 0 rgba(227,167,47,0); } 50% { box-shadow: 0 0 0 7px rgba(227,167,47,.75); background: #fff6d8; } }

.result {
  margin-top: auto;
  padding-top: 18px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
}
.result-msg { font-family: var(--font-comic); font-size: 1.25rem; font-weight: 700; color: var(--green); flex: 1 1 200px; }
.result-clue { display: block; font-size: 1rem; color: var(--ink); font-weight: 400; }

/* Chapter done */
.done { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; padding-top: 10px; }
.stamp {
  display: inline-block;
  border: 5px double var(--red);
  color: var(--red);
  font-family: var(--font-title);
  font-size: 1.7rem;
  letter-spacing: .08em;
  padding: 6px 18px;
  transform: rotate(-6deg);
  border-radius: 8px;
  animation: stamp .5s cubic-bezier(.3,1.6,.5,1);
  background: rgba(255,255,255,.4);
}
@keyframes stamp { from { transform: scale(2.4) rotate(-14deg); opacity: 0; } to { transform: scale(1) rotate(-6deg); opacity: 1; } }
.reward { font-family: var(--font-comic); font-size: 1.3rem; font-weight: 700; }
.unlock-card {
  display: flex; align-items: center; gap: 12px;
  border: var(--line); border-radius: 10px; background: #fff;
  box-shadow: 4px 4px 0 var(--ink);
  padding: 10px 16px; text-align: left; max-width: 360px;
}
.unlock-card .ico { font-size: 2.6rem; }
.unlock-card small { display: block; color: #6b604a; }
.done-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 8px; }

/* ---------- Evidence bag ---------- */
.evidence {
  margin: 0 22px 18px;
  padding: 14px 18px 12px;
  background:
    repeating-linear-gradient(45deg, rgba(0,0,0,.035) 0 6px, transparent 6px 12px),
    #c99a55;
  border: 4px solid var(--ink);
  border-radius: 10px;
  box-shadow: 6px 6px 0 var(--ink);
}
.evidence-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.evidence h2 { margin: 0; font-family: var(--font-comic); font-size: 1.4rem; color: var(--ink); }
.evidence-count { font-family: var(--font-type); font-weight: 700; background: var(--cream); border: 2px solid var(--ink); border-radius: 6px; padding: 0 8px; }
.evidence-list { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; }
.clue {
  width: 88px; min-height: 96px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: var(--cream);
  border: var(--line);
  border-radius: 6px;
  box-shadow: 3px 3px 0 var(--ink);
  padding: 6px 4px;
  font-family: var(--font-comic);
  font-size: .8rem;
  line-height: 1.1;
  text-align: center;
  position: relative;
}
.clue .ico { font-size: 2.1rem; }
.clue::before { /* evidence tag string */
  content: ""; position: absolute; top: -7px; left: 50%; width: 12px; height: 12px; margin-left: -6px;
  border-radius: 50%; border: 2px solid var(--ink); background: var(--red);
}
.clue:hover { background: #fff; }
.clue.active { background: #fff3c9; outline: 3px solid var(--blue); }
.clue.new { animation: clueIn .7s cubic-bezier(.3,1.6,.5,1); }
@keyframes clueIn { from { transform: translateY(-60px) rotate(-20deg) scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
.clue.empty { background: rgba(255,250,240,.35); border-style: dashed; box-shadow: none; color: rgba(0,0,0,.45); cursor: default; }
.clue.empty::before { background: transparent; border-style: dashed; }
.clue.empty .ico { font-size: 1.6rem; }
.evidence-detail { margin: 10px 0 0; font-size: .98rem; min-height: 1.4em; background: var(--cream); border: 2px solid var(--ink); border-radius: 6px; padding: 6px 10px; }

/* ---------- Footer & notices ---------- */
.footer {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 10px;
  padding: 10px 22px 70px;
  font-size: .88rem;
  color: #5b5040;
  text-align: center;
}
.privacy {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%);
  z-index: 40;
  display: flex; align-items: center; gap: 14px;
  width: min(680px, calc(100% - 24px));
  background: var(--cream);
  border: var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 10px 14px;
  font-size: .92rem;
}
.toasts { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: var(--ink); color: #fff;
  border: 3px solid var(--ochre);
  border-radius: 10px;
  padding: 8px 16px;
  font-family: var(--font-comic);
  font-size: 1.1rem;
  box-shadow: 4px 4px 0 rgba(0,0,0,.3);
  animation: toastIn .3s ease, toastOut .4s ease 2.6s forwards;
}
@keyframes toastIn { from { transform: translateY(-20px); opacity: 0; } }
@keyframes toastOut { to { transform: translateY(-20px); opacity: 0; } }

/* ---------- Modals ---------- */
.modal {
  width: min(900px, calc(100% - 24px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 4px solid var(--ink);
  border-radius: 10px;
  box-shadow: 10px 10px 0 var(--ink);
  background: var(--cream);
  color: var(--ink);
  overflow: auto;
}
.modal::backdrop { background: rgba(20, 22, 40, .6); }
.modal[open] { animation: modalIn .3s cubic-bezier(.3,1.4,.5,1); }
@keyframes modalIn { from { transform: translateY(30px) scale(.96); opacity: 0; } }
.modal-head {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px;
  background: var(--blue); color: #fff;
  border-bottom: var(--line);
}
.modal-head h2 { margin: 0; font-family: var(--font-comic); font-size: 1.5rem; text-shadow: 2px 2px 0 var(--ink); }
.modal-head .btn { color: var(--ink); }

/* Newspaper */
.modal-paper { background: #f6eedb; }
.newspaper {
  padding: 22px 28px 24px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/><feColorMatrix values='0 0 0 0 .4  0 0 0 0 .32  0 0 0 0 .2  0 0 0 .09 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  font-family: var(--font-news);
}
.np-masthead { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 4px double var(--ink); padding-bottom: 6px; }
.np-ear { font-family: var(--font-type); font-size: .8rem; width: 130px; border: 2px solid var(--ink); padding: 4px 6px; text-align: center; }
.np-title { margin: 0; font-family: "Old English Text MT", "UnifrakturMaguntia", var(--font-news); font-size: 3.3rem; line-height: 1; text-align: center; letter-spacing: .01em; }
.np-rule { font-family: var(--font-type); font-size: .78rem; letter-spacing: .14em; text-align: center; border-bottom: 2px solid var(--ink); padding: 5px 0; }
.np-headline {
  font-family: var(--font-news);
  font-weight: 900;
  font-size: 2.3rem;
  line-height: 1.05;
  text-align: center;
  margin: 16px 0 14px;
  text-transform: uppercase;
  letter-spacing: -.01em;
}
.np-headline-xl { font-size: 2.6rem; color: var(--red-dark); }
.np-body { display: grid; grid-template-columns: 260px 1fr; gap: 20px; align-items: start; }
.np-photo { margin: 0; }
.np-photo-img {
  position: relative;
  height: 200px;
  border: var(--line);
  display: grid; place-items: center;
  font-size: 96px;
  background-color: #d9cfb8;
  background-image: radial-gradient(rgba(0,0,0,.28) 1.2px, transparent 1.6px);
  background-size: 6px 6px;
  filter: grayscale(.6) contrast(1.1);
}
.np-photo-moon { position: absolute; top: 10px; right: 16px; font-size: 38px; }
.np-cuffs { position: absolute; bottom: 8px; right: 16px; font-size: 42px; }
.np-photo figcaption { font-size: .82rem; font-style: italic; margin-top: 4px; }
.np-text { columns: 1; }
.np-lead { margin: 0 0 12px; font-size: 1.08rem; text-align: justify; hyphens: auto; }
.np-lead::first-letter { float: left; font-size: 3.4em; line-height: .85; padding: 4px 6px 0 0; font-weight: 900; color: var(--red-dark); }
.np-briefs { border-top: 2px solid var(--ink); padding-top: 8px; display: grid; gap: 4px; font-size: .92rem; }
.np-briefs p { margin: 0; }
.np-actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: 18px; padding-top: 14px; border-top: 4px double var(--ink); }

.epi-stats { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.epi-stats li { border: 2px solid var(--ink); border-radius: 6px; padding: 2px 10px; background: var(--cream); font-family: var(--font-comic); font-weight: 700; }

.presscard-form { margin-top: 18px; padding: 14px; border: 2px dashed var(--ink); background: rgba(255,255,255,.5); }
.presscard-form label { font-family: var(--font-comic); font-weight: 700; font-size: 1.1rem; }
.presscard-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.presscard-row input {
  flex: 1 1 220px;
  font: inherit; font-family: var(--font-type); font-size: 1.15rem;
  padding: 8px 12px;
  border: var(--line); border-radius: 6px; background: #fff;
}
.presscard-hint { margin: 6px 0 0; font-size: .82rem; color: #6b604a; }
.presscard-preview { display: flex; justify-content: center; margin-top: 18px; }

/* Press card (preview + print) */
.presscard {
  width: 520px; max-width: 100%;
  aspect-ratio: 1.6;
  background: #fffaf0;
  border: 4px solid var(--ink);
  border-radius: 14px;
  box-shadow: 6px 6px 0 var(--ink);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto;
  font-family: var(--font-news);
  position: relative;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.pc-top { background: var(--red); color: #fff; border-bottom: var(--line); display: flex; justify-content: space-between; align-items: center; padding: 6px 14px; }
.pc-top b { font-family: "Old English Text MT", var(--font-news); font-size: 1.5rem; font-weight: 400; }
.pc-top span { font-family: var(--font-title); font-size: .8rem; letter-spacing: .15em; }
.pc-main { display: grid; grid-template-columns: 120px 1fr; gap: 14px; padding: 12px 14px; align-items: center; }
.pc-photo { height: 140px; border: var(--line); background: var(--ochre); display: grid; place-items: center; font-size: 56px; line-height: 1.05; text-align: center; }
.pc-fields { font-size: .9rem; line-height: 1.35; }
.pc-fields .pc-name { font-family: var(--font-type); font-weight: 700; font-size: 1.35rem; border-bottom: 2px solid var(--ink); margin: 2px 0 6px; word-break: break-word; }
.pc-fields small { font-family: var(--font-type); font-size: .66rem; text-transform: uppercase; letter-spacing: .1em; color: #6b604a; display: block; }
.pc-bottom { background: var(--blue); color: #fff; border-top: var(--line); display: flex; justify-content: space-between; padding: 4px 14px; font-size: .78rem; font-family: var(--font-type); }
.pc-sign { font-family: "Segoe Script", "Brush Script MT", cursive; font-size: 1.1rem; }
.pc-stamp {
  position: absolute; right: 18px; bottom: 40px;
  width: 104px; height: 104px; border-radius: 50%;
  border: 4px double var(--red); color: var(--red);
  display: grid; place-items: center; text-align: center;
  font-family: var(--font-title); font-size: .72rem; line-height: 1.1;
  transform: rotate(-14deg); opacity: .85;
}
#print-area { display: none; }

/* Dossiers */
.dossier-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; padding: 18px; }
.dossier {
  position: relative;
  background: #f0d9a2;
  border: var(--line);
  border-radius: 4px 14px 4px 4px;
  box-shadow: 4px 4px 0 var(--ink);
  padding: 14px;
  min-height: 210px;
}
.dossier-photo { width: 88px; height: 88px; border: var(--line); display: grid; place-items: center; font-size: 54px; background: var(--ochre); box-shadow: 3px 3px 0 var(--ink); transform: rotate(-3deg); }
.dossier h3 { margin: 10px 0 0; font-family: var(--font-comic); font-size: 1.25rem; line-height: 1.15; }
.dossier .role { font-family: var(--font-type); font-size: .82rem; color: var(--blue-dark); font-weight: 700; }
.dossier p { margin: 6px 0 0; font-size: .95rem; }
.dossier .tag { position: absolute; top: 14px; right: 12px; border: 3px solid var(--red); color: var(--red); font-family: var(--font-title); font-size: .7rem; padding: 2px 6px; transform: rotate(8deg); letter-spacing: .06em; }
.dossier.locked { background: #d8ccb0; color: #6b604a; }
.dossier.locked .dossier-photo { background: #9e927a; filter: grayscale(1) brightness(.4); }
.dossier.locked .tag { border-color: #6b604a; color: #6b604a; }

/* Grammar notebook */
.modal-notebook { background: var(--cream); }
.rules { padding: 18px; display: grid; gap: 14px; }
.rule {
  border: var(--line); border-radius: 8px; background: #fff;
  box-shadow: 4px 4px 0 var(--ink);
  padding: 14px 16px;
  background-image: repeating-linear-gradient(transparent 0 27px, rgba(31,90,166,.15) 27px 28px);
}
.rule.current { border-color: var(--red); box-shadow: 4px 4px 0 var(--red); }
.rule.flash-rule { animation: glow 1.4s ease 2; }
.rule h3 { margin: 0 0 6px; font-family: var(--font-comic); font-size: 1.3rem; color: var(--blue-dark); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rule h3 .chip { font-size: .78rem; background: var(--red); color: #fff; }
.rule p { margin: 0; white-space: pre-line; }
.rule ul { margin: 8px 0 0; padding-left: 20px; font-family: var(--font-type); font-weight: 700; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .stage { grid-template-columns: 1fr; }
  .panel { min-height: 440px; }
  .notebook { min-height: 0; }
  .stats { margin-left: 0; }
  .topbar { justify-content: center; }
}
@media (max-width: 600px) {
  body { font-size: 16px; }
  .topbar, .tabs { padding-left: 12px; padding-right: 12px; }
  .stage { padding: 0 12px 16px; }
  .stage::before { inset: 0 12px; }
  .evidence { margin: 0 12px 16px; }
  .brand-title { font-size: 1.9rem; }
  .tools .btn { font-size: .88rem; padding: .35em .55em; }
  .panel { min-height: 460px; }
  .portrait-frame { width: 110px; height: 110px; font-size: 66px; }
  .bubble { font-size: 1.1rem; padding: 12px 48px 12px 14px; }
  .shout { max-width: 56%; font-size: 1rem; }
  .notebook { padding: 18px 14px 18px 46px; }
  .notebook::before { left: 8px; }
  .notebook { background-image: linear-gradient(90deg, transparent 36px, rgba(210,56,43,.55) 36px, rgba(210,56,43,.55) 38px, transparent 38px), repeating-linear-gradient(transparent 0 31px, rgba(31,90,166,.22) 31px 32px); }
  .prompt { font-size: 1.25rem; }
  .options { gap: 8px; }
  .option { font-size: 1.1rem; padding: 12px 4px; }
  .np-body { grid-template-columns: 1fr; }
  .np-title { font-size: 2.2rem; }
  .np-ear { display: none; }
  .np-headline { font-size: 1.6rem; }
  .np-headline-xl { font-size: 1.8rem; }
  .newspaper { padding: 16px; }
  .pc-main { grid-template-columns: 90px 1fr; }
  .pc-photo { height: 110px; font-size: 42px; }
  .pc-stamp { width: 80px; height: 80px; font-size: .6rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}

/* ---------- Print: only the press card ---------- */
@media print {
  @page { size: A4 landscape; margin: 15mm; }
  body { background: #fff !important; }
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: flex !important; justify-content: center; align-items: center; min-height: 90vh; }
  #print-area .presscard { width: 160mm; box-shadow: none; }
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
}
