:root {
  --olive-dark: #3a3d1f;
  --olive: #4f5328;
  --olive-light: #6a6e3a;
  --manila: #ede0b8;
  --manila-light: #f4e8c4;
  --manila-shadow: #c9b884;
  --paper: #f9f1d8;
  --stamp-red: #a83a2c;
  --stamp-red-faded: #b85245;
  --mustard: #c8a23c;
  --mustard-dark: #a78420;
  --ink-brown: #3d2a1a;
  --ink-blue: #1c2a4a;
  --pencil: #5a4d3a;
  --margin-pen: #3a2818;

  /* COUNTY TILE — 1971 institutional government building.
     The 60% surrounding "world" is pale aqua-grey 9-inch asphalt tile
     (period-accurate for municipal buildings of the era). The desk is
     wedged into a wall of files; the manila folder sits on top of the
     tile so paper reads as paper, not as more wallpaper. */
  --tile:        #a8b6b0;  /* pale aqua-grey wall/floor tile         */
  --tile-deep:   #8a9890;  /* tile in shadow at corners              */
  --tile-grout:  #909c97;  /* hairline between tiles                 */
  --desk:        var(--tile);   /* legacy alias — old rules use it   */
  --felt:        #424927;       /* legacy alias                       */

  /* SILVER ACCENTS — chrome and brushed steel for hardware, slab
     edge, sub-tab indicators. Not for body text or major surfaces;
     used in thin lines and small fittings. */
  --silver:        #c8cdc8;  /* polished chrome                      */
  --silver-deep:   #9aa2a0;  /* brushed steel                        */
  --silver-shadow: #6e7674;  /* deep gunmetal                        */

  /* Section-specific paper tones — period-appropriate office stock.
     Each section's evidence/report cards inherit one of these so the
     player feels they're handling a different document type. */
  --paper-intake:  #f6ecc6;  /* warm manila — official intake form */
  --paper-witness: #e3e8c8;  /* pale sage carbon copy             */
  --paper-tox:    #d8e0d8;  /* pale slate-green lab form          */
  --paper-det:    #f4ead0;  /* ivory cream — determination        */
  --paper-review: #f0e2cc;  /* warm cream w/ red trim — court     */
  --ink-witness:  #2a3a18;  /* darker green-ink for carbon copies */
  --ink-tox:      #1c3a3a;  /* lab-stamp teal-black               */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--tile);
  font-family: 'Special Elite', 'Courier New', monospace;
  color: var(--ink-brown);
  overflow: hidden;
}

/* Tile floor/wall — 9-inch asphalt tile. Hairline grout lines plus a
   subtle vignette so the corners of the room sit a touch darker than
   the center where the lamp is. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(to right,  rgba(0, 20, 15, 0.10) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 20, 15, 0.10) 1px, transparent 1px),
    radial-gradient(ellipse at 30% 30%, rgba(255, 255, 255, 0.10), transparent 55%),
    radial-gradient(ellipse at 80% 80%, rgba(40, 60, 50, 0.18), transparent 60%);
  background-size: 90px 90px, 90px 90px, 100% 100%, 100% 100%;
  pointer-events: none;
  z-index: 0;
}

#app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 320px 1fr 280px;
  height: 100vh;
  gap: 0;
}

#sidebar {
  background: var(--olive);
  background-image:
    repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(0,0,0,0.04) 2px, rgba(0,0,0,0.04) 3px),
    repeating-linear-gradient(-45deg, transparent, transparent 2px, rgba(255,255,255,0.02) 2px, rgba(255,255,255,0.02) 3px);
  color: #e8e2c8;
  padding: 18px 16px;
  overflow-y: auto;
  border-right: 4px solid var(--olive-dark);
  box-shadow: inset -8px 0 16px rgba(0,0,0,0.3);
}

#sidebar h1 {
  font-family: 'Stardos Stencil', sans-serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 2px;
  color: #f0e8c8;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.4);
  line-height: 1.05;
  margin-bottom: 4px;
}
#sidebar .subtitle {
  font-family: 'Special Elite', monospace;
  font-size: 10px;
  color: #c8c0a0;
  letter-spacing: 1.5px;
  margin-bottom: 18px;
  text-transform: uppercase;
}

.day-display {
  background: var(--olive-dark);
  border: 1px solid #2a2c10;
  padding: 12px 14px;
  margin-bottom: 18px;
  text-align: center;
  box-shadow: inset 0 1px 4px rgba(0,0,0,0.5);
}
.day-display .dow {
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 14px;
  letter-spacing: 4px;
  color: #d8d0a0;
}
.day-display .date {
  font-family: 'Crimson Text', serif;
  font-style: italic;
  font-size: 14px;
  color: #b8b088;
  margin-top: 2px;
}
.day-display .week-num {
  font-size: 9px;
  color: #908860;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 4px;
}

.docket-label {
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 12px;
  letter-spacing: 3px;
  color: #d8d0a0;
  margin: 4px 0 10px 2px;
  border-bottom: 1px dashed #6a6e3a;
  padding-bottom: 6px;
}

.case-card {
  background: var(--manila);
  color: var(--ink-brown);
  padding: 10px 12px 12px;
  margin-bottom: 10px;
  cursor: pointer;
  position: relative;
  border-left: 3px solid var(--stamp-red);
  box-shadow: 1px 2px 4px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.3);
  transform: rotate(-0.3deg);
  transition: transform 0.15s, box-shadow 0.15s;
}
.case-card:nth-child(even) { transform: rotate(0.4deg); }
.case-card:hover {
  transform: rotate(0deg) translateY(-1px);
  box-shadow: 2px 4px 8px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.3);
}
.case-card.active {
  border-left-width: 6px;
  background: var(--manila-light);
  transform: rotate(0deg);
}
.case-card.closed {
  opacity: 0.7;
  border-left-color: #5d5d3a;
}
.case-card .case-num {
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 10px;
  letter-spacing: 2px;
  color: #6a4528;
}
.case-card .decedent {
  font-family: 'Crimson Text', serif;
  font-weight: 600;
  font-size: 15px;
  margin-top: 2px;
  color: var(--ink-brown);
  letter-spacing: 0.5px;
}
.case-card .meta {
  font-size: 10px;
  margin-top: 4px;
  color: #6a5538;
  letter-spacing: 0.5px;
}
.case-card .day-count {
  position: absolute;
  top: 8px;
  right: 8px;
  font-family: 'Special Elite', monospace;
  font-size: 9px;
  color: #8a6840;
  background: rgba(0,0,0,0.06);
  padding: 1px 6px;
  border-radius: 1px;
}
.case-card .pending-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--stamp-red);
  margin-right: 4px;
  vertical-align: middle;
  animation: blink 2.5s ease-in-out infinite;
}
@keyframes blink {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

.closed-stamp {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%) rotate(-12deg);
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 11px;
  color: var(--stamp-red);
  border: 2px solid var(--stamp-red);
  padding: 1px 6px;
  letter-spacing: 1px;
  opacity: 0.75;
}

.advance-btn {
  width: 100%;
  margin-top: 12px;
  padding: 14px 12px;
  background: var(--mustard);
  background-image: linear-gradient(180deg, var(--mustard) 0%, var(--mustard-dark) 100%);
  color: #2a1f08;
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 13px;
  letter-spacing: 2px;
  border: 1px solid #6a4f10;
  border-bottom-width: 3px;
  cursor: pointer;
  box-shadow: 0 2px 0 #5a4208, 0 4px 8px rgba(0,0,0,0.4);
  text-shadow: 1px 1px 0 rgba(255,230,150,0.3);
}
.advance-btn:hover {
  background-image: linear-gradient(180deg, #d8b04a 0%, var(--mustard) 100%);
}
.advance-btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 #5a4208, 0 2px 4px rgba(0,0,0,0.4);
}
.advance-btn:disabled {
  background-image: linear-gradient(180deg, #8a7340 0%, #6a5530 100%);
  cursor: not-allowed;
  color: #5a4830;
}

.week-end {
  margin-top: 10px;
  padding: 10px;
  background: rgba(0,0,0,0.2);
  font-family: 'Special Elite', monospace;
  font-size: 10px;
  color: #c0b890;
  text-align: center;
  letter-spacing: 1px;
}

#main {
  background: var(--manila);
  background-image:
    radial-gradient(ellipse at 30% 20%, rgba(255,255,255,0.4), transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(180,150,100,0.2), transparent 60%),
    repeating-linear-gradient(0deg, transparent, transparent 24px, rgba(180,150,100,0.04) 24px, rgba(180,150,100,0.04) 25px);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* Inner shadow at the gutter (where the file meets the cabinet);
     outer shadow lifts the file off the tile so paper reads as paper. */
  box-shadow:
    inset 8px 0 24px rgba(120,90,40,0.2),
    inset -2px 0 6px rgba(120,90,40,0.15),
    -4px 0 18px rgba(40, 60, 50, 0.25),
     4px 0 18px rgba(40, 60, 50, 0.18);
}

