
:root {
  --paper: #f4f0e7;
  --paper-strong: #fffdf8;
  --ink: #171d1b;
  --muted: #667069;
  --line: #d7cec0;
  --line-strong: #aca18d;
  --rail: #1d2420;
  --rail-soft: #27302b;
  --rail-ink: #f6f1e8;
  --sidebar: #121716;
  --rust: #a84f36;
  --red: #7f2d2d;
  --olive: #62704e;
  --steel: #4e6974;
  --shadow: 0 16px 38px rgba(24, 29, 27, 0.13);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  height: 100vh;
  overflow: hidden;
  background: var(--paper);
}

a {
  color: #245f73;
  text-decoration: none;
}

a:hover {
  color: var(--rust);
}

button,
input {
  font: inherit;
}

.app-shell {
  height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 24px;
  align-items: center;
  min-height: 72px;
  padding: 12px 24px;
  color: var(--rail-ink);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    #111513;
  background-size: 5px 5px, auto;
  border-bottom: 1px solid #111512;
  box-shadow: 0 9px 28px rgba(15, 18, 16, 0.24);
}

.brand {
  display: flex;
  flex: 0 1 360px;
  gap: 11px;
  align-items: center;
  min-width: 280px;
  color: var(--rail-ink);
}

.brand > span:last-child {
  min-width: 0;
}

.brand-mark {
  display: block;
  flex: 0 0 54px;
  width: 54px;
  height: 44px;
  overflow: hidden;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.08));
}

.brand-mark svg {
  display: block;
  width: 100%;
  height: 100%;
}

.brand-mark rect {
  fill: #101513;
  stroke: rgba(232, 222, 199, 0.9);
  stroke-width: 1.6;
}

.brand-mark g:first-of-type {
  fill: #e4d8be;
}

.brand-mark-scars {
  fill: #101513;
  opacity: 0.92;
}

.brand strong,
.brand em {
  display: block;
  line-height: 1.15;
}

.brand strong {
  color: #efe8d8;
  font-family: "Bahnschrift Condensed", "Arial Narrow", "Roboto Condensed", "Segoe UI Condensed", sans-serif;
  font-size: 31px;
  font-stretch: condensed;
  font-weight: 750;
  letter-spacing: 0.055em;
  line-height: 0.9;
  text-transform: uppercase;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
  white-space: nowrap;
}

.brand em {
  margin-top: 4px;
  color: #d0c6b4;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 14px;
  font-style: normal;
  line-height: 1;
  white-space: nowrap;
}

.search {
  display: grid;
  flex: 1 1 360px;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  max-width: 520px;
  min-width: 0;
}

.search span {
  color: #cdd3cb;
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.search input {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  color: #fffdf8;
  background: #121713;
  border: 1px solid rgba(246, 241, 232, 0.25);
  border-radius: 6px;
  outline: none;
}

.search input:focus {
  border-color: #d7c99f;
  box-shadow: 0 0 0 3px rgba(215, 201, 159, 0.16);
}

.top-actions {
  display: flex;
  flex: 0 0 auto;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
  min-width: 0;
  white-space: nowrap;
}

.top-link {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  gap: 8px;
  border: 0;
  border-left: 1px solid rgba(246, 241, 232, 0.12);
  border-radius: 0;
  padding: 7px 16px;
  color: var(--rail-ink);
  background: transparent;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.top-link svg,
.nav-section svg,
.article-actions svg,
.verification svg {
  width: 17px;
  height: 17px;
}

.workspace {
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr) 390px;
  height: calc(100vh - 72px);
  min-height: 0;
  overflow: hidden;
}

.left-rail,
.right-rail,
.article {
  min-height: 0;
  overflow-y: auto;
}

.left-rail {
  padding: 18px 0;
  color: #e8e1d4;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    var(--sidebar);
  background-size: 5px 5px, auto;
  border-right: 1px solid #0b0e0d;
}

.right-rail {
  padding: 0;
  background:
    linear-gradient(90deg, rgba(87, 72, 51, 0.035) 1px, transparent 1px),
    #eee7d8;
  border-left: 1px solid #c9bfab;
}

.article {
  padding: 28px 34px 58px;
  background:
    radial-gradient(circle at 18% 12%, rgba(128, 91, 44, 0.04), transparent 28%),
    linear-gradient(90deg, rgba(87, 72, 51, 0.026) 1px, transparent 1px),
    var(--paper);
}

.nav-section {
  margin-bottom: 0;
  padding: 16px 0 18px;
  border-bottom: 1px solid rgba(232, 225, 212, 0.12);
}

.nav-section h2,
.rail-box h2,
.content-section h2 {
  margin: 0 0 12px;
  color: #9faaa0;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-section h2 {
  padding: 0 20px;
  color: #b4bcb3;
}

.content-section h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #9e3e27;
  font-family: "Arial Narrow", "Roboto Condensed", "Segoe UI", sans-serif;
  font-size: 24px;
  letter-spacing: 0;
  text-transform: none;
}

