/* ==========================================================================
   D9 — Mobile Companion
   A phone-first, PWA-installable Urantia experience.
   Designed for one-handed reading. Bottom tabs. iOS/Android-feel chrome.
   System fonts. Light + dark.
   ========================================================================== */

/* --------- tokens (light) --------- */
:root {
  /* Color (light, iOS-feel) */
  --bg:           #F2F2F4;
  --bg-elev:     #FFFFFF;          /* card surface */
  --bg-elev-2:   #FFFFFF;          /* deeper surface */
  --surface-alt: #E8EAF0;          /* secondary surface */
  --surface-2:   #F7F7F9;          /* between bg and elev */
  --ink:         #1C1C1E;
  --ink-mute:    #6E6E73;
  --ink-soft:    #3A3A3C;
  --tint:        #2563EB;          /* system blue */
  --tint-soft:   rgba(37,99,235,.12);
  --accent:      #FF7A1A;          /* warm orange — playing/now */
  --accent-soft: rgba(255,122,26,.14);
  --rule:        #D9D9DD;
  --rule-soft:   #ECECEF;
  --green:       #34C759;
  --purple:      #AF52DE;
  --pink:        #FF2D55;

  /* Surface for the chrome bars */
  --appbar-bg:    rgba(255,255,255,.88);
  --appbar-blur:  saturate(180%) blur(20px);
  --appbar-border: rgba(60,60,67,.18);
  --tabbar-bg:    rgba(255,255,255,.92);
  --tabbar-border: rgba(60,60,67,.18);

  /* Type */
  --ff-body:    -apple-system, BlinkMacSystemFont, 'Inter Variable', 'Inter', system-ui, 'Segoe UI', Roboto, sans-serif;
  --ff-display: -apple-system, BlinkMacSystemFont, 'Inter Variable', 'Inter', system-ui, 'Segoe UI', Roboto, sans-serif;
  --ff-mono:    ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
  --ff-serif:   'Newsreader', ui-serif, 'Iowan Old Style', Charter, serif;

  /* Type scale (small to large) */
  --t-caption: 11px;
  --t-foot:    13px;
  --t-body:    16px;
  --t-callout: 17px;
  --t-h4:      20px;
  --t-h3:      22px;
  --t-h2:      28px;
  --t-h1:      34px;
  --t-display: 48px;

  /* Rhythm */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-7: 32px;
  --s-8: 44px;   /* iOS minimum tap target */
  --s-9: 56px;
  --s-10: 80px;

  /* Chrome heights */
  --appbar-h: 56px;
  --tabbar-h: 64px;
  --safe-top:    env(safe-area-inset-top,    0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left:   env(safe-area-inset-left,   0px);
  --safe-right:  env(safe-area-inset-right,  0px);

  /* Radii */
  --r-1: 8px;
  --r-2: 12px;
  --r-3: 16px;
  --r-4: 22px;
  --r-pill: 999px;

  /* Shadows */
  --sh-1: 0 1px 2px rgba(0,0,0,.04), 0 1px 1px rgba(0,0,0,.05);
  --sh-2: 0 4px 16px rgba(0,0,0,.06), 0 2px 4px rgba(0,0,0,.04);
  --sh-3: 0 20px 40px rgba(0,0,0,.10), 0 8px 16px rgba(0,0,0,.04);
  --sh-up: 0 -2px 12px rgba(0,0,0,.04);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:           #0F0F12;
    --bg-elev:      #1C1C1E;
    --bg-elev-2:    #232325;
    --surface-alt:  #2A2A2D;
    --surface-2:    #161618;
    --ink:          #F5F5F7;
    --ink-mute:     #8E8E93;
    --ink-soft:     #C6C6C8;
    --tint:         #5B9CFF;
    --tint-soft:    rgba(91,156,255,.18);
    --accent:       #FF8A36;
    --accent-soft:  rgba(255,138,54,.18);
    --rule:         #3A3A3C;
    --rule-soft:    #2A2A2C;
    --appbar-bg:    rgba(28,28,30,.84);
    --appbar-border: rgba(255,255,255,.10);
    --tabbar-bg:    rgba(22,22,24,.92);
    --tabbar-border: rgba(255,255,255,.08);
    --sh-1: 0 1px 2px rgba(0,0,0,.50), 0 1px 1px rgba(0,0,0,.40);
    --sh-2: 0 4px 16px rgba(0,0,0,.50), 0 2px 4px rgba(0,0,0,.40);
    --sh-3: 0 20px 40px rgba(0,0,0,.60), 0 8px 16px rgba(0,0,0,.40);
    --sh-up: 0 -2px 16px rgba(0,0,0,.40);
  }
}

/* Manual theme override (data-theme="light" | "dark") wins over system */
:root[data-theme="light"] {
  --bg:           #F2F2F4;
  --bg-elev:      #FFFFFF;
  --bg-elev-2:    #FFFFFF;
  --surface-alt:  #E8EAF0;
  --surface-2:    #F7F7F9;
  --ink:          #1C1C1E;
  --ink-mute:     #6E6E73;
  --ink-soft:     #3A3A3C;
  --tint:         #2563EB;
  --tint-soft:    rgba(37,99,235,.12);
  --accent:       #FF7A1A;
  --accent-soft:  rgba(255,122,26,.14);
  --rule:         #D9D9DD;
  --rule-soft:    #ECECEF;
  --appbar-bg:    rgba(255,255,255,.88);
  --appbar-border: rgba(60,60,67,.18);
  --tabbar-bg:    rgba(255,255,255,.92);
  --tabbar-border: rgba(60,60,67,.18);
}
:root[data-theme="dark"] {
  --bg:           #0F0F12;
  --bg-elev:      #1C1C1E;
  --bg-elev-2:    #232325;
  --surface-alt:  #2A2A2D;
  --surface-2:    #161618;
  --ink:          #F5F5F7;
  --ink-mute:     #8E8E93;
  --ink-soft:     #C6C6C8;
  --tint:         #5B9CFF;
  --tint-soft:    rgba(91,156,255,.18);
  --accent:       #FF8A36;
  --accent-soft:  rgba(255,138,54,.18);
  --rule:         #3A3A3C;
  --rule-soft:    #2A2A2C;
  --appbar-bg:    rgba(28,28,30,.84);
  --appbar-border: rgba(255,255,255,.10);
  --tabbar-bg:    rgba(22,22,24,.92);
  --tabbar-border: rgba(255,255,255,.08);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}
html.scroll-locked { overflow: hidden; height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ff-body);
  font-size: var(--t-body);
  line-height: 1.45;
  letter-spacing: -0.005em;
  font-feature-settings: "kern" 1, "liga" 1;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  min-height: 100dvh;
  /* Reserve space for app-bar + tab-bar so content never hides behind them */
  padding-top:    calc(var(--appbar-h) + var(--safe-top));
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom));
  overflow-x: hidden;
}

img, svg { max-width: 100%; height: auto; display: block; }

