/* ============================================================
   Prepnol · HSLC Guru — "Reading Room"
   Material-3-minimal Android feel on the Prepnol design tokens:
   evergreen accent on warm ivory paper, white cards, hairlines.
   Roboto for Latin, Noto Serif Bengali for Assamese — routed
   purely by unicode-range, no classes.
   ============================================================ */

@font-face {
  font-family: 'Roboto Variable';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('vendor/fonts/roboto-latin-wght.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Noto Serif Bengali Variable';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('vendor/fonts/noto-serif-bengali-wght.woff2') format('woff2-variations');
  unicode-range: U+0951-0952, U+0964-0965, U+0980-09FE, U+1CD0, U+1CD2,
    U+1CD5-1CD6, U+1CD8, U+1CE1, U+1CEA, U+1CED, U+1CF2, U+1CF5-1CF7,
    U+200C-200D, U+20B9, U+25CC, U+A8F1;
}

/* ---- Tokens ---------------------------------------------------
   Surfaces: neutral cool-gray scale (industry study-app standard —
   white cards on a light gray canvas). Accent: Prepnol evergreen
   from the design system. */
:root {
  /* Surfaces & ink */
  --paper: #f5f7fa;
  --card: #ffffff;
  --card-2: #f2f4f7;
  --ink: #1a1c1e;
  --muted: #5f6368;
  --faint: #71767b;
  --line: #e4e7ec;
  --line-2: #eef0f3;

  /* Brand accent (evergreen) */
  --accent: #1e6b54;
  --accent-ink: #154d3d;
  --accent-soft: #e4efe9;
  --accent-line: #cfe3da;
  --on-accent: #ffffff;

  /* Semantic */
  --danger: #c0392b;
  --backdrop: rgba(18, 20, 23, 0.44);

  --font: 'Roboto Variable', 'Noto Serif Bengali Variable', Roboto,
    system-ui, 'Noto Sans Bengali', sans-serif;

  /* Radii */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  /* Spacing scale (4pt) — every gap/margin/padding comes from here */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-6: 24px;
  --sp-8: 32px;

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 8px 22px -14px rgba(16, 24, 40, 0.2);
  --shadow-lg: 0 24px 48px -28px rgba(16, 24, 40, 0.38);

  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 130ms;
  --dur: 190ms;
  --dur-slow: 260ms;

  /* Layout */
  --appbar-h: 56px;
  --botnav-h: 64px;
  --w: 600px;

  --z-bar: 100;
  --z-overlay: 400;
  --z-toast: 600;

  --reader-size: 0.875rem;      /* 14px default, user-adjustable */

  /* State-layer (ripple / pressed) ink */
  --press: rgba(26, 28, 30, 0.07);
  --ripple: rgba(26, 28, 30, 0.11);

  color-scheme: light;
}

/* Dark — derived from the same hues (design system defines light only) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --paper: #111315;
    --card: #1b1e20;
    --card-2: #212528;
    --ink: #e4e6e8;
    --muted: #9aa0a6;
    --faint: #83888d;
    --line: #2b2f33;
    --line-2: #26292c;
    --accent: #34926f;
    --accent-ink: #8fd0b4;
    --accent-soft: #1c2f28;
    --accent-line: #2a4136;
    --on-accent: #ffffff;
    --danger: #d96a57;
    --backdrop: rgba(0, 0, 0, 0.55);
    --shadow-sm: none;
    --shadow-md: none;
    --shadow-lg: 0 24px 48px -28px rgba(0, 0, 0, 0.6);
    --press: rgba(228, 230, 232, 0.08);
    --ripple: rgba(228, 230, 232, 0.1);
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --paper: #111315;
  --card: #1b1e20;
  --card-2: #212528;
  --ink: #e4e6e8;
  --muted: #9aa0a6;
  --faint: #83888d;
  --line: #2b2f33;
  --line-2: #26292c;
  --accent: #34926f;
  --accent-ink: #8fd0b4;
  --accent-soft: #1c2f28;
  --accent-line: #2a4136;
  --on-accent: #ffffff;
  --danger: #d96a57;
  --backdrop: rgba(0, 0, 0, 0.55);
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: 0 24px 48px -28px rgba(0, 0, 0, 0.6);
  --press: rgba(228, 230, 232, 0.08);
  --ripple: rgba(228, 230, 232, 0.1);
  color-scheme: dark;
}

/* ---- Base -------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
* { margin: 0; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  font-family: var(--font);
  font-size: 0.875rem;          /* 14px UI default */
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  overscroll-behavior-y: contain;
  -webkit-tap-highlight-color: transparent;
}

img, svg { display: block; max-width: 100%; }
img { height: auto; }
button, input { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; padding: 0; }
a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

