/* ==========================================================================
   CT-ARCHIVE v3 · Investigative Print-Digital Broadsheet Design System
   Default: Crisp Pure-White Canvas (#FFFFFF) & Jet-Black Ink (#090B0F)
   ========================================================================== */
:root, [data-theme="light"] {
  color-scheme: light;
  --bg-canvas: #ffffff;
  --bg-surface: #f7f8fa;
  --bg-elevated: #eff1f5;
  --bg-ticker: #0b0e14;
  --fg-ticker: #f8fafc;
  --text-ink: #090b0f;
  --text-body: #1d222b;
  --text-secondary: #485160;
  --text-muted: #687385;
  --rule-heavy: #090b0f;
  --rule-medium: #cfd5df;
  --rule-light: #e5e9f0;
  --brand-crimson: #b91c1c;
  --brand-crimson-soft: #fef2f2;
  --brand-crimson-border: #f5bcbc;
  --brand-blue: #1e40af;
  --brand-blue-soft: #eff6ff;
  --brand-blue-border: #bfdbfe;
  --brand-emerald: #065f46;
  --brand-emerald-soft: #ecfdf5;
  --brand-emerald-border: #a7f3d0;
  --brand-amber: #92400e;
  --brand-amber-soft: #fffbeb;
  --brand-amber-border: #fde68a;
  --brand-plum: #5b21b6;
  --brand-plum-soft: #f5f3ff;
  --brand-plum-border: #ddd6fe;
  --seal-t1-bg: #090b0f;
  --seal-t1-fg: #ffffff;
  --seal-t2-bg: #991b1b;
  --seal-t2-fg: #ffffff;
  --seal-t3-bg: #1e3a8a;
  --seal-t3-fg: #ffffff;
  --seal-t4-bg: #334155;
  --seal-t4-fg: #ffffff;
  --shadow-subtle: 0 1px 2px rgba(9, 11, 15, 0.04);
  --shadow-popover: 0 10px 28px rgba(9, 11, 15, 0.14);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg-canvas: #0b0d11;
  --bg-surface: #12161e;
  --bg-elevated: #191f2a;
  --bg-ticker: #161b25;
  --fg-ticker: #f1f5f9;
  --text-ink: #f3f5f8;
  --text-body: #d5dce6;
  --text-secondary: #9aa5b5;
  --text-muted: #6e7b8f;
  --rule-heavy: #e2e8f0;
  --rule-medium: #2a3342;
  --rule-light: #1d2430;
  --brand-crimson: #f87171;
  --brand-crimson-soft: rgba(248, 113, 113, 0.13);
  --brand-crimson-border: rgba(248, 113, 113, 0.34);
  --brand-blue: #60a5fa;
  --brand-blue-soft: rgba(96, 165, 250, 0.13);
  --brand-blue-border: rgba(96, 165, 250, 0.34);
  --brand-emerald: #34d399;
  --brand-emerald-soft: rgba(52, 211, 153, 0.13);
  --brand-emerald-border: rgba(52, 211, 153, 0.34);
  --brand-amber: #fbbf24;
  --brand-amber-soft: rgba(251, 191, 36, 0.13);
  --brand-amber-border: rgba(251, 191, 36, 0.34);
  --brand-plum: #c4b5fd;
  --brand-plum-soft: rgba(196, 181, 253, 0.13);
  --brand-plum-border: rgba(196, 181, 253, 0.34);
  --seal-t1-bg: #f1f5f9;
  --seal-t1-fg: #090b0f;
  --seal-t2-bg: #dc2626;
  --seal-t2-fg: #ffffff;
  --seal-t3-bg: #2563eb;
  --seal-t3-fg: #ffffff;
  --seal-t4-bg: #475569;
  --seal-t4-fg: #ffffff;
  --shadow-subtle: 0 2px 6px rgba(0, 0, 0, 0.35);
  --shadow-popover: 0 12px 32px rgba(0, 0, 0, 0.65);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg-canvas);
  color: var(--text-body);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  line-height: 1.66;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

button, input {
  font-family: inherit;
}

.serif-display {
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", Georgia, "Times New Roman", serif;
}