.content-section h2 svg {
  width: 22px;
  height: 22px;
  color: #9e3e27;
}

.nav-section a {
  display: flex;
  min-height: 34px;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  color: #efe8dd;
  font-size: 16px;
  font-weight: 650;
}

.nav-section a:hover,
.nav-section a.active {
  color: #fffdf8;
  background: #9e3e27;
  box-shadow: none;
}

.nav-section a em {
  margin-left: auto;
  min-width: 22px;
  padding: 2px 6px;
  color: #efe8dd;
  background: rgba(255, 255, 255, 0.16);
  border-radius: 4px;
  font-size: 12px;
  font-style: normal;
  text-align: center;
}

.book-nav {
  display: grid !important;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 0 !important;
  min-height: 27px !important;
  padding: 6px 20px !important;
  color: #e4dccf !important;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px !important;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: 0;
}

.book-nav:first-of-type {
  color: #d45f3e !important;
}

.book-nav span {
  color: inherit;
  font-weight: 600;
}

.book-nav:hover {
  color: #fffdf8 !important;
  background: rgba(158, 62, 39, 0.55) !important;
}

.book-nav strong {
  overflow: hidden;
  font-weight: 500;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-header {
  max-width: 1060px;
  margin: 0 0 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid #bdb29f;
}

.breadcrumbs {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 0 0 12px;
  color: var(--rust);
  font-size: 12px;
  font-weight: 850;
}

.breadcrumbs b {
  color: #8d877b;
  font-weight: 500;
}

.title-line {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.page-header h1 {
  margin: 0;
  max-width: 900px;
  font-family: "Arial Narrow", "Roboto Condensed", "Segoe UI", sans-serif;
  font-size: 58px;
  line-height: 0.98;
  font-weight: 850;
  letter-spacing: 0.01em;
}

.page-header p {
  max-width: 860px;
  margin: 12px 0 0;
  color: #4e4339;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  font-style: italic;
  line-height: 1.55;
}

.article-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.article-actions button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  color: #8f301f;
  background: transparent;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.metric {
  min-height: 88px;
  padding: 15px;
  background: var(--paper-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.metric strong {
  display: block;
  font-size: 28px;
  line-height: 1;
}

.metric span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.content-section {
  max-width: 1020px;
  margin: 0 0 28px;
  padding: 0 0 20px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #bdb29f;
  border-radius: 0;
}

.content-section p,
.content-section li {
  color: #1d1d19;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  line-height: 1.55;
}

.narrative-section p {
  font-size: 16px;
  line-height: 1.72;
}

.prose-link {
  color: #8f3424;
  text-decoration: none;
  border-bottom: 1px solid rgba(168, 79, 54, 0.34);
}

.prose-link:hover {
  color: #5f2119;
  border-bottom-color: rgba(168, 79, 54, 0.72);
}

.content-section p:first-of-type {
  margin-top: 0;
}

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, 0.75fr);
  gap: 22px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.card,
.mini-card,
.source-card {
  padding: 16px;
  min-height: 170px;
  background: var(--paper-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(24, 29, 27, 0.08);
}

.card span {
  color: var(--rust);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.card h3,
.mini-card h3 {
  margin: 8px 0 8px;
  font-size: 20px;
  line-height: 1.2;
}

.card p,
.mini-card p {
  color: #4e5a53;
  font-size: 14px;
  line-height: 1.55;
}

.card footer {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.book-list,
.result-list,
.timeline-list,
.research-list,
.source-list {
  display: grid;
  gap: 12px;
}

.book-row,
.result-row,
.timeline-row,
.research-row {
  display: grid;
  gap: 7px;
  padding: 16px;
  color: var(--ink);
  background: var(--paper-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.book-row {
  grid-template-areas:
    "cover number phase"
    "cover title phase"
    "cover deck phase";
  grid-template-columns: 78px minmax(0, 1fr) 220px;
  column-gap: 16px;
  align-items: center;
}

.book-cover {
  display: block;
  grid-area: cover;
  align-self: start;
  width: 72px;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: #e4dbc9;
  border: 1px solid rgba(172, 161, 141, 0.82);
  border-radius: 4px;
  box-shadow: 0 10px 22px rgba(24, 29, 27, 0.16);
}

.book-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rail-book-cover {
  display: block;
  width: min(180px, 100%);
  max-width: 100%;
  aspect-ratio: 2 / 3;
  margin: 0 auto;
  overflow: hidden;
  background: #e4dbc9;
  border: 1px solid rgba(172, 161, 141, 0.82);
  border-radius: 5px;
  box-shadow: 0 15px 30px rgba(24, 29, 27, 0.2);
}

.rail-book-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.book-cover-box {
  padding: 14px;
  text-align: center;
}

.book-row .book-number,
.timeline-row span,
.research-row > span,
.result-row span {
  color: var(--rust);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.book-row .book-number {
  grid-area: number;
}

.book-row strong,
.timeline-row strong,
.result-row strong {
  font-size: 18px;
}

.book-row strong {
  grid-area: title;
}

.book-row p,
.timeline-row p,
.result-row p,
.research-row p {
  margin: 0;
  color: #4e5a53;
  line-height: 1.5;
}

.book-row p {
  grid-area: deck;
}

.book-row em {
  grid-area: phase;
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  text-align: right;
}

.phase-list,
.relationship-list {
  display: grid;
  gap: 12px;
}

.fact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

.fact-grid article {
  padding: 12px 14px;
  background: rgba(244, 240, 231, 0.72);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.fact-grid strong {
  display: block;
  margin-bottom: 6px;
  color: #1f2923;
  font-family: "Arial Narrow", "Roboto Condensed", "Segoe UI", sans-serif;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.fact-grid p {
  margin: 0;
}

.bio-block {
  margin: 0 0 22px;
}

.bio-block:last-child {
  margin-bottom: 0;
}

.bio-block h3 {
  margin: 0 0 8px;
  color: #27342c;
  font-family: "Arial Narrow", "Roboto Condensed", "Segoe UI", sans-serif;
  font-size: 18px;
  font-weight: 800;
}

.phase-list article,
.relationship-list article {
  padding: 14px;
  background: rgba(244, 240, 231, 0.7);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.phase-list strong,
.relationship-list strong {
  color: #1f2923;
}

.tag-list,
.link-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inline-related {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 150px;
}

.inline-related a,
.inline-related span,
.rail-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 7px;
  border: 1px solid #c9bda9;
  border-radius: 5px;
  background: rgba(255, 253, 247, 0.48);
  color: #8f301f;
  font-family: "Roboto Condensed", "Arial Narrow", sans-serif;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.1;
  text-decoration: none;
}

.inline-related span {
  color: #62594c;
}

.pill,
.related-link {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border: 1px solid #c8baa4;
  border-radius: 6px;
  padding: 6px 9px;
  color: #34413a;
  background: #f2ebdc;
  font-size: 13px;
  font-weight: 700;
}

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

.chapter-grid span {
  display: block;
  padding: 8px;
  color: #3d4841;
  background: #f2ebdc;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
}

.rail-box {
  margin: 0;
  padding: 20px 22px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #c9bfab;
  border-radius: 0;
}

.rail-box p {
  color: #4e4438;
  font-size: 13px;
  line-height: 1.55;
}

.rail-box a {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  color: #8f301f;
  font-size: 13px;
  font-weight: 700;
  border-top: 1px solid rgba(145, 133, 113, 0.3);
}

.rail-box a:first-of-type {
  border-top: 0;
}

.rail-box a.related-rail {
  justify-content: flex-start;
  gap: 8px;
}

.rail-box a.related-rail span {
  min-width: 0;
}

.source-note {
  border-color: #bdb29f;
  background: transparent;
}

.collapsed-evidence {
  padding: 0;
}

.collapsed-evidence details {
  padding: 18px 22px;
}

.collapsed-evidence summary {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--rust);
  cursor: pointer;
  font-family: var(--display);
  font-size: 22px;
  font-weight: 850;
  list-style: none;
}

.collapsed-evidence summary::-webkit-details-marker {
  display: none;
}

.collapsed-evidence summary svg {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}

.collapsed-evidence summary em {
  margin-left: auto;
  color: var(--muted);
  font-family: var(--ui);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  text-transform: uppercase;
}

.collapsed-evidence summary::after {
  content: "+";
  width: 22px;
  color: #5a4e42;
  font-family: var(--ui);
  font-size: 18px;
  text-align: center;
}

.collapsed-evidence details[open] summary::after {
  content: "-";
}

.evidence-details-body {
  margin-top: 16px;
}

.coverage-row {
  display: grid;
  grid-template-columns: 126px minmax(70px, 1fr) 40px;
  gap: 10px;
  align-items: center;
  margin: 9px 0;
  color: #5a4e42;
  font-size: 13px;
}

.coverage-row b {
  display: block;
  height: 8px;
  background: #ded6c8;
  border: 1px solid #beb3a2;
}

.coverage-row i {
  display: block;
  height: 100%;
  background: #344b2f;
}

.coverage-row.accent span,
.coverage-row.accent em {
  color: #8f301f;
  font-weight: 800;
}

.coverage-row.accent i {
  background: #8f301f;
}

.appearance-note {
  margin: 12px 0 0;
  color: #8f301f !important;
  font-style: italic;
}

.verification strong {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #2f5f39;
}

.compact-table table {
  min-width: 680px;
}

.compact-table th,
.compact-table td {
  padding: 7px 10px;
  font-family: Georgia, "Times New Roman", serif;
}

.evidence-table table {
  min-width: 920px;
}

.evidence-table td {
  font-size: 13px;
}

.evidence-table small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 11px;
}

.evidence-confidence {
  display: inline-flex;
  margin-top: 6px;
  border: 1px solid #b9ad9a;
  border-radius: 4px;
  padding: 2px 5px;
  color: #34413a;
  background: #eee7d8;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
}

.evidence-confidence.confirmed {
  color: #234d31;
  border-color: #9eb29a;
  background: #e8eee2;
}

.evidence-confidence.likely {
  color: #604915;
  border-color: #c4ad6c;
  background: #f1ead1;
}

.evidence-confidence.encyclopedia-only {
  color: #653726;
  border-color: #c9a18d;
  background: #f2e3d8;
}

.research-row {
  grid-template-columns: 52px minmax(0, 1fr);
}

.research-row h2 {
  margin: 0;
  font-size: 19px;
}

.table-wrap {
  overflow-x: auto;
  background: var(--paper-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th,
td {
  padding: 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

th {
  color: #39443d;
  background: #ece5d7;
  font-size: 12px;
  text-transform: uppercase;
}

td {
  color: #303934;
  font-size: 14px;
  line-height: 1.45;
}

.empty,
.muted {
  color: var(--muted);
}

@media (max-width: 980px) {
  body {
    height: auto;
    overflow: auto;
  }

  .topbar,
  .workspace {
    height: auto;
  }

  .topbar {
    display: block;
    position: relative;
  }

  .workspace {
    display: flex;
    flex-direction: column;
  }

  .search {
    margin: 12px 0;
  }

  .top-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
    gap: 8px;
    justify-content: stretch;
    margin: 12px 0 0;
    white-space: normal;
  }

  .top-link {
    justify-content: center;
    min-height: 38px;
    border: 1px solid rgba(246, 241, 232, 0.12);
    padding: 7px 8px;
    text-align: center;
  }

  .left-rail,
  .right-rail,
  .article {
    overflow: visible;
  }

  .left-rail,
  .right-rail {
    border: 0;
  }

  .article {
    order: 1;
  }

  .right-rail {
    order: 2;
  }

  .left-rail {
    order: 3;
  }

  .article {
    padding: 24px 18px 38px;
  }

  .page-header h1 {
    font-size: 34px;
  }

  .stat-grid,
  .two-col {
    grid-template-columns: 1fr;
  }

  .book-row {
    grid-template-areas:
      "cover number"
      "cover title"
      "cover deck"
      "cover phase";
    grid-template-columns: 72px minmax(0, 1fr);
    column-gap: 14px;
  }

  .book-cover {
    width: 64px;
  }

  .book-row em {
    text-align: left;
  }
}

@media (min-width: 981px) and (max-width: 1320px) {
  .topbar {
    gap: 16px;
    padding: 12px 18px;
  }

  .brand {
    flex-basis: 340px;
  }

  .search {
    flex-basis: 300px;
  }

  .top-link {
    padding: 7px 10px;
    letter-spacing: 0.05em;
  }
}

@media (min-width: 981px) and (max-width: 1120px) {
  .top-link span {
    display: none;
  }

  .top-link {
    padding: 7px 9px;
  }
}

@media (max-width: 520px) {
  .topbar {
    padding: 10px 14px;
  }

  .brand {
    gap: 9px;
  }

  .brand-mark {
    flex-basis: 46px;
    width: 46px;
    height: 38px;
  }

  .brand strong {
    font-size: 25px;
    letter-spacing: 0.04em;
  }

  .brand em {
    font-size: 12px;
  }

  .book-row {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 5px 12px;
    padding: 12px;
  }

  .book-cover {
    width: 54px;
  }

  .book-row strong {
    font-size: 16px;
  }

  .book-row p {
    font-size: 13px;
  }
}
