/* base.css (owner: foundation). Global: tokens, the Sakuga guard block, typography, layout and the shared components.
   Every other stylesheet scopes its selectors under its own sections (BUILD-PLAN §4). Class vocabulary: site/CONTRACT.md.
   Light only (SPEC 2.1): every colour is a token on bare :root; there is no prefers-color-scheme block on purpose. */

/* ───────── 2.2 palette ───────── */
:root {
  color-scheme: light;
  --paper: #ffffff;
  --board: #f7f6ff;
  --tone: #e4e1fb;
  --rule: #dcdaf0;
  --ink: #1d1a4a;
  --muted: #5b5689;
  --line: #5a4fd8;
  --soft: #b8b3ff;
  --pri: #8f8df7;
  --wash: #efedff;
  --pink: #ff5fa8;
  --pink-ink: #c4166f;
  --tape: #ffd84a;
  --on-ink: #ffffff;

  /* patterns (hard stops only) */
  --hatch: repeating-linear-gradient(135deg, var(--wash) 0 6px, var(--paper) 6px 12px);
  --tone-dots: radial-gradient(var(--tone) 1.2px, transparent 1.4px) 0 0 / 10px 10px;

  /* 2.4 font stacks */
  --font-display: "Dela Gothic One", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", system-ui, sans-serif;
  --font-head: "Nunito", "Avenir Next", system-ui, sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* 2.5 type scale */
  --fs-cover: clamp(40px, 11vw, 96px);
  --fs-h2: clamp(28px, 7vw, 52px);
  --fs-kicker: 14px;
  --fs-h3: clamp(19px, 4.6vw, 24px);
  --fs-body: 16px;
  --fs-small: 13.5px;
  --fs-mono: 13.5px;
  --fs-mono-table: 14px;
  --fs-big: clamp(30px, 8vw, 56px);
  --fs-stamp: 17px;

  /* layout */
  --hud-h: 52px;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  --maxw: 1120px;
  --shadow: 6px 7px 0 var(--soft);
  --shadow-sm: 3px 4px 0 var(--soft);
  --panel-bw: 3px;
  --r: 15px;
}

/* ───────── 2.3 --sk-* overrides (exact) ───────── */
:root{
  --sk-ink:#1d1a4a; --sk-card:#ffffff; --sk-pri:#8f8df7; --sk-pri-ink:#1d1a4a; --sk-on-pri:#ffffff;
  --sk-acc:#ff5fa8; --sk-fill:#ff5fa8; --sk-soft:#b8b3ff; --sk-dim:#5b5689; --sk-track:#c9cbe0;
  --sk-r:15px; --sk-bw:3.2px; --sk-sh:6px 7px 0 #b8b3ff;
  --sk-slider-width:100%; --sk-progress-width:min(100%,420px); --sk-input-width:100%;
}
/* engine guard block: required */
html,body{overflow-x:clip}                       /* clip, not hidden: hidden would break the sticky HUD */
sakuga-slider,sakuga-progress,sakuga-input{display:block;width:100%}   /* else the inline-block host collapses to 0 width */
sakuga-toggle{margin:89px 21px 20px}             /* keep its splash room; never override smaller */
sakuga-tooltip{vertical-align:middle}
sakuga-tooltip::part(button){width:44px;height:44px}   /* the help button is 42px by default; 44px meets the tap-target rule */

/* ───────── base elements ───────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; background: var(--paper); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--fs-body)/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
@media (min-width: 900px) { body { font-size: 17px; } }
h1, h2, h3, h4 { margin: 0; color: var(--ink); text-wrap: balance; }
h1 { font: italic 400 var(--fs-cover)/0.95 var(--font-display); letter-spacing: -0.01em; }
h2 { font: italic 400 var(--fs-h2)/1.05 var(--font-display); letter-spacing: -0.005em; }
h3 { font: italic 900 var(--fs-h3)/1.2 var(--font-head); }
h4 { font: italic 900 17px/1.25 var(--font-head); }
p, figure, blockquote, dl, dd { margin: 0; }
ul, ol { margin: 0; padding-left: 1.25em; }
li + li { margin-top: 0.3em; }
a { color: var(--line); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2.5px; }
strong, b { font-weight: 600; }
button { font: inherit; color: inherit; }
code, kbd, .mono { font-family: var(--font-mono); font-weight: 500; font-variant-numeric: tabular-nums; }
code, .mono { font-size: 0.86em; }
small, .small { font: 500 var(--fs-small)/1.45 var(--font-body); color: var(--muted); }
.muted { color: var(--muted); }
.big { font: italic 400 var(--fs-big)/1 var(--font-display); letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
::selection { background: var(--soft); color: var(--ink); }
[hidden] { display: none !important; }

/* focus: one ring everywhere (Sakuga's own matches) */
:focus-visible { outline: 2.5px solid var(--pink); outline-offset: 3px; }
[tabindex="-1"]:focus:not(:focus-visible) { outline: none; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ───────── layout ───────── */
/* .page is the ONLY element that sets side gutters. */
.page { padding-left: var(--gutter-l); padding-right: var(--gutter-r); }
.page > main, .page > footer { display: block; max-width: var(--maxw); margin-inline: auto; }
.chapter { position: relative; margin-top: clamp(56px, 10vw, 112px); scroll-margin-top: 72px; }   /* margin, not padding: a jump lands the title card just under the HUD */
main > .chapter:first-child { margin-top: 24px; }
main [id], footer[id], footer [id], #main { scroll-margin-top: 72px; }
/* full-bleed band inside main/footer: background reaches the screen edges, content stays on the column */
.bleed { margin-inline: calc(50% - 50vw); padding-inline: calc(50vw - 50%); }
.band { background: var(--board); }
.band--tone { background: var(--tone-dots), var(--board); }
.stack > * + * { margin-top: var(--stack, 16px); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap, 8px 10px); }
.center { text-align: center; }
.lede { font-size: 1.12em; line-height: 1.55; max-width: 62ch; }
.measure { max-width: 68ch; }
.outro { display: grid; gap: 30px; margin-top: clamp(40px, 6vw, 64px); }