.mono {
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

.is-hidden,
.is-paginated-hidden {
  display: none !important;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  width: 100%;
  max-width: 1340px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ==========================================================================
   Masthead & Unified Navigation (Zero Redundant Duplicate Tabs)
   ========================================================================== */
.masthead {
  background: var(--bg-canvas);
  border-top: 4px solid var(--rule-heavy);
  border-bottom: 1.5px solid var(--rule-heavy);
  position: sticky;
  top: 0;
  z-index: 60;
}

.masthead-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 0 9px;
  border-bottom: 1px solid var(--rule-light);
  flex-wrap: wrap;
}

.brand-lockup {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.brand-title {
  font-size: 1.58rem;
  font-weight: 900;
  color: var(--text-ink);
  letter-spacing: 0.03em;
  line-height: 1.1;
}

.brand-stamp {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  padding: 2px 6px;
  border: 1.5px solid var(--rule-heavy);
  color: var(--text-ink);
}

.brand-tagline {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.mode-switcher {
  display: inline-flex;
  border: 1.5px solid var(--rule-heavy);
  border-radius: 2px;
  overflow: hidden;
  background: var(--bg-canvas);
}

.mode-tab {
  padding: 5px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-ink);
  background: var(--bg-canvas);
  border-right: 1px solid var(--rule-heavy);
  white-space: nowrap;
}

.mode-tab:last-child {
  border-right: none;
}

.mode-tab.active {
  background: var(--rule-heavy);
  color: var(--bg-canvas);
}

.mode-tab:hover:not(.active) {
  background: var(--bg-elevated);
}

.masthead-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  flex-wrap: wrap;
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
}

.nav-item {
  padding: 4px 10px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.nav-item:hover, .nav-item.active {
  color: var(--text-ink);
  border-bottom-color: var(--brand-crimson);
}

.nav-divider {
  color: var(--rule-medium);
  font-size: 0.75rem;
  padding: 0 2px;
  user-select: none;
}

.nav-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box {
  background: var(--bg-surface);
  border: 1px solid var(--rule-medium);
  color: var(--text-ink);
  padding: 5px 28px 5px 10px;
  font-size: 0.83rem;
  width: 248px;
  border-radius: 2px;
  outline: none;
}

.search-box:focus {
  border-color: var(--rule-heavy);
  background: var(--bg-canvas);
}

.search-box:focus + .search-kbd,
.search-wrap.has-value .search-kbd {
  display: none;
}

.search-kbd {
  position: absolute;
  right: 7px;
  font-size: 0.68rem;
  color: var(--text-muted);
  border: 1px solid var(--rule-medium);
  padding: 0 4px;
  border-radius: 2px;
  pointer-events: none;
  line-height: 1.35;
}

.search-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 380px;
  max-width: 92vw;
  max-height: min(380px, calc(100vh - 110px));
  overflow-y: auto;
  background: var(--bg-canvas);
  border: 1.5px solid var(--rule-heavy);
  box-shadow: var(--shadow-popover);
  z-index: 90;
  padding: 6px 0;
}

.search-pop-item {
  display: block;
  padding: 8px 12px;
  border-bottom: 1px solid var(--rule-light);
}

.search-pop-item:last-child {
  border-bottom: none;
}

.search-pop-item:hover {
  background: var(--bg-surface);
}

.search-pop-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-ink);
  display: block;
  line-height: 1.38;
}

.search-pop-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

.theme-switch {
  background: var(--bg-canvas);
  border: 1px solid var(--rule-medium);
  color: var(--text-secondary);
  padding: 5px 10px;
  font-size: 0.77rem;
  font-weight: 700;
  border-radius: 2px;
  cursor: pointer;
  white-space: nowrap;
}

.theme-switch:hover {
  border-color: var(--rule-heavy);
  color: var(--text-ink);
}

/* ==========================================================================
   Frontline Breaking Wire Strip & Dateline Ledger
   ========================================================================== */
.frontline-wire-bar {
  background: var(--bg-ticker);
  color: var(--fg-ticker);
  border-bottom: 1px solid var(--rule-heavy);
  font-size: 0.79rem;
}

.frontline-wire-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 36px 7px 0;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to right, #000 0%, #000 calc(100% - 42px), transparent 100%);
  mask-image: linear-gradient(to right, #000 0%, #000 calc(100% - 42px), transparent 100%);
}

.frontline-wire-inner::-webkit-scrollbar {
  display: none;
}

.wire-badge {
  background: #dc2626;
  color: #ffffff;
  font-weight: 800;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 2px;
  flex-shrink: 0;
}

.wire-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  color: var(--fg-ticker);
  opacity: 0.92;
  padding-right: 12px;
  border-right: 1px solid rgba(255, 255, 255, 0.18);
  flex-shrink: 0;
}

.wire-item:last-child {
  border-right: none;
}

.wire-item:hover {
  opacity: 1;
  text-decoration: underline;
}

.wire-date {
  color: #fca5a5;
  font-size: 0.73rem;
  font-weight: 700;
}

