/* ==========================================================
   THE DOOM FILE — design system
   A classified case file on a dark desk.
   Dark "desk" surfaces · cream "paper" for reading · red ink
   ========================================================== */

:root {
  /* desk (dark) */
  --desk: #0e0d0c;
  --desk-2: #171513;
  --desk-3: #221f1c;
  --line: #2e2a26;
  --fog: #8b8378;      /* muted text on desk */
  --bone: #ebe3d3;     /* primary text on desk */

  /* paper (light) */
  --paper: #ece4d3;
  --paper-2: #e2d8c4;
  --paper-line: #cdbfa6;
  --ink: #1d1a16;
  --ink-2: #5a5247;

  /* accents */
  --red: #c0352b;      /* stamp / ink red */
  --red-deep: #8f2219;
  --doom: #6f8a4a;     /* Doom green, used sparingly */
  --doom-deep: #2f3d22;
  --ok: #3f7a52;

  /* type */
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --type: "Special Elite", "Courier New", monospace;

  --r: 6px;
  --shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 18px 40px -18px rgba(0,0,0,.8);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tabs-h: 64px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--desk);
  color: var(--bone);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
/* film grain over everything */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 100;
  opacity: .07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
/* faint vignette */
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 99;
  background: radial-gradient(130% 90% at 50% 30%, transparent 60%, rgba(0,0,0,.35));
}

svg { width: 18px; height: 18px; flex: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }
em, i { font-style: italic; }

.app {
  max-width: 480px; margin: 0 auto; min-height: 100dvh;
  padding: 0 18px calc(var(--tabs-h) + var(--safe-b) + 24px);
  position: relative;
}
.app.no-tabs { padding-bottom: 0; }
.tabs[hidden] { display: none; }

/* ---------- type primitives ---------- */
.mono { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.fog { color: var(--fog); }
.redtx { color: var(--red); }
.h-display { font-family: var(--serif); font-weight: 500; font-size: 34px; line-height: 1.08; letter-spacing: -.01em; margin: 0; }
.h2 { font-family: var(--serif); font-weight: 500; font-size: 24px; line-height: 1.15; margin: 0; }

.stamp {
  display: inline-block; font-family: var(--type); color: var(--red);
  border: 2px solid currentColor; padding: 3px 10px 2px; border-radius: 3px;
  letter-spacing: .08em; text-transform: uppercase; font-size: 13px;
  transform: rotate(-3deg); opacity: .92;
  box-shadow: 0 0 0 1px rgba(192,53,43,.25) inset;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='40'%3E%3Cfilter id='r'%3E%3CfeTurbulence baseFrequency='.7' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -2.2 1.9'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23r)'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='40'%3E%3Cfilter id='r'%3E%3CfeTurbulence baseFrequency='.7' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -2.2 1.9'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23r)'/%3E%3C/svg%3E");
}
.stamp.big { font-size: 22px; padding: 6px 14px 4px; border-width: 3px; }
.stamp.green { color: var(--ok); box-shadow: none; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 16px) 0 10px;
}
.iconbtn {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%;
  color: var(--fog); border: 1px solid var(--line); background: var(--desk-2);
}
.iconbtn:active { transform: scale(.96); }
.iconbtn svg { width: 18px; height: 18px; }

/* ---------- buttons ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 54px; padding: 14px 18px; border-radius: var(--r);
  font-family: var(--mono); font-size: 13px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  background: var(--red); color: #fff4ee;
  box-shadow: 0 10px 24px -12px rgba(192,53,43,.7);
  transition: transform .12s ease, background .2s;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn.ghost { background: transparent; color: var(--bone); border: 1px solid var(--line); box-shadow: none; }
.btn.ink { background: var(--ink); color: var(--paper); box-shadow: none; }
.btn[disabled] { opacity: .35; pointer-events: none; }

/* ==========================================================
   WELCOME
   ========================================================== */