#main-inner {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* The locked chrome — case header, status pills, tab strip — sits at
   the top of the file and never scrolls. Switching tabs swaps only
   the tab-content below it, so the page doesn't reflow as you move
   between sections. */
.file-chrome {
  flex: 0 0 auto;
  padding: 32px 36px 0 36px;
  position: relative;
  z-index: 2;
}

#main-dock {
  flex: 0 0 auto;
  background: linear-gradient(180deg, rgba(120,90,40,0.05) 0%, rgba(120,90,40,0.12) 100%);
  border-top: 1px solid var(--manila-shadow);
  box-shadow: inset 0 6px 8px -6px rgba(40,30,15,0.20);
}
#main-dock:empty { display: none; }
#main-dock .body-controls {
  margin: 0;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 22px;
}
#main-dock .body-controls .lbl {
  margin: 0;
  flex-shrink: 0;
}
#main-dock .body-controls .body-status {
  margin: 0;
  flex: 1;
  font-size: 13px;
}
#main-dock .body-controls .body-buttons {
  flex-shrink: 0;
}

#main::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 12% 18%, rgba(120,90,40,0.07) 0, transparent 1px),
    radial-gradient(circle at 78% 42%, rgba(120,90,40,0.06) 0, transparent 1.5px),
    radial-gradient(circle at 35% 75%, rgba(120,90,40,0.08) 0, transparent 1px),
    radial-gradient(circle at 88% 88%, rgba(120,90,40,0.05) 0, transparent 1px);
  background-size: 200px 200px, 240px 240px, 180px 180px, 220px 220px;
  pointer-events: none;
}

#main-inner {
  position: relative;
  padding: 0 36px 40px;
  max-width: 760px;
  margin: 0 auto;
}

.empty-state {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  color: #8a7548;
  padding: 40px;
}
.empty-state h2 {
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 20px;
  letter-spacing: 4px;
  margin-bottom: 12px;
}
.empty-state p {
  font-family: 'Crimson Text', serif;
  font-style: italic;
  font-size: 16px;
  max-width: 400px;
  line-height: 1.5;
}

.file-header {
  padding: 8px 0 18px;
  border-bottom: 2px double #8a6840;
  margin-bottom: 0;
  position: relative;
}
.file-header .agency {
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 11px;
  letter-spacing: 4px;
  color: #6a4528;
  text-align: center;
}
.file-header .case-title {
  font-family: 'Crimson Text', serif;
  font-size: 28px;
  font-weight: 600;
  color: var(--ink-brown);
  margin-top: 4px;
  letter-spacing: 1px;
  text-align: center;
}
.file-header .case-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  font-size: 11px;
  letter-spacing: 1.5px;
  color: #6a5538;
  text-transform: uppercase;
}

.status-row {
  display: flex;
  gap: 16px;
  padding: 12px 0;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #6a5538;
  border-bottom: 1px solid rgba(120,90,40,0.3);
}
.status-row .pill {
  padding: 3px 10px;
  background: rgba(168,58,44,0.08);
  border: 1px solid rgba(168,58,44,0.4);
  color: var(--stamp-red);
}
.status-row .pill.green {
  background: rgba(70,90,40,0.08);
  border-color: rgba(70,90,40,0.5);
  color: #4a5028;
}

.tabs {
  display: flex;
  gap: 2px;
  margin-top: 18px;
  border-bottom: 2px solid var(--olive-dark);
}
.tab {
  padding: 10px 18px 8px;
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 11px;
  letter-spacing: 2px;
  background: rgba(120,90,40,0.15);
  color: #6a4528;
  cursor: pointer;
  border: 1px solid #a8895a;
  border-bottom: none;
  position: relative;
  top: 1px;
  transition: background 0.15s;
}
.tab:hover { background: rgba(120,90,40,0.25); }
.tab.active {
  background: var(--manila-light);
  color: var(--ink-brown);
  border-color: var(--olive-dark);
  border-bottom: 2px solid var(--manila-light);
  z-index: 2;
}
.tab .tab-flag {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--stamp-red);
  margin-left: 6px;
  vertical-align: middle;
}

.tab-content {
  flex: 1 1 0;
  overflow-y: auto;
  padding: 18px 36px 24px;
  border-left: 2px solid transparent;
  transition: border-color 0.4s ease;
  /* Examination tab specifically needs no padding because the
     body-panel + ledger column manage their own internal spacing,
     and the body panel needs to extend to the bottom of the file. */
}
.tab-content[data-active-tab="examination"] {
  padding: 14px 24px 14px;
  display: flex;
  flex-direction: column;
}

/* =================================================================
   SECTION PAPER TONES — different paper stock per tab. Set on
   .tab-content via [data-active-tab] from renderMain so all evidence,
   reports, and panels inherit the right tint without per-card edits.
   Examination skips the variable (the body chart and ledger have
   their own dedicated styling).
   ================================================================= */
.tab-content[data-active-tab="intake"]        { --section-paper: var(--paper-intake);  --section-ink: var(--ink-brown); }
.tab-content[data-active-tab="witness"]       { --section-paper: var(--paper-witness); --section-ink: var(--ink-witness); }
.tab-content[data-active-tab="toxicology"]    { --section-paper: var(--paper-tox);     --section-ink: var(--ink-tox); }
.tab-content[data-active-tab="determination"] { --section-paper: var(--paper-det);     --section-ink: var(--ink-brown); }
.tab-content[data-active-tab="review"]        { --section-paper: var(--paper-review);  --section-ink: var(--ink-brown); }
.tab-content[data-active-tab="examination"]   { --section-paper: var(--paper);         --section-ink: var(--ink-brown); }

.tab-content[data-active-tab="witness"]       { border-left-color: rgba(80, 110, 50, 0.35); }
.tab-content[data-active-tab="toxicology"]    { border-left-color: rgba(60, 100, 110, 0.35); }
.tab-content[data-active-tab="determination"] { border-left-color: rgba(168, 58, 44, 0.35); }
.tab-content[data-active-tab="review"]        { border-left-color: rgba(168, 58, 44, 0.6); }

.report-block {
  background: var(--section-paper, var(--paper));
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 23px, rgba(150,100,50,0.08) 23px, rgba(150,100,50,0.08) 24px);
  padding: 22px 28px;
  font-family: 'Special Elite', monospace;
  font-size: 13.5px;
  line-height: 24px;
  color: var(--section-ink, #2a1f10);
  box-shadow: 1px 2px 4px rgba(0,0,0,0.15), inset 0 0 0 1px rgba(180,150,100,0.5);
  position: relative;
  white-space: pre-wrap;
  transition: background 0.3s ease;
}
.report-block::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(ellipse at center, transparent 60%, rgba(120,90,40,0.1) 100%);
}

.stamp {
  position: absolute;
  font-family: 'Stardos Stencil', sans-serif;
  border: 3px solid var(--stamp-red);
  color: var(--stamp-red);
  padding: 6px 14px;
  letter-spacing: 3px;
  font-size: 14px;
  transform: rotate(-7deg);
  opacity: 0.82;
  text-shadow: 1px 1px 0 rgba(168,58,44,0.2);
  pointer-events: none;
  background: rgba(245, 230, 200, 0.1);
}

/* =================================================================
   EXAMINATION — BODY DIAGRAM & FINDINGS LEDGER
   ================================================================= */

/* Sub-tabs across the top of the examination view. They look like
   manila file-folder tabs along the top edge of an open folder —
   each one a labeled grip that lifts a different page to the front. */
.exam-pages {
  display: flex;
  gap: 4px;
  margin-bottom: 0;
  padding: 0 8px;
  position: relative;
  z-index: 2;
}
.exam-page-tab {
  background: var(--manila-shadow);
  color: #4a3520;
  border: 1px solid #8a7a4a;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  padding: 9px 16px 11px;
  cursor: pointer;
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 11px;
  letter-spacing: 2px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  transition: background 0.15s, transform 0.15s, padding 0.15s;
  position: relative;
  top: 1px;
  /* Brushed-steel tab grip on top edge */
  box-shadow: inset 0 2px 0 var(--silver), inset 0 3px 0 var(--silver-deep);
}
.exam-page-tab:hover {
  background: var(--manila-light);
}
.exam-page-tab.active {
  background: var(--paper);
  border-color: #6a5530;
  padding-bottom: 14px;
  top: 0;
  z-index: 3;
  box-shadow:
    inset 0 2px 0 var(--silver),
    inset 0 3px 0 var(--silver-deep),
    -2px -1px 4px rgba(40, 30, 15, 0.10);
}
.exam-page-tab.complete .exam-page-count {
  color: #4a5028;
  font-weight: 700;
}
.exam-page-tab.complete::before {
  content: '✓';
  color: #4a5028;
  font-family: 'Crimson Text', serif;
  margin-right: 2px;
  font-size: 13px;
}
.exam-page-label {
  font-weight: 700;
}
.exam-page-count {
  font-family: 'Special Elite', monospace;
  font-size: 9.5px;
  letter-spacing: 1px;
  color: #8a7050;
  font-weight: 400;
}