a {
  color: var(--tint);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
a:active { opacity: 0.72; }

button {
  font: inherit;
  cursor: pointer;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
button:active { opacity: 0.78; }

::selection { background: var(--tint-soft); color: var(--ink); }

code, kbd {
  font-family: var(--ff-mono);
  font-size: 0.88em;
}
kbd {
  background: var(--surface-alt);
  color: var(--ink-soft);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--rule);
  font-size: 0.78em;
  margin: 0 1px;
}

h1, h2, h3, h4, h5 {
  font-family: var(--ff-display);
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0;
  line-height: 1.18;
}

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

.skip-link {
  position: fixed;
  top: 8px; left: -1000px;
  z-index: 1000;
  background: var(--tint);
  color: white;
  padding: 8px 14px;
  border-radius: var(--r-1);
  font-weight: 600;
}
.skip-link:focus { left: 8px; }

/* Focus rings */
:focus-visible {
  outline: 3px solid var(--tint);
  outline-offset: 2px;
  border-radius: 4px;
}
.appbar-btn:focus-visible, .tab:focus-visible {
  outline-offset: 4px;
}

/* --------- top app bar --------- */
.appbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  height: calc(var(--appbar-h) + var(--safe-top));
  padding-top: var(--safe-top);
  background: var(--appbar-bg);
  backdrop-filter: var(--appbar-blur);
  -webkit-backdrop-filter: var(--appbar-blur);
  border-bottom: 1px solid var(--appbar-border);
  display: flex; align-items: stretch;
}
.appbar-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: 100%;
  padding: 0 calc(8px + var(--safe-left)) 0 calc(8px + var(--safe-right));
  gap: var(--s-2);
}
.appbar-left  { display: flex; align-items: center; justify-content: flex-start; min-width: 0; }
.appbar-right { display: flex; align-items: center; justify-content: flex-end; gap: var(--s-2); }
.appbar-center {
  display: flex; align-items: center; justify-content: center;
  min-width: 0;
}

.appbar-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 6px 10px 6px 6px;
  min-height: 44px;
  border-radius: var(--r-1);
}
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  background: var(--tint);
  color: white;
  border-radius: 8px;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.5px;
}
.brand-word {
  font-weight: 600;
  font-size: 17px;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.appbar-back {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  color: var(--tint);
  border-radius: 44px;
}
.appbar-back svg { width: 26px; height: 26px; }

.appbar-title {
  font-size: 17px;
  font-weight: 600;
  margin: 0;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 56vw;
  text-align: center;
}

.appbar-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  color: var(--tint);
  border-radius: 44px;
}
.appbar-btn svg { width: 22px; height: 22px; }
.appbar-btn:hover { background: var(--surface-alt); }

/* --------- bottom tab bar --------- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--tabbar-bg);
  backdrop-filter: var(--appbar-blur);
  -webkit-backdrop-filter: var(--appbar-blur);
  border-top: 1px solid var(--tabbar-border);
  display: flex; align-items: stretch;
  box-shadow: var(--sh-up);
}
.tab {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  color: var(--ink-mute);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.01em;
  min-height: 44px;
  padding: 6px 4px 4px;
  transition: color 120ms ease;
}
.tab-ic {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
}
.tab-ic svg { width: 26px; height: 26px; }
.tab-label { display: block; }
.tab.active { color: var(--tint); }
.tab.active .tab-ic { transform: translateY(-1px); }
.tab:not(.active):hover { color: var(--ink-soft); }

/* --------- main content frame --------- */
.app-main {
  min-height: calc(100dvh - var(--appbar-h) - var(--tabbar-h) - var(--safe-top) - var(--safe-bottom));
  padding: 0 calc(16px + var(--safe-left)) 0 calc(16px + var(--safe-right));
  animation: viewFadeIn 200ms ease-out both;
}
.view { max-width: 720px; margin: 0 auto; }

@keyframes viewFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* Sub-views slide in from the right (when accessed via in-app nav) */
.view-detail { animation: slideInRight 240ms ease-out both; }
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: none; }
}

/* --------- HOME / Avaleht --------- */
/* Vertical rhythm: two clear tiers. The greeting + search form the header
   pair (tight, 20px); every content section below is uniform (32px).
   The explicit list re-asserts the top margin over sections whose own
   `margin: 0 4px` shorthand would otherwise zero it. */
.view-home > * { margin-top: var(--s-7); }
.view-home > :first-child { margin-top: var(--s-5); }
.view-home > .search-card { margin-top: var(--s-5); }
.view-home > .resume-card,
.view-home > .cards-grid,
.view-home > .quote-card,
.view-home > .news-rail-block,
.view-home > .about-strip { margin-top: var(--s-7); }

.greet {
  padding: var(--s-2) 4px 0;
}
.greet-date {
  margin: 0 0 var(--s-2);
  color: var(--ink-mute);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: lowercase;
}
.greet-line {
  margin: 0;
  font-size: var(--t-h2);
  line-height: 1.16;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Search pseudo-input (looks like an iOS search field) */
.search-card { padding: 0 4px; }
.search-input-pseudo {
  width: 100%;
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px;
  min-height: 44px;
  background: var(--surface-alt);
  border-radius: var(--r-3);
  color: var(--ink-mute);
  font-size: 16px;
  text-align: left;
  border: 1px solid transparent;
  transition: background 120ms ease, border-color 120ms ease;
}
.search-input-pseudo:hover { background: var(--surface-2); border-color: var(--rule); }
.sip-ic { display: inline-flex; align-items: center; flex: 0 0 auto; }
.sip-ic svg { width: 18px; height: 18px; color: var(--ink-mute); }
.sip-placeholder { flex: 1; }

/* Resume card (big play prompt) */
.resume-card { padding: 0 4px; }
.rc-link {
  display: flex; align-items: center;
  gap: var(--s-3);
  padding: 14px;
  background: var(--bg-elev);
  border-radius: var(--r-3);
  border: 1px solid var(--rule-soft);
  box-shadow: var(--sh-2);
  min-height: 92px;
}
.rc-art { flex: 0 0 64px; width: 64px; height: 64px; border-radius: var(--r-2); overflow: hidden; }
.rc-art svg { width: 100%; height: 100%; display: block; }
.rc-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rc-eye {
  font-size: 11px; color: var(--ink-mute);
  text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600;
}
.rc-title {
  font-size: 17px; font-weight: 600; color: var(--ink);
  line-height: 1.25;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.rc-sub { font-size: 13px; color: var(--ink-mute); font-family: var(--ff-mono); letter-spacing: 0.01em; }
.rc-play {
  flex: 0 0 44px; width: 44px; height: 44px; border-radius: 44px;
  background: var(--accent); color: white;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px var(--accent-soft);
}
.rc-play svg { width: 22px; height: 22px; }

/* 2-column tap grid */
.cards-grid {
  padding: 0 4px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s-3);
}
/* Quiet tap targets: a barely-there fill instead of a floating white card,
   monochrome icons (no rainbow chips), hierarchy carried by type + space. */
.card-tap {
  display: flex; flex-direction: column;
  gap: 8px;
  padding: 16px 14px;
  min-height: 104px;
  border-radius: var(--r-3);
  background: var(--surface-2);
  color: var(--ink);
  transition: background 120ms ease;
}
.card-tap:active { background: var(--surface-alt); }
.ct-ic {
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: flex-start;
  color: var(--ink-mute);
}
.ct-ic svg { width: 24px; height: 24px; }
.ct-title { font-weight: 600; font-size: 16px; }
.ct-sub { color: var(--ink-mute); font-size: 13px; }

/* Quote of the day — a plain quiet block, not a card. A single hairline
   rule carries it; the serif text does the rest. */
.quote-card {
  margin: 0 4px;
  padding: 2px 4px 2px 18px;
  border-left: 2px solid var(--rule);
  background: none;
  border-radius: 0;
  box-shadow: none;
}
.qc-eye {
  margin: 0 0 10px;
  font-size: 11px; color: var(--ink-mute);
  text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600;
}
.qc-text {
  margin: 0 0 12px;
  font-family: var(--ff-serif);
  font-style: italic;
  font-size: 20px;
  line-height: 1.5;
  color: var(--ink);
}
.qc-cite {
  margin: 0;
  font-size: 13px;
  color: var(--ink-mute);
}

/* News rail (horizontal scroll) */
.news-rail-block { padding: 0 4px; }
.rail-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 0 0 var(--s-3);
}
.rail-title { font-size: var(--t-h3); font-weight: 700; }
.rail-link {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 15px; font-weight: 600; color: var(--tint);
  min-height: 32px; padding: 0 4px;
}
.rail-link svg { width: 16px; height: 16px; }
.news-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 78%;
  gap: var(--s-3);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 8px;
  margin: 0 -20px;   /* bleed to edges */
  padding-left: 20px;
  padding-right: 20px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.news-rail::-webkit-scrollbar { height: 6px; }