/* ───────── kicker + episode title card ───────── */
.kicker {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px;
  font: italic 900 var(--fs-kicker)/1.25 var(--font-head); letter-spacing: 0.04em; text-transform: uppercase; color: var(--line);
}
.kicker__ja { font: 400 var(--fs-kicker)/1.25 var(--font-display); letter-spacing: 0.04em; color: var(--ink); text-transform: none; }

.title-card {
  position: relative; isolation: isolate;
  margin: 0 0 clamp(26px, 4vw, 44px);
  padding: clamp(18px, 3.2vw, 30px) clamp(16px, 4vw, 40px) clamp(40px, 6vw, 64px) clamp(14px, 3.4vw, 34px);
}
.title-card__frame { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -3; overflow: visible; filter: drop-shadow(6px 7px 0 var(--soft)); }
.title-card__frame polygon { fill: var(--paper); stroke: var(--ink); stroke-width: 3px; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.title-card__tone {
  position: absolute; z-index: -2; top: 3px; right: 3px; width: 52%; height: 64%;
  background: linear-gradient(104deg, var(--paper) 0 26%, transparent 26.2%), var(--tone-dots);
}
.title-card__lines { position: absolute; z-index: -1; top: 3px; right: 3px; width: 50%; height: 64%; overflow: hidden; }
.title-card__lines path { fill: var(--ink); }
.title-card__body { position: relative; display: flex; align-items: flex-start; gap: clamp(12px, 2.6vw, 22px); }
.title-card__badge {
  flex: none; writing-mode: vertical-rl; text-orientation: upright;
  font: 400 clamp(19px, 4.6vw, 27px)/1 var(--font-display); letter-spacing: 0.06em;
  padding: 10px 8px; background: var(--ink); color: var(--on-ink);
  rotate: -4deg; box-shadow: 4px 4px 0 var(--pink);
  margin-top: 2px;
}
.title-card__text { min-width: 0; display: grid; gap: 10px; padding-top: 2px; }
.title-card .kicker, .title-card__h, .title-card__sub {
  /* a paper outline keeps type readable where it crosses the speed lines */
  text-shadow: 2px 0 var(--paper), -2px 0 var(--paper), 0 2px var(--paper), 0 -2px var(--paper), 1.5px 1.5px var(--paper), -1.5px -1.5px var(--paper), 1.5px -1.5px var(--paper), -1.5px 1.5px var(--paper);
}
.title-card__h { font: italic 400 var(--fs-h2)/1.05 var(--font-display); overflow-wrap: break-word; }
.title-card__sub { font: 500 var(--fs-small)/1.45 var(--font-body); color: var(--muted); max-width: 60ch; }

/* ───────── manga panels ───────── */
.panels { display: grid; gap: 14px; }
@media (min-width: 800px) { .panels--2 { grid-template-columns: 1fr 1fr; } .panels--3 { grid-template-columns: repeat(3, 1fr); } }
.panel { position: relative; background: var(--paper); border: var(--panel-bw) solid var(--ink); box-shadow: var(--shadow); }
.panel__body { position: relative; padding: clamp(14px, 3vw, 22px); }
.panel--cut { isolation: isolate; border: 0; background: transparent; box-shadow: none; }
.panel__frame { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; overflow: visible; filter: drop-shadow(6px 7px 0 var(--soft)); }
.panel__frame polygon { fill: var(--paper); stroke: var(--ink); stroke-width: 3px; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.panel--cut-right .panel__body { padding-right: max(22px, 8%); }
.panel--cut-left .panel__body { padding-left: max(22px, 8%); }
.panel--cut-bottom .panel__body { padding-bottom: max(26px, 6%); }
.panel--tone { background: var(--tone-dots), var(--paper); }
.panel__tab {
  position: absolute; top: -14px; left: 14px; z-index: 1;
  display: inline-flex; align-items: center; height: 26px; padding: 0 10px;
  background: var(--ink); color: var(--on-ink); font: 700 13px/1 var(--font-mono); letter-spacing: 0.02em;
}

/* ───────── Nib's narrator box ───────── */
.nib-box {
  position: relative; max-width: 780px; margin-top: 18px;
  padding: 24px 20px 18px; background: var(--paper);
  border: 2.5px solid var(--ink); box-shadow: var(--shadow);
}
.nib-box__tab {
  position: absolute; top: -16px; left: 14px; display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 13px 0 3px; background: var(--ink); color: var(--on-ink);
  font: italic 900 14px/1 var(--font-head); letter-spacing: 0.12em; rotate: -2deg;
}
.nib-box__face { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--paper); overflow: hidden; }
.nib-box__face svg { display: block; width: 24px; height: 24px; color: var(--ink); }
.nib-box__text { font: 500 16.5px/1.55 var(--font-body); }
.nib-box::after { /* the visual-novel "next" mark */
  content: ""; position: absolute; right: 14px; bottom: 10px;
  border-left: 7px solid transparent; border-right: 7px solid transparent; border-top: 9px solid var(--pink);
}

/* ───────── CASE NOTE strip ───────── */
.case-note { position: relative; padding: 14px 16px 16px; background: var(--board); border-block: 3px solid var(--ink); }
.case-note::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 10px; background: var(--tone-dots), var(--tone); }
.case-note__head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 0 0 12px 6px; }
.case-note__title { display: inline-block; padding: 6px 10px 5px; background: var(--ink); color: var(--on-ink); font: 400 15px/1 var(--font-display); letter-spacing: 0.06em; rotate: -2deg; }
.case-note__key { display: flex; flex-wrap: wrap; gap: 4px 14px; font: 600 12.5px/1.3 var(--font-body); color: var(--muted); }
.case-note__k { display: inline-flex; align-items: center; gap: 5px; }
.case-note__k .cn-mark { width: 19px; height: 19px; font-size: 12px; border-width: 1.5px; }
.case-note__list { list-style: none; margin: 0 0 0 6px; padding: 0; display: grid; gap: 10px; }
@media (min-width: 900px) { .case-note__list { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px 22px; } }
.case-note__item { display: flex; align-items: flex-start; gap: 10px; margin: 0; font: 500 15px/1.45 var(--font-body); }
.case-note__empty { margin-left: 6px; font: 500 15px/1.45 var(--font-body); color: var(--muted); }
.cn-mark {
  flex: none; display: inline-grid; place-items: center; width: 25px; height: 25px; margin-top: -1px;
  border: 2px solid var(--ink); border-radius: 50%; font: 900 14px/1 var(--font-head); color: var(--ink); background: var(--paper);
}
.cn-mark[data-mark="proven"] { background: var(--line); color: var(--on-ink); }
.cn-mark[data-mark="consistent"] { background: var(--hatch); }
.cn-mark[data-mark="unknown"] { border-style: dashed; }