/* Counters and overall progress notes. Smaller than the main page label
   since the active tab already shows you what page you're on. */
.exam-overall-counter {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px dashed #b89860;
  font-family: 'Special Elite', monospace;
  font-size: 9.5px;
  letter-spacing: 0.5px;
  color: #8a7050;
  text-align: center;
  font-style: italic;
}

.exam-instructions {
  font-family: 'Crimson Text', serif;
  font-size: 14px;
  font-style: italic;
  color: #5a4530;
  margin-bottom: 4px;
  line-height: 19px;
}
.exam-counter {
  font-family: 'Special Elite', monospace;
  font-size: 11px;
  letter-spacing: 1px;
  color: #6a5538;
  margin-bottom: 14px;
  border-bottom: 1px dashed #b89860;
  padding-bottom: 8px;
  text-align: center;
}
.exam-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 22px;
  align-items: stretch;
  /* Visually attaches the layout to the active sub-tab. */
  border-top: 1px solid #6a5530;
  padding-top: 16px;
  position: relative;
  z-index: 1;
  flex: 1 1 0;
  min-height: 0;     /* allow children to shrink so overflow works   */
}

/* The body panel is fixed in view — fits its content, doesn't scroll.
   The ledger fills the rest and scrolls inside its own column. */
.exam-layout > .body-panel {
  align-self: start;
  overflow-y: auto;
  max-height: 100%;
}
.exam-layout > .findings-ledger {
  min-height: 0;
  overflow-y: auto;
  max-height: 100%;
}
.body-panel {
  background: var(--paper);
  border: 1px solid var(--manila-shadow);
  padding: 14px 14px 18px 14px;
  text-align: center;
  position: relative;
  box-shadow: 1px 1px 0 rgba(120, 90, 50, 0.1);
}
.body-panel-header {
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 10px;
  letter-spacing: 3px;
  color: #4a3520;
  border-bottom: 1px solid #b89860;
  padding-bottom: 6px;
  margin-bottom: 4px;
}
.body-panel-sub {
  font-family: 'Special Elite', monospace;
  font-size: 9.5px;
  letter-spacing: 1.5px;
  color: #8a7050;
  margin-bottom: 10px;
}
.body-svg {
  width: 100%;
  height: auto;
  max-width: 220px;
  display: block;
  margin: 0 auto;
  /* Form grid — drawn as CSS background instead of SVG <pattern> to
     avoid the corner-leak bug some browsers exhibit during innerHTML
     re-renders. The 20px grid maps to the 200x440 viewBox. */
  background-image:
    linear-gradient(to right,  rgba(184, 152, 96, 0.18) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(184, 152, 96, 0.18) 1px, transparent 1px);
  background-size: 10% 4.55%; /* 20/200 horiz, 20/440 vert */
}
.body-svg .figure-line {
  stroke: var(--ink-brown);
  stroke-width: 1.4;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.body-svg .figure-watermark {
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 7px;
  letter-spacing: 2px;
  fill: rgba(120, 90, 50, 0.45);
  text-anchor: middle;
}
.body-svg .hotspot {
  fill: rgba(184, 152, 96, 0.001);
  cursor: crosshair;
  transition: fill 0.25s ease, opacity 0.25s ease;
}
.body-svg .hotspot:hover {
  fill: rgba(200, 162, 60, 0.22);
}
/* Regions on the current page get a faint warm wash so the eye knows
   what's in scope. Already-examined regions in scope get a slightly
   greener (recorded) wash. */
.body-svg .hotspot.in-scope {
  fill: rgba(200, 162, 60, 0.07);
}
.body-svg .hotspot.in-scope.examined {
  fill: rgba(74, 80, 40, 0.08);
}
.body-svg .hotspot.in-scope:hover {
  fill: rgba(200, 162, 60, 0.28);
}
/* Regions on other pages still take a click (which jumps the page),
   but visually recede so the active page reads first. */
.body-svg .hotspot.out-of-scope {
  opacity: 0.35;
  cursor: pointer;
}
.body-svg .hotspot.out-of-scope:hover {
  opacity: 0.65;
  fill: rgba(200, 162, 60, 0.15);
}
.body-svg .hotspot.examining {
  animation: hotspotPulse 0.65s ease-in-out;
}
@keyframes hotspotPulse {
  0%   { fill: rgba(200, 162, 60, 0.15); }
  45%  { fill: rgba(200, 162, 60, 0.55); }
  100% { fill: rgba(200, 162, 60, 0.001); }
}
.body-svg .mark {
  pointer-events: none;
  transform-origin: center;
  animation: markStamp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.body-svg .mark.check circle {
  fill: #4a5028;
  opacity: 0.85;
}
.body-svg .mark.flag text {
  fill: var(--stamp-red);
  font-family: 'Stardos Stencil', sans-serif;
  font-weight: 700;
  font-size: 18px;
  text-anchor: middle;
  dominant-baseline: central;
  opacity: 0.92;
}
@keyframes markStamp {
  0%   { transform: scale(2.4); opacity: 0; }
  60%  { transform: scale(0.85); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.records-section {
  margin-top: 14px;
  text-align: left;
}
.records-section-inline {
  margin: 0 0 16px 0;
  padding: 8px 12px 10px;
  background: rgba(184, 152, 96, 0.08);
  border: 1px dashed #b89860;
  border-radius: 4px;
}
.records-section-inline .records-header {
  border-top: none;
  padding-top: 0;
  margin-bottom: 8px;
}
.records-section-inline .record-card {
  margin-bottom: 4px;
}
.records-section-inline .record-card:last-child {
  margin-bottom: 0;
}
.records-header {
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 9.5px;
  letter-spacing: 2.5px;
  color: #6a5538;
  margin-bottom: 6px;
  border-top: 1px dashed #b89860;
  padding-top: 8px;
}
.record-card {
  background: rgba(255, 248, 220, 0.4);
  border: 1px solid #c4a878;
  padding: 7px 10px;
  margin-bottom: 5px;
  font-size: 10px;
  letter-spacing: 1.5px;
  font-family: 'Stardos Stencil', sans-serif;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #4a3520;
  text-transform: uppercase;
}
.record-card:hover { background: var(--manila-light); }
.record-card.checked {
  border-left: 4px solid #4a5028;
  padding-left: 9px;
}
.record-card.checked::after {
  content: '✓';
  color: #4a5028;
  font-size: 13px;
  font-family: 'Crimson Text', serif;
}
.record-card.flagged {
  border-left: 4px solid var(--stamp-red);
  padding-left: 9px;
  color: var(--stamp-red);
}
.record-card.flagged::after {
  content: '!';
  color: var(--stamp-red);
  font-size: 14px;
  font-family: 'Stardos Stencil', sans-serif;
  font-weight: 700;
}

/* Findings ledger */
.findings-ledger {
  background: var(--paper);
  border: 1px solid var(--manila-shadow);
  padding: 16px 22px 22px 32px;
  font-family: 'Special Elite', monospace;
  font-size: 12.5px;
  line-height: 19px;
  position: relative;
  box-shadow: 1px 1px 0 rgba(120, 90, 50, 0.1);
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent 0,
      transparent 21px,
      rgba(120, 90, 50, 0.07) 21px,
      rgba(120, 90, 50, 0.07) 22px
    );
}
.ledger-header {
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 10px;
  letter-spacing: 3px;
  color: #4a3520;
  border-bottom: 2px double #b89860;
  padding-bottom: 6px;
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.ledger-header .case-ref {
  font-family: 'Special Elite', monospace;
  font-size: 9px;
  letter-spacing: 1.5px;
  color: #8a7050;
}
.ledger-empty {
  font-family: 'Crimson Text', serif;
  font-style: italic;
  color: #8a7050;
  text-align: center;
  padding: 90px 30px;
  font-size: 14px;
  line-height: 22px;
}
.ledger-empty span {
  display: block;
  font-size: 11px;
  letter-spacing: 1.5px;
  color: #a89860;
  margin-top: 12px;
  font-family: 'Special Elite', monospace;
  font-style: normal;
}
.ledger-entry {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px dashed rgba(184, 152, 96, 0.45);
  position: relative;
  transition: background 0.4s;
}
.ledger-entry:last-child { border-bottom: none; margin-bottom: 0; }
.ledger-entry-num {
  position: absolute;
  left: -22px;
  top: 1px;
  font-family: 'Special Elite', monospace;
  font-size: 9px;
  color: #a89860;
  letter-spacing: 1px;
}
.ledger-region-name {
  font-family: 'Crimson Text', serif;
  font-weight: 600;
  font-size: 13px;
  color: var(--ink-brown);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin-bottom: 3px;
}
.ledger-region-name::before {
  content: '— ';
  color: #b89860;
}
.ledger-finding {
  white-space: pre-wrap;
  color: var(--ink-brown);
  margin: 4px 0 8px 0;
  font-size: 12px;
  line-height: 18px;
  min-height: 18px;
}
.ledger-finding.unremarkable {
  font-style: italic;
  color: #6a5538;
}
.typing-cursor {
  display: inline-block;
  width: 7px;
  height: 13px;
  background: var(--ink-brown);
  vertical-align: text-bottom;
  margin-left: 1px;
  animation: blink 0.85s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.ledger-controls {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  align-items: center;
  flex-wrap: wrap;
}
.ledger-controls .label {
  font-family: 'Special Elite', monospace;
  font-size: 10px;
  letter-spacing: 1px;
  color: #8a7050;
  margin-right: 4px;
}
.ledger-mark-btn {
  border: 1px solid #b89860;
  background: transparent;
  font-family: 'Special Elite', monospace;
  font-size: 11px;
  padding: 4px 12px;
  cursor: pointer;
  letter-spacing: 1px;
  color: var(--ink-brown);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.ledger-mark-btn:hover {
  background: var(--manila-light);
}
.ledger-mark-btn.active.check {
  background: #4a5028;
  color: var(--manila);
  border-color: #4a5028;
}
.ledger-mark-btn.active.flag {
  background: var(--stamp-red);
  color: var(--manila);
  border-color: var(--stamp-red);
}
.examining-row {
  font-family: 'Special Elite', monospace;
  font-size: 12px;
  color: #8a7050;
  letter-spacing: 1.5px;
  padding: 6px 0;
}
.examining-row::after {
  content: '';
  display: inline-block;
  width: 18px;
  text-align: left;
  animation: examDots 1.1s steps(4) infinite;
}
@keyframes examDots {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
  100% { content: ''; }
}
.ledger-flash {
  background: rgba(200, 162, 60, 0.18);
}

/* =================================================================
   COURT REVIEW TAB
   ================================================================= */
.review-summons {
  background: var(--section-paper, var(--paper));
  border: 1px solid var(--manila-shadow);
  padding: 22px 26px;
  position: relative;
  margin-top: 8px;
  transition: background 0.3s ease;
}
.review-summons::before {
  content: 'COURT — IN RE:';
  position: absolute;
  top: 10px; right: 16px;
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 9px;
  letter-spacing: 3px;
  color: #8a3520;
  border: 1.5px solid #8a3520;
  padding: 3px 8px;
  opacity: 0.7;
  transform: rotate(2deg);
}
.review-summons h4 {
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 14px;
  letter-spacing: 4px;
  color: var(--stamp-red);
  margin-bottom: 14px;
  border-bottom: 1.5px solid var(--stamp-red);
  padding-bottom: 6px;
  display: inline-block;
}
.review-summons .review-body {
  font-family: 'Special Elite', monospace;
  font-size: 12.5px;
  line-height: 21px;
  white-space: pre-wrap;
  color: var(--ink-brown);
}
.review-summons .review-meta {
  font-family: 'Crimson Text', serif;
  font-style: italic;
  font-size: 12px;
  color: #6a5538;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed #b89860;
}
.review-actions {
  margin-top: 20px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.review-btn {
  font-family: 'Stardos Stencil', sans-serif;
  letter-spacing: 3px;
  padding: 12px 22px;
  border: 2px solid;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.15s, color 0.15s;
}
.review-btn.affirm {
  border-color: #4a5028;
  color: #3a4020;
}
.review-btn.affirm:hover { background: #4a5028; color: var(--manila); }
.review-btn.amend {
  border-color: var(--stamp-red);
  color: var(--stamp-red);
}
.review-btn.amend:hover { background: var(--stamp-red); color: var(--manila); }
.review-amend-form {
  margin-top: 18px;
  background: var(--paper);
  border: 1px dashed var(--stamp-red);
  padding: 16px 18px;
}
.review-amend-form h5 {
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--stamp-red);
  margin-bottom: 10px;
}
.review-amend-form select {
  width: 100%;
  font-family: 'Special Elite', monospace;
  padding: 8px;
  border: 1px solid #b89860;
  background: var(--manila-light);
  margin-bottom: 10px;
  font-size: 13px;
}
.review-amend-form textarea {
  width: 100%;
  min-height: 70px;
  font-family: 'Caveat', cursive;
  font-size: 16px;
  padding: 10px;
  border: 1px solid #b89860;
  background: rgba(255, 250, 235, 0.6);
  color: var(--margin-pen);
  resize: vertical;
  margin-bottom: 10px;
}
.review-resolved {
  background: var(--section-paper, var(--paper));
  border: 1px solid var(--manila-shadow);
  padding: 28px 28px;
  margin-top: 8px;
  text-align: center;
  transition: background 0.3s ease;
}
.review-resolved .review-stamp {
  display: inline-block;
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 16px;
  letter-spacing: 5px;
  color: var(--stamp-red);
  border: 3px solid var(--stamp-red);
  padding: 10px 22px;
  transform: rotate(-3deg);
  opacity: 0.85;
  margin-bottom: 16px;
}
.review-resolved p {
  font-family: 'Crimson Text', serif;
  font-size: 14px;
  line-height: 21px;
  font-style: italic;
  color: var(--ink-brown);
  max-width: 480px;
  margin: 0 auto;
}
.review-banner {
  background: rgba(168, 58, 44, 0.08);
  border: 1px solid var(--stamp-red);
  padding: 10px 14px;
  margin-bottom: 14px;
  font-family: 'Special Elite', monospace;
  font-size: 11.5px;
  letter-spacing: 1px;
  color: var(--stamp-red);
  text-align: center;
}
.tab .review-tab-flag {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: var(--stamp-red);
  border-radius: 50%;
  margin-left: 5px;
  animation: gentlePulse 1.4s ease-in-out infinite;
}
@keyframes gentlePulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}
.case-card .review-pending {
  margin-top: 6px;
  font-size: 9.5px;
  letter-spacing: 1px;
  color: var(--stamp-red);
  text-transform: uppercase;
}
.case-card .review-pending::before {
  content: '◆ ';
}

.evidence-item {
  background: var(--section-paper, var(--paper));
  color: var(--section-ink, var(--ink-brown));
  border: 1px solid #b89860;
  padding: 18px 22px;
  margin-bottom: 14px;
  position: relative;
  font-size: 13px;
  line-height: 22px;
  transition: background 0.3s ease;
}

/* Witness statements: pale green carbon-copy paper, with a subtle
   diagonal "C O P Y" suggestion in the top-right corner. */
.tab-content[data-active-tab="witness"] .evidence-item {
  border-color: #8a9870;
  border-left-width: 3px;
}
.tab-content[data-active-tab="witness"] .evidence-item::after {
  content: 'CARBON COPY';
  position: absolute;
  top: 8px;
  right: 12px;
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 8px;
  letter-spacing: 2px;
  color: rgba(60, 80, 30, 0.32);
  pointer-events: none;
}

/* Toxicology: cool slate-tinted lab paper, with a "LABORATORY" stamp
   marking. */
.tab-content[data-active-tab="toxicology"] .evidence-item {
  border-color: #6a8a90;
  border-left-width: 3px;
}
.tab-content[data-active-tab="toxicology"] .evidence-item::after {
  content: 'LAB · STATE OF INDIANA';
  position: absolute;
  top: 8px;
  right: 12px;
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 8px;
  letter-spacing: 2px;
  color: rgba(20, 50, 60, 0.35);
  pointer-events: none;
}
.evidence-item .ev-header {
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 11px;
  letter-spacing: 2px;
  color: #4a3520;
  border-bottom: 1px dashed #a89860;
  padding-bottom: 6px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
}
.evidence-item .ev-body {
  font-family: 'Special Elite', monospace;
  white-space: pre-wrap;
  color: #2a1f10;
}
.pending {
  background: rgba(120,90,40,0.05);
  border: 1px dashed #a89860;
  padding: 16px 22px;
  margin-bottom: 12px;
  font-style: italic;
  color: #6a5538;
  font-size: 12.5px;
  font-family: 'Crimson Text', serif;
  position: relative;
}
.pending::before {
  content: '⌛';
  margin-right: 8px;
  font-style: normal;
}

.det-panel {
  background: var(--section-paper, var(--paper));
  border: 2px solid var(--olive);
  padding: 22px 24px;
  margin-top: 8px;
  position: relative;
  transition: background 0.3s ease;
}
.det-panel h3 {
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 14px;
  letter-spacing: 3px;
  color: var(--olive-dark);
  margin-bottom: 4px;
}
.det-panel .sub {
  font-size: 11px;
  letter-spacing: 1px;
  color: #6a5538;
  text-transform: uppercase;
  margin-bottom: 16px;
}
.det-locked {
  text-align: center;
  padding: 40px 20px;
  position: relative;
}
.det-locked .stamp-big {
  display: inline-block;
  font-family: 'Stardos Stencil', sans-serif;
  border: 4px solid var(--stamp-red);
  color: var(--stamp-red);
  padding: 12px 24px;
  letter-spacing: 5px;
  font-size: 18px;
  transform: rotate(-3deg);
  opacity: 0.85;
}
.det-locked p {
  font-family: 'Crimson Text', serif;
  font-style: italic;
  font-size: 14px;
  color: #6a5538;
  margin-top: 24px;
}
.det-select {
  width: 100%;
  padding: 14px 16px;
  font-family: 'Special Elite', monospace;
  font-size: 14px;
  background: #fff8e0;
  border: 1px solid #8a6840;
  color: var(--ink-brown);
  margin-bottom: 12px;
}
.sign-btn {
  width: 100%;
  padding: 14px;
  background: var(--mustard);
  background-image: linear-gradient(180deg, var(--mustard) 0%, var(--mustard-dark) 100%);
  color: #2a1f08;
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 13px;
  letter-spacing: 3px;
  border: 1px solid #6a4f10;
  border-bottom-width: 3px;
  cursor: pointer;
  box-shadow: 0 2px 0 #5a4208;
}
.sign-btn:hover { filter: brightness(1.05); }
.sign-btn:active { transform: translateY(1px); }
.sign-btn:disabled {
  background-image: linear-gradient(180deg, #8a7340 0%, #6a5530 100%);
  cursor: not-allowed;
  color: #5a4830;
}
.det-signed {
  text-align: center;
  padding: 30px 20px;
}

.body-controls {
  background: rgba(120,90,40,0.06);
  border: 1px solid #a89860;
  padding: 14px 18px;
  margin-top: 24px;
  font-size: 12px;
}
.body-controls .lbl {
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 10px;
  letter-spacing: 2px;
  color: #4a3520;
  margin-bottom: 8px;
}
.body-controls .body-status {
  font-family: 'Crimson Text', serif;
  font-style: italic;
  font-size: 14px;
  margin-bottom: 10px;
  color: var(--ink-brown);
}
.body-controls button {
  padding: 6px 12px;
  margin-right: 6px;
  font-family: 'Special Elite', monospace;
  font-size: 11px;
  background: var(--manila);
  border: 1px solid #8a6840;
  color: var(--ink-brown);
  cursor: pointer;
  letter-spacing: 0.5px;
}
.body-controls button:hover { background: var(--manila-light); }
.body-controls button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Release-button variants — visual hierarchy follows the action's
   weight. Family release is the default (warm, expected); sheriff
   transfer is consequential (red, custody change); Plot 7 is somber
   (muted, county burial). */
.body-controls .release-btn.primary {
  background: var(--manila);
  border-color: #6a5530;
  font-weight: 700;
}
.body-controls .release-btn.primary:hover:not(:disabled) {
  background: #f4ead0;
}
.body-controls .release-btn.evidence {
  background: rgba(168, 58, 44, 0.06);
  border-color: var(--stamp-red);
  color: var(--stamp-red);
}
.body-controls .release-btn.evidence:hover:not(:disabled) {
  background: var(--stamp-red);
  color: var(--manila);
}
.body-controls .release-btn.plot7 {
  background: rgba(110, 118, 116, 0.10);
  border-color: var(--silver-shadow);
  color: var(--silver-shadow);
  font-style: italic;
}
.body-controls .release-btn.plot7:hover:not(:disabled) {
  background: var(--silver-shadow);
  color: var(--manila);
}

#margin {
  background:
    repeating-linear-gradient(0deg, transparent, transparent 23px, rgba(70,90,150,0.18) 23px, rgba(70,90,150,0.18) 24px),
    linear-gradient(180deg, #f7eed0 0%, #f0e4b8 100%);
  border-left: 1px solid #b89860;
  padding: 20px 18px;
  overflow-y: auto;
  position: relative;
  box-shadow: inset 8px 0 16px rgba(120,90,40,0.15);
}
#margin::before {
  content: '';
  position: absolute;
  left: 36px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(168,58,44,0.5);
}
.margin-header {
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 11px;
  letter-spacing: 3px;
  color: #4a3520;
  margin-bottom: 14px;
  padding-bottom: 6px;
  border-bottom: 1px dashed #a89860;
}
.margin-empty {
  font-family: 'Caveat', cursive;
  font-size: 16px;
  color: #8a7548;
  font-style: italic;
  text-align: center;
  margin-top: 40px;
  line-height: 22px;
}
.margin-note {
  font-family: 'Caveat', cursive;
  font-size: 18px;
  line-height: 24px;
  color: var(--margin-pen);
  margin-bottom: 16px;
  padding-left: 4px;
  position: relative;
}
.margin-note .author {
  font-family: 'Special Elite', monospace;
  font-size: 9px;
  letter-spacing: 1px;
  color: #6a5538;
  display: block;
  margin-bottom: 2px;
  text-transform: uppercase;
}
.margin-note.harlan { color: var(--ink-blue); }
.margin-note.harlan .author::before { content: '— '; }
.margin-note.you { color: var(--margin-pen); }

.margin-input {
  width: 100%;
  margin-top: 12px;
  background: transparent;
  border: none;
  border-bottom: 1px solid #a89860;
  font-family: 'Caveat', cursive;
  font-size: 17px;
  color: var(--margin-pen);
  padding: 6px 4px;
  resize: none;
  min-height: 60px;
  outline: none;
}
.margin-input:focus { border-bottom-color: var(--stamp-red); }
.margin-input::placeholder {
  font-style: italic;
  color: #a89860;
}
.margin-add-btn {
  margin-top: 6px;
  font-family: 'Special Elite', monospace;
  font-size: 10px;
  letter-spacing: 1px;
  background: transparent;
  border: 1px solid #8a6840;
  color: #6a4528;
  padding: 4px 10px;
  cursor: pointer;
}
.margin-add-btn:hover { background: rgba(120,90,40,0.1); }

.eow-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20,15,8,0.85);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.eow-card {
  background: var(--manila-light);
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 23px, rgba(150,100,50,0.06) 23px, rgba(150,100,50,0.06) 24px);
  padding: 36px 44px;
  max-width: 540px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.6);
  border: 1px solid #8a6840;
  position: relative;
}
.eow-card h2 {
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 20px;
  letter-spacing: 3px;
  text-align: center;
  color: var(--olive-dark);
  margin-bottom: 6px;
}
.eow-card .eow-week {
  font-family: 'Crimson Text', serif;
  font-style: italic;
  font-size: 14px;
  text-align: center;
  color: #6a5538;
  margin-bottom: 22px;
}
.eow-card .eow-line {
  font-family: 'Special Elite', monospace;
  font-size: 13px;
  margin-bottom: 8px;
  color: var(--ink-brown);
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dotted #a89860;
  padding: 6px 0;
}
.eow-card .eow-coda {
  font-family: 'Crimson Text', serif;
  font-style: italic;
  font-size: 16px;
  text-align: center;
  margin-top: 24px;
  color: #4a3520;
  line-height: 22px;
}
.eow-card .plot7 {
  margin-top: 20px;
  text-align: center;
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 13px;
  letter-spacing: 3px;
  padding: 14px;
  border: 2px dashed var(--olive);
  color: var(--olive-dark);
}
.eow-card button {
  margin-top: 24px;
  display: block;
  margin-left: auto;
  margin-right: auto;
  padding: 10px 24px;
  font-family: 'Stardos Stencil', sans-serif;
  letter-spacing: 2px;
  background: var(--olive);
  color: #f0e8c8;
  border: 1px solid var(--olive-dark);
  cursor: pointer;
}

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.1); }
::-webkit-scrollbar-thumb { background: #6a5538; border-radius: 0; }
::-webkit-scrollbar-thumb:hover { background: #8a7548; }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink-brown);
  color: var(--manila-light);
  padding: 10px 20px;
  font-family: 'Special Elite', monospace;
  font-size: 12px;
  letter-spacing: 1px;
  border: 1px solid #6a4528;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  z-index: 200;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}


/* The active tab gets a colored stripe along its bottom edge that
   matches the section type, so the eye registers which document type
   you're reading even when peripheral vision picks up the tab strip
   alone. */
.tabs .tab.active {
  position: relative;
}
.tab[data-tab="examination"].active::before,
.tab[data-tab="witness"].active::before,
.tab[data-tab="toxicology"].active::before,
.tab[data-tab="determination"].active::before,
.tab[data-tab="review"].active::before,
.tab[data-tab="intake"].active::before {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
}
.tab[data-tab="intake"].active::before        { background: #8e7a4a; }
.tab[data-tab="examination"].active::before   { background: #a26b3c; }
.tab[data-tab="witness"].active::before       { background: #6f5a48; }
.tab[data-tab="toxicology"].active::before    { background: #5e6e3f; }
.tab[data-tab="determination"].active::before { background: #6e5a30; }
.tab[data-tab="review"].active::before        { background: #4a4a5c; }

/* =================================================================
   TUTORIAL OVERLAY — Harlan Mercer's orientation walkthrough
   ================================================================= */

.tutorial-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;        /* clicks pass through to the world */
  z-index: 300;                /* above book modal (250) — tutorial points to it */
}

/* Pulse-ring around the target. A double-stroke gold outline that
   gently pulses so the player's eye is drawn there without the
   element itself being obscured. */
.tutorial-spotlight {
  position: fixed;
  border: 2px solid #d8a93a;
  border-radius: 6px;
  box-shadow:
    0 0 0 4px rgba(216, 169, 58, 0.20),
    0 0 24px rgba(216, 169, 58, 0.45);
  pointer-events: none;
  animation: tutorialRing 1.6s ease-in-out infinite;
}
@keyframes tutorialRing {
  0%, 100% { box-shadow: 0 0 0 4px rgba(216, 169, 58, 0.18), 0 0 18px rgba(216, 169, 58, 0.35); }
  50%      { box-shadow: 0 0 0 6px rgba(216, 169, 58, 0.28), 0 0 28px rgba(216, 169, 58, 0.55); }
}

/* The tooltip — Harlan's voice in a notepad-style card. Sits above
   everything else and accepts clicks for the Continue / Skip buttons. */
.tutorial-tooltip {
  position: fixed;
  pointer-events: auto;
  width: 320px;
  background: var(--paper);
  border: 1px solid var(--manila-shadow);
  border-left: 4px solid var(--olive);
  padding: 14px 18px 12px;
  box-shadow: 4px 6px 14px rgba(20, 25, 18, 0.35);
  font-family: 'Crimson Text', serif;
  color: var(--ink-brown);
  /* Subtle paper-rule lines so it reads as Harlan's notebook page. */
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent 0,
      transparent 21px,
      rgba(120, 90, 50, 0.08) 21px,
      rgba(120, 90, 50, 0.08) 22px
    );
}
.tutorial-speaker {
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 9.5px;
  letter-spacing: 2.5px;
  color: var(--olive);
  margin-bottom: 8px;
  border-bottom: 1px dashed var(--manila-shadow);
  padding-bottom: 6px;
}
.tutorial-text {
  font-size: 14px;
  line-height: 21px;
  margin-bottom: 12px;
  white-space: pre-wrap;
}
.tutorial-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.tutorial-btn-continue {
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 11px;
  letter-spacing: 2.5px;
  background: var(--olive);
  color: var(--manila);
  border: none;
  padding: 7px 18px;
  cursor: pointer;
  transition: background 0.15s;
}
.tutorial-btn-continue:hover:not(:disabled) {
  background: var(--olive-dark);
}
.tutorial-btn-continue:disabled {
  background: var(--manila-shadow);
  color: #6a5538;
  cursor: not-allowed;
}
.tutorial-btn-skip {
  font-family: 'Crimson Text', serif;
  font-size: 11px;
  font-style: italic;
  background: transparent;
  border: none;
  color: #8a7050;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.tutorial-btn-skip:hover { color: var(--ink-brown); }

/* =================================================================
   REFERENCE LIBRARY — book modal + courses + exam
   ================================================================= */

/* Sidebar entry to open the book. */
.library-btn {
  width: 100%;
  margin-top: 16px;
  padding: 10px 14px;
  background: rgba(184, 152, 96, 0.10);
  border: 1px solid var(--manila-shadow);
  color: var(--manila-light);
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 11px;
  letter-spacing: 2.5px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.library-btn:hover {
  background: rgba(184, 152, 96, 0.22);
  color: var(--manila);
}

/* Modal overlay covers the full screen above everything. */
.book-modal {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}
.book-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 20, 18, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

/* The book card itself — a wide pad of paper on the desk. */
.book-card {
  position: relative;
  z-index: 1;
  width: min(92vw, 1100px);
  max-height: 88vh;
  background: var(--paper);
  border: 1px solid var(--manila-shadow);
  box-shadow:
    0 12px 36px rgba(20, 25, 18, 0.55),
    inset 0 0 0 1px rgba(180, 150, 100, 0.4);
  display: flex;
  flex-direction: column;
  background-image:
    radial-gradient(ellipse at 30% 10%, rgba(255,255,255,0.45), transparent 60%),
    repeating-linear-gradient(0deg, transparent, transparent 23px, rgba(180,150,100,0.05) 23px, rgba(180,150,100,0.05) 24px);
}

.book-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px 12px;
  border-bottom: 2px double #8a6840;
  flex-shrink: 0;
}
.book-title {
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 13px;
  letter-spacing: 4px;
  color: var(--olive-dark);
}
.book-close {
  background: transparent;
  border: 1px solid var(--manila-shadow);
  color: var(--ink-brown);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  font-family: 'Crimson Text', serif;
  transition: background 0.15s, color 0.15s;
}
.book-close:hover {
  background: var(--stamp-red);
  color: var(--manila);
  border-color: var(--stamp-red);
}

.book-body {
  flex: 1;
  overflow: hidden;
  display: grid;
  grid-template-columns: 280px 1fr;
}

/* TOC — curriculum sidebar. */
.book-toc {
  background: rgba(184, 152, 96, 0.10);
  border-right: 1px dashed var(--manila-shadow);
  padding: 18px 14px;
  overflow-y: auto;
}
.book-toc-header {
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 10px;
  letter-spacing: 2.5px;
  color: var(--olive);
  margin-bottom: 14px;
  border-bottom: 1px dashed var(--manila-shadow);
  padding-bottom: 6px;
}
.book-toc-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  margin-bottom: 4px;
  font-family: 'Crimson Text', serif;
  font-size: 13px;
  cursor: pointer;
  border-left: 3px solid transparent;
  border-radius: 2px;
  transition: background 0.15s, border-color 0.15s;
  color: var(--ink-brown);
}
.book-toc-item:hover:not(.locked) {
  background: var(--manila-light);
  border-left-color: var(--mustard-dark);
}
.book-toc-item.active {
  background: var(--paper);
  border-left-color: var(--olive);
  font-weight: 600;
}
.book-toc-item.passed .book-toc-status {
  color: #4a5028;
  font-weight: 700;
}
.book-toc-item.locked {
  opacity: 0.55;
  cursor: not-allowed;
  font-style: italic;
}
.book-toc-name {
  flex: 1;
  line-height: 19px;
  padding-right: 4px;
}
.book-toc-status {
  font-family: 'Special Elite', monospace;
  font-size: 14px;
  color: var(--manila-shadow);
  flex-shrink: 0;
}

/* Content — chapter prose, exam questions, results.

   The book-content scroll container is full width, but inside we use
   a max-width column so prose stays at a comfortable reading measure
   (~680px) regardless of viewport. Stencil is reserved for the
   chapter title (the equivalent of a label on a folder); section
   sub-headings are in serif italic for reading flow rather than
   document-chrome feel. */
.book-content {
  overflow-y: auto;
  padding: 24px 36px 32px;
  font-family: 'Crimson Text', serif;
  font-size: 15.5px;
  line-height: 24px;
  color: var(--ink-brown);
}
.chapter-column {
  max-width: 680px;
}
.book-h2 {
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 17px;
  letter-spacing: 2.5px;
  color: var(--olive-dark);
  margin: 0 0 22px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--manila-shadow);
}
.book-h3 {
  font-family: 'Crimson Text', serif;
  font-size: 17px;
  font-style: italic;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: var(--olive-dark);
  margin: 24px 0 10px;
}
.book-h3:first-of-type {
  margin-top: 8px;
}
.book-p {
  margin: 0 0 14px;
}
.book-p:last-child {
  margin-bottom: 0;
}
.book-list {
  margin: 4px 0 16px;
  padding-left: 22px;
  list-style: square;
}
.book-list li {
  margin-bottom: 6px;
  line-height: 24px;
  padding-left: 4px;
}
.book-list li::marker {
  color: var(--olive);
}
.book-list li:last-child {
  margin-bottom: 0;
}

.book-exam-cta {
  margin-top: 32px;
  padding-top: 22px;
  border-top: 1px dashed var(--manila-shadow);
}

.book-btn-primary,
.book-btn-secondary {
  font-family: 'Stardos Stencil', sans-serif;
  letter-spacing: 3px;
  padding: 11px 22px;
  border: 2px solid var(--olive);
  background: var(--olive);
  color: var(--manila);
  cursor: pointer;
  font-size: 12px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.book-btn-primary:hover:not(:disabled) {
  background: var(--olive-dark);
  border-color: var(--olive-dark);
}
.book-btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.book-btn-secondary {
  background: transparent;
  color: var(--olive);
}
.book-btn-secondary:hover {
  background: var(--olive);
  color: var(--manila);
}

.book-cert {
  display: inline-block;
  margin-bottom: 14px;
  padding: 10px 18px;
  background: rgba(74, 80, 40, 0.08);
  border: 1px solid #4a5028;
  border-radius: 4px;
}
.book-cert-stamp {
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 14px;
  letter-spacing: 4px;
  color: #4a5028;
  margin-bottom: 4px;
}
.book-cert-meta {
  font-family: 'Special Elite', monospace;
  font-size: 11px;
  color: #6a5538;
}

/* Exam view — single column; questions take over the content pane.
   Sized to a comfortable reading measure with options that read as
   numbered choices rather than command-buttons. */
.exam-view {
  max-width: 720px;
}
.exam-progress {
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--olive);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--manila-shadow);
}
.exam-scenario {
  font-family: 'Crimson Text', serif;
  font-size: 16.5px;
  line-height: 26px;
  margin-bottom: 24px;
  padding: 18px 22px;
  background: var(--manila-light);
  border-left: 3px solid var(--olive);
  color: var(--ink-brown);
}
.exam-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 22px;
}
.exam-option {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid var(--manila-shadow);
  font-family: 'Crimson Text', serif;
  font-size: 15px;
  line-height: 22px;
  text-align: left;
  cursor: pointer;
  color: var(--ink-brown);
  transition: background 0.15s, border-color 0.15s;
}
.exam-option:hover:not(.reveal-correct):not(.reveal-wrong) {
  background: var(--manila-light);
  border-color: var(--mustard-dark);
}
.exam-option.picked {
  background: var(--manila-light);
  border-color: var(--olive);
}
.exam-option.reveal-correct {
  background: rgba(74, 80, 40, 0.10);
  border-color: #4a5028;
  cursor: default;
}
.exam-option.reveal-wrong {
  background: rgba(168, 58, 44, 0.08);
  border-color: var(--stamp-red);
  cursor: default;
}
.exam-option-mark {
  font-size: 16px;
  color: var(--olive);
  flex-shrink: 0;
  line-height: 22px;
}
.exam-option-text {
  flex: 1;
}
.exam-option-tag {
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 9px;
  letter-spacing: 2px;
  padding: 4px 9px;
  background: #4a5028;
  color: var(--manila);
  border-radius: 2px;
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 1px;
}
.exam-option-tag.wrong {
  background: var(--stamp-red);
}

.exam-explanation {
  margin: 0 0 20px;
  padding: 16px 20px;
  background: var(--paper);
  border: 1px dashed var(--olive);
}
.exam-explanation-label {
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 9.5px;
  letter-spacing: 2.5px;
  color: var(--olive-dark);
  margin-bottom: 6px;
}
.exam-explanation-text {
  font-family: 'Crimson Text', serif;
  font-size: 14px;
  line-height: 22px;
  color: var(--ink-brown);
}

.exam-controls {
  margin-top: 18px;
}
.exam-result {
  text-align: center;
  padding: 20px 0;
}
.exam-result-score {
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 22px;
  letter-spacing: 5px;
  margin: 18px 0 22px;
  padding: 16px;
  border: 3px solid;
  display: inline-block;
}
.exam-result-score.pass {
  color: #4a5028;
  border-color: #4a5028;
  background: rgba(74, 80, 40, 0.08);
}
.exam-result-score.fail {
  color: var(--stamp-red);
  border-color: var(--stamp-red);
  background: rgba(168, 58, 44, 0.08);
}

/* =================================================================
   LENS ROW + CLUE SPANS — visible in the file chrome
   ================================================================= */

.lens-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 8px 0 10px;
  padding: 6px 10px;
  background: rgba(184, 152, 96, 0.05);
  border-left: 2px solid var(--manila-shadow);
  font-family: 'Special Elite', monospace;
}
.lens-row-label {
  font-size: 10px;
  letter-spacing: 2px;
  color: #6a5538;
  text-transform: uppercase;
  font-family: 'Stardos Stencil', sans-serif;
}
.lens-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  background: transparent;
  border: 1px solid var(--manila-shadow);
  color: #6a5538;
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 10px;
  letter-spacing: 1.8px;
  cursor: pointer;
  border-radius: 13px;
  transition: background 0.15s, color 0.15s, border-color 0.15s, opacity 0.15s;
  opacity: 0.7;
}
.lens-chip:hover {
  opacity: 1;
}
.lens-chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lens-color, #888);
  opacity: 0.45;
  transition: opacity 0.15s, box-shadow 0.15s;
}
.lens-chip.active {
  opacity: 1;
  background: rgba(184, 152, 96, 0.10);
  border-color: var(--lens-color, #888);
  color: var(--ink-brown);
}
.lens-chip.active .lens-chip-dot {
  opacity: 1;
  box-shadow: 0 0 6px var(--lens-color, transparent);
}

/* Tagged clue spans inside finding prose. The underline color is
   set per-course so multiple lenses on at once read distinctly. */
.clue {
  border-bottom: 1.5px solid currentColor;
  padding-bottom: 1px;
  cursor: help;
}
.clue.clue-cardiac    { color: #c8a23c; }
.clue.clue-trauma     { color: #a83a2c; }
.clue.clue-tox        { color: #5e6e3f; }
.clue.clue-lividity   { color: #8a9890; }
.clue.clue-iatrogenic { color: #6f5a48; }
.clue.clue-asphyxia   { color: #4a4a5c; }
.clue.clue-self-harm  { color: #6e5a30; }

/* =================================================================
   EXPERT CONSULT — request CTA, status, and the report letterhead
   ================================================================= */

/* The CTA appears on the determination tab — invitation to request
   a written second opinion when the case isn't telling you enough. */
.consult-cta {
  margin-top: 18px;
  padding: 14px 18px;
  background: rgba(110, 90, 48, 0.06);
  border: 1px dashed #8a7050;
  border-left: 3px solid #6e5a30;
}
.consult-cta-label {
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 10px;
  letter-spacing: 2.5px;
  color: #6e5a30;
  margin-bottom: 6px;
}
.consult-cta-prose {
  font-family: 'Crimson Text', serif;
  font-size: 13px;
  line-height: 19px;
  color: #5a4530;
  font-style: italic;
  margin-bottom: 10px;
}
.consult-cta-btn {
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 10.5px;
  letter-spacing: 2px;
  padding: 8px 14px;
  background: transparent;
  border: 1px solid #6e5a30;
  color: #4a3520;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.consult-cta-btn:hover {
  background: #6e5a30;
  color: var(--manila);
}

/* Status line shown after a consult is requested or arrived. */
.consult-status {
  margin-top: 18px;
  padding: 12px 16px;
  background: rgba(184, 152, 96, 0.08);
  border-left: 3px solid var(--manila-shadow);
  font-family: 'Crimson Text', serif;
  font-size: 13.5px;
  line-height: 19px;
  color: #5a4530;
  font-style: italic;
}
.consult-status strong {
  font-style: normal;
  color: var(--ink-brown);
}
.consult-status.arrived {
  background: rgba(74, 80, 40, 0.08);
  border-left-color: #4a5028;
  color: #3a4020;
}

/* The consult report itself — formatted as the expert's letter on
   their letterhead, wrapped in a sheet of cream paper that visually
   distinguishes it from the case file proper. The reader is reading
   correspondence from outside the office. */
.tab-content[data-active-tab="consult"] {
  padding: 18px 24px 24px;
}
.consult-letter {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 44px 36px;
  background: #f4ecd8;
  background-image:
    radial-gradient(ellipse at 80% 8%, rgba(180,150,100,0.08), transparent 60%),
    radial-gradient(ellipse at 12% 92%, rgba(140,100,60,0.06), transparent 50%);
  border: 1px solid rgba(140, 110, 70, 0.35);
  box-shadow:
    0 2px 6px rgba(20,25,18,0.18),
    0 8px 22px rgba(20,25,18,0.10),
    inset 0 0 0 1px rgba(255,255,255,0.4);
}
.consult-letterhead {
  border-bottom: 1.5px solid var(--ink-brown);
  padding-bottom: 12px;
  margin-bottom: 18px;
}
.consult-from {
  font-family: 'Crimson Text', serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--ink-brown);
  letter-spacing: 0.5px;
  line-height: 26px;
}
.consult-title {
  font-family: 'Crimson Text', serif;
  font-size: 13px;
  font-style: italic;
  color: #6a5538;
  margin-top: 2px;
}
.consult-date {
  font-family: 'Special Elite', monospace;
  font-size: 10.5px;
  letter-spacing: 1px;
  color: #8a7050;
  margin-top: 6px;
}
.consult-recipient {
  font-family: 'Special Elite', monospace;
  font-size: 11.5px;
  line-height: 19px;
  color: #5a4530;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--manila-shadow);
}
.consult-recipient-label {
  display: inline-block;
  width: 32px;
  font-weight: 700;
  color: #6a5538;
}
.consult-body {
  font-family: 'Crimson Text', serif;
  font-size: 15.5px;
  line-height: 25px;
  color: var(--ink-brown);
  white-space: pre-wrap;
  margin-bottom: 28px;
}
.consult-signature-block {
  margin: 24px 0 22px;
  padding-left: 6px;
  display: inline-block;
}
.consult-signature {
  font-family: 'Caveat', cursive;
  font-size: 30px;
  line-height: 32px;
  color: var(--margin-pen);
  margin-bottom: 4px;
  padding-right: 24px;
}
.consult-typed-name {
  font-family: 'Special Elite', monospace;
  font-size: 10.5px;
  letter-spacing: 1.5px;
  color: #5a4530;
  border-top: 1px solid var(--ink-brown);
  padding-top: 4px;
  display: inline-block;
  min-width: 220px;
}

/* The suggestion box reads as a stamped addendum to the letter —
   distinct from the body, with a stamped-on feel via the dashed border
   and the typewriter-stamp label. */
.consult-suggestion {
  margin-top: 26px;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.45);
  border: 2px dashed #8a6840;
  position: relative;
}
.consult-suggestion::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 18px;
  right: 18px;
  height: 1px;
  background: rgba(140, 110, 70, 0.5);
}
.consult-suggestion-label {
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 10px;
  letter-spacing: 3px;
  color: #6e5a30;
  margin-bottom: 6px;
}
.consult-suggestion-text {
  font-family: 'Crimson Text', serif;
  font-size: 19px;
  font-weight: 700;
  color: var(--ink-brown);
  letter-spacing: 0.3px;
}
.consult-suggestion-meta {
  font-family: 'Crimson Text', serif;
  font-size: 12.5px;
  font-style: italic;
  color: #6a5538;
  margin-top: 8px;
  line-height: 18px;
}

/* =================================================================
   HARLAN MEMO — sticky-note overlay for week-start moments
   ================================================================= */

.harlan-memo-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 18, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 260;
}
.harlan-memo {
  width: min(88vw, 480px);
  background: #f0e8c8;
  background-image:
    radial-gradient(ellipse at 90% 4%, rgba(180,140,80,0.10), transparent 55%),
    radial-gradient(ellipse at 8% 96%, rgba(140,100,60,0.07), transparent 50%);
  border: 1px solid rgba(140, 110, 70, 0.4);
  box-shadow:
    0 6px 16px rgba(20,25,18,0.30),
    0 14px 36px rgba(20,25,18,0.18),
    inset 0 0 0 1px rgba(255,255,255,0.5);
  padding: 26px 32px 22px;
  position: relative;
  /* a slight tilt so it reads as a note slid onto the desk */
  transform: rotate(-0.6deg);
}
.harlan-memo-header {
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--olive-dark);
  text-align: center;
  margin-bottom: 14px;
  border-bottom: 1px dashed var(--manila-shadow);
  padding-bottom: 8px;
}
.harlan-memo-body {
  font-family: 'Caveat', cursive;
  font-size: 19px;
  line-height: 26px;
  color: var(--margin-pen);
}
.harlan-memo-body p {
  margin: 0 0 12px;
}
.harlan-memo-body p:last-child {
  margin-bottom: 0;
}
.harlan-memo-close {
  margin-top: 16px;
  background: transparent;
  border: 1px solid var(--manila-shadow);
  color: #6a5538;
  font-family: 'Special Elite', monospace;
  font-size: 10.5px;
  letter-spacing: 1.5px;
  padding: 5px 14px;
  cursor: pointer;
  display: block;
  margin-left: auto;
  transition: background 0.15s, color 0.15s;
}
.harlan-memo-close:hover {
  background: var(--ink-brown);
  color: var(--manila);
}

/* Reset link at the bottom of the sidebar — quiet, italic, only
   noticed when looked for. Clicking it triggers a confirmation
   dialog and a localStorage clear. */
.reset-row {
  margin-top: 18px;
  text-align: center;
  font-size: 9.5px;
  color: #6a6038;
  letter-spacing: 1px;
}
#reset-link {
  font-family: 'Crimson Text', serif;
  font-style: italic;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  opacity: 0.6;
  transition: opacity 0.15s, color 0.15s;
}
#reset-link:hover {
  opacity: 1;
  color: var(--stamp-red);
}

/* =================================================================
   ENDGAME — closing scene, epilogue, archive
   ================================================================= */

.closing-overlay {
  position: fixed;
  inset: 0;
  z-index: 280;
  background: rgba(15, 18, 14, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  overflow-y: auto;
}

.closing-card {
  width: min(96vw, 720px);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  background-image:
    radial-gradient(ellipse at 75% 6%, rgba(180,150,100,0.10), transparent 60%),
    radial-gradient(ellipse at 18% 94%, rgba(140,100,60,0.07), transparent 50%);
  border: 1px solid rgba(140, 110, 70, 0.4);
  box-shadow:
    0 14px 38px rgba(20, 25, 18, 0.55),
    inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}
.archive-card {
  width: min(96vw, 980px);
}

.closing-header {
  padding: 22px 32px 16px;
  border-bottom: 2px double var(--ink-brown);
  flex-shrink: 0;
}
.closing-date {
  font-family: 'Special Elite', monospace;
  font-size: 10.5px;
  letter-spacing: 1.5px;
  color: #8a7050;
  margin-bottom: 6px;
}
.closing-title {
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 13px;
  letter-spacing: 3.5px;
  color: var(--olive-dark);
  line-height: 1.5;
}

.closing-body {
  flex: 1;
  overflow-y: auto;
  padding: 22px 36px 24px;
  font-family: 'Crimson Text', serif;
  font-size: 15.5px;
  line-height: 25px;
  color: var(--ink-brown);
}
.closing-body p {
  margin: 0 0 14px;
}
.closing-body p:last-child {
  margin-bottom: 0;
}

.closing-quote {
  margin: 18px 14px !important;
  padding: 14px 22px;
  font-family: 'Caveat', cursive;
  font-size: 19px;
  line-height: 28px;
  color: var(--margin-pen);
  background: rgba(184, 152, 96, 0.06);
  border-left: 3px solid var(--manila-shadow);
}

.closing-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 16px 32px 22px;
  border-top: 1px dashed var(--manila-shadow);
  flex-shrink: 0;
}
.closing-btn {
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 11px;
  letter-spacing: 2.5px;
  padding: 10px 20px;
  border: 1.5px solid var(--olive);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.closing-btn-primary {
  background: var(--olive);
  color: var(--manila);
}
.closing-btn-primary:hover {
  background: var(--olive-dark);
  border-color: var(--olive-dark);
}
.closing-btn-secondary {
  background: transparent;
  color: var(--olive-dark);
}
.closing-btn-secondary:hover {
  background: var(--olive);
  color: var(--manila);
}

/* Epilogue body — reads as more spacious than the closing scene
   because each page is a single character/case. */
.epilogue-card .closing-body p {
  margin-bottom: 16px;
}
.epilogue-progress {
  margin-left: auto;
  font-family: 'Special Elite', monospace;
  font-size: 10.5px;
  letter-spacing: 1.5px;
  color: #8a7050;
}

/* Archive table — paper-ledger feel. */
.archive-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 32px 24px;
}
.archive-intro,
.archive-outro {
  font-family: 'Crimson Text', serif;
  font-size: 14px;
  line-height: 22px;
  font-style: italic;
  color: #6a5538;
  margin: 0 0 16px;
}
.archive-outro {
  margin: 22px 0 0;
  text-align: center;
  letter-spacing: 0.5px;
}
.archive-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'Special Elite', monospace;
  font-size: 12.5px;
  line-height: 17px;
  color: var(--ink-brown);
}
.archive-table th {
  font-family: 'Stardos Stencil', sans-serif;
  font-size: 9.5px;
  letter-spacing: 2px;
  color: var(--olive-dark);
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1.5px solid var(--ink-brown);
  background: rgba(184, 152, 96, 0.08);
}
.archive-table td {
  padding: 12px 10px;
  border-bottom: 1px dashed var(--manila-shadow);
  vertical-align: top;
}
.archive-table tr:last-child td {
  border-bottom: none;
}
.arch-id {
  font-weight: 700;
  color: var(--olive-dark);
  white-space: nowrap;
}
.arch-name {
  font-family: 'Crimson Text', serif;
  font-size: 14px;
  font-weight: 600;
  line-height: 18px;
}
.arch-sub {
  font-family: 'Special Elite', monospace;
  font-size: 10.5px;
  font-weight: 400;
  color: #8a7050;
  letter-spacing: 0.3px;
}
.arch-day {
  white-space: nowrap;
  color: #6a5538;
}
.arch-det {
  font-family: 'Crimson Text', serif;
  font-size: 13.5px;
  font-style: italic;
  color: var(--ink-brown);
}
