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

:root {
  --bg: #0a0a0a;
  --surface: #111111;
  --surface2: #1a1a1a;
  --border: #2a2a2a;
  --border2: #3d3d3d;
  --text: #ece7dd;
  --muted: #a39b8d;
  --muted2: #837b6d;
  --accent: #e2231a;
  --accent2: #ff3b30;
  --accent-lite: #ff6a5c;
  --green: #6bbf8a;
  --blue: #6fa8c9;
  --paper: #ece7dd;
  --ink: #0a0a0a;
  --display: 'Anton', 'Arial Narrow', sans-serif;
  --mono: 'Space Mono', ui-monospace, monospace;
  --serif: 'Crimson Pro', Georgia, 'Times New Roman', serif;
  --sans: 'Space Mono', ui-monospace, monospace;
  --radius: 0px;
  --accent-text: #ff3b30;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

html { font-size: 17px; scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font-family: var(--sans); line-height: 1.6; min-height: 100vh; }
@media (min-width: 861px) {
  body { padding-left: 264px; }
  .container { max-width: 1180px; }
}
a { color: inherit; text-decoration: none; }
code { font-family: 'Fira Code', 'Courier New', monospace; font-size: 0.85em; background: var(--surface2); padding: 0.15em 0.4em; border-radius: 3px; }

/* ── NAV ── */
.rail {
  position: fixed; top: 0; left: 0; width: 264px; height: 100vh;
  display: flex; flex-direction: column; gap: 1.5rem;
  padding: 1.5rem 1.1rem;
  border-right: 1px solid var(--border);
  background: var(--surface);
  overflow-y: auto; z-index: 50;
}
.rail-logo {
  display: flex; align-items: center; gap: 0.55rem;
  font-family: var(--display); font-size: 1.5rem; font-weight: 700;
  letter-spacing: -0.02em; color: var(--text); line-height: 1;
}
.rail-logo img { width: 34px; height: 34px; }
.rail-search input {
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.55rem 0.85rem;
  color: var(--text); font-size: 0.9rem; font-family: var(--sans);
  outline: none; transition: border-color 0.15s;
}
.rail-search input:focus { border-color: var(--accent); }
.rail-search input::placeholder { color: var(--muted2); }
.rail-search .search-wrap { position: relative; display: flex; }
.rail-search input { padding-right: 2.2rem; }
.rail-search .search-btn { position: absolute; right: 0.5rem; top: 50%; transform: translateY(-50%); display: block; background: none; border: none; color: var(--muted); font-size: 1.1rem; cursor: pointer; padding: 0; }
.rail-search .search-btn:hover { color: var(--accent); }
.rail-search .search-suggest { position: absolute; top: 100%; left: 0; right: 0; z-index: 60; }
.rail-nav { display: flex; flex-direction: column; gap: 0.1rem; }
.rail-link {
  font-family: var(--display); font-size: 1.05rem; font-weight: 500;
  color: var(--muted); padding: 0.4rem 0.6rem; border-radius: var(--radius);
  border-left: 2px solid transparent; transition: color 0.12s, background 0.12s, border-color 0.12s;
}
.rail-link:hover { color: var(--text); background: var(--surface2); border-left-color: var(--accent); }
.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 0.75rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.rail-random { font-size: 0.85rem; color: var(--accent-text); font-weight: 500; }
.rail-random:hover { text-decoration: underline; }
.rail-toggle { display: none; }
/* mobile: rail collapses to a slide-in drawer */
@media (max-width: 860px) {
  .rail {
    position: fixed; top: 0; left: 0; z-index: 200; width: 260px; height: 100vh;
    transform: translateX(-100%); transition: transform 0.2s ease;
    box-shadow: 2px 0 24px rgba(0,0,0,0.4);
  }
  .rail.open { transform: translateX(0); }
  .rail-toggle {
    display: flex; position: fixed; top: 0.7rem; left: 0.7rem; z-index: 150;
    width: 40px; height: 40px; align-items: center; justify-content: center;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    color: var(--text); font-size: 1.2rem; cursor: pointer;
  }
  .container { padding-top: 3.5rem; }
}

/* ── TICKER ── */
.ticker {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0 1rem; height: 28px;
  border-bottom: 1px solid var(--border);
  background: var(--surface); overflow: hidden;
  font-size: 0.72rem;
}
.ticker-label {
  font-size: 0.6rem; font-weight: 800; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--accent);
  flex-shrink: 0;
}
.ticker-scroll {
  display: flex; overflow: hidden; min-width: 0; flex: 1;
  mask-image: linear-gradient(to right, transparent 0, black 2%, black 96%, transparent 100%);
}
.ticker-scroll:hover .ticker-track { animation-play-state: paused; }
.ticker-track {
  display: flex; align-items: center; gap: 0.6rem; padding-right: 0.6rem;
  flex-shrink: 0; white-space: nowrap;
  animation: tickerScroll 90s linear infinite;
}
@keyframes tickerScroll { to { transform: translateX(-100%); } }
@media (prefers-reduced-motion: reduce) { .ticker-track { animation: none; } .ticker-scroll { overflow-x: auto; } }
.ticker-link { color: var(--muted); white-space: nowrap; flex-shrink: 0; transition: color 0.1s; }
.ticker-link:hover { color: var(--text); }
.ticker-divider { color: var(--muted2); flex-shrink: 0; user-select: none; }