.ic {
  width: 22px; height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.ic.sm { width: 16px; height: 16px; }

/* ---- Ripple (Android press feedback) ------------------------ */
.rp {
  position: relative;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}
.ripple-ink {
  position: absolute;
  border-radius: 50%;
  background: var(--ripple);
  transform: scale(0);
  animation: ripple var(--dur-slow) var(--ease-expo) forwards;
  pointer-events: none;
}
@keyframes ripple {
  to { transform: scale(2.4); opacity: 0; }
}

/* ---- Top app bar (single, adaptive) -------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-bar);
  /* Edge-to-edge (Android 15+ TWA, notched phones): keep the bar below the
     transparent status bar; the bar's background fills the inset. */
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--paper);
  border-bottom: 1px solid transparent;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}
.topbar.scrolled {
  background: var(--card);
  border-bottom-color: var(--line);
  box-shadow: var(--shadow-sm);
}
.topbar-inner {
  max-width: var(--w);
  margin: 0 auto;
  height: var(--appbar-h);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 8px;
}
.wordmark {
  font-weight: 900;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
  padding: 8px;                 /* bar 8 + 8 = text on the 16px rail */
  border-radius: var(--radius-pill);
}
.wordmark i { color: var(--accent); font-style: normal; }

.bar-title {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 4px;
}
.bar-spacer { flex: 1; }

.bar-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  flex: none;
  transition: background var(--dur-fast) var(--ease);
}
.bar-btn:active { background: var(--press); }
.bar-btn[aria-pressed='true'] { color: var(--accent-ink); }

/* ---- Page ---------------------------------------------------- */
main { display: block; }
.page {
  max-width: var(--w);
  margin: 0 auto;
  width: 100%;
  padding: var(--sp-2) var(--sp-4) calc(var(--botnav-h) + env(safe-area-inset-bottom) + var(--sp-8));
  animation: page-in var(--dur) var(--ease);
}
@keyframes page-in {
  from { opacity: 0; transform: translateY(4px); }
}

/*
 * One 16px rail: all text (titles, labels, prose) sits flush on the page
 * gutter, exactly where card borders sit. Vertical rhythm: 24px before a
 * section label, 8px after it, 16px between sibling blocks.
 */
.page-title {
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin: var(--sp-4) 0 2px;
  text-wrap: balance;
}
.page-sub { font-size: 0.8125rem; color: var(--muted); }

.section-label {
  font-weight: 600;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--faint);
  margin-top: var(--sp-6);
}

/* Block rhythm — one rule instead of per-screen inline margins */
.card, .search, .hscroll, .seg, .stepper, .note, .promo { margin-top: var(--sp-4); }
.section-label + .card, .section-label + .hscroll,
.section-label + .seg, .section-label + .stepper { margin-top: var(--sp-2); }

/* ---- Cards & list cells (Material list on paper) ------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.cell {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 56px;
  padding: 12px 16px;
  text-align: left;
  color: var(--ink);
  transition: background var(--dur-fast) var(--ease);
}
.cell + .cell { border-top: 1px solid var(--line-2); }
.cell:active { background: var(--press); }

.tonal {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 600;
  font-size: 0.9375rem;
}
.tonal .ic { width: 20px; height: 20px; }
.tonal.n { font-size: 0.8125rem; font-variant-numeric: tabular-nums; }

.cell-main { flex: 1; min-width: 0; }
.cell-t {
  display: block;
  font-weight: 500;
  font-size: 0.9375rem;
  line-height: 1.4;
}
.cell-s {
  display: block;
  margin-top: 2px;
  font-size: 0.75rem;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cell-end { flex: none; color: var(--faint); }

/* ---- Continue-reading carousel -------------------------------- */
.hscroll {
  display: flex;
  gap: var(--sp-3);
  overflow-x: auto;
  margin-left: calc(-1 * var(--sp-4));
  margin-right: calc(-1 * var(--sp-4));
  padding: 2px var(--sp-4) 6px;   /* full-bleed scroll, cards start on the rail */
  scroll-padding-inline: var(--sp-4); /* snap respects the rail inset */
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}
.hscroll::-webkit-scrollbar { display: none; }
.cr-card {
  flex: none;
  width: 172px;
  scroll-snap-align: start;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-3) var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--ink);
  text-align: left;
  transition: background var(--dur-fast) var(--ease);
}
.cr-card:active { background: var(--press); }
.cr-card .ic { color: var(--accent-ink); width: 17px; height: 17px; margin-bottom: 2px; }
.cr-t {
  font-weight: 500;
  font-size: 0.875rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cr-s { font-size: 0.6875rem; color: var(--faint); margin-top: auto; padding-top: 4px; }

/* ---- Bottom navigation (M3 pill indicator) -------------------- */
.botnav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: var(--z-bar);
  background: var(--card);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.botnav-inner {
  max-width: var(--w);
  margin: 0 auto;
  height: var(--botnav-h);
  display: flex;
}
.botnav .nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--muted);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  user-select: none;
  -webkit-user-select: none;
}
.nav-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 30px;
  border-radius: var(--radius-pill);
  transition: background var(--dur) var(--ease);
}
.botnav .nav:active .nav-pill { background: var(--press); }
.botnav .nav.on { color: var(--ink); font-weight: 600; }
.botnav .nav.on .nav-pill { background: var(--accent-soft); color: var(--accent-ink); }

