/* ==========================================================================
   The Invisible Hand Bureau — Victorian steampunk / Sheffield exchange, 1885
   ========================================================================== */

:root {
  --wood-1: #2b160d;
  --wood-2: #3d2015;
  --wood-3: #4e2a1b;
  --brass: #c9a24a;
  --brass-light: #ecd18a;
  --brass-dark: #8a6a26;
  --parchment: #f5e9cc;
  --parchment-2: #eadab0;
  --parchment-edge: #d2bb86;
  --ink: #2e2117;
  --ink-soft: #5b4636;
  --crimson: #8e2a1e;
  --teal: #1f4e5f;
  --green: #3d6b35;
  --serif: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, "Times New Roman", serif;
  --display: "Baskerville Old Face", Baskerville, "Palatino Linotype", Georgia, serif;
  --blackletter: "Old English Text MT", "UnifrakturMaguntia", "Goudy Old Style", Georgia, serif;
  --mono: "Courier New", Courier, monospace;
  --radius: 6px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--serif);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 210, 140, .12), transparent 60%),
    repeating-linear-gradient(92deg, rgba(0,0,0,.06) 0 2px, transparent 2px 9px),
    repeating-linear-gradient(88deg, rgba(255,255,255,.025) 0 1px, transparent 1px 23px),
    linear-gradient(180deg, var(--wood-3), var(--wood-1));
  background-attachment: fixed;
}
.hidden { display: none !important; }
button { font-family: inherit; }
:focus-visible { outline: 3px solid var(--brass-light); outline-offset: 2px; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 24px;
  padding: 12px 22px;
  background: linear-gradient(180deg, #24120a, #3a1d12);
  border-bottom: 3px solid var(--brass-dark);
  box-shadow: inset 0 -1px 0 var(--brass-light), 0 4px 14px rgba(0,0,0,.5);
  color: var(--parchment);
}
.brand { display: flex; align-items: center; gap: 12px; flex: 1 1 280px; }
.brand-gear {
  font-size: 2.2rem; color: var(--brass);
  animation: spin 18s linear infinite;
  text-shadow: 0 0 6px rgba(201,162,74,.5);
}
@keyframes spin { to { transform: rotate(360deg); } }
.brand h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.55rem;
  letter-spacing: .04em;
  color: var(--brass-light);
  text-shadow: 0 2px 0 #000;
}
.brand-sub { margin: 2px 0 0; font-size: .82rem; font-style: italic; color: #d9c7a0; letter-spacing: .05em; }

.stats { display: flex; flex-wrap: wrap; gap: 10px; }
.stat {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 78px; padding: 5px 12px;
  background: linear-gradient(180deg, #4a2a1a, #2c170e);
  border: 1px solid var(--brass-dark);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(236,209,138,.3);
}
.stat-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: #c7b28a; }
.stat-value { font-size: 1.15rem; font-weight: bold; color: var(--brass-light); font-variant-numeric: tabular-nums; }
.stat-rep { min-width: 170px; }
.rep-meter {
  width: 140px; height: 10px; margin: 3px 0 1px;
  background: #1a0d07; border: 1px solid var(--brass-dark); border-radius: 6px; overflow: hidden;
}
.rep-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--brass-dark), var(--brass-light));
  transition: width .8s cubic-bezier(.2,.8,.2,1);
}
.stat-rep .stat-value { font-size: .95rem; }
.pulse { animation: pulse .6s ease; }
@keyframes pulse { 50% { transform: scale(1.25); color: #fff3c4; } }

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

/* ---------- Buttons ---------- */
.btn {
  cursor: pointer;
  border-radius: var(--radius);
  padding: 8px 14px;
  font-size: .92rem;
  border: 1px solid var(--brass-dark);
  transition: transform .12s ease, filter .12s ease, box-shadow .12s ease;
}
.btn:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { cursor: not-allowed; opacity: .5; }
.btn-brass {
  color: #2a1608;
  background: linear-gradient(180deg, var(--brass-light), var(--brass) 55%, var(--brass-dark));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 2px 0 #5a4214;
  font-weight: bold;
}
.btn-ghost { color: var(--parchment); background: transparent; }
.btn-ghost-dark { color: var(--ink); background: transparent; border-color: var(--ink-soft); }
.btn-danger { color: #fff; background: linear-gradient(180deg, #b0402f, var(--crimson)); border-color: #5c1a11; font-weight: bold; }
.btn-seal {
  color: #fbeed0; font-size: 1.05rem; font-weight: bold; padding: 11px 22px;
  background: radial-gradient(circle at 35% 30%, #b8443a, #7a1f16 70%);
  border: 2px solid #5a150e; border-radius: 30px;
  box-shadow: 0 3px 0 #3d0d08, 0 6px 14px rgba(0,0,0,.35);
  letter-spacing: .03em;
}
.btn-sm { padding: 5px 10px; font-size: .82rem; }
.btn-close {
  position: absolute; top: 10px; right: 12px;
  background: none; border: none; cursor: pointer; font-size: 1.3rem; color: var(--ink-soft);
}

/* ---------- Chapter tabs ---------- */
.chapter-tabs {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 18px 22px 0;
  max-width: 1400px; width: 100%; margin: 0 auto;
}
.tab {
  position: relative;
  cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 18px 12px;
  border: 1px solid var(--parchment-edge);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  background: linear-gradient(180deg, #d9c597, #c2aa72);
  color: var(--ink);
  font-size: .95rem;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4);
  transform: translateY(4px);
  transition: transform .15s ease, background .15s;
}
.tab:hover { transform: translateY(1px); }
.tab[aria-selected="true"] {
  background: linear-gradient(180deg, #fbf2db, var(--parchment));
  transform: translateY(0);
  font-weight: bold;
  z-index: 2;
}
.tab-num { font-family: var(--display); color: var(--crimson); }
.tab-icon { font-size: 1.15rem; }
.tab-done {
  font-size: .72rem; color: #fff; background: var(--green);
  border-radius: 10px; padding: 1px 7px; letter-spacing: .04em;
}
.tab-progress { font-size: .75rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* ---------- Desk layout ---------- */
.desk {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 22px;
  padding: 0 22px 26px;
  max-width: 1400px; width: 100%; margin: 0 auto;
  flex: 1;
}
@media (max-width: 960px) { .desk { grid-template-columns: 1fr; } }

.paper {
  position: relative;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(255,255,255,.55), transparent 55%),
    radial-gradient(ellipse at 90% 100%, rgba(160,120,50,.18), transparent 60%),
    linear-gradient(180deg, #fbf2db, var(--parchment) 40%, var(--parchment-2));
  border: 1px solid var(--parchment-edge);
  border-radius: 0 var(--radius) var(--radius) var(--radius);
  box-shadow: var(--shadow), inset 0 0 40px rgba(140,100,40,.18);
  padding: 22px 24px;
}
.chart-panel { border-radius: var(--radius); margin-top: 0; }
@media (min-width: 961px) { .chart-panel { margin-top: 0; align-self: start; position: sticky; top: 12px; } }

/* ---------- Case card ---------- */
.client {
  display: flex; gap: 16px; align-items: center;
  padding-bottom: 14px; margin-bottom: 14px;
  border-bottom: 2px double var(--parchment-edge);
}
.portrait {
  flex: 0 0 auto;
  width: 88px; height: 104px;
  display: grid; place-items: center;
  font-size: 2.8rem;
  border-radius: 50% / 45%;
  background: radial-gradient(ellipse at 50% 35%, #fff6df, #d8c08a);
  border: 5px solid var(--brass);
  box-shadow:
    0 0 0 2px var(--brass-dark),
    0 0 0 6px var(--brass-light),
    0 0 0 8px var(--brass-dark),
    0 6px 14px rgba(0,0,0,.35),
    inset 0 0 12px rgba(120,80,20,.4);
}
.portrait.shake { animation: shake .45s ease; }
@keyframes shake {
  20%, 60% { transform: translateX(-6px) rotate(-3deg); }
  40%, 80% { transform: translateX(6px) rotate(3deg); }
}
.client-meta h2 { margin: 0; font-family: var(--display); font-size: 1.45rem; color: var(--crimson); }
.client-meta .subtitle { margin: 2px 0 6px; font-style: italic; color: var(--ink-soft); }
.client-meta .client-name { margin: 0; font-size: .95rem; }
.step-dots { display: flex; gap: 6px; margin-top: 8px; align-items: center; font-size: .8rem; color: var(--ink-soft); }
.dot {
  width: 12px; height: 12px; border-radius: 50%;
  border: 1px solid var(--brass-dark); background: #efe1bd;
}
.dot.done { background: radial-gradient(circle at 35% 35%, var(--brass-light), var(--brass-dark)); }
.dot.current { box-shadow: 0 0 0 2px var(--crimson); }

.story { font-size: 1.04rem; line-height: 1.6; margin: 0 0 14px; }
.story::first-letter {
  float: left; font-family: var(--display); font-size: 2.9rem; line-height: .9;
  padding: 4px 6px 0 0; color: var(--crimson);
}

.bubble {
  position: relative;
  margin: 0 0 14px;
  padding: 12px 16px;
  background: #fffaf0;
  border: 2px solid var(--crimson);
  border-radius: 14px;
  font-style: italic;
  color: #5a1a12;
  box-shadow: 0 3px 8px rgba(0,0,0,.15);
  animation: pop .25s ease;
}
.bubble::before {
  content: ""; position: absolute; left: 34px; top: -12px;
  border: 10px solid transparent; border-bottom-color: var(--crimson); border-top: 0;
}
.bubble::after {
  content: ""; position: absolute; left: 36px; top: -8px;
  border: 8px solid transparent; border-bottom-color: #fffaf0; border-top: 0;
}
.bubble.good { border-color: var(--green); color: #23401e; }
.bubble.good::before { border-bottom-color: var(--green); }
@keyframes pop { from { transform: scale(.94); opacity: 0; } }

.q-label {
  margin: 0 0 4px; font-size: .75rem; letter-spacing: .16em; text-transform: uppercase; color: var(--crimson); font-weight: bold;
}
.question { margin: 0 0 12px; font-size: 1.08rem; font-weight: bold; line-height: 1.45; }

.formula {
  margin: 0 0 16px;
  padding: 12px 18px;
  text-align: center;
  font-family: var(--mono);
  font-size: 1.12rem;
  font-weight: bold;
  color: #2a1a0c;
  background: linear-gradient(180deg, #efd99c, #d6b768 50%, #c4a050);
  border: 1px solid var(--brass-dark);
  border-radius: 4px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6), inset 0 -2px 0 rgba(0,0,0,.15), 0 2px 5px rgba(0,0,0,.25);
  position: relative;
  overflow-x: auto;
  white-space: pre-wrap;
}
.formula::before, .formula::after {
  content: ""; position: absolute; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff2c0, #6e5218);
}
.formula::before { left: 7px; }
.formula::after { right: 7px; }

.options { display: grid; gap: 10px; margin-bottom: 14px; }
.option {
  cursor: pointer;
  display: flex; align-items: center; gap: 12px;
  text-align: left;
  padding: 12px 14px;
  font-size: 1rem;
  color: var(--ink);
  background: #fffaf0;
  border: 1px solid var(--parchment-edge);
  border-left: 5px solid var(--brass);
  border-radius: 4px;
  box-shadow: 0 2px 0 rgba(0,0,0,.08);
  transition: transform .12s, background .12s, border-color .12s;
}
.option:hover:not(:disabled) { transform: translateX(4px); background: #fff3d6; }
.option-letter {
  flex: 0 0 auto; width: 28px; height: 28px; display: grid; place-items: center;
  border-radius: 50%; font-family: var(--display); font-weight: bold;
  background: var(--wood-2); color: var(--brass-light);
}
.option:disabled { cursor: default; }
.option.wrong { background: #f6ddd6; border-left-color: var(--crimson); color: #6d2a20; text-decoration: line-through; opacity: .8; }
.option.wrong .option-letter { background: var(--crimson); color: #fff; }
.option.correct { background: #dfeccd; border-left-color: var(--green); font-weight: bold; }
.option.correct .option-letter { background: var(--green); color: #fff; }
.option.eliminated { opacity: .35; text-decoration: line-through; border-left-color: #999; }

.lens-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 10px 12px; margin-bottom: 12px;
  border: 1px dashed var(--brass-dark); border-radius: 4px;
  background: rgba(201,162,74,.08);
  font-size: .88rem; color: var(--ink-soft);
}
.tip {
  margin: 0 0 14px; padding: 12px 14px 12px 44px;
  position: relative;
  background: #eef3ea;
  border: 1px solid #a9c19c;
  border-radius: 4px;
  line-height: 1.5;
  animation: pop .25s ease;
}
.tip::before { content: "🔍"; position: absolute; left: 14px; top: 11px; }
.tip strong { color: var(--green); }

.next-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.reward-note { font-weight: bold; color: var(--brass-dark); }

/* Closed case */
.stamp {
  display: inline-block;
  margin: 4px 0 14px;
  padding: 6px 18px;
  font-family: var(--display);
  font-size: 1.6rem;
  letter-spacing: .12em;
  color: var(--crimson);
  border: 4px double var(--crimson);
  border-radius: 6px;
  transform: rotate(-4deg);
  opacity: .85;
  animation: stamp .35s ease-out;
}
@keyframes stamp { from { transform: rotate(-4deg) scale(2.2); opacity: 0; } }
.review-list { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 10px; }
.review-list li {
  padding: 10px 14px; background: #fffaf0; border: 1px solid var(--parchment-edge); border-radius: 4px;
}
.review-list .rq { font-weight: bold; margin: 0 0 4px; }
.review-list .ra { margin: 0 0 4px; color: var(--green); }
.review-list .rt { margin: 0; font-size: .9rem; color: var(--ink-soft); }

.empty { text-align: center; padding: 30px; }

/* ---------- Chart panel ---------- */
.chart-title { margin: 0 0 10px; font-family: var(--display); font-size: 1.2rem; color: var(--teal); text-align: center; }
.canvas-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  min-height: 260px;
  background: #fbf4e0;
  border: 6px solid var(--wood-2);
  border-radius: 4px;
  box-shadow: inset 0 0 0 2px var(--brass), 0 4px 10px rgba(0,0,0,.3);
}
.canvas-wrap canvas { display: block; width: 100%; height: 100%; }
.slider-row {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px;
  margin: 14px 0 10px;
  font-weight: bold;
}
.slider-row output {
  min-width: 64px; text-align: center; padding: 3px 8px;
  font-family: var(--mono); background: var(--wood-2); color: var(--brass-light); border-radius: 4px;
}
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 10px; background: transparent; cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 8px; border-radius: 4px;
  background: linear-gradient(180deg, #5a3a22, #2e1a0e);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.6), 0 1px 0 rgba(255,255,255,.4);
}
input[type="range"]::-moz-range-track {
  height: 8px; border-radius: 4px;
  background: linear-gradient(180deg, #5a3a22, #2e1a0e);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px; height: 24px; margin-top: -8px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff2c0, var(--brass) 45%, var(--brass-dark));
  border: 2px solid #5a4214;
  box-shadow: 0 2px 4px rgba(0,0,0,.4);
}
input[type="range"]::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff2c0, var(--brass) 45%, var(--brass-dark));
  border: 2px solid #5a4214;
}
.readouts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.readout {
  padding: 8px 10px; text-align: center;
  background: #fffaf0; border: 1px solid var(--parchment-edge); border-radius: 4px;
}
.readout .rl { display: block; font-size: .78rem; font-style: italic; color: var(--ink-soft); }
.readout .rv { display: block; font-family: var(--mono); font-weight: bold; font-size: 1.05rem; }
.readout.wide { grid-column: 1 / -1; font-style: italic; }
.rv.bad { color: var(--crimson); }
.rv.info { color: var(--teal); }
.rv.good { color: var(--green); }

/* ---------- Footer ---------- */
.footer {
  text-align: center; padding: 16px 20px 22px;
  color: #d9c7a0; font-size: .9rem;
  border-top: 1px solid rgba(201,162,74,.3);
}
.footer p { margin: 2px 0; }
.footer p:first-child { font-family: var(--display); font-style: italic; color: var(--brass-light); }
.footer-small { font-size: .78rem; opacity: .75; }

/* ---------- Modals ---------- */
.modal {
  border: none; padding: 0; background: transparent;
  max-width: min(680px, 94vw); width: 100%;
  max-height: 92vh;
  color: var(--ink);
}
.modal-wide { max-width: min(980px, 96vw); }
.modal-small { max-width: min(460px, 94vw); }
.modal::backdrop { background: rgba(20, 10, 4, .72); backdrop-filter: blur(2px); }
.modal[open] { animation: unroll .35s ease-out; }
@keyframes unroll { from { transform: translateY(16px) scale(.97); opacity: 0; } }

.parchment-inner {
  position: relative;
  padding: 32px 38px 28px;
  max-height: 92vh; overflow-y: auto;
  background:
    radial-gradient(ellipse at 15% 10%, rgba(255,255,255,.6), transparent 50%),
    radial-gradient(ellipse at 85% 90%, rgba(150,105,40,.25), transparent 55%),
    linear-gradient(180deg, #fbf1d6, #efdcae);
  border: 1px solid var(--parchment-edge);
  border-radius: 4px;
  box-shadow: var(--shadow), inset 0 0 60px rgba(130,90,30,.3);
}
.press-kicker { margin: 0; text-align: center; font-size: .78rem; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-soft); }
.press-head { margin: 8px 0 6px; text-align: center; font-family: var(--display); font-size: 1.8rem; line-height: 1.15; color: var(--ink); }
.press-head span { display: block; font-size: 1.05rem; font-style: italic; color: var(--crimson); }
.rule-double { border-top: 3px double var(--ink); margin: 10px 0 16px; }
.dropcap { font-size: 1.06rem; line-height: 1.65; text-align: justify; }
.dropcap::first-letter {
  float: left; font-family: var(--display); font-size: 3.4rem; line-height: .85; padding: 5px 8px 0 0; color: var(--crimson);
}
.briefing-list { margin: 10px 0 0; padding-left: 4px; list-style: none; line-height: 1.6; font-size: .95rem; }
.modal-actions { display: flex; gap: 10px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.modal-head { position: relative; }

/* Glossary */
.glossary-count { text-align: center; margin: 0 0 16px; font-style: italic; color: var(--ink-soft); }
.glossary-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.gcard {
  position: relative;
  padding: 14px 16px;
  background: #fffaf0;
  border: 1px solid var(--parchment-edge);
  border-top: 4px solid var(--brass);
  border-radius: 4px;
  box-shadow: 0 3px 8px rgba(0,0,0,.12);
}
.gcard h3 { margin: 0 0 6px; font-family: var(--display); font-size: 1.05rem; color: var(--crimson); }
.gcard .gsym {
  margin: 0 0 10px; padding: 6px 8px; text-align: center;
  font-family: var(--mono); font-weight: bold; background: #f1e3bd; border-radius: 3px;
}
.gcard p { margin: 0 0 6px; font-size: .9rem; line-height: 1.45; }
.gcard .glab { font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; font-weight: bold; display: block; }
.gcard .glab.m { color: var(--teal); }
.gcard .glab.e { color: var(--green); }
.gcard.locked { border-top-color: #8b7a5c; background: repeating-linear-gradient(45deg, #efe3c3 0 8px, #e9dbb6 8px 16px); }
.gcard.locked .gsym, .gcard.locked .gbody { filter: blur(5px); user-select: none; }
.gcard.locked::after {
  content: "🔒 Sealed — solve cases to unlock";
  position: absolute; inset: auto 0 14px 0; text-align: center;
  font-weight: bold; color: var(--ink-soft); font-size: .88rem;
}
.gcard.fresh { animation: glow 1.6s ease 2; }
@keyframes glow { 50% { box-shadow: 0 0 0 4px var(--brass-light), 0 0 22px var(--brass); } }

/* Newspaper epilogue */
.newspaper {
  position: relative;
  max-height: 92vh; overflow-y: auto;
  padding: 26px 34px 28px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255,255,255,.4), transparent 60%),
    linear-gradient(180deg, #f2ead7, #e2d5b5);
  color: #1d160f;
  border-radius: 2px;
  box-shadow: var(--shadow), inset 0 0 50px rgba(100,80,40,.3);
}
.np-top {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: .78rem; text-transform: uppercase; letter-spacing: .12em;
  border-bottom: 1px solid #1d160f; padding-bottom: 4px;
}
.np-masthead {
  margin: 8px 0 4px; text-align: center;
  font-family: var(--blackletter); font-weight: normal;
  font-size: clamp(2rem, 6vw, 3.6rem); line-height: 1;
}
.np-rule { border-top: 4px double #1d160f; border-bottom: 1px solid #1d160f; height: 5px; margin-bottom: 12px; }
.np-headline {
  margin: 4px 0; text-align: center;
  font-family: var(--display); font-size: clamp(1.5rem, 4vw, 2.4rem); text-transform: uppercase; letter-spacing: .06em;
}
.np-subhead { margin: 0 auto 14px; max-width: 720px; text-align: center; font-style: italic; }
.np-cols { columns: 2 260px; column-gap: 28px; column-rule: 1px solid #8a7b60; text-align: justify; line-height: 1.55; font-size: .96rem; }
.np-cols p { margin: 0 0 10px; }
.np-cases-head { font-weight: bold; text-transform: uppercase; letter-spacing: .1em; font-size: .82rem; text-align: center; break-after: avoid; }
.np-cases { margin: 0 0 10px; padding-left: 18px; }
.np-cases li { margin-bottom: 4px; break-inside: avoid; }

.letter {
  margin: 22px auto 0; max-width: 620px;
  padding: 24px 30px;
  background: linear-gradient(180deg, #fffaf0, #f6ebcd);
  border: 1px solid var(--parchment-edge);
  box-shadow: 0 6px 18px rgba(0,0,0,.25);
  transform: rotate(-.6deg);
  line-height: 1.55;
}
.letter-head { text-align: center; font-family: var(--display); letter-spacing: .14em; color: var(--crimson); border-bottom: 2px double var(--brass-dark); padding-bottom: 8px; }
.letter-stats { width: 100%; border-collapse: collapse; margin: 10px 0 14px; }
.letter-stats td { padding: 5px 4px; border-bottom: 1px dotted var(--ink-soft); }
.letter-stats td:last-child { text-align: right; font-family: var(--mono); font-weight: bold; }
.letter-sign { margin-top: 14px; }
.signature { font-family: "Segoe Script", "Brush Script MT", cursive; font-size: 1.5rem; color: #1b2f6b; }

/* Toasts */
.privacy-toast {
  position: fixed; left: 18px; bottom: 18px; z-index: 50;
  max-width: 380px;
  display: flex; gap: 12px; align-items: center;
  padding: 12px 14px;
  background: rgba(36, 18, 10, .95);
  color: var(--parchment);
  border: 1px solid var(--brass-dark);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: .85rem;
}
.privacy-toast p { margin: 0; }
.privacy-toast code { color: var(--brass-light); }
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 60; display: grid; gap: 8px; justify-items: end; }
.toast {
  padding: 10px 16px;
  background: linear-gradient(180deg, #4a2a1a, #2c170e);
  color: var(--brass-light);
  border: 1px solid var(--brass);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-weight: bold;
  animation: toastIn .3s ease, toastOut .4s ease 2.8s forwards;
}
@keyframes toastIn { from { transform: translateY(14px); opacity: 0; } }
@keyframes toastOut { to { transform: translateY(8px); opacity: 0; } }

.coin-burst {
  position: fixed; z-index: 70; pointer-events: none;
  font-weight: bold; font-size: 1.3rem; color: var(--brass-dark);
  text-shadow: 0 1px 0 #fff;
  animation: floatUp 1.2s ease-out forwards;
}
@keyframes floatUp { to { transform: translateY(-70px); opacity: 0; } }

@media (max-width: 640px) {
  .topbar { padding: 10px 12px; }
  .chapter-tabs, .desk { padding-left: 10px; padding-right: 10px; }
  .paper { padding: 16px; }
  .parchment-inner, .newspaper { padding: 22px 18px; }
  .stat-rep { min-width: 140px; }
  .rep-meter { width: 110px; }
}

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