.dateline-bar {
  border-bottom: 2px solid var(--rule-heavy);
  background: var(--bg-surface);
  font-size: 0.8rem;
}

.dateline-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-left: 1px solid var(--rule-light);
  border-right: 1px solid var(--rule-light);
}

.dateline-cell {
  padding: 8px 14px;
  border-right: 1px solid var(--rule-light);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.dateline-cell:last-child {
  border-right: none;
}

.dateline-k {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.dateline-v {
  color: var(--text-ink);
  font-weight: 800;
  font-size: 0.92rem;
}

main {
  flex: 1;
  padding: 22px 0 56px;
}

/* ==========================================================================
   Editorial Stamps, Typographic Kickers & Avatars (Restrained Ink Hierarchy)
   ========================================================================== */
.stamp {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: 2px;
  border: 1px solid var(--rule-medium);
  white-space: nowrap;
  line-height: 1.45;
}

.stamp-ink {
  background: var(--rule-heavy);
  color: var(--bg-canvas);
  border-color: var(--rule-heavy);
}

.stamp-crimson {
  color: var(--brand-crimson);
  background: var(--brand-crimson-soft);
  border-color: var(--brand-crimson-border);
}

.stamp-blue {
  color: var(--brand-blue);
  background: var(--brand-blue-soft);
  border-color: var(--brand-blue-border);
}

.stamp-emerald {
  color: var(--brand-emerald);
  background: var(--brand-emerald-soft);
  border-color: var(--brand-emerald-border);
}

.stamp-amber {
  color: var(--brand-amber);
  background: var(--brand-amber-soft);
  border-color: var(--brand-amber-border);
}

.stamp-slate {
  color: var(--text-secondary);
  background: var(--bg-surface);
  border-color: var(--rule-medium);
}

.stamp-plum {
  color: var(--brand-plum);
  background: var(--brand-plum-soft);
  border-color: var(--brand-plum-border);
}

.stamp-fresh {
  background: var(--brand-crimson);
  color: #ffffff;
  border-color: var(--brand-crimson);
  font-weight: 800;
}

.kicker-meta-dot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.kicker-meta-dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
}

.kicker-meta-dot.tone-crimson { color: var(--brand-crimson); }
.kicker-meta-dot.tone-crimson::before { background: var(--brand-crimson); }
.kicker-meta-dot.tone-emerald { color: var(--brand-emerald); }
.kicker-meta-dot.tone-emerald::before { background: var(--brand-emerald); }
.kicker-meta-dot.tone-amber { color: var(--brand-amber); }
.kicker-meta-dot.tone-amber::before { background: var(--brand-amber); }

/* 6-Track Broadsheet Section Index Strip (Zero background-transition flash!) */
.track-overview-bar {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 20px;
}

.track-overview-cell {
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-canvas);
  color: var(--text-ink);
  border: 1px solid var(--rule-medium);
  border-top: 2.5px solid var(--rule-heavy);
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 3px;
  border-radius: 2px;
  transition: border-color 0.14s ease;
}

.track-overview-cell:hover {
  background: var(--bg-surface);
  border-color: var(--rule-heavy);
}

.track-overview-cell.active {
  background: var(--rule-heavy);
  border-color: var(--rule-heavy);
}

.track-overview-cell.active .track-cell-name,
.track-overview-cell.active .track-cell-count {
  color: var(--bg-canvas);
}

.track-cell-name {
  font-size: 0.79rem;
  font-weight: 800;
  color: var(--text-ink);
  line-height: 1.28;
}

.track-cell-count {
  font-size: 0.73rem;
  color: var(--text-muted);
}

/* KOL Geometric Monogram Avatar */
.avatar-seal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: 0.82rem;
  font-weight: 800;
  border-radius: 3px;
  flex-shrink: 0;
  letter-spacing: -0.02em;
}

.avatar-sm {
  width: 22px;
  height: 22px;
  font-size: 0.66rem;
}

.avatar-lg {
  width: 48px;
  height: 48px;
  font-size: 1.05rem;
}

.avatar-t1 { background: var(--seal-t1-bg); color: var(--seal-t1-fg); }
.avatar-t2 { background: var(--seal-t2-bg); color: var(--seal-t2-fg); }
.avatar-t3 { background: var(--seal-t3-bg); color: var(--seal-t3-fg); }
.avatar-t4 { background: var(--seal-t4-bg); color: var(--seal-t4-fg); }

/* ==========================================================================
   Front-Page Hero, Duel Arena & Chronicle Density Bar Chart
   ========================================================================== */