.news-rail::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 6px; }
.ncard {
  background: var(--surface-2);
  border-radius: var(--r-3);
  padding: 16px;
  min-height: 148px;
  display: flex; flex-direction: column;
  gap: 4px;
  scroll-snap-align: start;
  color: var(--ink);
}
.ncard-modern { }
.ncard-archive { }
.ncard-date {
  font-size: 12px; color: var(--accent); font-weight: 600;
  text-transform: lowercase; letter-spacing: 0.02em;
}
.ncard-archive .ncard-date { color: var(--ink-mute); }
.ncard-title {
  font-size: 17px; font-weight: 700; line-height: 1.22;
  margin: 0;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.ncard-sub { font-size: 14px; color: var(--ink-soft); margin: 2px 0 0; }
.ncard-venue { font-size: 12px; color: var(--ink-mute); margin-top: auto; }

/* About (book cover + intro) — an open section, not a boxed card. The cover
   floats with rounded corners; the text sits directly on the page. */
.about-strip {
  margin: 0 4px;
  background: none;
  border: none;
  box-shadow: none;
}
.about-cover img {
  width: 100%; height: 168px; object-fit: cover; object-position: center;
  display: block;
  border-radius: var(--r-3);
}
.about-text { padding: 16px 2px 0; }
.about-eye {
  margin: 0 0 4px;
  font-size: 11px; color: var(--ink-mute); text-transform: uppercase;
  letter-spacing: 0.08em; font-weight: 600;
}
.about-text h2 { font-size: var(--t-h3); margin: 0 0 8px; line-height: 1.18; }
.about-dek { font-size: 15px; color: var(--ink-soft); margin: 0 0 12px; line-height: 1.5; }
.link-arrow {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 600; color: var(--tint);
  font-size: 15px;
  min-height: 32px;
}
.link-arrow svg { width: 16px; height: 16px; }

/* App footnote */
.app-footnote {
  margin: var(--s-7) 4px var(--s-5);
  text-align: center;
  display: flex; flex-direction: column; gap: 4px;
}
.app-footnote p { margin: 0; font-size: 12px; color: var(--ink-mute); }
.fn-brand { font-weight: 600; color: var(--ink-soft); }
.fn-design { font-family: var(--ff-mono); font-size: 11px; letter-spacing: 0.04em; }

/* --------- KUULA tab --------- */
.view-kuula > * + * { margin-top: var(--s-5); }

.kuula-hero {
  position: relative;
  margin: 4px;
  border-radius: var(--r-3);
  overflow: hidden;
  background: var(--bg-elev);
  box-shadow: var(--sh-2);
  display: flex; flex-direction: column;
}
.kh-art {
  width: 100%;
  aspect-ratio: 1 / 1;
  position: relative;
  overflow: hidden;
}
.kh-art svg { width: 100%; height: 100%; display: block; }
.kh-meta {
  padding: 20px 20px 22px;
  background: linear-gradient(180deg, transparent 0%, var(--bg-elev) 30%);
  margin-top: -40px;
  position: relative;
}
.kh-eye {
  margin: 0 0 4px;
  font-size: 11px; color: var(--ink-mute);
  text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600;
  font-family: var(--ff-mono);
}
.kh-title {
  font-size: var(--t-h1);
  font-weight: 800;
  margin: 0 0 6px;
  line-height: 1.12;
  letter-spacing: -0.022em;
}
.kh-sub { margin: 0 0 var(--s-4); font-size: 14px; color: var(--ink-mute); }

.kh-actions { display: flex; gap: var(--s-3); align-items: center; }
.kh-play {
  display: inline-flex; align-items: center; gap: var(--s-2);
  height: 50px;
  padding: 0 22px 0 16px;
  background: var(--accent);
  color: white;
  border-radius: 50px;
  font-weight: 700;
  font-size: 16px;
  box-shadow: 0 6px 18px var(--accent-soft);
  flex: 0 0 auto;
  transition: transform 100ms ease;
}
.kh-play:active { transform: scale(.96); }
.khp-ic { display: inline-flex; align-items: center; }
.khp-ic svg { width: 22px; height: 22px; fill: currentColor; }
.kh-download {
  display: inline-flex; align-items: center; justify-content: center;
  width: 50px; height: 50px;
  border-radius: 50px;
  background: var(--surface-alt);
  color: var(--ink-soft);
}
.kh-download svg { width: 22px; height: 22px; }

/* "Mida sa kuulad" callout */
.kuula-callout {
  margin: 0 4px;
  background: var(--bg-elev);
  border-radius: var(--r-3);
  border: 1px solid var(--rule-soft);
  overflow: hidden;
}
.kc-details > summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 56px;
}
.kc-details > summary::-webkit-details-marker { display: none; }
.kc-eye {
  font-size: 15px; font-weight: 600; color: var(--ink);
}
.kc-chev {
  display: inline-flex; transition: transform 200ms ease;
  color: var(--ink-mute);
}
.kc-chev svg { width: 20px; height: 20px; }
.kc-details[open] .kc-chev { transform: rotate(90deg); }
.kc-body {
  padding: 0 18px 18px;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink-soft);
}
.kc-body p { margin: 0 0 var(--s-3); }
.kc-body p:last-child { margin-bottom: 0; }

/* Sisukord (collapsible parts) */
.kuula-toc { margin: 0 4px; }
.toc-h-block {
  padding: 4px 4px 12px;
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
}
.toc-h { font-size: var(--t-h3); margin: 0; font-weight: 700; }
.toc-sub { margin: 0; font-size: 13px; color: var(--ink-mute); }

.toc-part {
  background: var(--bg-elev);
  border: 1px solid var(--rule-soft);
  border-radius: var(--r-3);
  margin: 0 0 var(--s-3);
  overflow: hidden;
}
.toc-part summary {
  list-style: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 18px;
  min-height: 56px;
  background: var(--bg-elev);
}
.toc-part summary::-webkit-details-marker { display: none; }
.tph-label { font-size: 16px; font-weight: 600; color: var(--ink); flex: 1; min-width: 0; }
.tph-count { font-size: 13px; color: var(--ink-mute); font-family: var(--ff-mono); }
.tph-chev { display: inline-flex; transition: transform 200ms ease; color: var(--ink-mute); }
.tph-chev svg { width: 20px; height: 20px; }
.toc-part[open] .tph-chev { transform: rotate(90deg); }