/* ───────── badges, chain chips, plates, time ───────── */
.badge {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px; flex: none;
  border: 2px solid var(--ink); border-radius: 6px; background: var(--paper); color: var(--ink);
  font: italic 900 12px/1 var(--font-head); letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap; vertical-align: middle;
}
.badge--chain { background: var(--line); color: var(--on-ink); }
.badge--analyst { background: repeating-linear-gradient(135deg, var(--tone) 0 3px, var(--paper) 3px 6px); }
.badge--said { /* ink long-dash outline */
  border: 0; padding: 0 10px; border-radius: 0;
  background:
    linear-gradient(90deg, var(--ink) 0 9px, transparent 9px) 0 0 / 14px 2px repeat-x,
    linear-gradient(90deg, var(--ink) 0 9px, transparent 9px) 0 100% / 14px 2px repeat-x,
    linear-gradient(180deg, var(--ink) 0 9px, transparent 9px) 0 0 / 2px 14px repeat-y,
    linear-gradient(180deg, var(--ink) 0 9px, transparent 9px) 100% 0 / 2px 14px repeat-y,
    var(--paper);
}
.badge--cant { border-style: dashed; border-color: var(--muted); }
.chain {
  display: inline-flex; align-items: center; height: 22px; padding: 0 6px; flex: none;
  border: 1.5px solid var(--ink); border-radius: 4px; background: var(--board); color: var(--ink);
  font: 700 12px/1 var(--font-mono); letter-spacing: 0.04em; vertical-align: middle;
}
.plate {
  display: inline-flex; align-items: center; height: 26px; padding: 0 12px; flex: none;
  background: var(--ink); color: var(--on-ink); transform: skewX(-10deg);
  font: italic 900 13px/1 var(--font-head); letter-spacing: 0.07em; text-transform: uppercase; white-space: nowrap;
}
.plate__text { display: inline-block; transform: skewX(10deg); }
.plate[data-plate="operator"] { background: var(--paper); color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.plate[data-plate="analyst"] { background: var(--line); }
.plate[data-plate="press"] { background: var(--muted); }
.when { font: 700 var(--fs-mono)/1.2 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink); }
.when__date, .when__time { white-space: nowrap; }
.when__utc { font-weight: 500; font-size: 12px; color: var(--muted); white-space: nowrap; }
.addr { font-family: var(--font-mono); font-weight: 500; overflow-wrap: anywhere; }
.addr--full { word-break: break-all; }
.unlinked { font-family: var(--font-mono); font-weight: 500; font-size: 0.86em; color: var(--ink); border-bottom: 1.5px dotted var(--muted); }
.asof {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px; min-height: 28px;
  border: 2px solid var(--ink); border-radius: 999px; background: var(--board);
  font: 600 13px/1.25 var(--font-body); color: var(--ink);
}
.asof__dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--pink); box-shadow: 0 0 0 2px var(--ink); }