.frontpage-grid {
  display: grid;
  grid-template-columns: 1.68fr 1fr;
  gap: 28px;
  padding-bottom: 24px;
  margin-bottom: 22px;
  border-bottom: 2px solid var(--rule-heavy);
}

.lead-story {
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
}

.lead-story-top {
  display: flex;
  flex-direction: column;
}

.lead-chrono-strip {
  margin-bottom: 4px;
}

.kicker-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.lead-headline {
  font-size: 1.84rem;
  font-weight: 900;
  color: var(--text-ink);
  line-height: 1.28;
  margin: 0 0 11px;
  letter-spacing: -0.01em;
}

.lead-headline a:hover {
  color: var(--brand-crimson);
}

.lead-deck {
  font-size: 0.98rem;
  color: var(--text-body);
  margin: 0 0 16px;
  line-height: 1.68;
}

.duel-arena {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  border: 1.5px solid var(--rule-heavy);
  background: var(--bg-surface);
  margin-bottom: 16px;
}

.duel-side {
  padding: 15px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.duel-divider {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border-left: 1px solid var(--rule-medium);
  border-right: 1px solid var(--rule-medium);
  background: var(--bg-elevated);
}

.vs-pill {
  font-weight: 900;
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  color: var(--brand-crimson);
}

/* Preserve exact @Handle case — NO text-transform: uppercase! */
.duel-camp-head {
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}

.duel-camp-a { color: var(--brand-crimson); }
.duel-camp-b { color: var(--brand-blue); }

.duel-pullquote {
  margin: 0;
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--text-ink);
  line-height: 1.52;
}

.duel-pos {
  margin: 0;
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Sidebar Hot Leaderboard */
.sidebar-column {
  border-left: 1px solid var(--rule-medium);
  padding-left: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}

.section-kicker {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--text-ink);
  border-bottom: 2px solid var(--rule-heavy);
  padding-bottom: 6px;
  margin: 0 0 12px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.hot-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.hot-item {
  padding: 9px 0;
  border-bottom: 1px solid var(--rule-light);
}

.hot-item:last-child {
  border-bottom: none;
}

.hot-link {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 9px;
  align-items: baseline;
}

.hot-rank-no {
  font-size: 1rem;
  font-weight: 900;
  color: var(--brand-crimson);
}

.hot-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-ink);
  line-height: 1.4;
  display: block;
}

.hot-link:hover .hot-title {
  color: var(--brand-crimson);
}

.hot-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 2px;
  display: block;
}

/* Pure-CSS Interactive Chronicle Density Bar Strip (Zero SVG distortion, Zero inline style) */
.density-strip-box {
  background: var(--bg-surface);
  border: 1px solid var(--rule-medium);
  padding: 10px 14px;
}

.density-strip-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.74rem;
}

.density-strip-title {
  font-weight: 800;
  color: var(--text-ink);
}

.density-bars-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(38px, 1fr));
  gap: 6px;
  align-items: end;
}

.density-col-btn {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 1px solid transparent;
  padding: 4px 2px 2px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border-radius: 2px;
}

.density-col-btn:hover,
.density-col-btn.active {
  background: var(--bg-canvas);
  border-color: var(--rule-heavy);
}

.density-val {
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1;
}

.density-bar-track {
  width: 100%;
  max-width: 24px;
  height: 36px;
  display: flex;
  align-items: flex-end;
  background: var(--rule-light);
  border-radius: 1px;
  overflow: hidden;
}

.density-bar-fill {
  width: 100%;
  background: var(--rule-heavy);
}

.density-bar-fill.is-fresh-yr {
  background: var(--brand-crimson);
}

.bar-h-1 { height: 12%; }
.bar-h-2 { height: 22%; }
.bar-h-3 { height: 32%; }
.bar-h-4 { height: 42%; }
.bar-h-5 { height: 52%; }
.bar-h-6 { height: 62%; }
.bar-h-7 { height: 72%; }
.bar-h-8 { height: 82%; }
.bar-h-9 { height: 92%; }
.bar-h-10 { height: 100%; }

.density-yr {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-ink);
  line-height: 1.1;
}

/* Rivalry Quick-Jump Ribbon */
.rivalry-ribbon {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--rule-medium);
  margin-bottom: 20px;
}

.rivalry-label {
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--brand-crimson);
  letter-spacing: 0.04em;
}

.rivalry-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  background: var(--bg-canvas);
  border: 1px solid var(--rule-medium);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-ink);
  border-radius: 2px;
}