.toc-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule-soft); }
.toc-row + .toc-row { border-top: 1px solid var(--rule-soft); }
.trow {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px;
  min-height: 64px;
  color: var(--ink);
  background: var(--bg-elev);
  transition: background 100ms ease;
}
.trow:hover { background: var(--surface-2); }
.trow.active {
  background: var(--tint-soft);
  position: relative;
}
.trow.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--tint);
}
.trow-art {
  flex: 0 0 44px; width: 44px; height: 44px;
  border-radius: 8px;
  overflow: hidden;
}
.trow-art svg { width: 100%; height: 100%; display: block; }
.trow-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.trow-title {
  font-size: 15px; font-weight: 500; line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.trow-sub { font-size: 12px; color: var(--ink-mute); font-family: var(--ff-mono); }
.trow-play, .trow-chev {
  flex: 0 0 32px; width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-mute);
  border-radius: 32px;
}
.trow-play svg, .trow-chev svg { width: 18px; height: 18px; }
.trow:hover .trow-play, .trow:hover .trow-chev { color: var(--accent); }

/* --------- MÕISTED tab --------- */
.view-moisted { padding-bottom: 0; }

.m-head {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  padding: 8px 4px 8px;
  margin: 0 -4px;
}
.m-search {
  font-size: 16px;
}
.m-pull-hint {
  margin: 6px 4px 0;
  font-size: 12px;
  color: var(--ink-mute);
  text-align: center;
}

.m-content-wrap {
  position: relative;
  display: flex;
  align-items: flex-start;
}
.m-content { flex: 1; min-width: 0; }

/* Alphabet rail (right edge) */
.m-rail {
  flex: 0 0 28px;
  position: sticky;
  top: calc(var(--appbar-h) + var(--safe-top) + 64px);
  align-self: flex-start;
  display: flex; flex-direction: column;
  align-items: center;
  padding: 4px 0;
  background: transparent;
  max-height: calc(100dvh - var(--appbar-h) - var(--tabbar-h) - var(--safe-top) - var(--safe-bottom) - 80px);
  overflow-y: auto;
  scrollbar-width: none;
}
.m-rail::-webkit-scrollbar { display: none; }
.rl-letter {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 18px;
  font-size: 10px;
  font-weight: 700;
  color: var(--tint);
  border-radius: 4px;
  letter-spacing: 0;
}
.rl-letter.empty { color: var(--ink-mute); opacity: 0.4; }
.rl-letter.active { background: var(--tint-soft); }
.rl-letter:hover { background: var(--tint-soft); }

/* Sections under the alphabet */
.m-section {
  scroll-margin-top: calc(var(--appbar-h) + var(--safe-top) + 80px);
}
.m-section + .m-section { margin-top: var(--s-5); }
.m-section-h {
  margin: 0 0 4px 4px;
  font-size: 28px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.03em;
  position: sticky;
  top: calc(var(--appbar-h) + var(--safe-top) + 64px);
  background: var(--bg);
  padding: 6px 0;
  z-index: 2;
}
.m-list { list-style: none; margin: 0; padding: 0; }
.m-row {
  background: var(--bg-elev);
  border-radius: 0;
  border-top: 1px solid var(--rule-soft);
}
.m-row:first-child {
  border-top: 1px solid var(--rule-soft);
  border-top-left-radius: var(--r-3);
  border-top-right-radius: var(--r-3);
}
.m-row:last-child {
  border-bottom-left-radius: var(--r-3);
  border-bottom-right-radius: var(--r-3);
}
.mrow {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%;
  padding: 14px 16px;
  min-height: 60px;
  text-align: left;
  color: var(--ink);
  transition: background 100ms ease;
}
.mrow:hover, .mrow:focus-visible { background: var(--surface-2); }
.mrow-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.mrow-title { font-size: 16px; font-weight: 600; }
.mrow-snippet {
  font-size: 13px; color: var(--ink-mute);
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical;
}
.mrow-chev { color: var(--ink-mute); display: inline-flex; flex: 0 0 auto; }
.mrow-chev svg { width: 18px; height: 18px; }

/* Letter detail view (m-section-letter) */
.m-section-letter { padding: 0; }
.m-letter-head {
  display: flex; align-items: baseline; gap: 12px;
  padding: var(--s-5) 4px var(--s-4);
}
.m-letter-big {
  font-size: 72px;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.04em;
  line-height: 1;
}
.m-letter-count {
  margin: 0;
  font-size: 14px;
  color: var(--ink-mute);
  font-family: var(--ff-mono);
}

/* Empty letter state */
.m-empty {
  background: var(--bg-elev);
  border-radius: var(--r-3);
  border: 1px solid var(--rule-soft);
  padding: 24px 20px;
  margin: var(--s-3) 0;
}
.m-empty-eye {
  margin: 0 0 8px;
  font-size: 11px; color: var(--accent); text-transform: uppercase;
  letter-spacing: 0.08em; font-weight: 700;
}
.m-empty-h { font-size: var(--t-h3); margin: 0 0 8px; }
.m-empty-dek { color: var(--ink-soft); font-size: 15px; margin: 0 0 16px; line-height: 1.5; }

/* --------- UUDISED tab --------- */
.view-uudised > * + * { margin-top: var(--s-7); }

.u-head { padding: 4px 4px 0; }
.u-pull-hint {
  margin: 0;
  text-align: center;
  font-size: 12px;
  color: var(--ink-mute);
}

.u-section { padding: 0 4px; }
.u-section-head { margin-bottom: var(--s-4); }
.u-section-h { font-size: var(--t-h2); margin: 0 0 4px; font-weight: 800; }
.u-section-sub { margin: 0; font-size: 14px; color: var(--ink-mute); }

.upc-grid { display: flex; flex-direction: column; gap: var(--s-3); }
.upc-card {
  background: var(--bg-elev);
  border-radius: var(--r-3);
  border: 1px solid var(--rule-soft);
  box-shadow: var(--sh-1);
  overflow: hidden;
}
.upc-head {
  display: flex; gap: 16px;
  padding: 16px 18px 10px;
  border-bottom: 1px solid var(--rule-soft);
}
.upc-date {
  flex: 0 0 60px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--accent-soft);
  border-radius: var(--r-2);
  padding: 8px 6px;
}
.upc-d-d { font-size: 28px; font-weight: 800; color: var(--accent); line-height: 1; letter-spacing: -0.02em; }
.upc-d-m { font-size: 11px; color: var(--accent); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; margin-top: 4px; }
.upc-d-y { font-size: 11px; color: var(--ink-mute); font-family: var(--ff-mono); margin-top: 2px; letter-spacing: 0.02em; }
.upc-titles { flex: 1; min-width: 0; }
.upc-eye {
  margin: 0 0 4px;
  font-size: 11px; color: var(--accent); text-transform: uppercase;
  letter-spacing: 0.08em; font-weight: 700;
}
.upc-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  line-height: 1.22;
}
.upc-body {
  padding: 12px 18px;
  font-size: 14px;
  color: var(--ink-soft);
  display: flex; flex-direction: column; gap: 6px;
}
.upc-body p { margin: 0; }
.upc-speaker { color: var(--ink); font-size: 15px; font-weight: 500; }
.upc-speaker .post-speaker { font-weight: 600; }
.upc-speaker .post-theme { color: var(--ink-soft); }
.upc-when { color: var(--ink-mute); font-size: 13px; }
.upc-where { color: var(--ink-mute); font-size: 13px; }
.upc-fee { font-size: 13px; }
.upc-fee-label { color: var(--ink-mute); }
.upc-fee-val { color: var(--ink); font-weight: 700; font-family: var(--ff-mono); }
.upc-foot {
  padding: 8px 14px 14px;
  display: flex; justify-content: flex-end;
}
.upc-cta {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 8px 14px;
  min-height: 36px;
  border-radius: var(--r-pill);
  background: var(--tint-soft);
  color: var(--tint);
  font-weight: 600;
  font-size: 14px;
}
.upc-cta svg { width: 14px; height: 14px; }

