:root,
html[data-theme="light"] {
  color-scheme: light;
  --ink: #121826;
  --muted: #5c6778;
  --paper: #f3f5f8;
  --paper-2: #e7ebf1;
  --card: #ffffff;
  --header: rgba(243, 245, 248, 0.9);
  --navy: #051e40;
  --navy-2: #020d1d;
  --red: #c81e3a;
  --red-soft: #fde8ec;
  --red-line: #f3c2cb;
  --gold: #051e40;
  --line: #e1e6ee;
  --warn: #8a4b08;
  --warn-soft: #fff4e0;
  --warn-line: #f0d7a8;
  --ok: #0f6b45;
  --ok-soft: #e5f6ee;
  --ok-line: #b7e4cc;
  --finding: #051e40;
  --finding-soft: #e7eef8;
  --finding-line: #c5d4ea;
  --conduct: #3d4656;
  --restore: #051e40;
  --restore-bg: #f3f6fb;
  --restore-line: #c5d2e4;
  --reform: #1eb8d0;
  --reform-ink: #0b5f6e;
  --reform-bg: #f1fbfd;
  --reform-line: #b7e6ee;
  --th-bg: #051e40;
  --th-ink: #f7f9fc;
  --btn-ink: #f7f9fc;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 10px 28px rgba(16, 24, 40, 0.05);
  --focus: #051e40;
  --footer: #101828;
  --footer-ink: #d5dbe6;
  --footer-muted: #aeb6c4;
  --footer-link: #8ed7e4;
  --max: 1120px;
  --sans: "Segoe UI", system-ui, -apple-system, sans-serif;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e8edf5;
  --muted: #a3afc2;
  --paper: #0c1017;
  --paper-2: #1c2433;
  --card: #151b26;
  --header: rgba(12, 16, 23, 0.88);
  --navy: #d5e2f4;
  --navy-2: #eef3fb;
  --red: #ff5d73;
  --red-soft: #3a1820;
  --red-line: #6e3140;
  --gold: #d5e2f4;
  --line: #2a3344;
  --warn: #f0c27a;
  --warn-soft: #332814;
  --warn-line: #6b5424;
  --ok: #7ddeaf;
  --ok-soft: #13281e;
  --ok-line: #245c42;
  --finding: #b9d2f7;
  --finding-soft: #17233a;
  --finding-line: #2d466e;
  --conduct: #c5cedb;
  --restore: #d5e2f4;
  --restore-bg: #101a2c;
  --restore-line: #2c4468;
  --reform: #1eb8d0;
  --reform-ink: #1eb8d0;
  --reform-bg: #0d2429;
  --reform-line: #1d5560;
  --th-bg: #1c2740;
  --th-ink: #e8edf5;
  --btn-ink: #051e40;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 12px 32px rgba(0, 0, 0, 0.28);
  --focus: #1eb8d0;
  --footer: #080b10;
  --footer-ink: #c5cedb;
  --footer-muted: #8b97aa;
  --footer-link: #8ed7e4;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme]) {
    color-scheme: dark;
    --ink: #e8edf5;
    --muted: #a3afc2;
    --paper: #0c1017;
    --paper-2: #1c2433;
    --card: #151b26;
    --header: rgba(12, 16, 23, 0.88);
    --navy: #d5e2f4;
    --navy-2: #eef3fb;
    --red: #ff5d73;
    --red-soft: #3a1820;
    --red-line: #6e3140;
    --gold: #d5e2f4;
    --line: #2a3344;
    --warn: #f0c27a;
    --warn-soft: #332814;
    --warn-line: #6b5424;
    --ok: #7ddeaf;
    --ok-soft: #13281e;
    --ok-line: #245c42;
    --finding: #b9d2f7;
    --finding-soft: #17233a;
    --finding-line: #2d466e;
    --conduct: #c5cedb;
    --restore: #d5e2f4;
    --restore-bg: #101a2c;
    --restore-line: #2c4468;
    --reform: #1eb8d0;
    --reform-ink: #1eb8d0;
    --reform-bg: #0d2429;
    --reform-line: #1d5560;
    --th-bg: #1c2740;
    --th-ink: #e8edf5;
    --btn-ink: #051e40;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 12px 32px rgba(0, 0, 0, 0.28);
    --focus: #1eb8d0;
    --footer: #080b10;
    --footer-ink: #c5cedb;
    --footer-muted: #8b97aa;
    --footer-link: #8ed7e4;
  }
  html:not([data-theme]) .brand .logo-light { display: none; }
  html:not([data-theme]) .brand .logo-dark { display: block; }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html:has(#record-search) { scroll-behavior: auto; }
body {
  margin: 0;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  background:
    radial-gradient(880px 360px at 100% -8%, color-mix(in srgb, #1eb8d0 18%, transparent), transparent 62%),
    radial-gradient(640px 280px at -8% -12%, color-mix(in srgb, #051e40 14%, transparent), transparent 58%),
    var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
}
img { max-width: 100%; }
a { color: var(--navy); text-underline-offset: 0.16em; }
a:hover { color: var(--reform-ink); }
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}
.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: var(--navy);
  color: var(--btn-ink);
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  z-index: 30;
}
.skip:focus { top: 0.6rem; }

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--header);
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.top a { color: inherit; text-decoration: none; }
.top-inner, .wrap, .footer-inner {
  width: min(var(--max), calc(100% - 2rem));
  margin-inline: auto;
}
.top-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  padding: 0.75rem 0;
}
.top-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  min-width: 0;
  max-width: 100%;
}
.brand {
  display: inline-flex;
  align-items: center;
  line-height: 0;
}
.brand .logo {
  display: block;
  height: 3.5rem;
  width: auto;
  max-width: min(100%, 17.5rem);
}
.brand .logo-dark { display: none; }
html[data-theme="dark"] .brand .logo-light { display: none; }
html[data-theme="dark"] .brand .logo-dark { display: block; }
.top nav { display: flex; flex-wrap: wrap; gap: 0.25rem; min-width: 0; max-width: 100%; }
.top nav a {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--muted);
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
}
.top nav a:hover { color: var(--ink); background: var(--paper-2); }
.top nav a[aria-current="page"] {
  background: var(--navy);
  color: var(--btn-ink);
}
.theme-toggle {
  min-height: 40px;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
}
.theme-toggle:hover { border-color: var(--navy); }