.welcome { min-height: 100dvh; display: flex; flex-direction: column; padding: calc(env(safe-area-inset-top,0px) + 28px) 0 calc(var(--safe-b) + 24px); }
.welcome .eyes { display: flex; justify-content: space-between; align-items: center; }
.welcome .lead { margin-top: 18vh; }
.welcome .lead p { font-size: 20px; line-height: 1.45; color: #d9d0bf; margin: 18px 0 0; }
.welcome .lead .h-display { font-size: 44px; }
.welcome .lead .h-display em { color: var(--red); font-style: italic; }
.welcome .spacer { flex: 1; }
.typed::after { content: "▍"; color: var(--red); animation: blink 1s steps(1) infinite; margin-left: 2px; }
@keyframes blink { 50% { opacity: 0; } }

.choice-list { display: grid; gap: 10px; margin: 22px 0 26px; }
.choice {
  display: flex; align-items: center; gap: 14px; text-align: left;
  padding: 14px 16px; border-radius: var(--r); border: 1px solid var(--line); background: var(--desk-2);
  transition: border-color .2s, background .2s;
}
.choice .yr { font-family: var(--mono); font-size: 11px; color: var(--fog); letter-spacing: .1em; margin-left: auto; }
.choice .dot { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--fog); flex: none; display: grid; place-items: center; }
.choice.on { border-color: var(--red); background: #241614; }
.choice.on .dot { border-color: var(--red); }
.choice.on .dot::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }

/* ==========================================================
   HOME
   ========================================================== */
.masthead { padding-top: 6px; }
.masthead .title { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-top: 10px; }
.masthead .h-display { font-size: 40px; }
.masthead .h-display span { display: block; font-size: 15px; font-family: var(--mono); letter-spacing: .2em; color: var(--fog); font-weight: 400; margin-bottom: 6px; }