/* ---- Buttons & links ------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 24px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  font-size: 0.875rem;
  transition: filter var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.btn:active { transform: translateY(1px); filter: brightness(1.08); }

.link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--accent-ink);
  padding: 6px 0;
}

/* ---- Notes ----------------------------------------------------- */
.note {
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius);
  padding: var(--sp-3) var(--sp-4);
}

/* ---- Promo / sponsor slots ---------------------------------------
   Manually curated banners (config.js PROMOS) — THE one saturated block
   in the app; everything else is neutral so these dominate. With an
   image: the banner fills the card at 3:1. Without: a bold brand card
   with a CTA pill built from title/sub/cta. */
.promo {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--accent);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  overflow: hidden;
  color: var(--on-accent);
  box-shadow: var(--shadow-md);
  --ripple: rgba(255, 255, 255, 0.25);
}
.promo.has-img { padding: 0; background: var(--card); }
.promo img { width: 100%; aspect-ratio: 3 / 1; object-fit: cover; }
.promo-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.promo-eyebrow {
  font-weight: 700;
  font-size: 0.8125rem;
  letter-spacing: -0.02em;
  color: rgba(255, 255, 255, 0.85);
}
.promo-eyebrow i { font-style: normal; color: rgba(255, 255, 255, 0.6); }
.promo-t {
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin-top: var(--sp-2);
  text-wrap: balance;
}
.promo-s {
  font-size: 0.8125rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.82);
  margin-top: 2px;
}
.promo-cta {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 var(--sp-4);
  margin-top: var(--sp-3);
  border-radius: var(--radius-pill);
  background: #ffffff;
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 0.8125rem;
}
:root[data-theme='dark'] .promo-cta, .promo-cta { color: #154d3d; }
.promo-tag {
  position: absolute;
  top: var(--sp-2);
  right: var(--sp-2);
  font-size: 0.5625rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-pill);
  padding: 2px 8px;
}
.promo.has-img .promo-tag {
  color: rgba(255, 255, 255, 0.9);
  background: rgba(0, 0, 0, 0.35);
}

/* ---- Search ----------------------------------------------------- */
.search {
  display: flex;
  align-items: center;
  gap: 14px;                    /* matches .cell gap — icons share a rail */
  height: 48px;
  padding: 0 var(--sp-4);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  width: 100%;
  transition: border-color var(--dur-fast) var(--ease);
}
.search .ic { color: var(--faint); width: 20px; height: 20px; }
.search input {
  border: 0;
  background: none;
  outline: none;
  width: 100%;
  height: 100%;
  padding: 0;
  font-size: 0.875rem;
}
.search input::placeholder { color: var(--faint); }
.search:focus-within { border-color: var(--accent); }
.search .hint { color: var(--faint); font-size: 0.875rem; }

/* ---- Settings ----------------------------------------------------
   One control family: segmented pickers and the stepper share the same
   recessed pill container (card-2 surface, 4px inner padding). */
.seg {
  display: flex;
  background: var(--card-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-pill);
  padding: var(--sp-1);
  gap: var(--sp-1);
}
.seg .opt {
  flex: 1;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  font-weight: 500;
  font-size: 0.8125rem;
  color: var(--muted);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.seg .opt.on {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--accent-line);
}

.stepper {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  background: var(--card-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-pill);
  padding: var(--sp-1);
}
.stepper button {
  width: 56px;
  height: 38px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1rem;
  color: var(--ink);
  flex: none;
  transition: background var(--dur-fast) var(--ease);
}
.stepper button:active { background: var(--press); }
.stepper .sample {
  flex: 1;
  text-align: center;
  color: var(--muted);
  font-size: var(--reader-size);
  line-height: 1.4;
}

.about {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.6;
  margin-top: var(--sp-8);
}
.about a { color: var(--accent-ink); font-weight: 600; }