.arch-grid { display: flex; flex-direction: column; gap: var(--s-3); }
.arch-card {
  background: var(--bg-elev);
  border-radius: var(--r-3);
  border: 1px solid var(--rule-soft);
  padding: 14px 16px;
  color: var(--ink);
  box-shadow: var(--sh-1);
  display: flex; flex-direction: column; gap: 4px;
}
.arch-date { margin: 0; font-size: 12px; color: var(--ink-mute); font-family: var(--ff-mono); letter-spacing: 0.02em; }
.arch-title { margin: 2px 0 4px; font-size: 17px; font-weight: 700; line-height: 1.22; }
.arch-excerpt { margin: 0; font-size: 14px; color: var(--ink-soft); line-height: 1.5; }
.arch-meta {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: 6px 0 0;
}
.arch-cat { font-size: 11px; color: var(--ink-mute); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.arch-chev { color: var(--tint); display: inline-flex; }
.arch-chev svg { width: 18px; height: 18px; }

.u-empty {
  padding: 24px;
  background: var(--bg-elev);
  border-radius: var(--r-3);
  border: 1px solid var(--rule-soft);
  text-align: center;
  color: var(--ink-mute);
}

/* --------- KONTO tab --------- */
.view-konto { padding-bottom: var(--s-7); }
.view-konto > * + * { margin-top: var(--s-5); }

.kt-profile {
  display: flex; align-items: center; gap: 14px;
  margin: var(--s-4) 4px 0;
  padding: 16px;
  background: var(--bg-elev);
  border-radius: var(--r-3);
  border: 1px solid var(--rule-soft);
}
.ktp-avatar {
  width: 64px; height: 64px;
  border-radius: 64px;
  overflow: hidden;
  background: var(--surface-alt);
}
.ktp-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ktp-name { margin: 0 0 2px; font-size: 17px; font-weight: 700; line-height: 1.22; }
.ktp-sub { margin: 0; font-size: 13px; color: var(--ink-mute); }

.kt-group { padding: 0 4px; }
.kt-group-h {
  margin: 0 14px 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-mute);
  font-weight: 600;
}
.kt-list {
  list-style: none; margin: 0; padding: 0;
  background: var(--bg-elev);
  border-radius: var(--r-3);
  border: 1px solid var(--rule-soft);
  overflow: hidden;
}
.kt-row {
  padding: 0;
  border-top: 1px solid var(--rule-soft);
}
.kt-row:first-child { border-top: none; }

/* generic kt-row contents — used for static rows */
.kt-row > .ktr-meta {
  display: flex; flex-direction: column; gap: 2px;
  flex: 1; min-width: 0;
  padding: 14px 16px;
}
.kt-row.kt-row-member {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 0;
}
.kt-row.kt-row-member > .ktr-meta {
  padding: 14px 0 14px 16px;
}
.ktr-role {
  font-size: 12px; color: var(--ink-mute);
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
}
.ktr-name { font-size: 16px; color: var(--ink); font-weight: 500; }
.ktr-contact-line { font-size: 13px; color: var(--ink-mute); }
.ktr-actions {
  display: flex; align-items: center; gap: 4px;
  padding: 6px 12px 6px 0;
  flex: 0 0 auto;
}
.ktr-action {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  border-radius: 44px;
  color: var(--tint);
}
.ktr-action:hover { background: var(--surface-alt); }
.ktr-action svg { width: 22px; height: 22px; }

.kt-row.kt-row-link { padding: 0; }
.kt-link {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px;
  min-height: 60px;
  color: var(--ink);
  width: 100%;
}
.kt-link:hover { background: var(--surface-2); }
.ktl-flag { font-size: 22px; flex: 0 0 auto; }
.ktl-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.ktl-country { font-size: 16px; font-weight: 500; }
.ktl-host { font-size: 13px; color: var(--ink-mute); font-family: var(--ff-mono); }
.ktl-ic { color: var(--ink-mute); display: inline-flex; }
.ktl-ic svg { width: 18px; height: 18px; }

.kt-nav, .kt-btn {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  min-height: 60px;
  color: var(--ink);
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
}
.kt-nav:hover, .kt-btn:hover { background: var(--surface-2); }
.ktn-label { font-size: 16px; font-weight: 500; }
.ktn-sub { font-size: 13px; color: var(--ink-mute); margin-left: auto; padding-right: 6px; }
.ktn-chev { color: var(--ink-mute); display: inline-flex; }
.ktn-chev svg { width: 18px; height: 18px; }

.kt-mono { font-family: var(--ff-mono); letter-spacing: 0.01em; font-size: 14px; }

/* pill action at bottom of konto */
.kt-pill-action {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin: var(--s-5) 4px 0;
  padding: 16px;
  min-height: 56px;
  background: var(--tint);
  color: white;
  border-radius: var(--r-pill);
  font-weight: 600;
  font-size: 16px;
  box-shadow: 0 8px 24px rgba(37,99,235,.24);
}
.kpa-ic svg { width: 22px; height: 22px; }
.app-footnote-konto { margin-top: var(--s-7); }

/* --------- KONTAKT detail (kt-hero) --------- */
.kt-hero {
  margin: 4px;
  background: var(--bg-elev);
  border-radius: var(--r-3);
  border: 1px solid var(--rule-soft);
  overflow: hidden;
  box-shadow: var(--sh-1);
}
.kt-hero-photo img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
}
.kt-hero-meta { padding: 18px 18px 20px; }
.kt-hero-compact { padding: 18px; }
.kt-hero-eye {
  margin: 0 0 6px;
  font-size: 11px; color: var(--accent); text-transform: uppercase;
  letter-spacing: 0.08em; font-weight: 700;
}
.kt-hero-h { font-size: var(--t-h3); margin: 0; font-weight: 700; line-height: 1.24; }

/* --------- topic-hero (general) --------- */
.topic-hero {
  margin: 4px;
  padding: 18px;
  background: var(--bg-elev);
  border-radius: var(--r-3);
  border: 1px solid var(--rule-soft);
  box-shadow: var(--sh-1);
}
.topic-hero-photo { padding: 0; overflow: hidden; }
.th-photo img { width: 100%; height: 200px; object-fit: cover; display: block; }
.topic-hero.topic-hero-photo .th-meta { padding: 18px; }
.th-cover img { width: 100%; height: 200px; object-fit: cover; display: block; }
.topic-hero .th-cover + .th-meta { padding: 18px 0 0; }
.topic-hero:has(.th-cover) { padding: 0 0 18px; padding-inline: 0; }
.topic-hero:has(.th-cover) .th-meta { padding: 16px 18px 0; }
.th-eye {
  margin: 0 0 6px;
  font-size: 11px; color: var(--ink-mute); text-transform: uppercase;
  letter-spacing: 0.08em; font-weight: 700;
}
.th-h { font-size: var(--t-h2); margin: 0; font-weight: 800; line-height: 1.16; letter-spacing: -0.02em; }
.th-dek { margin: 8px 0 0; color: var(--ink-soft); font-size: 15px; line-height: 1.5; }