.countdown {
  margin-top: 22px; display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; align-items: end;
  padding: 18px 0 20px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.countdown .num { font-family: var(--serif); font-size: 84px; line-height: .82; font-weight: 500; letter-spacing: -.03em; font-variant-numeric: lining-nums; }
.countdown .lbl { font-size: 19px; line-height: 1.25; padding-bottom: 4px; }
.countdown .lbl b { color: var(--red); font-weight: 500; font-style: italic; }
.countdown .sub { grid-column: 1 / -1; }

/* clearance meter */
.clearance { margin-top: 20px; padding: 16px; border-radius: var(--r); background: var(--desk-2); border: 1px solid var(--line); }
.clearance .row { display: flex; justify-content: space-between; align-items: baseline; }
.clearance .level { font-family: var(--serif); font-size: 22px; font-weight: 500; }
.clearance .pct { font-family: var(--mono); font-size: 13px; color: var(--bone); }
.meter { display: grid; grid-template-columns: repeat(20, 1fr); gap: 3px; margin: 12px 0 10px; }
.meter i { height: 14px; border-radius: 1px; background: var(--desk-3); }
.meter i.on { background: var(--red); }
.meter i.on.top { background: #e0574b; box-shadow: 0 0 10px rgba(224,87,75,.7); }
.levels { display: flex; justify-content: space-between; }
.levels span { font-family: var(--mono); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; color: #5b554d; }
.levels span.on { color: var(--fog); }
.levels span.cur { color: var(--red); }
.breakdown { display: flex; gap: 14px; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.breakdown div { flex: 1; }
.breakdown b { display: block; font-family: var(--serif); font-weight: 500; font-size: 18px; }

/* next-file card (paper) */
.nextfile {
  position: relative; display: block; text-align: left; width: 100%;
  margin-top: 22px; padding: 20px 18px 18px; border-radius: var(--r);
  background: var(--paper); color: var(--ink); box-shadow: var(--shadow);
}
.nextfile::before { /* folder tab */
  content: ""; position: absolute; top: -10px; left: 18px; width: 92px; height: 14px;
  background: var(--paper); border-radius: 6px 6px 0 0;
}
.nextfile .mono { color: var(--ink-2); }
.nextfile .h2 { font-size: 30px; margin: 8px 0 4px; }
.nextfile .meta { font-family: var(--mono); font-size: 11px; color: var(--ink-2); letter-spacing: .08em; }
.nextfile .go { margin-top: 16px; display: flex; align-items: center; justify-content: space-between; padding-top: 14px; border-top: 1px solid var(--paper-line); }
.nextfile .go .mono { color: var(--red); font-weight: 600; }
.nextfile .stamp { position: absolute; top: 16px; right: 14px; }

/* file list */
.section-h { display: flex; align-items: baseline; gap: 10px; margin: 32px 0 10px; }
.section-h .h2 { font-size: 20px; }
.filelist { display: grid; gap: 0; border-top: 1px solid var(--line); }
.filerow {
  display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 12px;
  padding: 14px 2px; border-bottom: 1px solid var(--line); text-align: left; width: 100%;
}
.filerow .n { font-family: var(--mono); font-size: 12px; color: var(--fog); }
.filerow .t { font-size: 18px; line-height: 1.2; }
.filerow .y { display: block; font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; color: var(--fog); text-transform: uppercase; margin-top: 3px; }
.filerow .st { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; }
.filerow.locked .t, .filerow.locked .n { color: #5b554d; }
.filerow.next .n { color: var(--red); }
.filerow.next .t::after { content: " ●"; color: var(--red); font-size: 10px; vertical-align: middle; }
.tick { color: var(--ok); }
.badge {
  display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 10px;
  letter-spacing: .1em; text-transform: uppercase; color: var(--fog);
}
.badge svg { width: 14px; height: 14px; }

.sealed {
  margin-top: 26px; padding: 18px; border-radius: var(--r); border: 1px dashed #4a2a25;
  background: repeating-linear-gradient(-45deg, transparent 0 10px, rgba(192,53,43,.05) 10px 20px);
  display: flex; gap: 14px; align-items: center;
}
.sealed .h2 { font-size: 19px; }

/* ==========================================================
   READER
   ========================================================== */
.reader { min-height: 100dvh; display: flex; flex-direction: column; }
.reader .topbar .mid { flex: 1; min-width: 0; text-align: center; }
.reader .topbar .mid .mono { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress { display: flex; gap: 4px; margin: 4px 0 16px; }
.progress i { flex: 1; height: 3px; border-radius: 2px; background: var(--desk-3); transition: background .3s; }
.progress i.on { background: var(--red); }

.stage { position: relative; flex: 1; display: flex; }
.card {
  position: relative; width: 100%; align-self: stretch;
  padding: 26px 22px 30px; border-radius: var(--r);
  background: var(--paper); color: var(--ink); box-shadow: var(--shadow);
  animation: cardIn .38s cubic-bezier(.2,.8,.2,1);
  display: flex; flex-direction: column;
}
.card.back { animation-name: cardInBack; }
@keyframes cardIn { from { opacity: 0; transform: translateX(28px) rotate(.6deg); } to { opacity: 1; transform: none; } }
@keyframes cardInBack { from { opacity: 0; transform: translateX(-28px) rotate(-.6deg); } to { opacity: 1; transform: none; } }
/* punched holes + rule like a case sheet */
.card::before {
  content: ""; position: absolute; left: 10px; top: 0; bottom: 0; width: 1px; background: rgba(192,53,43,.25);
}
.card .kicker { color: var(--ink-2); padding-bottom: 12px; border-bottom: 1px solid var(--paper-line); }
.card .h2 { font-size: 30px; line-height: 1.12; margin: 18px 0 14px; }
.card .body p { font-size: 19.5px; line-height: 1.58; margin: 0 0 14px; }
.card .body p:last-child { margin-bottom: 0; }

/* inline marks */
.who {
  font: inherit; color: inherit; font-weight: 600;
  background: linear-gradient(transparent 62%, rgba(192,53,43,.22) 62%);
  padding: 0 1px;
}
.who.seen { background: linear-gradient(transparent 62%, rgba(63,122,82,.22) 62%); }
.term { font: inherit; color: inherit; border-bottom: 1.5px dotted var(--red); }
.redact {
  font: inherit; color: transparent; background: var(--ink); border-radius: 2px; padding: 0 3px;
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
  position: relative; transition: color .4s, background .4s;
  animation: redactPulse 2.4s ease-in-out infinite;
}
.redact.open { color: var(--red-deep); background: transparent; animation: none; font-weight: 600; }
@keyframes redactPulse { 50% { box-shadow: 0 0 0 3px rgba(192,53,43,.18); } }
.hint { margin-top: auto; padding-top: 22px; color: var(--ink-2); display: flex; gap: 14px; flex-wrap: wrap; }
.hint span { display: inline-flex; align-items: center; gap: 6px; }
.hint .sw { width: 22px; height: 10px; display: inline-block; }

/* remember card */
.card.remember { background: #f3e6b8; }
.card.remember::before { background: rgba(0,0,0,.08); }
.card.remember .clip {
  position: absolute; top: -12px; right: 26px; width: 22px; height: 52px; border: 3px solid #8c8577; border-radius: 12px; border-bottom-color: transparent;
}
.card.remember ol { margin: 20px 0 0; padding: 0; list-style: none; counter-reset: r; }
.card.remember li { counter-increment: r; position: relative; padding-left: 42px; font-size: 20px; line-height: 1.5; margin-bottom: 18px; }
.card.remember li::before {
  content: counter(r, decimal-leading-zero); position: absolute; left: 0; top: 3px;
  font-family: var(--mono); font-size: 12px; color: var(--red); border: 1.5px solid var(--red); border-radius: 50%;
  width: 28px; height: 28px; display: grid; place-items: center;
}

/* cliffhanger card */
.card.cliff { background: #0b0a09; color: var(--bone); border: 1px solid var(--line); justify-content: center; }
.card.cliff::before { display: none; }
.card.cliff .q { font-size: 27px; line-height: 1.35; font-style: italic; font-weight: 400; margin: 0; }
.card.cliff .q::first-letter { color: var(--red); }
.card.cliff .nx { margin-top: 30px; color: var(--fog); }

.navrow { display: grid; grid-template-columns: 56px 1fr; gap: 10px; padding: 16px 0 calc(var(--safe-b) + 4px); }
.navrow .iconbtn { width: 56px; height: 54px; border-radius: var(--r); }
.tapzone { position: absolute; top: 0; bottom: 0; width: 22%; z-index: 2; }
.tapzone.l { left: 0; } .tapzone.r { right: 0; }

/* empty / in preparation */
.empty { margin-top: 18vh; text-align: center; }
.empty p { color: var(--fog); }

/* ==========================================================
   CASE CHECK
   ========================================================== */
.check .card { animation: cardIn .3s ease; }
.check .card.still { animation: none; }
.verdict { animation: fade .3s ease; }
.check .q { font-size: 25px; line-height: 1.25; margin: 18px 0 20px; font-weight: 500; }
.opts { display: grid; gap: 10px; }
.opt {
  display: flex; align-items: center; gap: 12px; text-align: left; width: 100%;
  padding: 14px 14px; border-radius: var(--r); border: 1.5px solid var(--paper-line); background: var(--paper-2);
  font-size: 18px; line-height: 1.3; color: var(--ink);
}
.opt .k { font-family: var(--mono); font-size: 11px; color: var(--ink-2); width: 24px; height: 24px; border: 1px solid var(--ink-2); border-radius: 50%; display: grid; place-items: center; flex: none; }
.opt.right { border-color: var(--ok); background: #d5e1cf; }
.opt.right .k { background: var(--ok); color: #fff; border-color: var(--ok); }
.opt.wrong { border-color: var(--red); background: #ecd2c9; }
.opt.wrong .k { background: var(--red); color: #fff; border-color: var(--red); }
.opt.dim { opacity: .45; }
.verdict { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--paper-line); display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start; }
.verdict p { margin: 0; font-size: 17px; line-height: 1.45; color: var(--ink-2); }

.result { text-align: center; justify-content: center; align-items: center; }
.result .score { font-family: var(--serif); font-size: 96px; line-height: 1; font-weight: 500; margin: 26px 0 6px; }
.result .score small { font-size: 40px; color: var(--ink-2); }

/* ==========================================================
   PEOPLE
   ========================================================== */
.page-h { padding-top: 6px; margin-bottom: 18px; }
.page-h .h-display { margin-top: 8px; }
.page-h p { color: var(--fog); margin: 8px 0 0; font-size: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dossier { text-align: left; background: var(--paper); color: var(--ink); border-radius: var(--r); padding: 8px 8px 12px; box-shadow: var(--shadow); position: relative; }
.dossier .ph { aspect-ratio: 3 / 4; border-radius: 3px; overflow: hidden; position: relative; background: var(--desk-3); }
.dossier .nm { font-size: 17px; font-weight: 500; line-height: 1.15; margin: 10px 4px 2px; }
.dossier .al { margin: 0 4px; font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }
.dossier.unknown { background: var(--desk-2); color: var(--fog); border: 1px dashed var(--line); box-shadow: none; }
.dossier.unknown .ph { background: repeating-linear-gradient(45deg, #1b1916 0 8px, #201d1a 8px 16px); }
.dossier .star { position: absolute; top: 14px; left: 14px; z-index: 2; }
.dossier .stamp { position: absolute; top: 16px; right: 14px; z-index: 2; font-size: 10px; padding: 2px 6px 1px; background: rgba(236,228,211,.85); }
.dossier.sealed-d { background: #161c10; color: var(--bone); border: 1px solid #2c3820; }
.dossier.sealed-d .stamp { position: static; color: #9bb374; background: none; font-size: 13px; transform: rotate(-8deg); }
.dossier.sealed-d .al { color: #8ea36b; }
.dossier.sealed-d .ph { background: radial-gradient(90% 70% at 50% 40%, #33422a, #0d1209); }
.dossier .bar { display: inline-block; width: 64px; height: .8em; background: #4b5f33; border-radius: 2px; vertical-align: -1px; }

.portrait { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; filter: grayscale(.85) contrast(1.1) sepia(.15); }
.portrait.char { filter: saturate(.85) contrast(1.05); }
/* the actor, in a small round inset on the character picture */
.actor-inset { position: absolute; right: 6px; bottom: 6px; width: 34%; aspect-ratio: 1; border-radius: 50%; overflow: hidden;
  border: 2px solid var(--paper); box-shadow: 0 2px 8px rgba(0,0,0,.45); background: var(--desk-3); z-index: 1; }
.actor-inset img, .actor-chip img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 25%; display: block; }
.who-row .actor-inset { display: none; }
.played { display: flex; align-items: center; gap: 10px; }
.actor-chip { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; flex: none; background: var(--desk-3); }
.mono-portrait { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--serif); font-size: 56px; font-weight: 500; color: rgba(255,255,255,.82); }
.mono-portrait::after { /* halftone */
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(0,0,0,.35) 1px, transparent 1.2px); background-size: 5px 5px; mix-blend-mode: multiply;
}
.tone-red { background: linear-gradient(160deg, #8f2219, #3a120e); }
.tone-blue { background: linear-gradient(160deg, #2c4a6e, #121d2c); }
.tone-gold { background: linear-gradient(160deg, #8a6a2a, #33270f); }
.tone-green { background: linear-gradient(160deg, #3f5e34, #17220f); }
.tone-grey { background: linear-gradient(160deg, #57524b, #1d1b18); }
.tone-doom { background: linear-gradient(160deg, #4b5f33, #0f140b); }
.qmark { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--type); font-size: 44px; color: #3d3833; }

/* ==========================================================
   TIMELINE
   ========================================================== */
.seg { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 999px; background: var(--desk-2); border: 1px solid var(--line); margin-bottom: 22px; }
.seg button { padding: 11px 8px; border-radius: 999px; font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--fog); }
.seg button.on { background: var(--bone); color: var(--ink); }
.tl { position: relative; padding-left: 26px; }
.tl::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(var(--red), var(--red-deep) 70%, transparent); }
.tl-item { position: relative; padding: 0 0 24px; }
.tl-item::before { /* pin */
  content: ""; position: absolute; left: -26px; top: 5px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--desk); border: 2px solid var(--red);
}
.tl-item.ess::before { background: var(--red); }
.tl-item.hot::before { background: var(--red); box-shadow: 0 0 0 6px rgba(192,53,43,.2), 0 0 18px rgba(192,53,43,.8); animation: pulse 1.8s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px rgba(192,53,43,.08), 0 0 26px rgba(192,53,43,.9); } }
.tl-item .y { font-family: var(--mono); font-size: 12px; letter-spacing: .12em; color: var(--red); }
.tl-item .t { font-size: 20px; line-height: 1.25; margin: 2px 0 3px; font-weight: 500; }
.tl-item .d { color: var(--fog); font-size: 16px; line-height: 1.4; }
.tl-item.soft .y::after { content: "  (approx.)"; color: var(--fog); letter-spacing: .05em; }
.prio { display: inline-block; margin-left: 8px; font-family: var(--mono); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; padding: 2px 6px; border-radius: 3px; border: 1px solid var(--line); color: var(--fog); vertical-align: 2px; }
.prio.Essential { border-color: var(--red); color: var(--red); }
.tl-sub { margin: 10px 0 16px; }

/* ==========================================================
   TERMS
   ========================================================== */
.termrow { border-bottom: 1px solid var(--line); }
.termrow summary { list-style: none; display: flex; justify-content: space-between; align-items: center; padding: 16px 2px; font-size: 19px; cursor: pointer; }
.termrow summary::-webkit-details-marker { display: none; }
.termrow summary::after { content: "+"; font-family: var(--mono); color: var(--red); font-size: 18px; transition: transform .2s; }
.termrow[open] summary::after { transform: rotate(45deg); }
.termrow p { margin: -4px 0 16px; color: #cfc6b5; font-size: 17px; }
.termrow .from { display: block; margin-top: 6px; }

/* ==========================================================
   BOTTOM TABS
   ========================================================== */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: grid; grid-template-columns: repeat(4, 1fr);
  max-width: 480px; margin: 0 auto;
  height: calc(var(--tabs-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: rgba(14,13,12,.92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; text-decoration: none; color: #6d665d; font-family: var(--mono); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; }
.tabs a svg { width: 20px; height: 20px; }
.tabs a.on { color: var(--bone); }
.tabs a.on svg { color: var(--red); }

/* ==========================================================
   BOTTOM SHEET (dossier / term popups)
   ========================================================== */
.sheet { position: fixed; inset: 0; z-index: 80; display: flex; align-items: flex-end; justify-content: center; }
.sheet[hidden] { display: none; }
.sheet .scrim { position: absolute; inset: 0; background: rgba(0,0,0,.6); animation: fade .2s ease; }
.sheet .panel {
  position: relative; width: 100%; max-width: 480px; max-height: 86dvh; overflow: auto;
  background: var(--paper); color: var(--ink); border-radius: 14px 14px 0 0;
  padding: 10px 20px calc(var(--safe-b) + 24px);
  animation: up .32s cubic-bezier(.2,.8,.2,1);
}
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--paper-line); margin: 0 auto 16px; }
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fade { from { opacity: 0; } }
.sheet .file-head { display: grid; grid-template-columns: 108px 1fr; gap: 16px; align-items: end; }
.sheet .file-head .ph { aspect-ratio: 3/4; position: relative; border-radius: 3px; overflow: hidden; }
.sheet .h2 { font-size: 28px; }
.sheet dl { margin: 18px 0 0; display: grid; grid-template-columns: 92px 1fr; gap: 10px 12px; border-top: 1px solid var(--paper-line); padding-top: 16px; }
.sheet dt { font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); padding-top: 4px; }
.sheet dd { margin: 0; font-size: 17px; line-height: 1.45; }
.sheet .termdef { font-size: 21px; line-height: 1.5; margin: 12px 0 10px; }

/* settings */
.settings .choice { background: var(--paper-2); border-color: var(--paper-line); color: var(--ink); }
.settings .choice.on { background: #ecd2c9; border-color: var(--red); }
.settings .choice .yr { color: var(--ink-2); }

/* ==========================================================
   ADDITIONS: personal notes, Night Of, backup
   ========================================================== */
.small { font-size: 15px !important; }
.welcome .lead p.small { margin-top: 22px; }

/* personal note card: a page from a notebook, taped into the file */
.card.personal {
  --hand: "Caveat", "Segoe Print", "Bradley Hand", cursive;
  background-color: #fbf6e9;
  background-image: repeating-linear-gradient(transparent 0 33px, rgba(70,110,170,.22) 33px 34px);
  background-position: 0 14px;
  transform: rotate(-.6deg); animation-name: noteIn;
}
.card.personal.back { animation-name: noteIn; }
@keyframes noteIn { from { opacity: 0; transform: translateY(14px) rotate(1.5deg); } to { opacity: 1; transform: rotate(-.6deg); } }
.card.personal::before { left: 34px; background: rgba(192,53,43,.35); }
.card.personal .tape {
  position: absolute; top: -12px; left: 50%; width: 110px; height: 28px; margin-left: -55px; transform: rotate(-3deg);
  background: rgba(214,200,160,.75); box-shadow: 0 1px 2px rgba(0,0,0,.2);
  -webkit-mask-image: linear-gradient(90deg, transparent 0 3px, #000 3px calc(100% - 3px), transparent 0);
}
.card.personal .kicker { color: var(--red); border-bottom: 0; padding-left: 26px; }
.card.personal .h2 { font-family: var(--hand); font-weight: 700; font-size: 38px; line-height: 1.05; margin: 14px 0 10px 26px; color: #1f2c4a; }
.card.personal .body { padding-left: 26px; }
.card.personal .body p { font-family: var(--hand); font-weight: 500; font-size: 25px; line-height: 34px; color: #1f2c4a; margin: 0 0 34px; }
.card.personal .body p:last-child { margin-bottom: 0; }
.card.personal em { font-style: normal; text-decoration: underline; text-decoration-thickness: 1px; }

/* Night Of checklist */
.checklist { display: grid; gap: 8px; margin: 16px 0 6px; }
.todo { display: grid; grid-template-columns: 28px 1fr; gap: 12px; align-items: start; text-align: left; padding: 12px 14px; border-radius: var(--r); background: var(--desk-2); border: 1px solid var(--line); font-size: 16.5px; line-height: 1.4; }
.todo .box { width: 24px; height: 24px; border-radius: 4px; border: 1.5px solid var(--fog); display: grid; place-items: center; color: transparent; }
.todo .box svg { width: 16px; height: 16px; }
.todo.on { border-color: #3c5228; }
.todo.on .box { background: var(--ok); border-color: var(--ok); color: #fff; }
.todo.on span:last-child { color: var(--fog); text-decoration: line-through; text-decoration-color: rgba(139,131,120,.6); }

/* home: unlocked night card */
.nightcard {
  display: block; width: 100%; text-align: left; margin-top: 26px; padding: 20px 18px; border-radius: var(--r);
  background: linear-gradient(160deg, #2a3a1d, #121a0c); border: 1px solid #3c5228; color: var(--bone);
  box-shadow: 0 0 40px -18px rgba(111,138,74,.8);
}
.nightcard .mono { color: #9bb374; }
.nightcard .h2 { font-size: 26px; margin: 6px 0 4px; }
.nightcard .sub { font-size: 15px; color: #c7cfb9; }
.nightcard .go { margin-top: 14px; padding-top: 12px; border-top: 1px solid #3c5228; display: flex; justify-content: space-between; align-items: center; }

/* people extras */
.film { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; padding: 3px 8px; border-radius: 3px; border: 1px solid var(--ink-2); }
.film.confirmed { color: var(--ok); border-color: var(--ok); }
.film.possible { color: #9a6b12; border-color: #9a6b12; }
.film.no { color: var(--ink-2); }

/* settings */
.settings .sp { font-size: 16px; color: var(--ink-2); margin: 0 0 12px; line-height: 1.45; }
.settings .code {
  width: 100%; min-height: 76px; resize: vertical; margin-bottom: 10px; padding: 10px;
  font-family: var(--mono); font-size: 11px; line-height: 1.4; word-break: break-all;
  background: var(--paper-2); border: 1px solid var(--paper-line); border-radius: var(--r); color: var(--ink);
}
.btn.ghost-ink { background: transparent; color: var(--red-deep); border: 1.5px solid var(--red); box-shadow: none; }
#restoreMsg { color: var(--red-deep); margin-top: 8px; }

/* THE NIGHT OF */
.night { padding-bottom: calc(var(--safe-b) + 40px); }
.night-hero { padding: 26px 0 10px; }
.night-hero .h-display { font-size: 46px; margin-top: 18px; }
.night-hero p { font-size: 18px; color: #d4cbba; }
.letter { margin: 18px 0 0; padding: 22px 20px; border-radius: var(--r); background: var(--paper); color: var(--ink); box-shadow: var(--shadow); }
.letter p { font-size: 19px; line-height: 1.55; margin: 12px 0 0; }
.facts { display: grid; grid-template-columns: 96px 1fr; gap: 10px 14px; margin: 0; border-top: 1px solid var(--line); padding-top: 14px; }
.facts dt { font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--fog); padding-top: 4px; }
.facts dd { margin: 0; font-size: 17px; line-height: 1.4; }
.tips { list-style: none; padding: 0; margin: 0; counter-reset: t; }
.tips li { counter-increment: t; position: relative; padding: 0 0 18px 44px; }
.tips li::before {
  content: counter(t, decimal-leading-zero); position: absolute; left: 0; top: 2px; width: 30px; height: 30px; border-radius: 50%;
  border: 1.5px solid var(--red); color: var(--red); font-family: var(--mono); font-size: 12px; display: grid; place-items: center;
}
.tips b { display: block; font-weight: 500; font-size: 19px; }
.tips span { color: var(--fog); font-size: 16px; }
.who-group { margin-bottom: 18px; }
.who-group > .mono { padding: 4px 0 8px; }
.who-row { display: grid; grid-template-columns: 54px 1fr; gap: 12px; align-items: center; width: 100%; text-align: left; padding: 8px 0; border-bottom: 1px solid var(--line); }
.who-row .ph { position: relative; width: 54px; height: 54px; border-radius: 50%; overflow: hidden; background: var(--desk-3); }
.who-row .mono-portrait { font-size: 18px; }
.who-row b { font-weight: 500; font-size: 17px; }
.who-row .ln { display: block; color: var(--fog); font-size: 14.5px; line-height: 1.35; }
.watch { list-style: none; padding: 0; margin: 0; }
.watch li { padding: 12px 0; border-bottom: 1px solid var(--line); display: grid; gap: 2px; }
.watch b { font-weight: 500; font-size: 18px; }
.watch span:last-child { color: var(--fog); font-size: 15.5px; }
.sign { text-align: center; margin-top: 36px; }

@media (min-width: 520px) {
  body { background: radial-gradient(80% 60% at 50% 0%, #1b1815, var(--desk)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* tappable case number */
.caseno { background: none; border: 0; padding: 0; cursor: pointer;
  font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--fog);
  text-decoration: underline dotted; text-underline-offset: 4px; text-decoration-color: rgba(255,255,255,.35); }
.sheet .casebody p { font-size: 19px; line-height: 1.55; margin: 12px 0 0; }

/* in-panel confirm (instead of a browser popup) */
.confirm { border: 1.5px dashed var(--red); border-radius: var(--r); padding: 12px 14px 14px; animation: confirmIn .25s ease; }
.confirm .sp { margin: 0 0 12px; }
.confirm-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn.danger { background: var(--red); color: #fff; border: 0; }
@keyframes confirmIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