.kicker {
  color: var(--reform-ink);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 750;
  margin: 0 0 0.7rem;
}
h1, h2, h3 {
  font-weight: 720;
  letter-spacing: -0.03em;
  line-height: 1.12;
  text-wrap: balance;
}
h1 { font-size: clamp(2.4rem, 5.4vw, 4.1rem); margin: 0 0 0.85rem; }
h2 { font-size: clamp(1.55rem, 2.6vw, 2.05rem); margin: 0 0 0.65rem; }
h3 { font-size: 1.2rem; margin: 0 0 0.4rem; }
.deck { font-size: 1.22rem; max-width: 42rem; color: var(--ink); }
.muted { color: var(--muted); }
.wrap { padding: 2.6rem 0 3.6rem; }
.wrap > * + * { margin-top: 1rem; }
.section { margin-top: 2.75rem; }

.hero { padding-top: 1.6rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.55rem; margin-top: 1.35rem; }
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  position: sticky;
  top: var(--top-h, 4.6rem);
  z-index: 15;
  margin-top: 1.35rem;
  padding: 0.55rem 0;
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: blur(14px);
}
.btn, .filters button, .theme-toggle { transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease; }
.btn, .filters button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--navy);
  background: var(--navy);
  color: var(--btn-ink);
  text-decoration: none;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}