.rivalry-pill:hover {
  border-color: var(--rule-heavy);
  background: var(--bg-elevated);
}

/* ==========================================================================
   Filter Console & Progressive Pagination Bar
   ========================================================================== */
.filter-console {
  background: var(--bg-surface);
  border: 1px solid var(--rule-medium);
  border-top: 2px solid var(--rule-heavy);
  padding: 12px 16px;
  margin-bottom: 18px;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-row + .filter-row {
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px dashed var(--rule-medium);
}

.filter-row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-label {
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  min-width: 54px;
  flex-shrink: 0;
}

.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule-medium);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-pill {
  background: var(--bg-canvas);
  border: 1px solid var(--rule-medium);
  color: var(--text-secondary);
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 2px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.filter-pill:hover {
  border-color: var(--rule-heavy);
  color: var(--text-ink);
}

.filter-pill.active {
  background: var(--rule-heavy);
  color: var(--bg-canvas);
  border-color: var(--rule-heavy);
}

.filter-pill-fresh {
  border-color: var(--brand-crimson-border);
  color: var(--brand-crimson);
  font-weight: 700;
}

.filter-pill-fresh:hover {
  border-color: var(--brand-crimson);
  background: var(--brand-crimson-soft);
  color: var(--brand-crimson);
}

.filter-pill-fresh.active {
  background: var(--brand-crimson);
  color: #ffffff;
  border-color: var(--brand-crimson);
}

.pill-count {
  font-size: 0.71rem;
  opacity: 0.78;
}

.inline-search-input {
  background: var(--bg-canvas);
  border: 1px solid var(--rule-medium);
  color: var(--text-ink);
  padding: 5px 11px;
  font-size: 0.82rem;
  width: 240px;
  max-width: 100%;
  border-radius: 2px;
  outline: none;
}

.inline-search-input:focus {
  border-color: var(--rule-heavy);
}

.reset-filter-btn {
  background: var(--bg-canvas);
  border: 1px solid var(--brand-crimson-border);
  color: var(--brand-crimson);
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 2px;
  cursor: pointer;
}

.reset-filter-btn:hover {
  background: var(--brand-crimson-soft);
  border-color: var(--brand-crimson);
}

.pagination-bar {
  margin-top: 22px;
  padding: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--rule-medium);
  border-top: 2px solid var(--rule-heavy);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.page-action-btn {
  background: var(--rule-heavy);
  color: var(--bg-canvas);
  border: 1px solid var(--rule-heavy);
  padding: 7px 16px;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: 2px;
  cursor: pointer;
}

.page-action-btn.secondary {
  background: var(--bg-canvas);
  color: var(--text-ink);
  border-color: var(--rule-medium);
}

.page-action-btn:hover {
  opacity: 0.9;
  border-color: var(--rule-heavy);
}

/* ==========================================================================
   2-Column Editorial Magazine Dossier Grid
   ========================================================================== */
.editorial-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.dossier-card {
  background: var(--bg-canvas);
  border: 1px solid var(--rule-medium);
  border-top: 2px solid var(--rule-heavy);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 13px;
  box-shadow: var(--shadow-subtle);
  transition: border-color 0.14s ease;
}

.dossier-card:hover {
  border-color: var(--brand-crimson);
}

.card-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.card-headline {
  font-size: 1.18rem;
  font-weight: 800;
  color: var(--text-ink);
  margin: 7px 0;
  line-height: 1.38;
}

.card-headline a:hover {
  color: var(--brand-crimson);
}

.card-deck {
  font-size: 0.89rem;
  color: var(--text-secondary);
  margin: 0 0 10px;
  line-height: 1.62;
}

.mini-quotes-box {
  border-top: 1px dashed var(--rule-medium);
  border-bottom: 1px dashed var(--rule-medium);
  padding: 10px 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  font-size: 0.81rem;
}

.mini-q-side {
  color: var(--text-body);
  min-width: 0;
}

.mini-q-tag {
  font-weight: 700;
  font-size: 0.73rem;
  display: block;
  margin-bottom: 2px;
}

.person-pill-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.person-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px 2px 3px;
  border: 1px solid var(--rule-light);
  background: var(--bg-surface);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-ink);
  border-radius: 2px;
}

.person-pill:hover {
  border-color: var(--rule-heavy);
}

.card-bottom-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.76rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Matrix Ledger (`/matrix/index.html`) & Live Timeline (`/timeline/index.html`)
   ========================================================================== */
.matrix-table-wrap {
  border: 1.5px solid var(--rule-heavy);
  background: var(--bg-canvas);
  overflow-x: auto;
}

.matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.matrix-table th {
  background: var(--bg-surface);
  color: var(--text-ink);
  font-weight: 800;
  text-align: left;
  padding: 10px 13px;
  border-bottom: 1.5px solid var(--rule-heavy);
  font-size: 0.77rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.matrix-table td {
  padding: 11px 13px;
  border-bottom: 1px solid var(--rule-light);
  vertical-align: top;
}

.matrix-table td.cell-nowrap {
  white-space: nowrap;
}

.matrix-table tr:hover td {
  background: var(--bg-surface);
}

.matrix-title-link {
  font-weight: 700;
  color: var(--text-ink);
  font-size: 0.93rem;
  display: block;
  margin-bottom: 3px;
}

.matrix-title-link:hover {
  color: var(--brand-crimson);
}

.matrix-summary-line {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.tl-period-section {
  margin-bottom: 28px;
}

.tl-period-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 2px solid var(--rule-heavy);
  padding-bottom: 6px;
  margin: 0 0 16px;
}

.tl-period-title {
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--text-ink);
  letter-spacing: 0.03em;
  margin: 0;
}

.tl-stream {
  display: flex;
  flex-direction: column;
}

.tl-entry {
  display: grid;
  grid-template-columns: 142px 1fr;
  gap: 20px;
  position: relative;
  padding-bottom: 18px;
}

.tl-rail {
  position: relative;
  padding-right: 16px;
  border-right: 2px solid var(--rule-medium);
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  padding-top: 4px;
}

.tl-node-dot {
  position: absolute;
  right: -6px;
  top: 9px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--rule-heavy);
  border: 2px solid var(--bg-canvas);
}

.tl-node-dot.is-fresh {
  background: var(--brand-crimson);
  width: 12px;
  height: 12px;
  right: -7px;
  top: 8px;
}

.tl-date-main {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-ink);
  line-height: 1.2;
}

.tl-date-sub {
  font-size: 0.73rem;
  color: var(--text-muted);
}

.tl-card {
  border: 1px solid var(--rule-medium);
  background: var(--bg-canvas);
  padding: 17px 20px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  box-shadow: var(--shadow-subtle);
  transition: border-color 0.14s ease;
}

.tl-card.tl-card-fresh {
  border-left: 3.5px solid var(--brand-crimson);
}

.tl-card:hover {
  border-color: var(--rule-heavy);
}

.micro-steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(205px, 1fr));
  gap: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--rule-light);
  padding: 10px 12px;
}

.micro-step-box {
  background: var(--bg-canvas);
  border: 1px solid var(--rule-light);
  border-top: 2px solid var(--rule-heavy);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.micro-step-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 0.72rem;
}

.micro-step-phase {
  font-weight: 800;
  color: var(--brand-crimson);
}

.micro-step-actor {
  font-size: 0.81rem;
  font-weight: 800;
  color: var(--text-ink);
}

.micro-step-body {
  font-size: 0.79rem;
  color: var(--text-secondary);
  line-height: 1.48;
  margin: 0;
}

/* ==========================================================================
   Case Detail Dossier, KOL Roster (Aligned Header Grid!), & Stele Cards
   ========================================================================== */
.crumb-bar {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.crumb-links {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.crumb-links a:hover {
  color: var(--text-ink);
  text-decoration: underline;
}

.cite-copy-btn {
  background: var(--bg-surface);
  border: 1px solid var(--rule-medium);
  color: var(--text-secondary);
  padding: 3px 9px;
  font-size: 0.74rem;
  font-weight: 700;
  border-radius: 2px;
  cursor: pointer;
}

.cite-copy-btn:hover {
  border-color: var(--rule-heavy);
  color: var(--text-ink);
}

.case-hero-box {
  border-top: 3px solid var(--rule-heavy);
  border-bottom: 1px solid var(--rule-medium);
  padding: 20px 0 18px;
  margin-bottom: 22px;
}

.case-h1 {
  font-size: 1.92rem;
  font-weight: 900;
  color: var(--text-ink);
  line-height: 1.28;
  margin: 10px 0 12px;
}

.audit-banner {
  margin-top: 14px;
  padding: 9px 14px;
  background: var(--bg-surface);
  border-left: 3px solid var(--rule-heavy);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.8rem;
}

.safe-harbor-alert {
  margin-bottom: 18px;
  padding: 12px 16px;
  background: var(--brand-amber-soft);
  border: 1px solid var(--brand-amber-border);
  border-left: 4px solid var(--brand-amber);
  color: var(--text-body);
  font-size: 0.84rem;
  line-height: 1.6;
}

.safe-harbor-title {
  display: block;
  font-weight: 800;
  color: var(--brand-amber);
  margin-bottom: 3px;
  font-size: 0.85rem;
}

.chronology-section {
  margin: 26px 0;
}

.chrono-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
}

.chrono-item {
  display: grid;
  grid-template-columns: 148px 1fr;
  gap: 20px;
  padding: 15px 0;
  border-top: 1px solid var(--rule-light);
}

.chrono-time-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.chrono-date {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-ink);
}