/* --------- topic cards (rubriik) --------- */
.topic-card-grid {
  margin: var(--s-3) 4px 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s-3);
}
.topic-card {
  background: var(--bg-elev);
  border-radius: var(--r-3);
  border: 1px solid var(--rule-soft);
  padding: 16px;
  display: flex; flex-direction: column; gap: 4px;
  min-height: 124px;
  color: var(--ink);
  box-shadow: var(--sh-1);
  text-decoration: none;
}
.topic-card:active { transform: scale(.98); }
.topic-card-wide { grid-column: 1 / -1; }
.tc-eye { font-size: 11px; color: var(--ink-mute); text-transform: uppercase; letter-spacing: 0.07em; font-weight: 600; }
.tc-h { font-size: 18px; font-weight: 700; margin: 0; }
.tc-dek { font-size: 14px; color: var(--ink-soft); margin: 0; }

/* --------- prose-block (long-form text pages) --------- */
.prose-block {
  margin: var(--s-3) 4px 0;
  padding: 18px;
  background: var(--bg-elev);
  border-radius: var(--r-3);
  border: 1px solid var(--rule-soft);
  font-size: var(--t-body);
  line-height: 1.65;
  color: var(--ink-soft);
}
.prose-block p { margin: 0 0 var(--s-4); }
.prose-block p:last-child { margin-bottom: 0; }
.prose-block p.lead {
  font-size: 18px;
  color: var(--ink);
  font-weight: 500;
  line-height: 1.5;
}
.prose-block h2, .prose-block h3, .prose-block h4, .prose-block h5 {
  margin: var(--s-5) 0 var(--s-2);
  color: var(--ink);
}
.prose-block h2 { font-size: var(--t-h3); }
.prose-block h3 { font-size: 18px; }
.prose-block h4 { font-size: 16px; }
.prose-block a:not(.cite):not(.term-chip) {
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 3px;
}
.prose-block a:not(.cite):not(.term-chip):hover {
  text-decoration-color: var(--tint);
}

/* Topic detail head */
.topic-detail-head {
  margin: 4px 4px 0;
  padding: 18px 18px 16px;
  background: var(--bg-elev);
  border-radius: var(--r-3);
  border: 1px solid var(--rule-soft);
  position: relative;
}
.tdh-eye {
  margin: 0 0 6px;
  font-size: 11px; color: var(--accent); text-transform: uppercase;
  letter-spacing: 0.08em; font-weight: 700;
}
.tdh-h { font-size: var(--t-h2); margin: 0 0 12px; font-weight: 800; letter-spacing: -0.02em; }
.topic-listen {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px 8px 12px;
  min-height: 36px;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
}
.topic-listen svg { width: 16px; height: 16px; }

/* Related terms */
.related-terms {
  margin: var(--s-4) 4px 0;
  padding: 18px;
  background: var(--bg-elev);
  border-radius: var(--r-3);
  border: 1px solid var(--rule-soft);
}
.rt-h { font-size: var(--t-h4); margin: 0 0 12px; }
.rt-grid {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 8px;
}
.rel-row { margin: 0; }
.rel-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px 8px 8px;
  min-height: 36px;
  background: var(--surface-alt);
  border-radius: var(--r-pill);
  color: var(--ink);
  font-size: 14px;
  border: none;
}
.rel-chip:hover { background: var(--tint-soft); color: var(--tint); }
.rc-letter {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  background: var(--bg-elev);
  border-radius: 22px;
  font-size: 11px; font-weight: 700;
  color: var(--ink);
}
.rc-name { font-weight: 500; }

/* --------- citation + term chips --------- */
.cite {
  display: inline-block;
  background: var(--tint-soft);
  color: var(--tint);
  border-radius: 6px;
  padding: 1px 8px;
  font-family: var(--ff-mono);
  font-size: 0.86em;
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
  font-weight: 600;
}
.cite:hover { background: var(--tint); color: white; }

.term-chip {
  display: inline;
  color: var(--ink);
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 100% 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  text-decoration: none;
  font-weight: 500;
  padding-bottom: 1px;
  opacity: 0.85;
}
.term-chip:hover { color: var(--tint); opacity: 1; }

/* --------- POST detail (news) --------- */
.view-post .post {
  margin: 4px 4px 0;
  background: var(--bg-elev);
  border-radius: var(--r-3);
  border: 1px solid var(--rule-soft);
  overflow: hidden;
}
.post-head {
  padding: 18px 18px 8px;
  border-bottom: 1px solid var(--rule-soft);
  background: var(--surface-2);
}
.post-date {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--ink-mute);
  font-family: var(--ff-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.post-h1 { font-size: var(--t-h1); margin: 0; font-weight: 800; letter-spacing: -0.022em; line-height: 1.14; }
.post-body {
  padding: 18px;
  font-size: var(--t-body);
  line-height: 1.65;
  color: var(--ink-soft);
}
.post-body p { margin: 0 0 var(--s-4); }
.post-body p:last-child { margin-bottom: 0; }
.post-body p.lead { font-size: 18px; font-weight: 500; color: var(--ink); }

/* Continue reading */
.cr-block { margin: var(--s-5) 4px 0; padding: 0 4px; }
.cr-h { font-size: 13px; color: var(--ink-mute); text-transform: uppercase; letter-spacing: 0.07em; font-weight: 600; margin: 0 0 8px; }
.cr-grid { display: flex; flex-direction: column; gap: 8px; }
.cr-card {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: var(--bg-elev);
  border-radius: var(--r-2);
  border: 1px solid var(--rule-soft);
  color: var(--ink);
  min-height: 60px;
}
.cr-date { font-size: 12px; color: var(--ink-mute); font-family: var(--ff-mono); flex: 0 0 auto; }
.cr-title { flex: 1; min-width: 0; font-weight: 500; font-size: 14px; }
.cr-chev { color: var(--ink-mute); }
.cr-chev svg { width: 16px; height: 16px; }

/* --------- KKK chat thread --------- */
.view-kkk { padding-bottom: var(--s-7); }
.view-kkk > * + * { margin-top: var(--s-4); }

.kkk-hero {
  margin: 4px;
  padding: 18px;
  background: var(--bg-elev);
  border-radius: var(--r-3);
  border: 1px solid var(--rule-soft);
}
.kkk-eye {
  margin: 0 0 6px;
  font-size: 11px; color: var(--tint); text-transform: uppercase;
  letter-spacing: 0.08em; font-weight: 700;
}
.kkk-h { font-size: var(--t-h2); margin: 0 0 8px; }
.kkk-intro p {
  margin: 0 0 var(--s-3);
  font-size: 14px; color: var(--ink-soft); line-height: 1.55;
}
.kkk-intro p:last-child { margin: 0; }

.chat-thread {
  list-style: none; margin: 0 4px; padding: 0;
  display: flex; flex-direction: column;
  gap: var(--s-4);
}
.chat-row { display: flex; align-items: flex-end; gap: 8px; }
.chat-q { justify-content: flex-end; }
.chat-a { justify-content: flex-start; }
.ch-bubble {
  padding: 12px 16px;
  border-radius: 20px;
  font-size: 15px;
  line-height: 1.5;
  max-width: 80%;
  word-wrap: break-word;
  box-shadow: var(--sh-1);
}
.ch-bubble-q {
  background: var(--tint);
  color: white;
  border-bottom-right-radius: 4px;
}
.ch-bubble-q .ch-q-text { margin: 0; font-weight: 500; }
.ch-bubble-a {
  background: var(--bg-elev);
  color: var(--ink-soft);
  border: 1px solid var(--rule-soft);
  border-bottom-left-radius: 4px;
}
.ch-a-line { margin: 0 0 8px; }
.ch-a-line:last-child { margin-bottom: 0; }
.ch-avatar {
  flex: 0 0 36px; width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent);
  border-radius: 36px;
  color: white;
}
.ch-av-letters { font-size: 11px; font-weight: 700; letter-spacing: 0.05em; }
.ch-share {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 8px;
  padding: 6px 10px;
  min-height: 32px;
  background: var(--surface-alt);
  border-radius: var(--r-pill);
  color: var(--ink-mute);
  font-size: 12px;
  font-weight: 600;
}
.ch-share:hover { background: var(--tint-soft); color: var(--tint); }
.ch-share svg { width: 14px; height: 14px; }