/* ───────── the two voices ───────── */
/* on-chain: block card, violet 4px left rule, mono UTC time, chain chip */
.block {
  position: relative; padding: 13px 14px 14px 20px; background: var(--paper);
  border: 2px solid var(--ink); border-radius: 4px 12px 12px 4px; box-shadow: 4px 5px 0 var(--soft);
}
.block::before { content: ""; position: absolute; left: 6px; top: 10px; bottom: 10px; width: 4px; border-radius: 2px; background: var(--line); }
.block__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-bottom: 7px; }
.block__title { font: italic 900 17.5px/1.25 var(--font-head); margin-bottom: 4px; }
.block__body { font-size: 15.5px; line-height: 1.55; }
.block__body > p + p { margin-top: 8px; }
.block__proofs { margin-top: 11px; }

/* statements: speech bubble, ink outline, a tail, speaker as a text plate */
.bubble { position: relative; display: grid; gap: 15px; align-content: start; }
.bubble__who { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 9px; padding-left: 4px; }
.bubble__balloon {
  position: relative; padding: 14px 18px 15px; background: var(--paper);
  border: 2.5px solid var(--ink); border-radius: 26px / 22px; box-shadow: 5px 6px 0 var(--soft);
}
.bubble__balloon::before, .bubble__balloon::after { content: ""; position: absolute; width: 0; height: 0; transform: skewX(34deg); transform-origin: bottom; }
.bubble__balloon::before { top: -19px; left: 26px; border-left: 11px solid transparent; border-right: 11px solid transparent; border-bottom: 19px solid var(--ink); }
.bubble__balloon::after { top: -12.5px; left: 30.5px; border-left: 6.5px solid transparent; border-right: 6.5px solid transparent; border-bottom: 14.5px solid var(--paper); }
.bubble__title { font: italic 900 17.5px/1.25 var(--font-head); margin-bottom: 4px; }
.bubble__body { font-size: 15.5px; line-height: 1.55; }
.bubble__body > p + p { margin-top: 8px; }
.bubble__proofs { margin-top: 11px; }