.chrono-actor {
  font-weight: 800;
  color: var(--text-ink);
  font-size: 0.94rem;
  margin-bottom: 4px;
}

.chrono-body {
  margin: 0 0 8px;
  color: var(--text-body);
  font-size: 0.91rem;
}

.chrono-refs {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 0.77rem;
}

.case-nav-footer {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 2px solid var(--rule-heavy);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.case-adj-card {
  display: block;
  padding: 12px 16px;
  border: 1px solid var(--rule-medium);
  background: var(--bg-surface);
}

.case-adj-card:hover {
  border-color: var(--rule-heavy);
  background: var(--bg-canvas);
}

.case-adj-dir {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
}

.case-adj-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-ink);
  display: block;
}

.link-accent {
  color: var(--brand-blue);
  font-weight: 600;
}

.link-accent:hover {
  text-decoration: underline;
}

/* KOL Portrait & Faction Directory — Strict Non-Wrapping Badge Column */
.tier-section {
  margin-bottom: 28px;
}

.kol-roster-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.kol-dossier-card {
  border: 1px solid var(--rule-medium);
  border-top: 2px solid var(--rule-heavy);
  background: var(--bg-canvas);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}

.kol-dossier-card:hover {
  border-color: var(--brand-crimson);
}

.kol-card-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  margin-bottom: 8px;
}

.kol-head-flex {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  min-width: 0;
}

.kol-head-meta {
  min-width: 0;
}

.kol-title-name {
  font-size: 1.04rem;
  font-weight: 800;
  color: var(--text-ink);
  margin: 0 0 2px;
  line-height: 1.3;
}

.kol-sub-line {
  font-size: 0.76rem;
  color: var(--text-muted);
  display: block;
  overflow-wrap: anywhere;
  line-height: 1.38;
}

.kol-tag-chip {
  background: var(--bg-surface);
  border: 1px solid var(--rule-light);
  color: var(--text-secondary);
  padding: 1px 7px;
  font-size: 0.72rem;
  border-radius: 2px;
  cursor: pointer;
}

.kol-tag-chip:hover {
  border-color: var(--rule-heavy);
  color: var(--text-ink);
}

.stele-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.stele-card {
  border: 1px solid var(--rule-medium);
  background: var(--bg-canvas);
  padding: 17px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.stele-card:target {
  border: 2px solid var(--brand-crimson);
}

.stele-excerpt {
  margin: 0;
  padding: 11px 14px;
  background: var(--bg-surface);
  border-left: 3px solid var(--rule-heavy);
  color: var(--text-ink);
  font-size: 0.89rem;
  line-height: 1.64;
}

.stele-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid var(--rule-light);
  font-size: 0.74rem;
  color: var(--text-muted);
}

/* Floating Back-To-Top Button */
.back-top-btn {
  position: fixed;
  right: 20px;
  bottom: 22px;
  z-index: 55;
  background: var(--rule-heavy);
  color: var(--bg-canvas);
  border: 1px solid var(--rule-medium);
  padding: 7px 12px;
  font-size: 0.76rem;
  font-weight: 800;
  border-radius: 2px;
  cursor: pointer;
  box-shadow: var(--shadow-popover);
}