/* ---- Bottom sheet ------------------------------------------------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: var(--backdrop);
  animation: fade-in var(--dur-slow) var(--ease);
}
.sheet {
  width: 100%;
  max-width: 440px;
  background: var(--card);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: var(--sp-2) var(--sp-4) calc(var(--sp-6) + env(safe-area-inset-bottom, 0px));
  animation: sheet-in 0.32s var(--ease-expo);
}
.sheet-grip {
  width: 32px;
  height: 4px;
  margin: 0 auto 16px;
  border-radius: 2px;
  background: var(--line);
}
.sheet-title { font-weight: 700; font-size: 1.0625rem; letter-spacing: -0.01em; }
.sheet-sub { font-size: 0.8125rem; color: var(--muted); margin: 3px 0 12px; }
.sheet .card { box-shadow: none; }
@keyframes sheet-in { from { transform: translateY(100%); } }
@keyframes fade-in { from { opacity: 0; } }
@media (min-width: 560px) {
  .overlay { align-items: center; }
  .sheet { border-radius: var(--radius-lg); padding-top: 22px; }
  .sheet-grip { display: none; }
}

/* ---- Toast ---------------------------------------------------------- */
.toast-region {
  position: fixed;
  left: 50%;
  bottom: calc(var(--botnav-h) + env(safe-area-inset-bottom) + 16px);
  transform: translateX(-50%);
  z-index: var(--z-toast);
  width: max-content;
  max-width: 90vw;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.toast {
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius-pill);
  padding: 10px 18px;
  font-size: 0.8125rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: toast-in var(--dur-slow) var(--ease);
}
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

/* ---- States ----------------------------------------------------------- */
.state {
  text-align: center;
  padding: 64px 24px;
  color: var(--muted);
}
.state .ic {
  width: 44px; height: 44px;
  margin: 0 auto 16px;
  padding: 11px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink);
  box-sizing: content-box;
  stroke-width: 1.6;
}
.state h2 { font-weight: 600; font-size: 1rem; color: var(--ink); margin-bottom: 4px; }
.state p { font-size: 0.8125rem; max-width: 40ch; margin: 0 auto 20px; line-height: 1.55; }

.skel { animation: skel 1.1s ease-in-out infinite alternate; }
@keyframes skel { from { opacity: 1; } to { opacity: 0.45; } }
.skel-line { height: 11px; border-radius: 6px; background: var(--line-2); margin: 14px 0; }
.skel-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-top: var(--sp-4);
}
.skel-row {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
}
.skel-row + .skel-row { border-top: 1px solid var(--line-2); }
.skel-row::before {
  content: '';
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--line-2);
  flex: none;
}
.skel-row::after {
  content: '';
  height: 11px;
  border-radius: 6px;
  background: var(--line-2);
  flex: 1;
  max-width: 70%;
}

/* ---- Reader ------------------------------------------------------------- */
.reader-meta {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: var(--sp-4);
}
.reader-title {
  font-weight: 700;
  font-size: 1.375rem;
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin: var(--sp-1) 0 6px;
  text-wrap: balance;
}
.reader-sub {
  display: flex;
  align-items: center;
  gap: 6px 14px;
  flex-wrap: wrap;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: var(--sp-6);
}

.prose {
  font-size: var(--reader-size);
  line-height: 1.8;
  max-width: 68ch;
  text-wrap: pretty;
  word-break: break-word;
}
.prose > * + * { margin-top: 0.85em; }
.prose h1, .prose h2, .prose h3, .prose h4 {
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.35;
  margin-top: 1.6em;
  text-wrap: balance;
}
.prose h1 { font-size: 1.25em; }
.prose h2 { font-size: 1.15em; }
.prose h3 { font-size: 1.05em; }
.prose h4 { font-size: 1em; }
.prose a {
  color: var(--accent-ink);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}
.prose ul, .prose ol { padding-left: 1.3em; margin-top: 0.85em; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li { margin-top: 0.3em; }
.prose blockquote {
  margin: 0.85em 0;
  padding: 10px 14px;
  background: var(--card-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  color: var(--muted);
}
.prose figure { margin: 1.1em 0; }
.prose img { border-radius: var(--radius-sm); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 1.6em 0; }
.prose .table-wrap { overflow-x: auto; margin: 0.85em 0; }
.prose table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.95em;
  background: var(--card);
  border-radius: var(--radius-sm);
}
.prose th, .prose td {
  border: 1px solid var(--line);
  padding: 6px 10px;
  text-align: left;
}
.prose th { background: var(--card-2); font-weight: 600; }

.prose .katex-display { overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
.prose .katex { font-size: 1.05em; }

.reader-foot {
  margin-top: var(--sp-8);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--line);
  display: flex;
  gap: var(--sp-6);
}