/* ───────── proof links ───────── */
.proofs { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 8px; min-width: 0; max-width: 100%; }
.proof {
  position: relative; display: inline-flex; align-items: center; gap: 5px; min-width: 0; max-width: 100%; min-height: 34px;
  padding: 3px 10px 3px 4px; vertical-align: middle;
  border: 2px solid var(--ink); border-radius: 10px; background: var(--paper); color: var(--ink);
  box-shadow: 3px 3px 0 var(--soft); text-decoration: none;
  font: 600 13px/1.2 var(--font-body);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: box-shadow 0.12s, translate 0.12s;
}
.proof::after { content: ""; position: absolute; inset: -6px -3px; }   /* 44px tall hit area */
a.proof:hover { translate: -1px -1px; box-shadow: 4px 4px 0 var(--soft); }
a.proof:active { translate: 2px 2px; box-shadow: 1px 1px 0 var(--soft); }
.proof__kind {
  flex: none; display: inline-flex; align-items: center; height: 22px; padding: 0 6px; border-radius: 6px;
  background: var(--ink); color: var(--on-ink); font: italic 900 12px/1 var(--font-head); letter-spacing: 0.05em;
}
.proof[data-kind="address"] .proof__kind, .proof[data-kind="token"] .proof__kind { background: var(--line); }
.proof[data-kind="post"] .proof__kind { background: var(--paper); color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.proof[data-kind="docs"] .proof__kind, .proof[data-kind="article"] .proof__kind, .proof[data-kind="analyst"] .proof__kind { background: var(--wash); color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.proof__site { flex: none; font: italic 800 13px/1.2 var(--font-head); color: var(--muted); }
/* chips with a mono short id (tx, address, token): when one runs out of room, the explorer name gives way first (ellipsis)
   so the id stays on one line; the full URL is in the title. Text labels (posts, docs, articles) wrap at spaces instead. */
.proof:is([data-kind="tx"], [data-kind="address"], [data-kind="token"]) .proof__site { flex: 0 1000 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proof__label { min-width: 0; overflow-wrap: break-word; }
.proof__label.mono { font: 500 13px/1.2 var(--font-mono); overflow-wrap: anywhere; }
.proof__go { flex: none; font: 900 15px/1 var(--font-head); color: var(--line); }
.proof--none {
  gap: 7px; padding: 5px 11px; min-height: 34px; border: 2px dashed var(--muted); background: var(--paper);
  box-shadow: none; color: var(--muted); font: 500 13px/1.3 var(--font-body); cursor: default;
}
.proof--none::after { content: none; }
.proof__none { font: 700 14px/1 var(--font-mono); }
.proof--cant { border-color: var(--ink); color: var(--ink); font: italic 800 12.5px/1.3 var(--font-head); letter-spacing: 0.02em; }

/* ───────── jump chips ───────── */
.chip {
  position: relative; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 15px;
  border: 2.5px solid var(--ink); border-radius: 999px; background: var(--paper); color: var(--ink);
  box-shadow: 3px 4px 0 var(--soft); text-decoration: none; white-space: nowrap;
  font: italic 800 14.5px/1 var(--font-head);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: box-shadow 0.12s, translate 0.12s;
}
.chip::after { content: ""; position: absolute; inset: -5px -3px; }   /* 44px tall hit area */
.chip:hover { translate: 0 -1px; box-shadow: 4px 5px 0 var(--soft); }
.chip:active { translate: 2px 2px; box-shadow: 1px 2px 0 var(--soft); }
.chips { display: flex; flex-wrap: wrap; gap: 12px 10px; }

/* ───────── evidence tents ───────── */
.tent {
  position: relative; display: inline-flex; align-items: center; gap: 6px; min-width: 44px; min-height: 44px;
  margin: 0; padding: 4px 10px 4px 4px; border: 0; border-radius: 12px; background: transparent; color: var(--ink);
  font: italic 800 13.5px/1.15 var(--font-head); text-align: left; cursor: pointer; vertical-align: middle;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.tent:hover { background: var(--board); }
.tent__art { flex: none; display: inline-grid; place-items: center; min-width: 34px; }
.tent__art svg { display: block; width: 34px; height: auto; }
.tent__label { text-decoration: underline dotted 1.5px; text-underline-offset: 3px; }
.tent--compact { justify-content: center; padding: 4px; }
.tents { display: inline-flex; flex-wrap: wrap; gap: 0 2px; vertical-align: middle; }
.tent__fallback {
  display: grid; place-items: center; width: 30px; height: 26px; border: 2px solid var(--ink); border-radius: 5px 5px 2px 2px;
  background: var(--tape); font: 400 13px/1 var(--font-display);
}

/* ───────── rubber stamps (SPEC 4.6 / 6.4) ───────── */
.stamp {
  position: relative; display: inline-flex; align-items: center; justify-content: center; vertical-align: middle;
  max-width: 100%; padding: 7px 15px 6px; rotate: -6deg;
  font: 400 var(--fs-stamp)/1.05 var(--font-display); letter-spacing: 0.03em; text-transform: uppercase; text-align: center;
  color: var(--ink); background: var(--paper); border: 2.5px solid var(--ink);
  cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.stamp__text { position: relative; z-index: 1; }
.stamp[data-size="sm"] { --fs-stamp: 14px; padding: 5px 11px 4px; }
.stamp[data-size="xl"] { --fs-stamp: clamp(19px, 4.9vw, 30px); padding: 16px 24px 14px; min-height: 3.6em; width: min(100%, 30rem); }
/* VERIFIED: double-outline pill */
.stamp--verified { border-radius: 999px; background: var(--wash); box-shadow: inset 0 0 0 3px var(--wash), inset 0 0 0 5px var(--ink); padding-inline: 20px; }
/* CONSISTENT / FITS: double-outline square */
.stamp--holds { border-radius: 3px; background: var(--wash); box-shadow: inset 0 0 0 3px var(--wash), inset 0 0 0 5px var(--ink); padding-inline: 18px; }
.stamp--verified[data-size="sm"], .stamp--holds[data-size="sm"] { box-shadow: inset 0 0 0 2.5px var(--wash), inset 0 0 0 4px var(--ink); }
.stamp--verified[data-size="xl"], .stamp--holds[data-size="xl"] { box-shadow: inset 0 0 0 5px var(--wash), inset 0 0 0 8px var(--ink); }
/* UNVERIFIED / CAN'T BE CHECKED / STILL OPEN …: dashed outline, paper fill */
.stamp--open { border-style: dashed; border-radius: 4px; }
.stamp--open[data-size="xl"] { border-width: 3.5px; }
/* INCOMPLETE: notched corners (hard-stop CSS backgrounds + edge strokes, no clip-path, no mask) */
.stamp--incomplete {
  --n: 11px; --bw: 2.5px; border: 0; border-radius: 0;
  background:
    linear-gradient(135deg, transparent calc(var(--n) * 0.7071 - 0.6px), var(--ink) 0 calc(var(--n) * 0.7071 + var(--bw) - 0.4px), var(--paper) 0) top left / 51% 51% no-repeat,
    linear-gradient(225deg, transparent calc(var(--n) * 0.7071 - 0.6px), var(--ink) 0 calc(var(--n) * 0.7071 + var(--bw) - 0.4px), var(--paper) 0) top right / 51% 51% no-repeat,
    linear-gradient(315deg, transparent calc(var(--n) * 0.7071 - 0.6px), var(--ink) 0 calc(var(--n) * 0.7071 + var(--bw) - 0.4px), var(--paper) 0) bottom right / 51% 51% no-repeat,
    linear-gradient(45deg, transparent calc(var(--n) * 0.7071 - 0.6px), var(--ink) 0 calc(var(--n) * 0.7071 + var(--bw) - 0.4px), var(--paper) 0) bottom left / 51% 51% no-repeat;
  padding: 9px 18px 8px;
}
.stamp--incomplete::before, .stamp--incomplete::after { content: ""; position: absolute; pointer-events: none; }
.stamp--incomplete::before { inset: 0 var(--n); border-block: var(--bw) solid var(--ink); }
.stamp--incomplete::after { inset: var(--n) 0; border-inline: var(--bw) solid var(--ink); }
.stamp--incomplete[data-size="sm"] { --n: 8px; padding: 6px 13px 5px; }
.stamp--incomplete[data-size="xl"] { --n: 16px; --bw: 3.5px; padding: 18px 28px 16px; }
/* DISPUTED / NOT KEPT / CONTRADICTED / OUT OF DATE / DOESN'T FIT: ink fill, crossed corner ticks */
.stamp--problem { background: var(--ink); color: var(--on-ink); border-radius: 3px; }
.stamp--problem::before, .stamp--problem::after {
  content: ""; position: absolute; width: 15px; height: 15px; pointer-events: none;
  background:
    linear-gradient(45deg, transparent calc(50% - 1.4px), var(--ink) 0 calc(50% + 1.4px), transparent 0),
    linear-gradient(-45deg, transparent calc(50% - 1.4px), var(--ink) 0 calc(50% + 1.4px), transparent 0);
}
.stamp--problem::before { left: -10px; top: -10px; }
.stamp--problem::after { right: -10px; bottom: -10px; }
.stamp--problem[data-size="xl"]::before, .stamp--problem[data-size="xl"]::after { width: 22px; height: 22px; }
.stamps { display: flex; flex-wrap: wrap; align-items: center; gap: 18px 22px; }

/* ───────── crime-scene tape ───────── */
.tape-band { position: relative; margin-inline: calc(50% - 50vw); padding-block: max(16px, 2.9vw); overflow-x: clip; overflow-y: visible; pointer-events: none; }
.tape-band > .crime-tape { pointer-events: auto; width: calc(100% + 80px); margin-inline: -40px; }
.crime-tape {
  --tape-l: 14deg; --tape-r: -18deg; --tape-drop: 90px;   /* torn angles, capped by the drop (fx.js) */
  position: relative; display: flex; width: 100%; height: 36px; rotate: -3deg;
  cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
.crime-tape__half { position: relative; flex: 1 1 50%; min-width: 0; display: flex; align-items: center; overflow: hidden; background: var(--tape); border-block: 3px solid var(--ink); }
.crime-tape__half--l { transform-origin: 0% 50%; }
.crime-tape__half--r { transform-origin: 100% 50%; }
.crime-tape__text { flex: none; padding-left: 14px; white-space: nowrap; font: 400 15px/1 var(--font-display); letter-spacing: 0.1em; color: var(--ink); }
.crime-tape__half--r .crime-tape__text { margin-left: -100%; }
.crime-tape[data-size="sm"] { height: 28px; }
.crime-tape[data-size="sm"] .crime-tape__text { font-size: 12.5px; }
.crime-tape.is-torn .crime-tape__half--l { rotate: var(--tape-l); }
.crime-tape.is-torn .crime-tape__half--r { rotate: var(--tape-r); }
.crime-tape.is-torn .crime-tape__half--l { border-right: 3px solid var(--ink); }
.crime-tape.is-torn .crime-tape__half--r { border-left: 3px solid var(--ink); }

/* ───────── pressable decorations ───────── */
[data-press] { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
svg [data-press], svg .fx-squash { transform-box: fill-box; transform-origin: center; }
/* sticky notes (pinned) */
.stickies { display: grid; gap: 26px 18px; padding-top: 10px; }
@media (min-width: 700px) { .stickies { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); } }
.sticky {
  position: relative; padding: 24px 17px 16px; background: var(--wash);
  border: 2px solid var(--ink); box-shadow: 5px 6px 0 var(--soft); rotate: -1.2deg;
}
.sticky:nth-child(even) { rotate: 1deg; }
.sticky:nth-child(3n) { rotate: -0.4deg; }
.sticky[data-tilt="none"] { rotate: 0deg; }
.sticky::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 9px; background: var(--tone-dots), var(--tone); border-bottom: 1.5px solid var(--ink); }
.sticky__pin { position: absolute; top: -13px; left: 50%; translate: -50% 0; z-index: 1; }
.pin-dot { display: block; width: 18px; height: 18px; border-radius: 50%; background: var(--pink); border: 2.5px solid var(--ink); box-shadow: 2px 2px 0 var(--ink); }
.sticky__title { font: italic 900 17.5px/1.2 var(--font-head); margin-bottom: 6px; }
.sticky__body { font: 500 15px/1.5 var(--font-body); }
.sticky__body > p + p { margin-top: 6px; }
.sticky__proofs { margin-top: 12px; }
/* vault cards + padlocks */
.vault {
  position: relative; padding: 26px 20px 20px; border: 3px solid var(--ink); border-radius: 16px;
  background: var(--tone-dots), var(--board);
  box-shadow: var(--shadow), inset 0 0 0 5px var(--paper), inset 0 0 0 7px var(--ink);
}
.vault > * { position: relative; }
.padlock { display: inline-grid; place-items: center; min-width: 44px; min-height: 44px; transform-origin: 50% 25%; }
.padlock svg { display: block; }
.vault .padlock { position: absolute; top: -26px; right: 18px; }
.padlock__fallback { position: relative; display: block; width: 30px; height: 24px; margin-top: 14px; border: 3px solid var(--ink); border-radius: 5px; background: var(--tape); }
.padlock__fallback::before { content: ""; position: absolute; left: 4px; right: 4px; top: -17px; height: 17px; border: 3px solid var(--ink); border-bottom: 0; border-radius: 12px 12px 0 0; }
/* cold-case index cards */
.index-card {
  position: relative; padding: 28px 16px 15px 36px; border: 2px solid var(--ink); box-shadow: 4px 5px 0 var(--soft); line-height: 26px;
  background: repeating-linear-gradient(180deg, transparent 0 25px, var(--rule) 25px 26px) 0 27px / 100% calc(100% - 27px) no-repeat, var(--paper);
}
.index-card p { line-height: 26px; }
.index-card::before { content: ""; position: absolute; top: 0; bottom: 0; left: 23px; width: 2px; background: var(--pink); }
.index-card__tab {
  position: absolute; top: -15px; left: 12px; display: inline-flex; align-items: baseline; gap: 8px; padding: 6px 11px 5px;
  background: var(--paper); border: 2px solid var(--ink); border-bottom-width: 3px;
  font: italic 900 12.5px/1 var(--font-head); letter-spacing: 0.06em; text-transform: uppercase;
}
.index-card__tab [lang="ja"] { font: 400 13px/1 var(--font-display); letter-spacing: 0.04em; text-transform: none; }

/* ───────── confidence chips ───────── */
.confidence { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 12px 10px; }
.conf { display: inline-flex; align-items: stretch; margin: 0; border: 2.5px solid var(--ink); border-radius: 10px; background: var(--paper); box-shadow: var(--shadow-sm); overflow: hidden; max-width: 100%; }
.conf__level { flex: none; display: flex; align-items: center; padding: 7px 10px 6px; background: var(--ink); color: var(--on-ink); font: 400 14px/1 var(--font-display); letter-spacing: 0.02em; }
.conf[data-level="medium-high"] .conf__level { background: var(--line); }
.conf[data-level="unknown"] .conf__level { background: var(--paper); color: var(--ink); border-right: 2.5px dashed var(--ink); }
.conf__what { display: flex; align-items: center; padding: 6px 12px; font: 600 14px/1.3 var(--font-body); }

/* ───────── scroll boxes + tables ───────── */
.scroll-box { position: relative; margin-block: 6px 18px; }
.scroll-box__hint { display: none; margin: 0 4px 7px 0; text-align: right; font: italic 800 13px/1 var(--font-head); color: var(--muted); }
@media (max-width: 719px) { .scroll-box__hint { display: block; } }
.scroll-box[data-overflow="false"] .scroll-box__hint { display: none; }
.scroll-box[data-overflow="true"] .scroll-box__hint { display: block; }
.scroll-box__view {
  overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch;
  border: 2.5px solid var(--ink); border-radius: 12px; background: var(--paper); box-shadow: var(--shadow);
  scrollbar-width: thin; scrollbar-color: var(--soft) transparent;
}
.scroll-box--bare .scroll-box__view { border: 0; border-radius: 0; box-shadow: none; background: transparent; }
.scroll-box__inner { min-width: var(--min-w, 0); }
.table { width: 100%; border-collapse: collapse; font: 500 14.5px/1.45 var(--font-body); font-variant-numeric: tabular-nums; }
.table caption { caption-side: top; padding: 12px 14px 6px; text-align: left; font: italic 900 15.5px/1.25 var(--font-head); }
.table th, .table td { padding: 9px 12px; text-align: left; vertical-align: top; border-bottom: 1.5px solid var(--rule); }
.table thead th { background: var(--board); border-bottom: 2.5px solid var(--ink); font: italic 900 12.5px/1.2 var(--font-head); letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap; }
.table tbody tr:nth-child(even) { background: var(--board); }
.table tbody tr:last-child > * { border-bottom: 0; }
.table tr.is-wash, .table tr[data-wash] { background: var(--wash); }
.table tr.is-wash > :first-child, .table tr[data-wash] > :first-child { box-shadow: inset 5px 0 0 var(--soft); }
.table .mono, .table .addr, .table .when { font-size: var(--fs-mono-table); }
.table .addr--full { word-break: break-all; }
.table .num { text-align: right; white-space: nowrap; }

/* ───────── HUD: the sticky URL bar (SPEC 3.0) ───────── */
.hud {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50; height: var(--hud-h);
  margin-left: calc(-1 * var(--gutter-l)); margin-right: calc(-1 * var(--gutter-r));
  padding-left: var(--gutter-l); padding-right: var(--gutter-r);
  background: var(--paper); border-bottom: 3px solid var(--ink); box-shadow: 0 4px 0 var(--soft);
}
.hud__bar { display: flex; align-items: center; gap: 10px; height: 100%; max-width: var(--maxw); margin-inline: auto; }
.hud__dots { display: none; flex: none; gap: 6px; }
.hud__dots i { width: 11px; height: 11px; border: 2px solid var(--ink); border-radius: 50%; background: var(--paper); }
.hud__dots i:first-child { background: var(--pink); }
.hud__url {
  flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 0; height: 34px; padding: 0 10px 0 8px;
  border: 2px solid var(--ink); border-radius: 999px; background: var(--board);
  font: 500 13px/1 var(--font-mono); color: var(--ink); white-space: nowrap;
}
.hud__icon { flex: none; width: 17px; height: 17px; margin-right: 6px; fill: none; stroke: var(--line); stroke-width: 1.6; stroke-linejoin: round; }
.hud__scheme { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.hud__chap { flex: none; font-weight: 700; color: var(--ink); }
.hud__slash { color: var(--muted); font-weight: 500; }
.hud__tz { display: none; flex: none; margin-left: auto; padding: 3px 6px; border: 1.5px solid var(--ink); border-radius: 5px; background: var(--paper); font: 700 12px/1 var(--font-mono); }
.hud__traced { display: none; flex: none; align-items: center; gap: 8px; font: italic 800 14px/1 var(--font-head); color: var(--muted); }
.hud__traced [data-hud-traced] { display: inline-block; min-width: 1.2ch; color: var(--ink); font: 700 14px/1 var(--font-mono); text-align: right; }
.hud__sep { color: var(--soft); }
.hud__nav { flex: none; display: flex; gap: 8px; }
.chip--hud { height: 36px; padding: 0 12px; font-size: 14px; box-shadow: 2px 3px 0 var(--soft); }
.chip--hud::after { inset: -4px -2px; }
@media (min-width: 600px) { .hud__dots { display: flex; } .hud__tz { display: inline-block; } .hud__bar { gap: 14px; } }
@media (min-width: 900px) { .hud__traced { display: flex; } .chip--hud { padding: 0 15px; } }

/* ───────── the single toast ───────── */
#toast {
  position: fixed; z-index: 60;
  top: calc(52px + 12px + env(safe-area-inset-top, 0px));
  left: max(16px, env(safe-area-inset-left, 0px));
  pointer-events: none;   /* the hidden host must not swallow taps; the visible toast takes them */
}
#toast::part(toast) { pointer-events: auto; }

/* ───────── dev-only: build placeholders ───────── */
.build-missing { margin: 18px 0; padding: 16px 18px; border: 2.5px dashed var(--pink-ink); border-radius: 10px; background: var(--paper); color: var(--pink-ink); font: 600 14px/1.45 var(--font-mono); }
.build-missing-wrap { min-height: 42vh; }
.build-missing__h { font: italic 400 26px/1.1 var(--font-display); color: var(--muted); }
.art-stub { color: var(--muted); }

/* ───────── reduced motion (SPEC 4.1) ───────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}

/* keyboard focus never lands under the sticky HUD (top) or the board's sticky Nib box (bottom) */
:is(main, footer) :is(a[href], button, [tabindex]:not([tabindex='-1']), sakuga-button, sakuga-toggle, sakuga-slider, sakuga-checkbox, sakuga-radio, sakuga-input, sakuga-tabs, sakuga-rating, sakuga-tooltip) { scroll-margin-top: 72px; }
#web :is(a[href], button, [tabindex]:not([tabindex='-1'])):not(#case-dialog *) { scroll-margin-bottom: 300px; }
@media (min-width: 700px) { #web :is(a[href], button, [tabindex]:not([tabindex='-1'])):not(#case-dialog *) { scroll-margin-bottom: 190px; } }