.chat-cta {
  margin: var(--s-7) 4px 0;
  padding: 18px;
  text-align: center;
  background: var(--bg-elev);
  border-radius: var(--r-3);
  border: 1px solid var(--rule-soft);
}
.cc-line { margin: 0 0 12px; font-size: 14px; color: var(--ink-mute); }

/* --------- Tsitaadid --------- */
.tsi-list {
  display: flex; flex-direction: column; gap: var(--s-5);
  margin: var(--s-3) 4px 0;
}
.tsi-section {
  background: var(--bg-elev);
  border-radius: var(--r-3);
  border: 1px solid var(--rule-soft);
  padding: 18px;
}
.tsi-head {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 0 0 12px;
  font-weight: 700;
}
.tsi-q {
  margin: 0 0 var(--s-3);
  padding: 0;
}
.tsi-q:last-child { margin-bottom: 0; }
.tsi-q blockquote {
  font-family: var(--ff-serif);
  font-size: 18px;
  font-style: italic;
  line-height: 1.5;
  color: var(--ink);
  margin: 0 0 6px;
  padding: 0 0 0 16px;
  border-left: 3px solid var(--accent);
}
.tsi-q figcaption { font-size: 13px; color: var(--ink-mute); }

/* Article (artiklid) sub-heads */
.article-section-h {
  margin: 0 0 var(--s-4) !important;
  font-size: var(--t-h3);
  font-weight: 800;
}
.article-sub {
  margin: var(--s-4) 0 var(--s-2);
  font-size: var(--t-h4);
  font-weight: 700;
  color: var(--ink);
}

/* --------- Video tiles --------- */
.vid-grid {
  margin: var(--s-3) 4px 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-3);
}
@media (min-width: 540px) {
  .vid-grid { grid-template-columns: 1fr 1fr; }
}
.vid-tile {
  background: var(--bg-elev);
  border-radius: var(--r-3);
  border: 1px solid var(--rule-soft);
  overflow: hidden;
  box-shadow: var(--sh-1);
}
.vid-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  overflow: hidden;
  background: var(--surface-2);
  border: none;
}
.vid-thumb img { width: 100%; height: 100%; object-fit: cover; }
.vid-play {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 56px; height: 56px;
  border-radius: 56px;
  background: rgba(0,0,0,0.6);
  display: inline-flex; align-items: center; justify-content: center;
  color: white;
}
.vid-play svg { width: 26px; height: 26px; margin-left: 3px; }
.vid-iframe {
  width: 100%; aspect-ratio: 16 / 9;
  border: none;
  display: block;
}
.vid-meta { padding: 14px 16px; }
.vid-kind { margin: 0 0 6px; font-size: 11px; color: var(--accent); text-transform: uppercase; letter-spacing: 0.07em; font-weight: 700; }
.vid-id { margin: 0; font-size: 12px; color: var(--ink-mute); font-family: var(--ff-mono); }
.vid-link {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 10px;
  font-size: 14px; font-weight: 600; color: var(--tint);
}
.vid-link svg { width: 14px; height: 14px; }

/* --------- buttons --------- */
.btn-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px 10px 14px;
  min-height: 44px;
  background: var(--surface-alt);
  color: var(--ink);
  border-radius: var(--r-pill);
  font-weight: 600;
  font-size: 15px;
}
.btn-pill:hover { background: var(--tint-soft); color: var(--tint); }
.btn-pill svg { width: 18px; height: 18px; }
.btn-pill-primary { background: var(--tint); color: white; }
.btn-pill-primary:hover { background: var(--tint); color: white; opacity: 0.92; }

.chip-link {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 14px;
  min-height: 36px;
  background: var(--surface-alt);
  border-radius: var(--r-pill);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
}
.chip-link:hover { background: var(--tint-soft); color: var(--tint); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  border-radius: 44px;
  color: var(--ink);
  background: transparent;
  border: none;
}
.icon-btn:hover { background: var(--surface-alt); }

/* --------- sheets (modal pattern) --------- */
.sheet {
  position: fixed; inset: 0;
  z-index: 100;
  display: flex; align-items: flex-end;
}
.sheet[hidden] { display: none; }
.sheet-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: backdropFade 200ms ease both;
}
@keyframes backdropFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.sheet-panel {
  position: relative;
  width: 100%;
  max-height: 90vh;
  background: var(--bg-elev);
  border-radius: 20px 20px 0 0;
  margin: auto auto 0;
  display: flex; flex-direction: column;
  box-shadow: var(--sh-3);
  animation: sheetUp 240ms cubic-bezier(0.32, 0.72, 0, 1) both;
  padding-bottom: var(--safe-bottom);
}
@keyframes sheetUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.sheet-grabber {
  width: 36px; height: 5px;
  border-radius: 99px;
  background: var(--rule);
  margin: 10px auto 4px;
}
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 16px 12px;
  gap: 8px;
}
.sheet-head h2 { font-size: 20px; font-weight: 700; margin: 0; }
.sheet-close {
  width: 36px; height: 36px;
  border-radius: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-alt);
  color: var(--ink-mute);
}
.sheet-close svg { width: 18px; height: 18px; }
.sheet-body {
  overflow-y: auto;
  padding: 0 16px 18px;
  flex: 1;
}

/* Settings sheet specifics */
.settings-list { list-style: none; margin: 0; padding: 0; }
.settings-row {
  padding: 14px 0;
  border-top: 1px solid var(--rule-soft);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  min-height: 60px;
}
.settings-row:first-child { border-top: none; }
.sr-label { font-size: 16px; color: var(--ink); }
.sr-value { font-size: 15px; color: var(--ink-mute); }
.sr-mono { font-family: var(--ff-mono); font-size: 13px; }

.seg {
  display: inline-flex;
  background: var(--surface-alt);
  border-radius: 10px;
  padding: 2px;
  gap: 0;
}
.seg-opt {
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  border-radius: 8px;
  border: none;
  background: transparent;
  min-height: 32px;
}
.seg-opt[aria-pressed="true"] {
  background: var(--bg-elev);
  box-shadow: var(--sh-1);
}

.sheet-footnote {
  margin: var(--s-4) 0 0;
  padding: 14px;
  background: var(--surface-2);
  border-radius: var(--r-2);
  font-size: 13px;
  color: var(--ink-mute);
  line-height: 1.55;
}