/* ── TOOLBAR ── */
.toolbar {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0 1rem; height: 36px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 44px; z-index: 90;
  background: rgba(12,11,10,0.97); backdrop-filter: blur(8px);
}
[data-theme="light"] .toolbar { background: rgba(245,243,240,0.97); }
.fdrop { position: relative; }
.fdrop summary { list-style: none; cursor: pointer; font-size: 0.78rem; color: var(--muted); padding: 0.3rem 0.6rem; user-select: none; }
.fdrop summary::-webkit-details-marker { display: none; }
.fdrop summary::after { content: " ▾"; font-size: 0.65em; color: var(--muted2); }
.fdrop summary:hover, .fdrop[open] summary { color: var(--text); }
.fdrop-menu {
  position: absolute; top: 100%; left: 0; z-index: 120;
  min-width: 200px; max-height: 60vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.4rem; box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  display: flex; flex-direction: column;
}
.fdrop-menu-wide { min-width: 260px; }
.fitem { padding: 0.35rem 0.6rem; font-size: 0.82rem; color: var(--muted); border-radius: 4px; text-transform: capitalize; }
.fitem:hover { background: var(--surface2); color: var(--text); }
.fitem.on { color: var(--accent-text); }
.chips { display: flex; gap: 0.5rem; padding: 0.5rem 1rem 0; flex-wrap: wrap; }
.chip { font-size: 0.75rem; padding: 0.2rem 0.6rem; border: 1px solid var(--border); border-radius: 999px; color: var(--accent-text); text-transform: capitalize; }
.chip:hover { border-color: var(--accent-text); }
.intro { padding: 1.5rem 0 2rem; }
.intro-title { font-family: var(--display); font-size: 1.75rem; font-weight: 600; letter-spacing: -0.5px; line-height: 1.25; }
.intro-sub { font-size: 0.88rem; color: var(--muted); margin-top: 0.35rem; line-height: 1.5; }
/* ── homepage hero ── */
/* ── magazine layout ── */
.mag-hero { display: grid; grid-template-columns: 1fr 300px; gap: 0; margin: 1.5rem 0 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
@media (max-width: 900px) { .mag-hero { grid-template-columns: 1fr; } }
.mag-hero-link { display: grid; grid-template-rows: 260px 1fr; text-decoration: none; }
@media (min-width: 600px) { .mag-hero-link { grid-template-columns: 1fr 1fr; grid-template-rows: unset; min-height: 320px; } }
.mag-hero-img { position: relative; overflow: hidden; background: var(--surface2); }
.mag-hero-img img { width: 100%; height: 100%; object-fit: cover; object-position: center; transition: transform .3s; }
.mag-hero-link:hover .mag-hero-img img { transform: scale(1.03); }
.mag-hero-body { padding: 1.5rem; display: flex; flex-direction: column; gap: .4rem; justify-content: center; }
.mag-kicker { font-size: .65rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-text); }
.mag-hero-title { font-family: var(--display); font-size: 1.6rem; font-weight: 700; line-height: 1.2; letter-spacing: -.3px; }
@media (max-width: 600px) { .mag-hero-title { font-size: 1.25rem; } }
.mag-hero-author { font-size: .82rem; color: var(--muted); }
.mag-hero-desc { font-size: .88rem; color: var(--muted); line-height: 1.55; margin-top: .25rem; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.mag-read-cta { font-size: .82rem; font-weight: 600; color: var(--accent-text); margin-top: auto; padding-top: .5rem; }
.mag-flag { font-size: 1.1rem; bottom: .4rem; right: .4rem; }
.mag-sidebar { border-left: 1px solid var(--border); display: flex; flex-direction: column; }
@media (max-width: 900px) { .mag-sidebar { border-left: none; border-top: 1px solid var(--border); flex-direction: row; overflow-x: auto; } }
.mag-secondary { display: flex; gap: .75rem; padding: .85rem 1rem; border-bottom: 1px solid var(--border); text-decoration: none; transition: background .15s; flex-shrink: 0; }
.mag-secondary:last-child { border-bottom: none; }
.mag-secondary:hover { background: var(--surface2); }
.mag-sec-img { flex: 0 0 56px; height: 56px; overflow: hidden; border-radius: 3px; position: relative; }
.mag-sec-img img { width: 100%; height: 100%; object-fit: cover; }
.mag-sec-body { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.mag-sec-title { font-size: .88rem; font-weight: 600; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.mag-sec-author { font-size: .75rem; color: var(--muted); }
.mag-otd { padding: .85rem 1rem; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: .4rem; margin-top: auto; }
.mag-banner { display: flex; justify-content: space-between; align-items: center; gap: 2rem; padding: 1.75rem 0 1.5rem; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; flex-wrap: wrap; }
.mag-banner-title { font-family: var(--display); font-size: 1.75rem; font-weight: 700; letter-spacing: -.4px; }
.mag-banner-sub { font-size: .88rem; color: var(--muted); margin-top: .3rem; }
.mag-banner-stats { display: flex; gap: 2rem; font-size: .82rem; color: var(--muted); text-align: center; flex-shrink: 0; }
.mag-banner-stats strong { display: block; font-size: 1.4rem; font-variant-numeric: tabular-nums; color: var(--text); }
.topic-shelf { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1.25rem 0 1rem; }
.topic-pill { display: flex; align-items: center; gap: .4rem; padding: .3rem .7rem; background: var(--surface); border: 1px solid var(--border); border-radius: 99px; font-size: .78rem; transition: border-color .15s, background .15s; white-space: nowrap; }
.topic-pill:hover { border-color: var(--accent); background: var(--surface2); }
.topic-pill-name { color: var(--text); }
.topic-pill-n { color: var(--muted2); font-variant-numeric: tabular-nums; font-size: .72rem; }
.topic-pill-more { color: var(--accent-text); border-color: transparent; }
.topic-pill-more:hover { border-color: var(--accent); }
.section-label { font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted2); margin: 1.25rem 0 .75rem; }
.toolbar-end { display: flex; align-items: center; gap: 0.6rem; flex-shrink: 0; margin-left: auto; }
.toolbar-count { font-size: 0.7rem; color: var(--muted2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.lang-sel {
  background: none; border: none;
  color: var(--muted); font-size: 0.72rem; font-family: var(--sans);
  cursor: pointer; outline: none; max-width: 90px;
}
.tpill {
  display: inline-block; padding: 0.25rem 0.5rem;
  font-size: 0.72rem; color: var(--muted); white-space: nowrap;
  text-decoration: none; flex-shrink: 0;
  border-bottom: 2px solid transparent;
  text-transform: capitalize;
  transition: color 0.1s;
}
.tpill:hover { color: var(--text); }
.tpill.on { color: var(--accent-text); border-bottom-color: var(--accent-text); }
.tpill-src { font-size: 0.68rem; text-transform: none; }
.tpill-divider { color: var(--muted2); opacity: 0.5; padding: 0 0.3rem; user-select: none; flex-shrink: 0; }
.tpill-rand { font-size: 0.85rem; padding: 0.1rem 0.35rem; }
.tpill-rand:hover { color: var(--accent); }

/* ── CONTAINER ── */
.container { max-width: 1360px; width: 100%; margin: 0 auto; padding: 1rem 1rem; flex: 1; }
.results-meta { font-size: 0.82rem; color: var(--muted); margin-bottom: 1.25rem; }
.results-meta strong { color: var(--text); }

/* ── FOOTER ── */
.foot-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0 1rem; height: 48px; font-size: 0.72rem; color: var(--muted);
  max-width: 1360px; margin: 0 auto; flex-wrap: wrap;
}
.foot-links { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; row-gap: 0.4rem; }
.foot-links a { color: var(--muted); transition: color 0.1s; }
.foot-links a:hover { color: var(--accent-text); }
.foot-copy, .foot-stats { color: var(--muted2); white-space: nowrap; }
@media (max-width: 640px) { .foot-row { height: auto; padding: 0.75rem 1rem; justify-content: center; text-align: center; flex-wrap: wrap; gap: 0.5rem; } }

/* ── BOOK GRID ── */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 0;
  border-top: 1px solid var(--border);
}
.book-card { display: grid; grid-template-columns: 44px 1fr; gap: 0.9rem; align-items: center; min-width: 0; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); transition: background 0.12s; }
.book-card:hover { background: var(--surface2); }
.book-cover {
  aspect-ratio: 2/3; overflow: hidden; background: var(--surface2);
  position: relative; border-radius: 3px; width: 44px; display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.book-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.2s ease, filter 0.2s; }
.book-card:hover .book-cover img { transform: scale(1.04); }
.book-card:hover .book-title-card { color: var(--accent-text); }
.cover-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: var(--surface2); }
.cover-placeholder.cp-0 { background: #1a1215; } .cover-placeholder.cp-0 .cover-initial { color: var(--accent); }
.cover-placeholder.cp-1 { background: #121a14; } .cover-placeholder.cp-1 .cover-initial { color: #4a9e5c; }
.cover-placeholder.cp-2 { background: #111520; } .cover-placeholder.cp-2 .cover-initial { color: #4a6fa5; }
.cover-placeholder.cp-3 { background: #1a1712; } .cover-placeholder.cp-3 .cover-initial { color: #b8962e; }
.cover-placeholder.cp-4 { background: #18121a; } .cover-placeholder.cp-4 .cover-initial { color: #8b5cf6; }
.cover-placeholder.cp-5 { background: #121818; } .cover-placeholder.cp-5 .cover-initial { color: #2d9da8; }
.cover-placeholder.cp-6 { background: #1a1318; } .cover-placeholder.cp-6 .cover-initial { color: #c2527a; }
.cover-placeholder.cp-7 { background: #141a12; } .cover-placeholder.cp-7 .cover-initial { color: #6a9e3a; }
.cover-initial { font-family: var(--display); font-size: 1.3rem; font-weight: 600; }
.book-readtime { font-size: 0.7rem; color: var(--muted); margin-bottom: 0.25rem; }
.book-info { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.book-title-card { font-family: var(--display); font-size: 0.98rem; font-weight: 500; line-height: 1.25; color: var(--text); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; transition: color 0.15s; }
.book-author-card { font-size: 0.75rem; color: var(--muted2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-style: italic; }
.book-badges { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: auto; padding-top: 0.4rem; }
.badge { font-size: 0.67rem; padding: 0.1rem 0.45rem; border-radius: 3px; font-weight: 500; }
.badge-cat { background: rgba(217,139,58,0.1); color: var(--accent2); }
.badge-text { background: rgba(76,175,110,0.1); color: var(--green); }
.badge-src { background: rgba(255,255,255,0.04); color: var(--muted); }
.cover-audio { background: rgba(249,115,22,0.08); }
.cover-audio .cover-initial { color: var(--accent); font-size: 1.6rem; }
.cover-video { background: rgba(91,143,212,0.08); }
.cover-video .cover-initial { color: var(--blue); font-size: 1.6rem; }
.cover-type-badge {
  position: absolute; bottom: 4px; right: 4px;
  background: rgba(0,0,0,0.65); backdrop-filter: blur(4px);
  border-radius: 4px; padding: 1px 5px; font-size: 0.75rem; line-height: 1.6;
  pointer-events: none;
}
.pill-sep { color: var(--border2); padding: 0 0.25rem; user-select: none; }
.btn-primary { display:inline-block;padding:0.6rem 1.25rem;background:var(--accent);color:#fff;border-radius:var(--radius);font-size:0.85rem;font-weight:600;text-decoration:none;transition:opacity .15s; }
.btn-primary:hover { opacity:0.85; }
.btn-secondary { display:inline-block;padding:0.6rem 1.25rem;background:var(--surface2);color:var(--text);border:1px solid var(--border);border-radius:var(--radius);font-size:0.85rem;font-weight:500;text-decoration:none;transition:background .15s; }
.btn-secondary:hover { background:var(--surface3); }

/* ── PAGINATION ── */
.pagination { display: flex; align-items: center; justify-content: center; gap: 1rem; padding: 2.5rem 0 1rem; }
.btn { padding: 0.4rem 0.9rem; border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.82rem; color: var(--text); transition: border-color 0.12s, color 0.12s; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.page-info { font-size: 0.82rem; color: var(--muted); }

/* ── BOOK PAGE LAYOUT ── */
.book-page { flex: 1; padding: 2rem 0; }
.book-page-inner { max-width: 960px; margin: 0 auto; padding: 0 1rem; }
.back-link { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; color: var(--muted); margin-bottom: 2rem; transition: color 0.12s; }
.back-link:hover { color: var(--text); }

.book-hero-band { height: 6px; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.book-header { margin-bottom: 1.5rem; display: flex; gap: 1.75rem; align-items: flex-start; padding-top: 0.5rem; }
.book-header-cover { width: 150px; flex-shrink: 0; border-radius: 4px; object-fit: contain; box-shadow: 0 6px 24px rgba(0,0,0,0.35); border: 1px solid var(--border); }
.book-header-info { flex: 1; min-width: 0; }
@media (max-width: 480px) { .book-header { flex-direction: column; align-items: center; text-align: center; } .book-header-cover { width: 140px; margin-bottom: 0.5rem; } .book-meta-row { justify-content: center; } .book-author { margin-bottom: 0.5rem; } }
.category-label { display: inline-block; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); margin-bottom: 0.8rem; }
.participant-notice { font-size: .78rem; color: var(--muted); border-left: 2px solid var(--border); padding: .35rem .75rem; margin: .5rem 0 .75rem; font-style: italic; }
.book-title { font-family: var(--display); font-size: 2.4rem; font-weight: 600; line-height: 1.2; color: var(--text); margin-bottom: 0.5rem; }
.book-author { font-size: 1rem; color: var(--muted); font-style: italic; font-family: var(--serif); margin-bottom: 1rem; }
.book-meta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 1rem; }
.meta-pill { font-size: 0.73rem; padding: 0.2rem 0.6rem; border: 1px solid var(--border); border-radius: 4px; color: var(--muted); }
.meta-pill-link { color: var(--accent); border-color: var(--accent); opacity: 0.8; text-decoration: none; transition: opacity 0.12s; }
.meta-pill-link:hover { opacity: 1; }
.meta-pill-ext { color: var(--accent-text); border-color: var(--accent); text-decoration: none; transition: opacity .12s; }
.meta-pill-ext:hover { opacity: .8; }
.book-subjects { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.75rem; }
.subject-tag { font-size: 0.72rem; padding: 0.15rem 0.55rem; background: var(--surface2); border: 1px solid var(--border); border-radius: 3px; color: var(--muted); }
.meta-date { font-size: 0.73rem; color: var(--muted2); }
.pill-text { border-color: rgba(76,175,110,0.3); color: var(--green); }
.pill-trans { border-color: rgba(91,143,212,0.3); color: var(--blue); }

/* ── TRANSLATION UI ── */
.lang-switcher {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 0.9rem; margin: 1rem 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 0.8rem; color: var(--muted); flex-wrap: wrap;
}
.lang-pill {
  padding: 0.2rem 0.65rem; border-radius: 999px; font-size: 0.75rem;
  font-weight: 500; border: 1px solid var(--border); color: var(--muted);
  background: var(--bg); transition: all 0.12s; cursor: pointer;
}
.lang-pill.current { border-color: var(--border2); color: var(--text); cursor: default; }
.lang-pill.translated { border-color: var(--accent); color: var(--accent); }
.lang-pill.translated:hover { background: var(--accent); color: #fff; }
.lang-pill.original { border-color: var(--border2); color: var(--text2); }
.lang-pill.original:hover { background: var(--border2); color: var(--text); }
.lang-pill.pill-notice { border-color: transparent; color: var(--text2); font-style: italic; cursor: default; }
.lang-engine { font-size: 0.65rem; opacity: 0.6; margin-left: 2px; }

.tx-origin-bar {
  display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
  padding: 0.65rem 0.9rem; margin: 0 0 1rem;
  background: rgba(217,139,58,0.05); border: 1px solid rgba(217,139,58,0.2);
  border-radius: var(--radius); font-size: 0.8rem; color: var(--muted);
}
.tx-origin-link { margin-left: auto; color: var(--accent); font-size: 0.75rem; }
.tx-origin-link:hover { text-decoration: underline; }
.tx-badge {
  display: inline-block; font-size: 0.75rem; color: var(--muted);
  background: rgba(217,139,58,0.06); border: 1px solid rgba(217,139,58,0.18);
  border-radius: var(--radius); padding: 0.3rem 0.7rem; margin-bottom: 1rem;
}
.tx-row { display: inline-flex; align-items: center; }
.tx-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.35rem 0.8rem; background: var(--surface2);
  border: 1px solid var(--border); border-radius: var(--radius) 0 0 var(--radius);
  color: var(--text); font-size: 0.8rem; cursor: pointer; font-family: var(--sans);
  transition: border-color 0.12s, color 0.12s;
}
.tx-btn:hover { border-color: var(--accent); color: var(--accent); }
.tx-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.tx-select {
  background: var(--surface2); border: 1px solid var(--border); border-left: none;
  color: var(--muted); padding: 0.35rem 1.6rem 0.35rem 0.6rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.78rem; cursor: pointer; outline: none; height: 32px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23707070'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 6px center;
}
.tx-select:focus { border-color: var(--accent); }
.tx-status { font-size: 0.75rem; color: var(--muted); margin-top: 0.5rem; font-style: italic; }

/* ── DESC + TAGS ── */
.book-desc {
  font-size: 0.95rem; line-height: 1.75; color: var(--muted);
  border-left: 2px solid var(--accent); padding-left: 1rem;
  margin: 1.5rem 0; font-style: italic;
}
.book-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 1rem 0; }
.tag { font-size: 0.71rem; padding: 0.15rem 0.5rem; background: var(--surface2); border: 1px solid var(--border); border-radius: 3px; color: var(--muted); }

/* ── DOWNLOADS ── */
.book-downloads { margin: 1.5rem 0; }
.section-label { display: block; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted2); margin-bottom: 0.6rem; }
.download-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.btn-download {
  padding: 0.4rem 0.9rem; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 0.79rem; font-weight: 600; color: var(--text); letter-spacing: 0.04em;
  transition: all 0.12s; background: var(--surface);
}
.btn-download:hover { border-color: var(--accent); color: var(--accent); background: rgba(217,139,58,0.06); }

/* ── TABLE OF CONTENTS ── */
.toc {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.25rem;
  margin: 1.5rem 0; font-size: 0.82rem;
}
.toc-title { font-weight: 600; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted2); margin-bottom: 0.75rem; }
.toc ol { padding-left: 1.2rem; }
.toc li { margin: 0.25rem 0; }
.toc a { color: var(--muted); transition: color 0.1s; }
.toc a:hover { color: var(--accent); }

/* ── BODY TEXT ── */
.body-divider { height: 1px; background: var(--border); margin: 2rem 0; }
.body-text {
  font-family: var(--serif); font-size: clamp(1.15rem, 1rem + 0.25vw, 1.3rem);
  line-height: 1.85; color: var(--text);
  max-width: 68ch; margin-inline: auto;
  overflow-wrap: break-word; word-break: break-word;
}
[data-theme="dark"] .body-text { color: #e8e4df; }
.body-text figure { margin: 1.5em 0; }
.body-text figure img { max-width: 100%; height: auto; border-radius: 4px; display: block; }
.body-text figure.portrait img { max-width: 320px; }
.body-text figcaption { font-size: 0.82rem; color: var(--muted); margin-top: 0.5em; font-style: italic; }
.body-text figcaption a { color: var(--accent); }
.body-text img { max-width: 100%; height: auto; border-radius: 4px; display: block; margin: 1em 0; }
.body-text p { margin-bottom: 1.15em; }
.body-img { max-width: 100%; height: auto; border-radius: 4px; margin: 1rem 0; display: block; cursor: zoom-in; }
#gallery-dlg[open] { background: rgba(0,0,0,.92); border: none; padding: 0; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; display: flex; align-items: center; justify-content: center; }
#gallery-dlg img { max-width: 90vw; max-height: 90vh; object-fit: contain; border-radius: 4px; }
.body-text h2 { font-family: var(--sans); font-size: 1.15rem; font-weight: 600; color: var(--text); margin: 2.2em 0 0.7em; padding-top: 1rem; border-top: 1px solid var(--border); }
.body-text h3 { font-family: var(--sans); font-size: 1rem; font-weight: 600; color: var(--text); margin: 1.8em 0 0.5em; }
.body-text h4 { font-family: var(--sans); font-size: 0.9rem; font-weight: 600; color: var(--muted); margin: 1.5em 0 0.4em; text-transform: uppercase; letter-spacing: 0.06em; }
.body-text strong, .body-text b { color: var(--text); font-weight: 700; }
.body-text em, .body-text i { font-style: italic; color: #bbb; }
/* ── READING PROGRESS ── */
#read-progress { position: fixed; top: 0; left: 0; height: 3px; background: var(--accent); width: 0%; z-index: 1000; transition: width 0.1s linear; }

/* ── COVER HERO ── */
.book-cover-hero { position: relative; width: 100%; height: 340px; overflow: hidden; margin-bottom: 0; border-radius: 0; }
.book-cover-hero img { width: 100%; height: 100%; object-fit: cover; object-position: center center; filter: blur(6px) brightness(0.3); transform: scale(1.08); }
.book-cover-hero .hero-overlay { position: absolute; inset: 0; background: linear-gradient(to top, var(--bg) 0%, transparent 60%); }

/* ── FLOATING TOC ── */
.book-toc { position: fixed; top: 5rem; right: 1rem; width: 200px; max-height: calc(100vh - 7rem); overflow-y: auto; font-size: 0.73rem; line-height: 1.5; z-index: 50; display: none; }
.book-toc a { display: block; color: var(--muted); text-decoration: none; padding: 0.15rem 0.5rem; border-left: 2px solid transparent; transition: color 0.15s, border-color 0.15s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-toc a:hover, .book-toc a.active { color: var(--accent); border-left-color: var(--accent); }
@media (min-width: 1200px) { .book-toc { display: block; } }

/* ── QUOTE FLYOUT ── */
#quote-bar { position: fixed; background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; padding: 0.3rem 0.6rem; font-size: 0.75rem; display: none; gap: 0.5rem; align-items: center; z-index: 200; box-shadow: 0 4px 16px rgba(0,0,0,.4); }
#quote-bar button { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 0.75rem; padding: 0; }

/* ── SHORTCUTS MODAL ── */
#shortcuts-modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 500; align-items: center; justify-content: center; }
#shortcuts-modal.open { display: flex; }
#shortcuts-inner { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 1.5rem; max-width: 340px; width: 90%; }
#shortcuts-inner h3 { margin: 0 0 1rem; font-size: 0.9rem; color: var(--text); }
#shortcuts-inner table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
#shortcuts-inner td { padding: 0.3rem 0.4rem; }
#shortcuts-inner td:first-child { color: var(--accent); font-family: monospace; font-weight: 700; width: 2rem; }
#shortcuts-inner td:last-child { color: var(--muted); }
.shortcuts-close { float: right; background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1rem; }

/* ── RELATED ── */
.related-section { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.related-section h3 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin-bottom: 1rem; }
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); gap: 0.75rem; }
.related-card { text-decoration: none; color: var(--text); background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; transition: border-color .15s, transform .15s; }
.related-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.related-card-img { height: 140px; overflow: hidden; background: var(--surface); display: flex; align-items: center; justify-content: center; }
.related-card-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.related-card-body { padding: 0.5rem 0.6rem; }
.related-card-title { font-size: 0.78rem; line-height: 1.35; font-weight: 500; }
.related-card-cat { font-size: 0.65rem; color: var(--muted); margin-top: 0.2rem; }

/* ── SHARE ── */
.btn-share { background: none; border: 1px solid var(--border); border-radius: 4px; color: var(--muted); font-size: 0.78rem; padding: 0.3rem 0.7rem; cursor: pointer; transition: color .15s, border-color .15s; }
.btn-share:hover { color: var(--accent); border-color: var(--accent); }
.book-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

/* ── SHORTCUTS HINT ── */
.shortcuts-hint { font-size: 0.68rem; color: var(--muted2); margin-top: 1.5rem; }
.shortcuts-hint kbd { font-family: monospace; background: var(--surface2); border: 1px solid var(--border); border-radius: 3px; padding: 0 0.3rem; font-size: 0.68rem; }

.body-text blockquote { border-left: 3px solid var(--accent); padding-left: 1rem; color: var(--muted); margin: 1.5em 0; font-style: italic; }
.body-text blockquote cite { display: block; margin-top: 0.5rem; font-size: 0.82rem; font-style: normal; color: var(--accent); opacity: 0.85; }
.body-text hr { border: none; border-top: 1px solid var(--border); margin: 2em 0; }
.body-text a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.body-text ul, .body-text ol { padding-left: 1.5rem; margin-bottom: 1em; }
.body-text li { margin: 0.3em 0; }
.body-loading { color: var(--muted2); font-size: 0.85rem; padding: 2rem 0; font-style: italic; }
#tx-content .body-text { color: #bbb; }

/* ── ERROR ── */
.error-banner { background: rgba(217,139,58,0.08); border: 1px solid rgba(217,139,58,0.25); color: var(--accent2); padding: 0.75rem 1rem; border-radius: var(--radius); font-size: 0.85rem; margin-bottom: 1.5rem; }

/* ── FOOTER ── */
footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  width: 100%;
}
@media (max-width: 1200px) { .book-grid { grid-template-columns: repeat(6, 1fr); } }
@media (max-width: 1000px) { .book-grid { grid-template-columns: repeat(5, 1fr); } }
@media (max-width: 820px)  { .book-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 700px)  { .book-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) {
  .book-grid { grid-template-columns: repeat(2, 1fr); }
  .book-title { font-size: 1.75rem; }
}

/* ── LIGHT MODE ── */
[data-theme="light"] {
  --bg: #f7f3ec;
  --surface: #fffdf8;
  --surface2: #efe9de;
  --border: #ddd4c5;
  --border2: #c9bfac;
  --text: #211b13;
  --muted: #6d6353;
  --muted2: #9a8f7c;
  --accent: #b5701f;
  --accent-text: #a5641a;
}
[data-theme="light"] .nav { background: rgba(247,243,236,0.96); }
[data-theme="light"] .body-text { color: #2c2519; }
[data-theme="light"] .hero-banner { background: linear-gradient(180deg, rgba(181,112,31,0.07) 0%, transparent 100%); }

/* ── THEME TOGGLE ── */
.theme-toggle { background: none; border: 1px solid var(--border); border-radius: var(--radius); padding: 0.2rem 0.5rem; color: var(--muted); cursor: pointer; font-size: 0.85rem; margin-right: 0.5rem; transition: border-color 0.12s; }
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* ── BOOK LAYOUT WITH STICKY TOC ── */
.book-with-toc { display: flex; gap: 2.5rem; align-items: flex-start; }
.book-content-col { flex: 1; min-width: 0; }

.toc {
  width: 220px; flex-shrink: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.25rem;
  font-size: 0.8rem;
  position: sticky; top: 70px;
  max-height: calc(100vh - 90px); overflow-y: auto;
  align-self: flex-start;
}
.toc-title { font-weight: 600; font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted2); margin-bottom: 0.75rem; }
.toc ol { padding-left: 1rem; }
.toc li { margin: 0.3rem 0; }
.toc a { color: var(--muted); transition: color 0.1s; }
.toc a:hover { color: var(--accent); }

/* ── COVER HERO ── */


@media (max-width: 860px) {
  .book-with-toc { flex-direction: column; }
  .toc { width: 100%; position: static !important; }
}
@media (max-width: 640px) {
  .book-title { font-size: 1.75rem; }
  .book-toc { display: none; }
}


/* ── STATS & CONTRIBUTE shared ── */
.page-inner { max-width: 1100px; margin: 0 auto; padding: 3rem 1.5rem 5rem; }
.page-header { margin-bottom: 3rem; border-bottom: 1px solid var(--border); padding-bottom: 1.5rem; }
.page-header h1 { font-size: 2.2rem; font-weight: 600; margin-bottom: 0.5rem; }
.page-subtitle { color: var(--muted); font-size: 1rem; max-width: 640px; line-height: 1.6; }
.stats-section { margin-top: 3rem; }
.stats-section h2 { font-size: 1.1rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted2); margin-bottom: 1.5rem; }
.prose { max-width: 660px; font-family: var(--serif); font-size: 1.1rem; line-height: 1.85; color: var(--text); }
.prose p { margin-bottom: 1em; }
.prose a { color: var(--accent); }
.stat-hero-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 2rem; }
.stat-hero-card { background: var(--surface); padding: 1.5rem; display: flex; flex-direction: column; gap: 0.4rem; }
.stat-hero-card.red .stat-hero-num { color: var(--accent); }
.stat-hero-num { font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-hero-label { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.breakdown-table { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.breakdown-header { display: grid; grid-template-columns: 1fr 80px 80px 140px; padding: 0.6rem 1rem; background: var(--surface2); font-size: 0.75rem; color: var(--muted2); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.breakdown-row { display: grid; grid-template-columns: 1fr 80px 80px 140px; padding: 0.65rem 1rem; border-top: 1px solid var(--border); font-size: 0.9rem; align-items: center; }
.breakdown-row:hover { background: var(--surface2); }
.breakdown-row a { color: var(--text); }
.breakdown-row a:hover { color: var(--accent); }
.breakdown-bar-cell { display: flex; align-items: center; gap: 0.6rem; }
.breakdown-bar { display: block; height: 6px; background: var(--accent); border-radius: 3px; min-width: 2px; opacity: 0.7; }
.breakdown-pct { font-size: 0.78rem; color: var(--muted); min-width: 32px; }
.contribute-layout { display: grid; grid-template-columns: 1fr 280px; gap: 3rem; align-items: flex-start; }
.contribute-form-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; }
.form-section-label { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted2); margin: 1.75rem 0 0.85rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.form-section-label:first-child { margin-top:0; padding-top:0; border-top:none; }
.form-section-label .field-hint { font-weight:400; text-transform:none; letter-spacing:0; color:var(--muted); margin-left:0.5rem; }
.field-group { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.75rem; }
.field label { font-size: 0.82rem; font-weight: 500; color: var(--muted); }
.field .field-hint { font-size: 0.75rem; color: var(--muted2); font-weight:400; margin-left:0.35rem; }
.req { color: var(--accent); }
.field input, .field select, .field textarea { background: var(--surface2); border: 1px solid var(--border2); border-radius: calc(var(--radius) - 2px); color: var(--text); font-family: var(--sans); font-size: 0.9rem; padding: 0.6rem 0.8rem; outline: none; transition: border-color 0.12s; width: 100%; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
[data-theme="light"] .field input, [data-theme="light"] .field select, [data-theme="light"] .field textarea { background: #fff; border-color: #ccc; }
.contrib-tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 0.75rem; }
.contrib-tab { background: none; border: none; border-bottom: 2px solid transparent; padding: 0.5rem 1rem; font-size: 0.85rem; color: var(--muted); cursor: pointer; margin-bottom: -1px; transition: color 0.1s, border-color 0.1s; }
.contrib-tab.active { color: var(--text); border-bottom-color: var(--accent); }
.contrib-tab-panel { display: none; }
.contrib-tab-panel.active { display: block; }
.file-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem; border: 2px dashed var(--border2); border-radius: var(--radius); padding: 2rem; cursor: pointer; text-align: center; transition: border-color 0.12s, background 0.12s; color: var(--muted); }
.file-drop:hover, .file-drop.dragging { border-color: var(--accent); background: rgba(217,139,58,0.04); }
.file-drop-icon { font-size: 2rem; opacity: 0.5; }
.form-footer { margin-top: 1.75rem; padding-top: 1.25rem; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 0.75rem; }
.btn-submit { background: var(--accent); color: #fff; border: none; border-radius: var(--radius); padding: 0.8rem 1.75rem; font-size: 0.95rem; font-weight: 600; cursor: pointer; transition: opacity 0.12s; align-self: flex-start; }
.btn-submit:hover { opacity: 0.88; }
.btn-submit:disabled { opacity: 0.5; cursor: not-allowed; }
.form-note { font-size: 0.78rem; color: var(--muted2); }
.form-note a { color: var(--muted); }
.contrib-success { background: rgba(74,222,128,0.1); border: 1px solid rgba(74,222,128,0.3); color: #4ade80; border-radius: var(--radius); padding: 0.9rem 1rem; margin-bottom: 1.5rem; font-size: 0.9rem; }
.contrib-success a { color: #4ade80; text-decoration: underline; }
.contrib-error { background: rgba(217,139,58,0.1); border: 1px solid rgba(217,139,58,0.35); color: #f87171; border-radius: var(--radius); padding: 0.9rem 1rem; margin-bottom: 1.5rem; font-size: 0.9rem; }
.contribute-sidebar { display: flex; flex-direction: column; gap: 1rem; position: sticky; top: 70px; }
.sidebar-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; font-size: 0.88rem; line-height: 1.6; }
.sidebar-card h3 { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted2); margin-bottom: 0.75rem; }
.sidebar-card ul, .sidebar-card ol { padding-left: 1.2rem; color: var(--muted); }
.sidebar-card li { margin: 0.3rem 0; }
.red-list li { color: #f87171; }
.process-list li { color: var(--text); }
.red-card { border-color: rgba(217,139,58,0.3); background: rgba(217,139,58,0.07); color: var(--muted); font-size: 0.95rem; font-family: var(--serif); font-style: italic; }
@media (max-width: 900px) { .contribute-layout { grid-template-columns: 1fr; } .contribute-sidebar { position: static; } }
@media (max-width: 640px) { .field-group { grid-template-columns: 1fr; } .breakdown-header, .breakdown-row { grid-template-columns: 1fr 60px 60px; } }

/* ── SEARCH AUTOCOMPLETE ── */
.search-wrap { position: relative; width: 100%; }
.search-suggest {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: var(--radius); overflow: hidden;
  z-index: 200; box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
.search-suggest:empty { display: none; }
.suggest-item {
  display: flex; flex-direction: column; gap: 0.15rem;
  padding: 0.65rem 1rem; text-decoration: none;
  border-bottom: 1px solid var(--border); transition: background 0.08s;
}
.suggest-item:last-child { border-bottom: none; }
.suggest-item:hover { background: var(--surface2); }
.suggest-title { font-size: 0.88rem; color: var(--text); }
.suggest-author { font-size: 0.75rem; color: var(--muted); }

.tx-contribute-btn { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 0.82rem; text-decoration: underline; padding: 0; }
.tx-contribute-btn:hover { opacity: 0.8; }

/* ── BOOK BODY FORMATTING ── */
.abbr-table { width: 100%; border-collapse: collapse; margin: 1.5em 0; font-size: 0.9rem; display: block; overflow-x: auto; }
.abbr-table td { padding: 0.35em 0.75em; border-bottom: 1px solid var(--border); vertical-align: top; }
.abbr-table .abbr-key { font-weight: 600; white-space: nowrap; color: var(--accent); width: 6em; }
.toc-table { width: 100%; border-collapse: collapse; margin: 1.5em 0; font-size: 0.9rem; }
.toc-table th { font-weight: 600; color: var(--muted2); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; border-bottom: 2px solid var(--border2); padding: 0.5em 0.75em; text-align: left; }
.toc-table td { padding: 0.45em 0.75em; border-bottom: 1px solid var(--border); vertical-align: middle; }
.toc-table tr:last-child td { border-bottom: none; }
.toc-table tr:nth-child(even) td { background: var(--surface); }
.toc-table td:last-child { color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; font-size: 0.82rem; }
p.footnote { font-size: 0.82rem; color: var(--muted); border-top: 1px solid var(--border); padding-top: 0.5em; margin-top: 0.5em; }
p.footnote sup { color: var(--accent); font-weight: 700; margin-right: 0.3em; }
h3.footnotes-heading { font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-top: 3em; }
.book-body-title { font-size: 1.5rem; font-weight: 700; margin: 2em 0 0.5em; line-height: 1.3; }


.btn-save { background: none; border: 1px solid var(--border); border-radius: 6px; color: var(--muted); cursor: pointer; font-size: 0.8rem; padding: 0.3em 0.8em; margin: 0.5rem 0 0; transition: all .15s; }
.btn-save:hover, .btn-save.saved { border-color: var(--accent); color: var(--accent); }
.book-actions { margin: 0.5rem 0; }

.related-section { padding: 1rem 1.5rem; border-top: 1px solid var(--border); }
.related-hd { margin-bottom: 0.6rem; }
.related-label { font-size: 0.6rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.related-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.6rem; }
.related-card { display: flex; flex-direction: column; gap: 0.35rem; text-decoration: none; color: var(--muted); font-size: 0.78rem; line-height: 1.35; background: var(--surface); padding: 0.4rem; border: 1px solid var(--border); border-radius: 6px; transition: border-color 0.15s, transform 0.15s; }
.related-card img { width: 100%; aspect-ratio: 2/3; object-fit: cover; border-radius: 4px; }
.related-placeholder { width: 100%; aspect-ratio: 2/3; background: var(--surface2); border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; color: var(--muted2); font-family: var(--serif); }
.related-title { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.related-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.related-card:hover .related-title { color: var(--accent-text); }
@media (max-width: 640px) { .related-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 480px) { .related-grid { grid-template-columns: repeat(2, 1fr); } }

.btn-remove { background: none; border: none; color: var(--muted); font-size: 0.75rem; cursor: pointer; padding: 0.2em 0; margin-top: 0.3rem; display: block; }
.btn-remove:hover { color: var(--red, #f87171); }

/* ── LANGUAGE BADGE (cover overlay) ── */
.cover-lang { position: absolute; bottom: 0.25rem; right: 0.25rem; font-size: 0.55rem; font-weight: 700; letter-spacing: 0.06em; background: rgba(0,0,0,0.75); color: var(--muted); border-radius: 3px; padding: 0.1em 0.35em; }
.cover-flag { position: absolute; bottom: .3rem; right: .3rem; font-size: 1rem; line-height: 1; filter: drop-shadow(0 1px 2px rgba(0,0,0,.7)); pointer-events: none; }

/* ── Animations ── */
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes logoPulse { 0%,100% { filter: drop-shadow(0 0 0px transparent); } 50% { filter: drop-shadow(0 0 8px rgba(217,139,58,0.5)); } }

.book-card { animation: fadeUp 0.2s ease both; }
.book-card:nth-child(1)  { animation-delay: 0s; }
.book-card:nth-child(2)  { animation-delay: 0.02s; }
.book-card:nth-child(3)  { animation-delay: 0.04s; }
.book-card:nth-child(4)  { animation-delay: 0.06s; }
.book-card:nth-child(5)  { animation-delay: 0.08s; }
.book-card:nth-child(6)  { animation-delay: 0.1s; }
.book-card:nth-child(n+7) { animation-delay: 0.12s; }

.body-text { animation: fadeIn 0.4s ease; }

@media (prefers-reduced-motion: reduce) {
  .book-card, .body-text { animation: none; }
}

/* search button inside search field */
.search-wrap { position: relative; }
.nav-search input { padding-right: 2.2rem; }
.search-btn {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 1rem; line-height: 1; padding: 0.25rem 0.45rem; border-radius: 4px;
  transition: color 0.1s;
}
.search-btn:hover { color: var(--accent); }

/* political stance */
.foot-stance {
  border-top: 1px solid var(--border);
  padding: 1rem 1rem;
  text-align: center;
  font-family: var(--serif); font-style: italic;
  font-size: 0.88rem; color: var(--muted); line-height: 1.6;
}
.foot-stance .red { color: var(--accent); font-style: normal; font-weight: 600; }

/* ── PAGE POLISH ── */
.page-header h1, .book-title { font-family: var(--display); letter-spacing: -0.5px; }
.page-kicker { font-size: 0.65rem; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); margin-bottom: 0.5rem; }
.stat-hero-card { transition: background 0.15s; }
.stat-hero-card:hover { background: var(--surface2); }
.body-text h2 { font-family: var(--serif); font-size: 1.35rem; margin: 2em 0 0.6em; letter-spacing: -0.3px; }
.back-link { font-size: 0.78rem; color: var(--muted); display: inline-block; margin-bottom: 1rem; transition: color 0.1s; }
.back-link:hover { color: var(--accent); }
::selection { background: rgba(217,139,58,0.35); }

@media (max-width: 600px) {
  .ticker { display: none; }
  .nav-logo-sub, .nav-logo-name { display: none; }
  .nav-search { flex: 1; max-width: none; }
  .nav { gap: 0.5rem; }
}

/* mobile: single Filter button wrapping the dropdowns */
/* display:contents on <details> computes to block per spec — use flex instead */
.fwrap { display: block; }
.fwrap-btn { display: none; }
.fwrap-body { display: flex; align-items: center; }
@media (max-width: 600px) {
  .fwrap { display: block; position: static; }
  .fwrap-btn {
    display: block; list-style: none; cursor: pointer; user-select: none;
    font-size: 0.78rem; color: var(--muted); padding: 0.3rem 0.6rem;
  }
  .fwrap-btn::-webkit-details-marker { display: none; }
  .fwrap-btn::after { content: " ▾"; font-size: 0.65em; color: var(--muted2); }
  .fwrap[open] .fwrap-btn { color: var(--text); }
  .fwrap-body {
    display: block; position: absolute; left: 1rem; right: 1rem; top: 100%; z-index: 120;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 0.4rem; box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    max-height: 60vh; overflow-y: auto;
  }
  .fwrap-body .fdrop summary { padding: 0.5rem 0.6rem; font-size: 0.85rem; }
  .fwrap-body .fdrop-menu {
    position: static; min-width: 0; max-width: none; max-height: none;
    border: none; box-shadow: none; padding: 0 0 0.4rem 0.8rem;
  }
}

/* ── MEDIA PAGES (video/audio) ── */
.media-page { flex: 1; }
.cinema-wrap { background: #000; border-bottom: 1px solid var(--border); }
.cinema-inner { max-width: 1100px; margin: 0 auto; padding: 0; }
.cinema-video { width: 100%; max-height: 78vh; display: block; background: #000; }
.cinema-track-label { color: var(--muted); font-size: 0.8rem; padding: 0.5rem 1rem 0.2rem; }
.cinema-empty { color: var(--muted); text-align: center; padding: 4rem 1rem; }
.media-info { max-width: 860px; margin: 0 auto; padding: 1.5rem 1.5rem 3rem; }
.media-info .back-link { display: inline-block; margin-bottom: 1rem; }
.media-head { margin-bottom: 0.75rem; }
.media-title { font-family: var(--serif); font-size: 1.7rem; line-height: 1.25; margin: 0.35rem 0 0.25rem; }
.media-meta-row { margin: 0.75rem 0; }
.media-desc { max-width: 65ch; }
.pill-risk { color: #d9a441; border-color: #5a4a24; }
.media-related { margin-top: 2.5rem; }

/* audio: album layout */
.audio-layout { display: flex; gap: 1.75rem; align-items: flex-start; margin-top: 0.5rem; }
.audio-art { flex: 0 0 220px; }
.audio-art img { width: 220px; height: 220px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--border); }
.audio-art-ph { width: 220px; height: 220px; display: flex; align-items: center; justify-content: center; font-size: 3.5rem; color: var(--muted2); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.audio-main { flex: 1; min-width: 0; }
.audio-tracks { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.85rem; }
.audio-track audio { width: 100%; }
.audio-track-name { font-size: 0.85rem; color: var(--text); margin-bottom: 0.3rem; }
.track-no { color: var(--muted2); font-variant-numeric: tabular-nums; margin-right: 0.4rem; }
@media (max-width: 640px) {
  .audio-layout { flex-direction: column; }
  .audio-art, .audio-art img, .audio-art-ph { width: 100%; flex-basis: auto; height: auto; aspect-ratio: 1; }
  .media-title { font-size: 1.35rem; }
}

/* ── HOMEPAGE: featured + topic tiles ── */
.featured-card { display: flex; gap: 1.25rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 1.5rem; transition: border-color .15s; }
.featured-card:hover { border-color: var(--accent); }
.featured-pinned { border-left: 3px solid var(--accent); }
.featured-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.featured-row .featured-card { margin-bottom: 0; }
@media (max-width: 800px) { .featured-row { grid-template-columns: 1fr; } }
.featured-cover { flex: 0 0 140px; }
.featured-cover img { width: 140px; height: 100%; min-height: 180px; object-fit: cover; display: block; }
.featured-body { padding: 1rem 1.25rem 1rem 0; display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.featured-label { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--accent-text); }
.featured-title { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; line-height: 1.3; }
.featured-author { font-size: 0.82rem; color: var(--muted); }
.featured-desc { font-size: 0.85rem; color: var(--muted); line-height: 1.5; margin: 0.25rem 0 0; }
.featured-read { font-size: 0.82rem; color: var(--accent-text); margin-top: auto; padding-top: 0.5rem; }
.topic-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 0.5rem; }
.topic-tile { display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 0.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; transition: border-color .15s, background .15s; }
.topic-tile:hover { border-color: var(--accent); background: var(--surface2); }
.topic-tile-name { font-weight: 500; font-size: 1rem; }\n.topic-tile-count { font-size: 0.72rem; color: var(--muted2); font-variant-numeric: tabular-nums; margin-top: auto; }
.coll-desc { font-size: 0.82rem; color: var(--muted); line-height: 1.4; display: block; margin-top: 0.25rem; }
@media (max-width: 600px) {
  .featured-card { flex-direction: column; }
  .featured-cover img { width: 100%; height: 160px; min-height: 0; }
  .featured-body { padding: 0 1rem 1rem; }
}

/* ── stat strip + torrent btn ── */
.stat-strip { display: flex; gap: 2.5rem; margin-top: 1.25rem; flex-wrap: wrap; } /* legacy — see .home-stats */
.stat { display: flex; flex-direction: column; gap: 0.1rem; }
.stat-n { font-family: var(--serif); font-size: 1.65rem; font-weight: 700; color: var(--text); line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-l { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted2); font-weight: 500; }
.btn-torrent { color: var(--green); }

/* ── quick links / collections / preserved ── */
.quick-links{display:flex;gap:.6rem;flex-wrap:wrap;margin-top:1.2rem}
.coll-tile{display:flex;flex-direction:column;gap:.35rem}
.coll-desc{font-size:.82rem;color:var(--muted);line-height:1.4}
.coll-banner{border:1px solid var(--border);border-radius:12px;padding:1.4rem 1.6rem;background:var(--surface)}
.ic{width:1em;height:1em;vertical-align:-0.15em;filter:invert(0.6)}
[data-theme=light] .ic{filter:invert(0.4)}

/* on-this-day / upcoming banner */
.otd-card { display: block; padding: 1rem 1.1rem; margin-bottom: 1rem; }
.otd-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.otd-cal-link { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.otd-cal-link:hover { color: var(--accent-text); }
.otd-days { display: flex; flex-direction: column; gap: .65rem; }
.otd-day { display: flex; gap: .85rem; align-items: stretch; }
.otd-date { flex: 0 0 3.4rem; display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: .35rem .2rem; line-height: 1.15; }
.otd-date-day { font-size: 1.25rem; font-weight: 700; color: var(--text); }
.otd-date-month { font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-text); }
.otd-date-in { font-size: .62rem; color: var(--muted); margin-top: .15rem; }
.otd-events { flex: 1; display: flex; flex-direction: column; gap: .35rem; justify-content: center; min-width: 0; }
.otd-event { display: block; color: var(--text); border-radius: 6px; padding: .3rem .5rem; margin: 0 -.5rem; transition: background .12s; }
.otd-event:hover { background: var(--bg); }
.otd-event-title { display: block; font-size: .98rem; line-height: 1.35; }
.otd-event-meta { display: block; font-size: .78rem; color: var(--muted2); margin-top: .1rem; }
.otd-event-cta { color: var(--accent-text); opacity: 0; transition: opacity .12s; margin-left: .5rem; }
.otd-event:hover .otd-event-cta { opacity: 1; }
@media (max-width: 640px) { .otd-head { flex-direction: column; gap: .15rem; } .otd-event-cta { opacity: 1; } }

/* ── EVENT PAGE ── */
.ev-page { max-width: 860px; margin: 0 auto; padding: 2rem 1.25rem 4rem; }
.ev-kicker { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin-bottom: 0.6rem; }
.ev-title { font-family: var(--serif); font-size: 2.2rem; line-height: 1.2; margin-bottom: 1.5rem; font-weight: 600; letter-spacing: -0.5px; }
.ev-body { max-width: 68ch; }
.ev-body p { margin-bottom: 1.15em; line-height: 1.85; font-size: clamp(1rem, 0.95rem + 0.25vw, 1.15rem); font-family: var(--serif); color: var(--text); }
.ev-legacy { max-width: 68ch; border-left: 3px solid var(--accent); padding-left: 1rem; margin: 2rem 0; }
.ev-legacy p { line-height: 1.75; font-style: italic; color: var(--muted); font-family: var(--serif); font-size: 0.95rem; }
.ev-books { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.ev-books-head { margin-bottom: 1rem; }
.ev-book-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }

.not-found-page { display:flex; flex-direction:column; align-items:center; justify-content:center; min-height:40vh; text-align:center; gap:1rem; padding:3rem 1rem; }
.not-found-code { font-size:6rem; font-weight:700; color:var(--accent); line-height:1; opacity:.18; letter-spacing:-.02em; }
.not-found-msg { font-size:1.4rem; font-weight:600; color:var(--fg); margin-top:-2rem; }
.not-found-sub { color:var(--fg2,#888); font-size:.95rem; max-width:36ch; }
.not-found-actions { display:flex; gap:.75rem; flex-wrap:wrap; justify-content:center; margin-top:.5rem; }
.btn-retry, .btn-home { padding:.5rem 1.2rem; border-radius:var(--radius,4px); font-size:.95rem; cursor:pointer; text-decoration:none; }
.btn-retry { background:var(--accent); color:#fff; border:none; }
.btn-retry:hover { opacity:.85; }
.btn-home { background:transparent; color:var(--fg); border:1px solid var(--border,#333); }
.btn-home:hover { background:var(--bg2,#1a1a1a); }

/* ══ OPENREADERY — NEW HOMEPAGE COMPONENTS ══ */
.masthead { padding: 2.5rem 0 1.75rem; border-bottom: 3px double var(--border2); margin-bottom: 1.75rem; }
.masthead-title { font-family: var(--display); font-size: clamp(2rem, 4vw, 3.25rem); font-weight: 700; line-height: 1.05; letter-spacing: -0.02em; max-width: 18ch; }
.masthead-sub { font-size: 1.05rem; color: var(--muted); margin-top: 1rem; max-width: 62ch; line-height: 1.6; }
.masthead-stats { display: flex; gap: 2rem; margin-top: 1.5rem; font-size: 0.9rem; color: var(--muted); flex-wrap: wrap; }
.masthead-stats strong { font-family: var(--display); font-size: 1.5rem; color: var(--accent-text); font-variant-numeric: tabular-nums; margin-right: 0.35rem; }

.feature-strip { display: grid; grid-template-columns: 200px 1fr; gap: 1.75rem; align-items: center; padding: 1.5rem; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: var(--radius); margin-bottom: 1.75rem; transition: transform 0.15s, box-shadow 0.15s; }
.feature-strip:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(0,0,0,0.18); }
.feature-strip-img { position: relative; aspect-ratio: 2/3; border-radius: 4px; overflow: hidden; background: var(--surface2); box-shadow: 0 4px 16px rgba(0,0,0,0.3); }
.feature-strip-img img { width: 100%; height: 100%; object-fit: cover; }
.feature-kicker { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-text); }
.feature-strip-title { font-family: var(--display); font-size: clamp(1.4rem, 2.5vw, 2rem); font-weight: 700; line-height: 1.15; margin: 0.4rem 0; }
.feature-strip-author { font-style: italic; color: var(--muted); font-size: 0.95rem; }
.feature-strip-desc { color: var(--muted); font-size: 0.95rem; line-height: 1.6; margin: 0.7rem 0; max-width: 65ch; }
.feature-strip-cta { font-weight: 600; color: var(--accent-text); font-size: 0.95rem; }

.also-featured { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; margin-bottom: 1.75rem; }
.also-card { display: grid; grid-template-columns: 52px 1fr; gap: 0.8rem; align-items: center; padding: 0.75rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); transition: border-color 0.12s; }
.also-card:hover { border-color: var(--accent); }
.also-card-img { aspect-ratio: 2/3; border-radius: 3px; overflow: hidden; background: var(--surface2); }
.also-card-img img { width: 100%; height: 100%; object-fit: cover; }
.also-card-title { font-family: var(--display); font-size: 0.95rem; font-weight: 500; line-height: 1.2; margin-top: 0.15rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.also-card-author { font-size: 0.75rem; color: var(--muted2); font-style: italic; }

.otd-bar { display: flex; align-items: center; gap: 1rem; padding: 0.9rem 1.1rem; background: var(--surface2); border-radius: var(--radius); margin-bottom: 1.75rem; flex-wrap: wrap; }
.otd-bar-label { font-family: var(--display); font-weight: 700; font-size: 0.9rem; color: var(--accent-text); flex-shrink: 0; }
.otd-bar-events { display: flex; gap: 1.25rem; flex: 1; overflow-x: auto; flex-wrap: wrap; }
.otd-bar-event { font-size: 0.82rem; color: var(--muted); white-space: nowrap; }
.otd-bar-event strong { color: var(--text); font-variant-numeric: tabular-nums; }
.otd-bar-event:hover { color: var(--accent-text); }
.otd-bar-link { font-size: 0.82rem; color: var(--accent-text); font-weight: 600; flex-shrink: 0; }

@media (max-width: 640px) {
  .feature-strip { grid-template-columns: 1fr; }
  .feature-strip-img { max-width: 160px; }
}

/* ═══════════════════════════════════════════════════════════
   ZINE LAYER — photocopied punk aesthetic. Overrides above.
   Bone paper on hard black, blood red, Anton heads, mono labels.
   ═══════════════════════════════════════════════════════════ */

/* paper grain over everything */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 1; pointer-events: none;
  opacity: 0.04; mix-blend-mode: screen;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
body > * { position: relative; z-index: 2; }

/* ── HEADINGS: Anton, uppercase, tight ── */
.masthead-title, .feature-strip-title, .book-title, .intro-title,
.section-label, .mag-hero-title, .rail-logo-name, h1.book-title {
  font-family: var(--display) !important;
  text-transform: uppercase; letter-spacing: 0.01em; font-weight: 400 !important;
  line-height: 0.95;
}

/* ── SIDEBAR: black slab, red edge, mono ── */
.rail { background: #0d0d0d; border-right: 3px solid var(--accent); padding: 1.4rem 1rem; gap: 1.1rem; }
.rail-logo-name { font-size: 1.7rem; letter-spacing: 0.02em; }
.rail-logo img { width: 30px; height: 30px; filter: none; }
.rail-search input { border: 2px solid var(--border2); background: #000; border-radius: 0; font-family: var(--mono); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
.rail-search input:focus { border-color: var(--accent); }
.rail-nav { gap: 0; border-top: 1px solid var(--border); }
.rail-link {
  font-family: var(--display) !important; font-size: 1.15rem; text-transform: uppercase;
  color: var(--muted); padding: 0.5rem 0.5rem; border-radius: 0;
  border-left: 3px solid transparent; border-bottom: 1px solid var(--border);
  letter-spacing: 0.03em; transition: none;
}
.rail-link:hover, .rail-link.on { color: #000; background: var(--accent); border-left-color: #000; }
.rail-section { margin-top: 0.3rem; }
.rail-section-label { font-family: var(--mono); font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.2em; color: var(--accent); margin-bottom: 0.5rem; }
.rail-topics { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.rail-topic {
  font-family: var(--mono); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--muted); border: 1px solid var(--border2); padding: 0.15rem 0.45rem;
}
.rail-topic:hover, .rail-topic.on { background: var(--accent); color: #000; border-color: var(--accent); }
.rail-random { font-family: var(--display) !important; text-transform: uppercase; font-size: 1rem; color: var(--accent); letter-spacing: 0.03em; }
.theme-toggle { background: #000; border: 1px solid var(--border2); border-radius: 0; color: var(--text); width: 32px; height: 32px; cursor: pointer; }

/* ── MASTHEAD: giant condensed statement ── */
.masthead { padding: 2.5rem 0 1.5rem; border-bottom: 4px solid var(--accent); margin-bottom: 1.5rem; }
.masthead-title { font-size: clamp(2.6rem, 6vw, 5rem) !important; max-width: none; color: var(--text); }
.masthead-sub { font-family: var(--mono); font-size: 0.85rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; max-width: 60ch; }
.masthead-stats { font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.72rem; gap: 1.5rem; }
.masthead-stats strong { font-family: var(--display); color: var(--accent); font-size: 1.6rem; }

/* ── TOOLBAR: thin mono strip ── */
.toolbar { border: none; border-bottom: 1px solid var(--border); padding: 0.5rem 0; margin-bottom: 1.25rem; }
.toolbar-count { font-family: var(--display); color: var(--accent); font-size: 1.3rem; }
.tpill, .lang-sel { font-family: var(--mono) !important; text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.05em; border-radius: 0 !important; border: 1px solid var(--border2) !important; background: #000 !important; color: var(--text) !important; }
.tpill:hover { background: var(--accent) !important; color: #000 !important; }

/* ── FEATURE STRIP: hard bordered, no round, tilt on hover ── */
.feature-strip { border: 2px solid var(--text); border-left: 6px solid var(--accent); border-radius: 0; background: #000; box-shadow: 6px 6px 0 var(--border); }
.feature-strip:hover { transform: none; box-shadow: 8px 8px 0 var(--accent); }
.feature-strip-img { border-radius: 0; box-shadow: none; border: 1px solid var(--border2); }
.feature-kicker { font-family: var(--mono); color: var(--accent); letter-spacing: 0.12em; }
.feature-strip-title { font-size: clamp(1.6rem, 3vw, 2.6rem) !important; }
.feature-strip-author { font-family: var(--mono); font-style: normal; font-size: 0.8rem; text-transform: uppercase; }
.feature-strip-desc { font-family: var(--serif); font-size: 1rem; }
.feature-strip-cta { font-family: var(--display); text-transform: uppercase; color: var(--accent); font-size: 1.1rem; }

/* ── ALSO-FEATURED + OTD ── */
.also-card { border: 1px solid var(--border2); border-radius: 0; background: #000; }
.also-card:hover { border-color: var(--accent); background: var(--surface); }
.also-card-title { font-family: var(--display) !important; text-transform: uppercase; font-weight: 400; }
.otd-bar { background: #000; border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 0; }
.otd-bar-label { font-family: var(--display); text-transform: uppercase; color: var(--accent); }
.otd-bar-event, .otd-bar-link { font-family: var(--mono); font-size: 0.72rem; text-transform: uppercase; }

/* ── SECTION LABEL: red tab ── */
.section-label { display: inline-block; font-family: var(--display) !important; font-size: 1.4rem; text-transform: uppercase; background: var(--accent); color: #000; padding: 0.1rem 0.7rem; margin: 0.5rem 0 1rem; }

/* ── TOPIC SHELF pills ── */
.topic-shelf { gap: 0.4rem; }
.topic-pill { border: 1px solid var(--border2); border-radius: 0; background: #000; font-family: var(--mono); font-size: 0.72rem; text-transform: uppercase; }
.topic-pill:hover { background: var(--accent); color: #000; border-color: var(--accent); }
.topic-pill-name { color: inherit; }
.topic-pill-n { font-family: var(--display); color: var(--accent); }
.topic-pill:hover .topic-pill-n { color: #000; }

/* ── BOOK GRID → catalog rows, hard edges ── */
.book-grid { border-top: 2px solid var(--text); }
.book-card { border-bottom: 1px solid var(--border); border-radius: 0; transition: none; }
.book-card:hover { background: var(--accent); }
.book-card:hover .book-title-card, .book-card:hover .book-author-card { color: #000; }
.book-title-card { font-family: var(--display) !important; text-transform: uppercase; font-weight: 400; letter-spacing: 0.01em; }
.book-author-card { font-family: var(--mono); font-size: 0.7rem; text-transform: uppercase; }
.book-cover, .cover-placeholder { border-radius: 0; }

/* ── BUTTONS everywhere: hard mono ── */
.btn, .btn-share, .btn-save, .btn-retry, .btn-home, .meta-pill, .chip {
  border-radius: 0 !important; font-family: var(--mono) !important;
  text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.72rem;
  border: 1px solid var(--border2) !important;
}
.btn:hover, .btn-share:hover, .btn-save:hover { background: var(--accent) !important; color: #000 !important; border-color: var(--accent) !important; }

/* ── BOOK PAGE ── */
.book-title { font-size: clamp(2rem, 4vw, 3.4rem) !important; }
.category-label { font-family: var(--mono); color: var(--accent); }
.book-hero-band { height: 8px; background: var(--accent); }
.book-desc { font-family: var(--serif); font-size: 1.1rem; }
.body-text { font-family: var(--serif); }

/* ── FOOTER ── */
footer { border-top: 3px solid var(--accent); background: #000; }

/* light mode = photocopy inverse: bone paper, black ink, red */
[data-theme="light"] {
  --bg: #ece7dd; --surface: #e2ddd2; --surface2: #d8d2c5;
  --border: #c3bbaa; --border2: #a89f8c; --text: #0a0a0a;
  --muted: #4a453d; --muted2: #726b5f; --accent: #d0140c; --accent2: #e2231a;
  --accent-text: #d0140c;
}
[data-theme="light"] .rail { background: #ece7dd; }
[data-theme="light"] .rail-search input, [data-theme="light"] .feature-strip,
[data-theme="light"] .also-card, [data-theme="light"] .otd-bar,
[data-theme="light"] .book-card:not(:hover), [data-theme="light"] .topic-pill,
[data-theme="light"] .tpill, [data-theme="light"] .lang-sel { background: #fff !important; }
[data-theme="light"] footer { background: #e2ddd2; }

/* ── STATS + COLLECTIONS + shared page headers: zine ── */
.page-header, .breakdown-header { border-bottom: 3px solid var(--accent); }
.page-title, .page-header h1 { font-family: var(--display) !important; text-transform: uppercase; font-weight: 400; }
.page-subtitle { font-family: var(--mono); text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.05em; color: var(--muted); }
.stat-hero-card { border: 2px solid var(--text); border-radius: 0 !important; background: #000; box-shadow: 5px 5px 0 var(--border); }
.stat-hero-card.red, .stat-hero-card:first-child { border-left: 6px solid var(--accent); }
.stat-hero-card .stat-n, .stat-n { font-family: var(--display) !important; color: var(--accent); }
.stat-l, .stat-hero-card .stat-l { font-family: var(--mono); text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.08em; }
.breakdown-table { border: 1px solid var(--border); }
.breakdown-bar { border-radius: 0; background: var(--surface2); }
.breakdown-bar-cell { border-radius: 0; background: var(--accent); }
.breakdown-row, .breakdown-header { font-family: var(--mono); text-transform: uppercase; font-size: 0.75rem; }
.breakdown-pct { font-family: var(--display); color: var(--accent); }
.topic-tile, .coll-tile { border: 1px solid var(--border2); border-radius: 0 !important; background: #000; transition: none; }
.topic-tile:hover, .coll-tile:hover { background: var(--accent); box-shadow: 4px 4px 0 var(--text); }
.topic-tile:hover .topic-tile-name, .topic-tile:hover .topic-tile-count { color: #000; }
.topic-tile-name { font-family: var(--display) !important; text-transform: uppercase; font-weight: 400; }
.topic-tile-count { font-family: var(--mono); }
.results-meta { font-family: var(--mono); text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.05em; border-bottom: 1px solid var(--border); }
.coll-desc, .prose { font-family: var(--serif); }
.quick-links a, .quick-links .btn { border-radius: 0 !important; }
[data-theme="light"] .stat-hero-card, [data-theme="light"] .topic-tile:not(:hover), [data-theme="light"] .coll-tile:not(:hover) { background: #fff !important; }

/* ── SIDEBAR Topics/Languages: 2-row clamp + See-all popup ── */
.rail-collapse {
  max-height: 3.6rem; overflow: hidden;              /* ~2 rows of mono tags */
  display: flex; flex-wrap: wrap; gap: 0.3rem; align-content: flex-start;
}
.rail-more { margin-top: 0.4rem; position: relative; }
.rail-more > summary {
  list-style: none; cursor: pointer;
  font-family: var(--mono); font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--accent); border-bottom: 1px dashed var(--border2); padding-bottom: 0.15rem; width: fit-content;
}
.rail-more > summary::-webkit-details-marker { display: none; }
.rail-more > summary::after { content: " +"; }
.rail-more[open] > summary::after { content: " ×"; }
.rail-more[open] > summary { color: #000; background: var(--accent); padding: 0.05rem 0.35rem; border: none; }
.rail-popup {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 1000;
  width: min(680px, 92vw); max-height: 80vh; overflow-y: auto;
  display: flex; flex-wrap: wrap; gap: 0.4rem; align-content: flex-start;
  background: #0d0d0d; border: 3px solid var(--accent); padding: 2.5rem 1.5rem 1.5rem;
  box-shadow: 0 0 0 100vmax rgba(0,0,0,0.82), 10px 10px 0 rgba(0,0,0,0.6);
}
.rail-popup::before {
  content: attr(data-title); position: absolute; top: 0; left: 0; right: 0;
  font-family: var(--display); text-transform: uppercase; font-size: 1.1rem;
  color: #000; background: var(--accent); padding: 0.3rem 1.5rem; letter-spacing: 0.03em;
}
.rail-popup .rail-topic { font-size: 0.8rem; padding: 0.3rem 0.6rem; }
.rail-popup-x {
  position: absolute; top: 0; right: 0; z-index: 1; height: 1.9rem; width: 2.4rem;
  background: #000; color: var(--accent); border: none; cursor: pointer;
  font-family: var(--display); font-size: 1.3rem; line-height: 1;
}
.rail-popup-x:hover { background: var(--accent); color: #000; }
[data-theme="light"] .rail-popup { background: #fff; }

/* ═══ BOOK PAGE → "DOSSIER" — nothing like TOS ═══ */
.zine-book .book-page-inner { max-width: 1080px; }
.dossier-head { border-bottom: 4px solid var(--accent); padding-bottom: 1.25rem; margin-bottom: 1.75rem; }
.dossier-tag {
  display: inline-block; font-family: var(--mono); font-size: 0.68rem; text-transform: uppercase;
  letter-spacing: 0.15em; background: var(--accent); color: #000; padding: 0.2rem 0.7rem; margin-bottom: 1rem;
}
.dossier-title {
  font-family: var(--display) !important; text-transform: uppercase; font-weight: 400;
  font-size: clamp(2.4rem, 6vw, 4.5rem); line-height: 0.92; letter-spacing: 0.005em; color: var(--text);
}
.dossier-byline { font-family: var(--mono); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-top: 0.85rem; }
.dossier-body { display: grid; grid-template-columns: 240px 1fr; gap: 2.5rem; align-items: start; }
.dossier-side { position: sticky; top: 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.dossier-cover { width: 100%; border: 1px solid var(--border2); filter: grayscale(0.3) contrast(1.1); }
.dossier-specs { font-family: var(--mono); font-size: 0.72rem; border-top: 1px solid var(--border); }
.dossier-specs dt { text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent); padding-top: 0.6rem; }
.dossier-specs dd { color: var(--text); padding-bottom: 0.6rem; border-bottom: 1px solid var(--border); margin: 0; }
.dossier-specs dd a { text-decoration: underline; text-underline-offset: 2px; }
.dossier-links { display: flex; flex-direction: column; gap: 0.4rem; }
.dossier-ext { font-family: var(--mono); font-size: 0.72rem; text-transform: uppercase; color: var(--accent); border: 1px solid var(--border2); padding: 0.35rem 0.6rem; text-align: center; }
.dossier-ext:hover { background: var(--accent); color: #000; border-color: var(--accent); }
.dossier-main { min-width: 0; }
.dossier-main .book-desc { font-family: var(--serif); font-size: 1.25rem; line-height: 1.5; border-left: 4px solid var(--accent); padding-left: 1.1rem; margin-bottom: 1.5rem; }
@media (max-width: 720px) {
  .dossier-body { grid-template-columns: 1fr; gap: 1.5rem; }
  .dossier-side { position: static; flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
  .dossier-cover { width: 130px; }
  .dossier-specs { flex: 1; min-width: 200px; }
}

/* ── Contrast: small red labels on black need a lighter red (AA) ── */
.rail-section-label, .feature-kicker, .dossier-specs dt, .rail-more > summary,
.otd-bar-label, .category-label, .dossier-tag ~ *, .masthead-stats strong,
.stat-n, .breakdown-pct, .topic-pill-n, .dossier-ext {
  color: var(--accent-lite);
}
/* red-on-black backgrounds keep pure red; only TEXT-on-black lightens */
.rail-link.on, .rail-topic.on, .rail-topic:hover, .rail-link:hover,
.section-label, .dossier-tag, .rail-popup::before, .rail-popup-x:hover,
.book-card:hover, .topic-tile:hover, .coll-tile:hover { color: #000; }
[data-theme="light"] .rail-section-label, [data-theme="light"] .feature-kicker,
[data-theme="light"] .dossier-specs dt, [data-theme="light"] .stat-n,
[data-theme="light"] .masthead-stats strong { color: var(--accent); }

/* ═══ HARD-EDGE ENFORCEMENT — kill leftover SaaS-soft chrome (TOS look) ═══ */
/* everything square except pills that are meant to be tags */
.fitem, .mag-sec-img, .badge, .meta-pill, .subject-tag, .tag, .body-img,
.body-text img, .body-text figure img, #gallery-dlg img, #quote-bar, #shortcuts-inner,
.related-card, .related-card img, .related-placeholder, .btn-share, .shortcuts-hint kbd,
.breakdown-bar, .btn-save, .cover-lang, .coll-banner, .otd-date, .otd-event,
.feature-strip-img, .also-card-img, .stat-hero-card, .stat-hero-num, .topic-tile,
.coll-tile, .book-card, .book-cover, .page-header, .breakdown-table, .stat-strip,
.stat, .cover, code, .chip, .topic-pill, .quick-links a, .btn, .search-wrap,
.rail-search input, .dossier-cover, .book-header-cover {
  border-radius: 0 !important;
}
/* soft drop-shadows → hard offset or none */
.stat-hero-card, .book-card, .related-card, .feature-strip-img, .also-card-img,
.badge, #shortcuts-inner, #quote-bar, .book-header-cover, .dossier-cover {
  box-shadow: none !important;
}
.stat-hero-card:hover, .topic-tile:hover, .coll-tile:hover, .book-card:hover,
.related-card:hover { box-shadow: 5px 5px 0 var(--accent) !important; }
/* pills that SHOULD stay rounded: none — zine is hard-edged. Keep theme toggle circle. */
.theme-toggle { border-radius: 0 !important; }

/* stats hero numbers → Anton, labels → mono (were plain) */
.stat-hero-num { font-family: var(--display) !important; font-weight: 400; letter-spacing: 0.01em; }
.stat-hero-label { font-family: var(--mono) !important; text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.7rem; color: var(--accent-lite); }

/* ── IA scan-viewer fallback (unreadable OCR) ── */
.ia-scan-note { font-family: var(--mono); font-size: 0.8rem; color: var(--accent-lite); text-transform: uppercase; letter-spacing: 0.06em; margin: 0 0 0.8rem; }
.ia-scan { width: 100%; height: 80vh; border: 2px solid var(--border); background: #000; }
.ia-scan-link { font-family: var(--mono); font-size: 0.82rem; margin: 0.6rem 0 0; }
.ia-scan-link a { color: var(--accent-lite); }