.btn.alt, .filters button {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.filters button[aria-pressed="true"] {
  background: var(--navy);
  color: var(--btn-ink);
  border-color: var(--navy);
}
.btn:hover, .filters button:hover { background: var(--navy-2); color: var(--btn-ink); border-color: var(--navy-2); }
html[data-theme="dark"] .btn.alt:hover,
html[data-theme="dark"] .filters button:hover { color: #0c1017; }

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.8rem;
  margin-top: 2rem;
}
.fact {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 1rem 1.05rem 0.9rem;
}
.fact b {
  display: block;
  font-size: 1.65rem;
  font-weight: 760;
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 0.4rem;
}
.fact span { display: block; color: var(--muted); font-size: 0.9rem; }

.grid-3, .grid-2 { display: grid; gap: 0.85rem; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.filters label { flex: 1 1 14rem; min-width: min(100%, 12rem); }
.record-search {
  width: 100%;
  min-height: 44px;
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
}
.record-search:focus { border-color: var(--reform); }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.case, #roll {
  scroll-margin-top: calc(var(--stick, 8rem) + 0.4rem);
}
.card, .case, .diff, .premise, .callout {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 1.15rem 1.2rem 1.05rem;
}
.card h2, .card h3 { font-size: 1.28rem; }
.card p:last-child, .case p:last-child { margin-bottom: 0; }
.card a.more { font-weight: 750; }

.status {
  display: inline-block;
  margin: 0 0 0.55rem;
  padding: 0.18rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--conduct);
  background: var(--paper-2);
}
.status-convicted { color: var(--red); background: var(--red-soft); border-color: var(--red-line); }
.status-finding { color: var(--finding); background: var(--finding-soft); border-color: var(--finding-line); }
.status-open { color: var(--warn); background: var(--warn-soft); border-color: var(--warn-line); }
.status-conduct { color: var(--conduct); background: var(--paper-2); border-color: var(--line); }
.status-control { color: var(--restore); background: var(--restore-bg); border-color: var(--restore-line); }
.role { color: var(--muted); margin-top: 0; }

.callout { border-left: 4px solid var(--red); }
.callout.navy { border-left-color: var(--navy); }
.premise ol, .plain ol, .plain ul { padding-left: 1.2rem; }
.premise li + li, .plain li + li { margin-top: 0.45rem; }

.diff .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.diff .side {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem 1rem;
}
.diff .side:first-child { background: var(--restore-bg); border-color: var(--restore-line); }
.diff .side:last-child { background: var(--reform-bg); border-color: var(--reform-line); }
.diff .side h3 {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.45rem;
}
.diff .side:first-child h3 { color: var(--restore); }
.diff .side:last-child h3 { color: var(--reform-ink); }
.diff .gap { margin: 0.9rem 0 0; }
.diff .verdict {
  margin: 0.9rem 0 0;
  padding: 0.85rem 1rem;
  background: var(--restore-bg);
  border: 1px solid var(--restore-line);
  border-radius: 12px;
}
.diff .verdict strong { color: var(--restore); }
.src, .sources { font-size: 0.88rem; color: var(--muted); }
.sources li + li { margin-top: 0.35rem; }

#roll .table-wrap {
  content-visibility: auto;
  contain-intrinsic-size: auto 36rem;
}
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
}
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td {
  text-align: left;
  padding: 0.7rem 0.8rem;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}
th { background: var(--th-bg); color: var(--th-ink); font-weight: 700; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

.footer {
  background: var(--footer);
  color: var(--footer-ink);
  margin-top: 1rem;
}
.footer a { color: var(--footer-link); }
.footer-inner { padding: 1.6rem 0 2rem; font-size: 0.92rem; }
.imprint { font-size: 0.84rem; color: var(--footer-muted); }

@media (max-width: 720px) {
  .diff .cols { grid-template-columns: 1fr; }
  body { font-size: 1rem; }
  .top-inner { display: block; }
  .top-tools { display: block; width: 100%; }
  .top nav { width: 100%; margin-top: 0.45rem; }
  .theme-toggle { margin-top: 0.55rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .filters button, .theme-toggle { transition: none; }
}
@media print {
  .top, .filters, .actions, .skip, .theme-toggle { display: none !important; }
  body { background: white; color: black; }
  a { color: black; }
  .card, .case, .diff, .fact { break-inside: avoid; box-shadow: none; }
}