/* Search sheet (fullscreen) */
.sheet-fullscreen { align-items: stretch; }
.sheet-fullscreen .sheet-panel {
  max-height: 100vh;
  height: 100dvh;
  border-radius: 0;
  padding-top: var(--safe-top);
}
.sheet-head-search {
  flex-direction: row; align-items: center; gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--rule-soft);
}
.sheet-head-search urantia-search { flex: 1; }
.search-hint {
  margin: var(--s-3) 0;
  color: var(--ink-mute); font-size: 13px;
}
.search-suggested {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 8px;
}

/* Term sheet body */
[data-term-body] {
  padding: 0 4px 16px;
}
[data-term-body] p { margin: 0 0 12px; line-height: 1.5; color: var(--ink-soft); font-size: 15px; }
[data-term-body] .term-refs {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 8px 0 0;
}
[data-term-body] .term-letter-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  background: var(--surface-alt);
  color: var(--ink-mute);
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
[data-term-body] .term-listen {
  display: inline-flex; align-items: center; gap: 6px;
  margin: 6px 0 0;
  padding: 8px 14px;
  min-height: 36px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 600;
}
[data-term-body] .term-listen svg { width: 14px; height: 14px; }

/* --------- mini player (docked above tabbar) --------- */
.miniplayer {
  position: fixed;
  left: 8px; right: 8px;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 6px);
  z-index: 49;
  background: var(--bg-elev);
  border: 1px solid var(--rule-soft);
  border-radius: 14px;
  height: 56px;
  display: flex; align-items: center;
  padding: 6px;
  gap: 8px;
  box-shadow: var(--sh-3);
  animation: mpRise 240ms cubic-bezier(0.32, 0.72, 0, 1) both;
}
@keyframes mpRise {
  from { transform: translateY(10px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.miniplayer[hidden] { display: none !important; }
.mp-expand {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 10px;
  padding: 0 6px;
  height: 44px;
  text-align: left;
}
.mp-art {
  flex: 0 0 44px; width: 44px; height: 44px;
  border-radius: 8px; overflow: hidden;
}
.mp-art svg { width: 100%; height: 100%; }
.mp-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mp-title {
  font-size: 14px; font-weight: 600; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mp-sub {
  font-size: 11px; color: var(--ink-mute); font-family: var(--ff-mono);
}
.mp-play {
  flex: 0 0 44px; width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent);
  color: white;
  border-radius: 44px;
}
.mp-play svg { width: 22px; height: 22px; }

/* --------- full player overlay --------- */
.fullplayer {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg);
  display: flex; flex-direction: column;
  padding: 0;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  animation: fpRise 320ms cubic-bezier(0.32, 0.72, 0, 1) both;
}
@keyframes fpRise {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.fullplayer[hidden] { display: none !important; }
.fp-dismiss {
  position: absolute;
  top: calc(var(--safe-top) + 8px);
  left: 12px;
  z-index: 2;
  width: 44px; height: 44px;
  border-radius: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.16);
  color: var(--ink);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.fp-dismiss svg { transform: rotate(90deg); width: 22px; height: 22px; }
.fp-art {
  margin: 60px auto 24px;
  width: min(86vw, 360px);
  aspect-ratio: 1 / 1;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 30px 60px rgba(0,0,0,0.30), 0 12px 24px rgba(0,0,0,0.18);
}
.fp-art svg { width: 100%; height: 100%; display: block; }
.fp-meta {
  text-align: center;
  padding: 0 24px 16px;
}
.fp-eyebrow {
  margin: 0 0 4px;
  font-size: 11px; color: var(--ink-mute); text-transform: uppercase;
  letter-spacing: 0.1em; font-weight: 700; font-family: var(--ff-mono);
}
.fp-title {
  font-size: 24px;
  font-weight: 800;
  margin: 0;
  line-height: 1.18;
  letter-spacing: -0.02em;
}
.fp-player {
  margin: auto 16px 12px;
  --uap-bg: var(--bg-elev);
  --uap-fg: var(--ink);
  --uap-muted: var(--ink-mute);
  --uap-accent: var(--accent);
  --uap-rail: var(--rule);
  --uap-radius: 16px;
  --uap-font: var(--ff-body);
}

/* --------- empty state for 404 --------- */
.four-oh-four {
  margin: var(--s-7) 4px 0;
  padding: 32px 20px;
  background: var(--bg-elev);
  border-radius: var(--r-3);
  border: 1px solid var(--rule-soft);
  text-align: center;
  box-shadow: var(--sh-1);
}
.ff-eye {
  margin: 0 0 8px; font-size: 12px;
  color: var(--accent); text-transform: uppercase;
  letter-spacing: 0.08em; font-weight: 700;
}
.ff-h { font-size: var(--t-h2); margin: 0 0 8px; }
.ff-dek { color: var(--ink-soft); margin: 0 0 18px; }
.ff-actions {
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
}

/* --------- urantia-search shadow (theme via vars) --------- */
urantia-search {
  --us-bg: var(--surface-alt);
  --us-fg: var(--ink);
  --us-muted: var(--ink-mute);
  --us-accent: var(--tint);
  --us-rail: var(--rule);
  --us-radius: 12px;
  --us-font: var(--ff-body);
}

/* --------- responsive — ≥768 tablet --------- */
@media (min-width: 540px) {
  .cards-grid { grid-template-columns: repeat(2, 1fr); }
  .news-rail { grid-auto-columns: 280px; }
  .app-main { padding-left: 24px; padding-right: 24px; }
  .topic-card-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 768px) {
  :root {
    --appbar-h: 64px;
    --tabbar-h: 72px;
  }
  .brand-word { font-size: 19px; }
  .appbar-title { font-size: 18px; }
  .greet-line { font-size: 32px; }
  .kh-title { font-size: 38px; }
  .post-h1 { font-size: 38px; }
  .news-rail { grid-auto-columns: 320px; }
  .view { max-width: 760px; }

  .topic-card-grid, .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 900px) {
  /* Desktop still uses bottom tabs, but content gets a roomier viewport */
  .view { max-width: 800px; }
  .app-main { padding-left: 32px; padding-right: 32px; }
  .greet-line { font-size: 36px; }
  .kh-title { font-size: 42px; }
  .post-h1 { font-size: 42px; }
  /* Center the tabbar visually with a max-width — still spans bottom */
  .tabbar { padding: 0 max(8px, calc((100vw - 540px) / 2)); padding-bottom: var(--safe-bottom); }
}

@media (min-width: 1280px) {
  .view { max-width: 880px; }
  .tabbar { padding-left: max(8px, calc((100vw - 600px) / 2)); padding-right: max(8px, calc((100vw - 600px) / 2)); padding-bottom: var(--safe-bottom); }
}

/* --------- landscape phones --------- */
@media (max-height: 500px) and (orientation: landscape) {
  .kh-art { aspect-ratio: 21 / 9; max-height: 200px; }
  .fp-art { margin: 16px auto; width: min(40vw, 200px); }
  .miniplayer { bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 4px); }
}

/* --------- print --------- */
@media print {
  .appbar, .tabbar, .miniplayer, .fullplayer, .sheet { display: none !important; }
  body { padding: 0; background: white; color: black; }
  .view, .app-main { max-width: none; padding: 0; }
  .prose-block { border: none; background: transparent; }
  a { color: black; text-decoration: underline; }
  .cite, .term-chip { background: transparent !important; color: black !important; padding: 0; }
}

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