/* Utilities & Footer */
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.row-wrap { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.mt-10 { margin-top: 10px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.text-muted-xs { font-size: 0.77rem; color: var(--text-muted); }
.empty-box { padding: 30px; text-align: center; border: 1px dashed var(--rule-medium); color: var(--text-muted); }

.site-footer {
  border-top: 2px solid var(--rule-heavy);
  background: var(--bg-surface);
  padding: 20px 0;
  font-size: 0.79rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   Responsive Breakpoints (980px Tablet & 390px Mobile Ergonomics)
   ========================================================================== */
@media (max-width: 980px) {
  .frontpage-grid,
  .editorial-cards-grid,
  .stele-grid,
  .case-nav-footer {
    grid-template-columns: minmax(0, 1fr);
  }
  .track-overview-bar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .sidebar-column {
    border-left: none;
    border-top: 1.5px solid var(--rule-heavy);
    padding-left: 0;
    padding-top: 18px;
  }
  .duel-arena {
    grid-template-columns: 1fr;
  }
  .duel-divider {
    border-left: none;
    border-right: none;
    border-top: 1px solid var(--rule-medium);
    border-bottom: 1px solid var(--rule-medium);
    padding: 5px;
  }
  .kol-roster-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .container {
    padding: 0 14px;
  }
  /* Release sticky header on small screens so viewport isn't permanently taxed */
  .masthead {
    position: relative;
  }
  .brand-tagline,
  .search-kbd,
  .nav-divider {
    display: none;
  }
  .brand-title {
    font-size: 1.28rem;
  }
  .masthead-top {
    padding: 8px 0 6px;
    gap: 6px;
  }
  .mode-switcher {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }
  .mode-tab {
    padding: 5px 4px;
    font-size: 0.74rem;
    text-align: center;
  }
  .masthead-nav-bar {
    padding: 6px 0;
    gap: 6px;
  }
  .primary-nav {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .primary-nav::-webkit-scrollbar {
    display: none;
  }
  .nav-item {
    padding: 3px 7px;
    font-size: 0.78rem;
  }
  .nav-tools {
    width: 100%;
    display: flex;
    gap: 6px;
  }
  .search-wrap {
    flex: 1;
    min-width: 0;
  }
  .search-box {
    width: 100%;
    padding-right: 10px;
    font-size: 0.8rem;
  }
  /* Compact single-row horizontal swipeable Dateline & Track strips on 390px! */
  .dateline-grid {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
    border: none;
  }
  .dateline-grid::-webkit-scrollbar {
    display: none;
  }
  .dateline-cell {
    flex: 0 0 auto;
    padding: 6px 12px;
    gap: 6px;
    white-space: nowrap;
  }
  .track-overview-bar {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    margin-bottom: 14px;
    padding-bottom: 2px;
    scrollbar-width: none;
  }
  .track-overview-bar::-webkit-scrollbar {
    display: none;
  }
  .track-overview-cell {
    flex: 0 0 142px;
    padding: 7px 9px;
  }
  main {
    padding: 14px 0 44px;
  }
  .lead-headline, .case-h1 {
    font-size: 1.36rem;
  }
  .stamp {
    max-width: 100%;
    white-space: normal;
  }
  .filter-console {
    padding: 10px 12px;
  }
  .filter-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .filter-row::-webkit-scrollbar {
    display: none;
  }
  .filter-row-between {
    flex-wrap: wrap;
    overflow-x: visible;
  }
  .filter-row-between > .filter-row {
    width: 100%;
  }
  .filter-group {
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    max-width: 100%;
    padding-bottom: 2px;
  }
  .filter-group::-webkit-scrollbar {
    display: none;
  }
  .filter-pill {
    flex-shrink: 0;
    white-space: nowrap;
  }
  .filter-row-between > .row-wrap {
    width: 100%;
  }
  .inline-search-input {
    width: 100%;
    flex: 1 1 100%;
  }
  .tl-entry {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }
  .tl-card {
    min-width: 0;
    overflow-wrap: anywhere;
  }
  .tl-rail {
    border-right: none;
    border-left: 3px solid var(--brand-crimson);
    padding-right: 0;
    padding-left: 10px;
    text-align: left;
    flex-direction: row;
    align-items: center;
    gap: 10px;
  }
  .tl-node-dot {
    display: none;
  }
  .micro-steps-grid,
  .mini-quotes-box,
  .kol-roster-grid,
  .chrono-item {
    grid-template-columns: minmax(0, 1fr);
  }
  .filter-bar > .row-wrap {
    width: 100%;
  }
  .chrono-item {
    gap: 6px;
  }
  /* Labeled compact mobile ledger cards for Matrix view */
  .matrix-table thead {
    display: none;
  }
  .matrix-table, .matrix-table tbody, .matrix-table tr, .matrix-table td {
    display: block;
    width: 100%;
  }
  .matrix-table tr {
    padding: 12px 14px;
    border-bottom: 1.5px solid var(--rule-medium);
  }
  .matrix-table td,
  .matrix-table td.cell-nowrap {
    padding: 3px 0;
    border: none;
    white-space: normal;
  }
  .matrix-table td[data-label]::before {
    content: attr(data-label) "：";
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-right: 4px;
  }
}

@media (max-height: 500px) {
  .masthead {
    position: relative;
  }
  .search-popover {
    max-height: min(220px, calc(100vh - 80px));
  }
}
