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

:root {
  --blue-glow: rgba(80, 140, 255, 0.6);
  --blue-dim: rgba(40, 80, 180, 0.3);
  --bg: #0a0a12;
  --text: #d8dce8;
  --text-dim: #8890a8;
  --accent: #5088ff;
  --bar-bg: rgba(8, 8, 16, 0.92);
  --shimmer-power: 0;
  --chrome-offset: 92px;
  --banner-h: 34px;
  --center-tabs-h: 40px;
  --center-brand-h: 48px;
  --panel-width: 500px;
}

html, body {
  height: 100%;
  overflow: hidden;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* ── Selectable reading surfaces ─────────────────────────────────
   user-select inherits, so container-level rules cover all their text. */
.reader-breadcrumb,
.reader-grid,
.reader-chapter,
.panel-reader-grid,
.panel-reader-chapter,
.panel-section-title,
.enrich-inner,
.study-focus-content,
.study-notes-panel,
#panel-studies-list,
.memorial,
.levi-messages {
  user-select: text;
  -webkit-user-select: text;
}

/* Buttons inside those surfaces stay non-selectable chrome. */
button {
  user-select: none;
  -webkit-user-select: none;
}

/* ── Inline text highlights (sub-verse ranges in the reader) ── */
.reader-chapter mark,
.panel-reader-chapter mark {
  background: rgba(216, 178, 80, 0.30);
  color: inherit;
  padding: 0;
  border-radius: 2px;
}
mark.hl-gold { background: rgba(216, 178, 80, 0.30); }
mark.hl-blue { background: rgba(95, 155, 230, 0.32); }
mark.hl-violet { background: rgba(170, 130, 230, 0.32); }
mark.hl-green { background: rgba(100, 200, 145, 0.32); }
mark.hl-red { background: rgba(225, 95, 95, 0.32); }
.verse-body mark { cursor: pointer; border-radius: 2px; transition: background 0.15s; }

/* Floating toolbar shown above a text selection */
.highlight-bar {
  position: fixed;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: rgba(10, 15, 28, 0.96);
  border: 1px solid rgba(120, 150, 210, 0.24);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
}
.highlight-bar.hidden { display: none; }
.hl-label { font-family: system-ui, sans-serif; font-size: 11px; color: rgba(160, 175, 210, 0.62); margin-right: 2px; letter-spacing: 0; }
.hl-swatch { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.2); padding: 0; cursor: pointer; transition: transform 0.12s; }
.hl-swatch:hover { transform: scale(1.15); }
.hl-swatch.active { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9); transform: scale(1.15); }
.hl-swatch[data-color="gold"] { background: rgba(216, 178, 80, 0.85); }
.hl-swatch[data-color="blue"] { background: rgba(95, 155, 230, 0.85); }
.hl-swatch[data-color="violet"] { background: rgba(170, 130, 230, 0.85); }
.hl-swatch[data-color="green"] { background: rgba(100, 200, 145, 0.85); }
.hl-swatch[data-color="red"] { background: rgba(225, 95, 95, 0.85); }
.hl-btn { font-family: system-ui, sans-serif; font-size: 11px; letter-spacing: 0; padding: 3px 8px; border: 1px solid rgba(120, 150, 210, 0.2); border-radius: 5px; background: rgba(20, 28, 44, 0.7); color: rgba(215, 225, 240, 0.85); cursor: pointer; }
.hl-btn:hover { background: rgba(30, 40, 60, 0.9); }
.hl-dismiss { padding: 3px 6px; font-size: 13px; line-height: 1; color: rgba(180, 190, 210, 0.6); }
.hl-tags { font-family: system-ui, sans-serif; font-size: 11.5px; color: #e8eefc; background: rgba(20, 28, 44, 0.7); border: 1px solid rgba(120, 150, 210, 0.24); border-radius: 5px; padding: 4px 8px; width: 130px; outline: none; }
.hl-tags:focus { border-color: rgba(216, 178, 80, 0.6); }
.hl-ask { color: #f5e9c8; border-color: rgba(216, 178, 80, 0.4); }
.hl-delete { color: rgba(255, 150, 150, 0.85); border-color: rgba(225, 95, 95, 0.4); }
.hl-delete.hidden { display: none; }
.recall-card-tags { margin-left: 6px; }

/* ── Slim, quiet scrollbars everywhere ───────────────────────── */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(96, 128, 190, 0.25) transparent;
}

::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(96, 128, 190, 0.22);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(122, 156, 216, 0.38);
  border: 2px solid transparent;
  background-clip: padding-box;
}

button {
  font-family: inherit;
}

#gl-canvas,
#ambient-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  display: none;
}

#viz-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  mix-blend-mode: screen;
  opacity: 0.35;
  pointer-events: none;
  display: none;
}

#brain-viz {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
  display: none;
}

.brain-bg #brain-viz {
  display: block;
}

#bg-video {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  object-fit: cover;
  pointer-events: none;
  filter: saturate(0.82) brightness(0.56) contrast(1.1);
  will-change: transform;
}

.text-veil {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  /* Light only — the soft blue center glow. No dark gradient: the edge
     fade is done by the real pixel-level mask on .read-left, so the text
     itself becomes transparent instead of sitting under a shadow. */
  background:
    radial-gradient(circle at 50% 42%, rgba(40, 80, 180, 0.16), transparent 45%);
}

.shader-bg #ambient-canvas,
.shader-bg #viz-canvas {
  display: block;
}

.shader-bg #bg-video {
  display: none;
}

#bg-stream {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  object-fit: cover;
  pointer-events: none;
  will-change: transform;
}


#overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: auto;
  height: 100%;
  z-index: 1;
  overflow-y: auto;
  padding: 24px 20px 80px;
  -webkit-overflow-scrolling: touch;
  background: linear-gradient(
    to bottom,
    rgba(8, 8, 16, 0.55) 0%,
    rgba(8, 8, 16, 0.70) 30%,
    rgba(8, 8, 16, 0.70) 70%,
    rgba(8, 8, 16, 0.55) 100%
  );
}

.screen { display: none; }
.screen.active { display: block; }

/* Read screen split layout */
.read-split {
  position: fixed;
  top: calc(var(--banner-h) + var(--center-tabs-h) + var(--center-brand-h));
  bottom: 0;
  left: var(--panel-width);
  right: 0;
  display: flex;
  z-index: 3;
  transition: left 0.3s ease, right 0.3s ease;
}

body.panel-closed .read-split {
  left: 0;
}

body.enrich-open {
  --enrich-w: min(500px, 45vw);
}

body.enrich-open .read-split {
  right: var(--enrich-w);
}

.read-left {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 96px 20px 128px;
  /* Steep, smoothed edge dissolves: the middle band stays untouched, and the
     bottom falloff eases to ~zero by 40px above the screen base, so nothing
     ever shows behind the memorial. Padding-bottom rests the last verse
     above the fade start so it stays fully opaque at max scroll. */
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0px,
    transparent 12px,
    rgba(0, 0, 0, 0.18) 24px,
    rgba(0, 0, 0, 0.6) 36px,
    black 50px,
    black calc(100% - 120px),
    rgba(0, 0, 0, 0.84) calc(100% - 88px),
    rgba(0, 0, 0, 0.5) calc(100% - 60px),
    rgba(0, 0, 0, 0.03) calc(100% - 40px),
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    transparent 0px,
    transparent 12px,
    rgba(0, 0, 0, 0.18) 24px,
    rgba(0, 0, 0, 0.6) 36px,
    black 50px,
    black calc(100% - 120px),
    rgba(0, 0, 0, 0.84) calc(100% - 88px),
    rgba(0, 0, 0, 0.5) calc(100% - 60px),
    rgba(0, 0, 0, 0.03) calc(100% - 40px),
    transparent 100%
  );
}

.read-right {
  position: fixed;
  top: var(--banner-h);
  bottom: 0;
  right: 0;
  width: 500px;
  max-width: 45vw;
  display: flex;
  flex-direction: column;
  background: rgba(5, 8, 18, 0.72);
  backdrop-filter: blur(12px);
  border-left: 1px solid rgba(80,140,255,0.08);
  z-index: 7;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.read-right .panel-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.read-right.hidden {
  transform: translateX(110%);
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 900px) {
  .read-split { left: 0; flex-direction: column; }
  .read-left { flex: 1; min-height: 40%; }
  .read-right { top: auto; bottom: 0; left: 0; right: 0; width: 100%; max-width: 100%; height: 55%; border-left: none; border-top: 1px solid rgba(80,140,255,0.08); }
  .read-right.hidden { transform: translateY(110%); }
  .panel-toggle { display: none; }
}

#bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: auto;
  z-index: 10;
  display: flex;
  background: var(--bar-bg);
  border-top: 1px solid rgba(80, 140, 255, 0.12);
  backdrop-filter: blur(12px);
}

.bottom-nav {
  position: fixed;
  bottom: 74px;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  background: var(--bar-bg);
  border-top: 1px solid rgba(80, 140, 255, 0.08);
  backdrop-filter: blur(12px);
}

.bottom-nav button {
  flex: 1;
  padding: 12px 0;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 13px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.3s;
  border-top: 2px solid transparent;
}

.bottom-nav button.active {
  color: var(--accent);
  border-top-color: var(--accent);
}

.nav-btn {
  flex: 1;
  padding: 14px 0;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 14px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.3s, border-color 0.3s;
  border-top: 2px solid transparent;
}

.nav-btn.active {
  color: var(--accent);
  border-top-color: var(--accent);
}

#study-content {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
}

.study-title {
  font-size: 22px;
  line-height: 1.35;
  margin-bottom: 28px;
  color: #e0e4f0;
  overflow-wrap: anywhere;
}

.study-section {
  margin-bottom: 32px;
}

.study-section h3 {
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--accent);
  margin-bottom: 12px;
  overflow-wrap: anywhere;
}

.study-verse-ref {
  display: inline-block;
  max-width: 100%;
  background: rgba(80, 140, 255, 0.12);
  color: var(--accent);
  border: 1px solid rgba(80, 140, 255, 0.18);
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 13px;
  margin: 2px 4px 2px 0;
  cursor: pointer;
  transition: background 0.2s;
}

.study-verse-ref:hover,
.study-verse-ref:active {
  background: rgba(80, 140, 255, 0.25);
}

.study-text {
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  margin-top: 10px;
  overflow-wrap: anywhere;
}

.study-synthesis {
  margin-top: 36px;
  padding: 20px;
  border-left: 3px solid var(--accent);
  background: rgba(80, 140, 255, 0.05);
}

.study-synthesis h3 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--accent);
  margin-bottom: 14px;
}

.study-synthesis li {
  font-size: 15px;
  line-height: 1.65;
  margin-bottom: 8px;
  list-style: none;
  padding-left: 0;
  overflow-wrap: anywhere;
}

#study-complete-bar {
  text-align: center;
  margin-top: 40px;
  padding-bottom: 20px;
}

#study-complete-bar button,
#reader-complete-bar button {
  background: rgba(80, 140, 255, 0.15);
  color: var(--accent);
  border: 1px solid rgba(80, 140, 255, 0.3);
  padding: 12px 28px;
  font-size: 14px;
  letter-spacing: 1px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

#study-complete-bar button:hover,
#reader-complete-bar button:hover {
  background: rgba(80, 140, 255, 0.25);
  border-color: rgba(80, 140, 255, 0.5);
}

#study-complete-bar button.done,
#reader-complete-bar button.done {
  background: rgba(50, 200, 120, 0.15);
  color: #50c878;
  border-color: rgba(50, 200, 120, 0.3);
  pointer-events: none;
}

#reader-nav {
  display: flex;
  gap: 12px;
  margin: 0 auto 16px;
  max-width: 640px;
}

#reader-nav button {
  flex: 1;
  padding: 10px 0;
  background: rgba(80, 140, 255, 0.08);
  border: 1px solid rgba(80, 140, 255, 0.2);
  color: var(--accent);
  font-size: 13px;
  letter-spacing: 0.8px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.2s;
}

#reader-nav button:hover {
  background: rgba(80, 140, 255, 0.18);
}

#reader-header {
  max-width: 640px;
  margin: 0 auto 20px;
  font-size: 18px;
  color: #c0c8e0;
  letter-spacing: 0.5px;
}

#verse-list {
  max-width: 640px;
  margin: 0 auto;
}

.verse-row {
  display: flex;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 4px;
  transition: background 0.15s;
  cursor: pointer;
}

.verse-row:hover {
  background: rgba(80, 140, 255, 0.06);
}

.verse-row.selected {
  background: rgba(80, 140, 255, 0.14);
}

.verse-row.jumped {
  background: rgba(80, 140, 255, 0.2);
}

.verse-num {
  min-width: 28px;
  color: var(--text-dim);
  font-size: 12px;
  padding-top: 3px;
  text-align: right;
  flex-shrink: 0;
}

.verse-body {
  font-size: 16px;
  line-height: 1.7;
}

#reader-complete-bar {
  text-align: center;
  margin: 30px auto 0;
  padding-bottom: 20px;
  max-width: 640px;
}

.toast {
  position: fixed;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(80, 140, 255, 0.2);
  color: var(--accent);
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 13px;
  letter-spacing: 0.5px;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 20;
  pointer-events: none;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(80, 140, 255, 0.15);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── TOP CHROME ────────────────────────────────────────────── */

.app-shell {
  position: relative;
  z-index: 1;
}

.top-chrome {
  position: relative;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 38px 20px 8px;
}

body[data-screen="read"] {
  --chrome-offset: 34px;
}

body[data-screen="read"] .top-chrome {
  display: none;
}

.top-chrome > div:first-child {
  min-width: 0;
}

.brand {
  font-size: 22px;
  line-height: 1.15;
  letter-spacing: 2px;
  color: rgba(180, 210, 255, 0.85);
  text-shadow: 0 0 20px rgba(40, 80, 200, 0.4);
}

.garden-line {
  font-size: 12px;
  line-height: 1.35;
  color: rgba(136, 150, 190, 0.4);
  letter-spacing: 0.5px;
  overflow-wrap: anywhere;
}

/* ── BETA BANNER ───────────────────────────────────────────── */

.beta-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--banner-h);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  background: rgba(5, 8, 18, 0.9);
  border-bottom: 1px solid rgba(80, 140, 255, 0.12);
  backdrop-filter: blur(10px);
  color: rgba(160, 170, 200, 0.6);
  font-size: 11px;
  font-family: system-ui, sans-serif;
  letter-spacing: 0.03em;
}

.banner-left {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: stretch;
}
.feedback-btn {
  background: rgba(210, 175, 90, 0.14);
  border: none;
  border-right: 1px solid rgba(210, 175, 90, 0.4);
  border-radius: 0;
  color: #e9dcb4;
  font-size: 12.5px;
  letter-spacing: 0.06em;
  padding: 0 18px;
  height: 100%;
  cursor: pointer;
}
.feedback-btn:hover { background: rgba(210, 175, 90, 0.26); }

.banner-actions {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: stretch;
  gap: 10px;
}

/* ── QUERY BAR ──────────────────────────────────────────────── */

.query-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, rgba(5,8,18,0.95) 0%, rgba(5,8,18,0.7) 70%, transparent 100%);
  display: flex;
  align-items: center;
  gap: 10px;
}

.query-bar input {
  flex: 1;
  background: rgba(20,24,40,0.6);
  border: 1px solid rgba(80,140,255,0.15);
  border-radius: 24px;
  padding: 12px 20px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15px;
  color: var(--text);
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.query-bar input::placeholder {
  color: rgba(136,144,168,0.5);
  font-style: italic;
}

.query-bar input:focus {
  border-color: rgba(80,140,255,0.4);
  box-shadow: 0 0 20px rgba(50,100,255,0.1);
}

.query-status {
  font-size: 11px;
  color: rgba(80,140,255,0.6);
  letter-spacing: 0.5px;
  white-space: nowrap;
  min-width: 0;
  transition: opacity 0.3s;
}

.query-status:empty { display: none; }

.query-status.generating::after {
  content: "";
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(80,140,255,0.8);
  margin-left: 6px;
  animation: pulse-dot 1.2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* ── ORB FIELD ──────────────────────────────────────────────── */

#orb-field {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

.study-orb {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  pointer-events: all;
  cursor: pointer;
  transition: transform 0.4s ease, box-shadow 0.4s ease;
  animation: orb-float var(--float-dur, 12s) ease-in-out infinite;
  animation-delay: var(--float-delay, 0s);
}

.study-orb::after {
  content: attr(data-title);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 12px;
  color: rgba(180,210,255,0.9);
  text-shadow: 0 0 10px rgba(40,80,200,0.6);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.study-orb:hover {
  transform: scale(1.6);
}

.study-orb:hover::after {
  opacity: 1;
}

@keyframes orb-float {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(var(--dx1, 8px), var(--dy1, -12px)); }
  50% { transform: translate(var(--dx2, -5px), var(--dy2, 6px)); }
  75% { transform: translate(var(--dx3, 10px), var(--dy3, -4px)); }
}

/* ── STUDY OVERLAY ──────────────────────────────────────────── */

/* ── STUDY FOCUS CONTENT ──────────────────────────────────── */

.study-focus-content .study-title {
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-size: 32px;
  font-weight: normal;
  line-height: 1.3;
  color: rgba(200,215,245,0.95);
  text-shadow:
    0 0 30px rgba(40,80,200,0.4),
    0 2px 8px rgba(0,0,0,0.8),
    0 0 60px rgba(30,60,160,0.2);
  margin-bottom: 12px;
}

.study-focus-content .study-query {
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-size: 15px;
  font-style: italic;
  color: rgba(136,150,190,0.6);
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
  margin-bottom: 48px;
}

.study-focus-content .study-heading {
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-size: 18px;
  font-weight: normal;
  letter-spacing: 0.5px;
  color: rgba(120,170,255,0.85);
  text-shadow:
    0 0 20px rgba(50,100,255,0.3),
    0 1px 4px rgba(0,0,0,0.7);
  margin: 40px 0 8px;
}

.study-focus-content .study-refs {
  font-family: Georgia, serif;
  font-size: 13px;
  color: rgba(100,150,255,0.55);
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  margin-bottom: 12px;
  letter-spacing: 0.3px;
}

.study-focus-content .study-body {
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-size: 17px;
  line-height: 1.8;
  color: rgba(210,220,240,0.88);
  text-shadow:
    0 0 15px rgba(20,40,100,0.3),
    0 2px 6px rgba(0,0,0,0.7);
  margin-bottom: 8px;
}

.study-focus-content .study-synth {
  margin-top: 56px;
  padding-top: 24px;
}

.study-focus-content .study-synth-heading {
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-size: 16px;
  letter-spacing: 1px;
  color: rgba(120,170,255,0.7);
  text-shadow: 0 0 16px rgba(50,100,255,0.25), 0 1px 4px rgba(0,0,0,0.6);
  margin-bottom: 20px;
  text-transform: uppercase;
}

.study-focus-content .study-synth-point {
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-size: 16px;
  line-height: 1.7;
  color: rgba(190,205,235,0.82);
  text-shadow: 0 0 12px rgba(20,40,100,0.25), 0 2px 5px rgba(0,0,0,0.65);
  margin-bottom: 12px;
  padding-left: 16px;
}

.study-focus-content ol.study-synth {
  list-style: none;
  padding: 0;
  margin-top: 56px;
  counter-reset: synth;
}

.study-focus-content ol.study-synth li {
  counter-increment: synth;
}

.study-focus-content ol.study-synth li::before {
  content: counter(synth) ".";
  color: rgba(100,150,255,0.5);
  margin-right: 8px;
  font-size: 14px;
}

.study-focus-content strong {
  color: rgba(140,180,255,0.9);
  font-weight: normal;
  text-shadow: 0 0 12px rgba(50,100,255,0.3), 0 1px 4px rgba(0,0,0,0.6);
}

.study-focus-content em {
  color: rgba(180,200,240,0.75);
  font-style: italic;
}

.study-focus-content code {
  font-family: "Courier New", monospace;
  font-size: 14px;
  color: rgba(160,190,240,0.7);
}

/* ── STUDY SPLIT + NOTES ──────────────────────────────────── */

.study-split {
  display: flex;
  gap: 24px;
  max-width: 1100px;
  margin: 0 auto;
  align-items: flex-start;
}

.study-split .study-focus-content {
  flex: 1;
  min-width: 0;
  max-width: 680px;
  margin: 0;
}

.study-notes-panel {
  width: 340px;
  flex-shrink: 0;
  position: sticky;
  top: 80px;
  border-left: 1px solid rgba(110, 150, 210, 0.14);
  padding-left: 20px;
  max-height: calc(100vh - 160px);
  overflow-y: auto;
}

.study-notes-panel.hidden {
  display: none;
}

.study-notes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(110, 150, 210, 0.1);
}

.study-notes-header h2 {
  font-family: system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: rgba(200, 215, 245, 0.8);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin: 0;
}

.study-notes-actions {
  display: flex;
  gap: 6px;
}

.notes-action-btn {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(210, 175, 90, 0.2);
  border-radius: 5px;
  background: rgba(180, 145, 70, 0.1);
  color: rgba(245, 235, 210, 0.7);
  font-family: system-ui, sans-serif;
  font-size: 11px;
  cursor: pointer;
  letter-spacing: 0;
}

.notes-action-btn:hover {
  background: rgba(195, 155, 75, 0.18);
  border-color: rgba(225, 185, 100, 0.3);
}

.notes-section {
  margin-bottom: 16px;
}

.notes-section-label {
  font-family: system-ui, sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: rgba(140, 170, 220, 0.6);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.notes-section-editor {
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid rgba(120, 160, 215, 0.1);
  border-radius: 6px;
  background: rgba(8, 12, 22, 0.5);
  color: rgba(210, 220, 240, 0.8);
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-size: 13px;
  line-height: 1.6;
  outline: none;
  cursor: text;
  white-space: pre-wrap;
}

.notes-section-editor:focus {
  border-color: rgba(120, 160, 215, 0.3);
  background: rgba(10, 15, 28, 0.65);
}

.notes-section-editor:empty::before {
  content: attr(placeholder);
  color: rgba(160, 170, 190, 0.3);
  pointer-events: none;
}

.study-notes-footer {
  margin-top: 8px;
  text-align: right;
}

.notes-saved-indicator {
  font-family: system-ui, sans-serif;
  font-size: 11px;
  color: rgba(140, 210, 170, 0.6);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.study-notes-show {
  position: fixed;
  bottom: 100px;
  right: 20px;
  z-index: 32;
  padding: 8px 16px;
  border: 1px solid rgba(210, 175, 90, 0.25);
  border-radius: 7px;
  background: rgba(10, 15, 28, 0.85);
  backdrop-filter: blur(8px);
  color: rgba(245, 235, 210, 0.8);
  font-family: system-ui, sans-serif;
  font-size: 12px;
  cursor: pointer;
  letter-spacing: 0;
}

.study-notes-show.hidden {
  display: none;
}

.study-notes-show:hover {
  background: rgba(195, 155, 75, 0.2);
  border-color: rgba(225, 185, 100, 0.35);
}

/* ── READER ────────────────────────────────────────────────── */

.reader-chrome {
  position: absolute;
  top: 10px;
  left: 20px;
  right: 20px;
  z-index: 6;
  padding: 0 4px 12px;
}


.reader-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px;
  font-size: 13px;
  line-height: 1.35;
  color: rgba(136,150,190,0.5);
  margin-bottom: 10px;
  min-height: 1.35em;
}

.reader-breadcrumb span {
  max-width: 100%;
  overflow-wrap: anywhere;
  cursor: pointer;
  transition: color 0.15s;
}

.reader-breadcrumb span:hover {
  color: var(--accent);
}

.reader-search {
  width: 100%;
  padding: 10px 14px;
  background: rgba(16,20,34,0.6);
  border: 1px solid rgba(80,140,255,0.12);
  border-radius: 8px;
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.reader-search:focus {
  border-color: rgba(80,140,255,0.35);
}

.reader-search::placeholder {
  color: rgba(136,144,168,0.4);
  font-style: italic;
}

.reader-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  min-height: 0;
}

.reader-suggestions:empty { margin-top: 0; }

.reader-suggestions .suggestion-pill {
  background: rgba(22,27,38,0.8);
  border: 1px solid rgba(80,140,255,0.15);
  border-radius: 12px;
  padding: 4px 10px;
  font-size: 12px;
  color: rgba(136,150,190,0.6);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.reader-suggestions .suggestion-pill:hover {
  background: var(--accent);
  color: #050812;
}

.reader-suggestions .suggestion-resolved {
  color: var(--accent);
  font-size: 13px;
  padding: 4px 0;
}

/* Tile grid */
.reader-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 6px;
  padding: 0 4px;
}

.reader-grid.numbers {
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
}

.reader-grid.verse-tiles {
  grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
  margin-bottom: 16px;
}

.reader-tile {
  background: rgba(18,22,32,0.7);
  border: 1px solid rgba(80,140,255,0.08);
  border-radius: 6px;
  padding: 8px 4px;
  text-align: center;
  cursor: pointer;
  font-size: 13px;
  color: rgba(200,210,235,0.7);
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reader-tile:hover {
  background: rgba(30,38,56,0.8);
  border-color: rgba(80,140,255,0.3);
  color: var(--text);
}

.reader-tile:active {
  background: rgba(36,48,68,0.9);
}

.reader-tile.active {
  background: var(--accent);
  color: #050812;
  border-color: var(--accent);
}

/* Chapter verse view */
.reader-chapter {
  display: none;
  padding: 0 4px;
}

.reader-chapter.active { display: block; }

.reader-chapter .verse-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.12s;
  line-height: 1.7;
}

.reader-chapter .verse-row:hover {
  background: rgba(80,140,255,0.06);
}

.reader-chapter .verse-row.selected {
  background: rgba(80,140,255,0.14);
  border-radius: 0;
}

.reader-chapter .verse-row.sel-first { border-radius: 0; }
.reader-chapter .verse-row.sel-last { border-radius: 0; }
.reader-chapter .verse-row.sel-first.sel-last { border-radius: 0; }

.reader-chapter .verse-row.jumped {
  background: rgba(80,140,255,0.12);
}

.reader-chapter .verse-num {
  color: var(--accent);
  font-size: 12px;
  min-width: 28px;
  text-align: right;
  padding-top: 3px;
  flex-shrink: 0;
  opacity: 0.6;
}

.reader-chapter .verse-body {
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-size: 16px;
  line-height: 1.75;
  color: rgba(210,220,240,0.85);
}

.reader-chapter-title {
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-size: 20px;
  color: rgba(180,210,255,0.8);
  text-shadow: 0 0 16px rgba(40,80,200,0.3);
  margin-bottom: 16px;
  letter-spacing: 0.5px;
}

/* ── ENRICHMENT (right pane) ────────────────────────────────── */

.enrich-inner {
  padding: 20px 18px 80px;
}

.enrich-top {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 56px;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.enrich-ref {
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-size: 20px;
  color: rgba(120,170,255,0.85);
  text-shadow: 0 0 16px rgba(40,80,200,0.3);
  min-width: 0;
  text-align: center;
  overflow-wrap: anywhere;
}

.enrich-nav-btn {
  min-width: 0;
  height: 34px;
  padding: 0 8px;
  background: rgba(80,140,255,0.08);
  border: 1px solid rgba(80,140,255,0.16);
  border-radius: 6px;
  color: rgba(140,180,255,0.8);
  font-family: system-ui, sans-serif;
  font-size: 11px;
  letter-spacing: 0;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.enrich-nav-btn:hover {
  background: rgba(80,140,255,0.15);
  border-color: rgba(80,140,255,0.28);
  color: rgba(180,205,255,0.95);
}

.enrich-nav-btn:disabled {
  opacity: 0.32;
  cursor: not-allowed;
  background: rgba(80,140,255,0.04);
}

.enrich-text {
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-size: 16px;
  line-height: 1.7;
  color: rgba(210,220,240,0.88);
  text-shadow: 0 0 8px rgba(20,40,100,0.2);
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(80,140,255,0.08);
}

.enrich-context {
  margin-bottom: 28px;
}

.enrich-context-verse {
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-size: 15px;
  line-height: 1.7;
  color: rgba(160,175,210,0.45);
  padding: 4px 0;
  display: flex;
  gap: 10px;
}

.enrich-context-verse.current {
  color: rgba(210,220,240,0.9);
  font-size: 16px;
}

.enrich-context-verse .ctx-num {
  color: rgba(80,140,255,0.4);
  font-size: 12px;
  min-width: 24px;
  text-align: right;
  padding-top: 3px;
  flex-shrink: 0;
}

.enrich-context-verse.current .ctx-num {
  color: rgba(80,140,255,0.7);
}

/* Interlinear — floating text with hover tooltips */
.enrich-interlinear {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(80,140,255,0.08);
}

.interlinear-header {
  font-family: system-ui, sans-serif;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(80,140,255,0.45);
  margin-bottom: 14px;
}

.interlinear-loading {
  font-size: 13px;
  color: rgba(136,150,190,0.3);
  font-style: italic;
}

.interlinear-words {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  line-height: 2.4;
}

.iw-float {
  position: relative;
  display: inline-block;
  cursor: default;
}

.iw-float .iw-original {
  font-size: 22px;
  color: rgba(200,215,245,0.88);
  text-shadow: 0 0 12px rgba(40,80,200,0.2);
  transition: color 0.15s, text-shadow 0.15s;
}

.iw-float:hover .iw-original {
  color: rgba(140,180,255,0.95);
  text-shadow: 0 0 20px rgba(50,100,255,0.4);
}

.iw-float .iw-translit {
  display: block;
  font-family: system-ui, sans-serif;
  font-size: 10px;
  font-style: italic;
  color: rgba(120,170,255,0.5);
  text-align: center;
  margin-top: -2px;
}

/* Tooltip — fixed-position singleton, positioned via JS */
#iw-tooltip-portal {
  position: fixed;
  background: rgba(8,12,24,0.95);
  border: 1px solid rgba(80,140,255,0.2);
  border-radius: 8px;
  padding: 10px 14px;
  min-width: 180px;
  max-width: 280px;
  max-height: 200px;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 200;
  backdrop-filter: blur(8px);
}

#iw-tooltip-portal.visible {
  opacity: 1;
}

#iw-tooltip-portal .tt-strongs {
  font-family: system-ui, sans-serif;
  font-size: 10px;
  color: rgba(80,140,255,0.6);
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

#iw-tooltip-portal .tt-meaning {
  font-family: "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(200,215,240,0.85);
  margin-bottom: 4px;
}

#iw-tooltip-portal .tt-kjv {
  font-family: system-ui, sans-serif;
  font-size: 11px;
  color: rgba(160,175,210,0.5);
  line-height: 1.4;
}

#iw-tooltip-portal .tt-domain {
  font-family: system-ui, sans-serif;
  font-size: 10px;
  color: rgba(100,160,255,0.6);
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(80,140,255,0.1);
}

#iw-tooltip-portal .tt-gloss {
  font-family: "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 12px;
  color: rgba(140,180,255,0.7);
  font-style: italic;
}

/* Word detail panel (click-to-expand on interlinear words) */
.word-detail {
  display: none;
  margin-bottom: 20px;
  padding: 16px;
  background: rgba(10,14,28,0.5);
  border: 1px solid rgba(80,140,255,0.12);
  border-radius: 8px;
}

.iw-float.active-word .iw-original {
  color: rgba(140,180,255,0.95);
  text-shadow: 0 0 20px rgba(50,100,255,0.5);
}

.wd-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.wd-original {
  font-size: 26px;
  color: rgba(200,215,245,0.92);
  text-shadow: 0 0 14px rgba(40,80,200,0.3);
}

.wd-translit {
  font-family: system-ui, sans-serif;
  font-size: 13px;
  font-style: italic;
  color: rgba(120,170,255,0.6);
}

.wd-strongs {
  font-family: system-ui, sans-serif;
  font-size: 11px;
  color: rgba(80,140,255,0.5);
  letter-spacing: 0.5px;
}

.wd-meaning {
  font-family: "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 14px;
  line-height: 1.6;
  color: rgba(200,215,240,0.85);
  margin-bottom: 6px;
}

.wd-glosses {
  font-family: "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 13px;
  font-style: italic;
  color: rgba(140,180,255,0.7);
  margin-bottom: 6px;
}

.wd-kjv {
  font-family: system-ui, sans-serif;
  font-size: 12px;
  color: rgba(160,175,210,0.5);
  line-height: 1.4;
  margin-bottom: 6px;
}

.wd-domains {
  font-family: system-ui, sans-serif;
  font-size: 11px;
  color: rgba(100,160,255,0.6);
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(80,140,255,0.08);
}

.wd-related {
  margin-top: 12px;
}

.wd-related:empty { display: none; }

.wd-related-loading {
  font-size: 12px;
  color: rgba(136,150,190,0.3);
  font-style: italic;
}

.wd-related-empty {
  font-size: 12px;
  color: rgba(136,150,190,0.35);
  font-style: italic;
  padding-top: 10px;
  border-top: 1px solid rgba(80,140,255,0.08);
}

.wd-related-header {
  font-family: system-ui, sans-serif;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(80,140,255,0.45);
  margin-bottom: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(80,140,255,0.08);
}

.wd-related-words {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wd-related-word {
  padding: 10px 12px;
  background: rgba(14,18,32,0.5);
  border: 1px solid rgba(80,140,255,0.08);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.wd-related-word:hover {
  background: rgba(20,26,44,0.7);
  border-color: rgba(80,140,255,0.2);
}

.wd-rw-lemma {
  font-size: 20px;
  color: rgba(200,215,245,0.85);
}

.wd-rw-translit {
  font-family: system-ui, sans-serif;
  font-size: 11px;
  font-style: italic;
  color: rgba(120,170,255,0.5);
}

.wd-rw-strongs {
  font-family: system-ui, sans-serif;
  font-size: 10px;
  color: rgba(80,140,255,0.4);
}

.wd-rw-def {
  font-family: "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(190,205,235,0.75);
  margin-top: 4px;
}

.wd-rw-glosses {
  font-size: 12px;
  font-style: italic;
  color: rgba(140,180,255,0.6);
  margin-top: 2px;
}

/* Extra enrichment (SAHD, cultural context) */
.enrich-extra {
  margin-bottom: 20px;
}

.enrich-extra:empty { display: none; }

.enrich-extra-section {
  margin-bottom: 16px;
  padding: 12px 14px;
  background: rgba(10,14,26,0.4);
  border-radius: 8px;
  border: 1px solid rgba(80,140,255,0.06);
}

.enrich-extra-label {
  font-family: system-ui, sans-serif;
  font-size: 10px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: rgba(80,140,255,0.45);
  margin-bottom: 8px;
}

.enrich-extra-text {
  font-family: "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 14px;
  line-height: 1.7;
  color: rgba(190,205,235,0.75);
}

.enrich-extra-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.enrich-field-tag {
  font-family: system-ui, sans-serif;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(80,140,255,0.08);
  color: rgba(120,170,255,0.6);
  border: 1px solid rgba(80,140,255,0.12);
}

.enrich-ask {
  display: block;
  width: 100%;
  padding: 14px 20px;
  background: rgba(80,140,255,0.1);
  border: 1px solid rgba(80,140,255,0.25);
  border-radius: 8px;
  color: var(--accent);
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  margin-bottom: 16px;
}

.enrich-ask:hover {
  background: rgba(80,140,255,0.18);
  border-color: rgba(80,140,255,0.4);
}

.enrich-ask:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.enrich-ask.generating {
  opacity: 0.7;
  animation: ask-pulse 2s ease-in-out infinite;
}

@keyframes ask-pulse {
  0%, 100% { border-color: rgba(80,140,255,0.25); }
  50% { border-color: rgba(80,140,255,0.5); }
}

.enrich-status {
  font-size: 12px;
  color: rgba(80,140,255,0.6);
  margin-bottom: 12px;
  min-height: 0;
}

.enrich-status:empty { display: none; }

.enrich-status.generating::after {
  content: "";
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(80,140,255,0.8);
  margin-left: 6px;
  animation: pulse-dot 1.2s ease-in-out infinite;
}

.enrich-response {
  padding-top: 16px;
  border-top: 1px solid rgba(80,140,255,0.08);
}

.enrich-response:empty {
  display: none;
  padding: 0;
  border: none;
}

/* Reuse study-overlay-content styles for enrich response */
.enrich-response .study-title { font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif; font-size: 24px; font-weight: normal; line-height: 1.3; color: rgba(200,215,245,0.95); text-shadow: 0 0 30px rgba(40,80,200,0.4), 0 2px 8px rgba(0,0,0,0.8); margin-bottom: 12px; }
.enrich-response .study-query { font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif; font-size: 14px; font-style: italic; color: rgba(136,150,190,0.5); margin-bottom: 32px; }
.enrich-response .study-heading { font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif; font-size: 17px; font-weight: normal; color: rgba(120,170,255,0.85); text-shadow: 0 0 20px rgba(50,100,255,0.3), 0 1px 4px rgba(0,0,0,0.7); margin: 32px 0 8px; }
.enrich-response .study-body { font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif; font-size: 16px; line-height: 1.8; color: rgba(210,220,240,0.85); text-shadow: 0 0 12px rgba(20,40,100,0.25), 0 2px 5px rgba(0,0,0,0.65); margin-bottom: 8px; }
.enrich-response ol.study-synth { list-style: none; padding: 0; margin-top: 40px; counter-reset: synth; }
.enrich-response ol.study-synth li { counter-increment: synth; font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif; font-size: 15px; line-height: 1.7; color: rgba(190,205,235,0.82); margin-bottom: 10px; }
.enrich-response ol.study-synth li::before { content: counter(synth) "."; color: rgba(100,150,255,0.5); margin-right: 8px; font-size: 13px; }
.enrich-response strong { color: rgba(140,180,255,0.9); font-weight: normal; }
.enrich-response em { color: rgba(180,200,240,0.75); font-style: italic; }

/* ── MOBILE ────────────────────────────────────────────────── */

@media (max-width: 600px) {
  :root { --chrome-offset: 98px; }
  .top-chrome { padding: 36px 16px 8px; }
  .read-left { padding: 12px 16px 40px; }
  .reader-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
  .reader-grid.numbers { grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); }
  .reader-grid.verse-tiles { grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); }
  .reader-chapter .verse-body { font-size: 15px; }
  .enrich-inner { padding: 50px 16px 100px; }
  .enrich-ref { font-size: 22px; }
  .enrich-text { font-size: 17px; }
  .left-panel { width: 100%; }
  .read-split { left: 0; }
}

@media (max-width: 340px) {
  :root { --chrome-offset: 124px; }
  .top-chrome {
    gap: 12px;
    padding-left: 12px;
    padding-right: 12px;
  }
  .chrome-actions { gap: 6px; }
  .icon-button {
    width: 30px;
    height: 30px;
  }
}

/* ── LEFT PANEL ───────────────────────────────────────────── */

.left-panel {
  position: fixed;
  top: var(--banner-h);
  left: 0;
  bottom: 0;
  width: var(--panel-width);
  max-width: 45vw;
  z-index: 80;
  display: flex;
  flex-direction: column;
  background: rgba(5, 8, 18, 0.6);
  backdrop-filter: blur(12px);
  border-right: 1px solid rgba(80, 140, 255, 0.08);
  transition: transform 0.3s ease, width 0.3s ease;
}

.left-panel.collapsed {
  transform: translateX(-100%);
}

.panel-toggle {
  position: fixed;
  top: 50%;
  left: var(--panel-width);
  transform: translateY(-50%);
  z-index: 81;
  width: 24px;
  height: 48px;
  background: rgba(5, 8, 18, 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(80, 140, 255, 0.12);
  border-left: none;
  border-radius: 0 6px 6px 0;
  color: rgba(160, 175, 210, 0.5);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: left 0.3s ease, color 0.2s;
}

.panel-toggle:hover {
  color: rgba(225, 232, 245, 0.9);
}

.left-panel.collapsed ~ .panel-toggle {
  left: 0;
  border-left: 1px solid rgba(80, 140, 255, 0.12);
  border-right: none;
  border-radius: 0 6px 6px 0;
}

.panel-tabs {
  display: flex;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(80, 140, 255, 0.08);
  background: rgba(5, 8, 18, 0.4);
}

.panel-tab {
  flex: 1;
  padding: 12px 8px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: rgba(160, 175, 210, 0.5);
  font-family: system-ui, sans-serif;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.panel-tab:hover {
  color: rgba(200, 210, 230, 0.7);
}

.panel-tab.active {
  color: rgba(225, 232, 245, 0.9);
  border-bottom-color: var(--accent);
}

.panel-content {
  display: none;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex-direction: column;
}

.panel-content.active {
  display: flex;
}

.panel-coming-soon {
  margin: auto;
  text-align: center;
  font-family: system-ui, sans-serif;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: rgba(160, 175, 210, 0.55);
  padding: 48px 24px;
}

/* ── PANEL SECTION HEADERS ────────────────────────────────── */

.panel-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 8px;
  border-bottom: 1px solid rgba(80, 140, 255, 0.06);
}

.panel-section-title {
  font-family: system-ui, sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(160, 175, 210, 0.5);
}

.panel-move-btn {
  font-family: system-ui, sans-serif;
  font-size: 11px;
  padding: 4px 10px;
  background: rgba(80, 140, 255, 0.1);
  border: 1px solid rgba(80, 140, 255, 0.2);
  border-radius: 4px;
  color: var(--accent);
  cursor: pointer;
  transition: background 0.2s;
}

.panel-move-btn:hover {
  background: rgba(80, 140, 255, 0.2);
}

.panel-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

/* ── PANEL READER (compact in left panel) ─────────────────── */

.panel-reader-search {
  padding: 8px 16px;
  /* Pin the search bar to the top of the panel while the book grid / chapter
     scrolls beneath it (mirrors the center reader, whose chrome already
     stays fixed). Solid backdrop so scrolled text never shows through. */
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(5, 8, 18, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(80, 140, 255, 0.08);
}

.panel-search-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid rgba(120, 160, 215, 0.18);
  border-radius: 6px;
  background: rgba(12, 16, 28, 0.6);
  color: rgba(225, 232, 245, 0.9);
  font-family: "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

.panel-search-input:focus {
  border-color: rgba(80, 140, 255, 0.4);
}

.panel-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0;
}

.panel-reader-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 6px;
  padding: 8px 16px;
}

.panel-reader-grid .reader-tile {
  padding: 8px 6px;
  text-align: center;
  font-size: 12px;
}

.panel-reader-chapter {
  padding: 4px 16px 8px;
  font-size: 12px;
  line-height: 1.5;
}

.panel-chapter-title {
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-size: 14px;
  color: rgba(180,210,255,0.8);
  padding: 6px 0 2px;
}

.panel-chapter-nav {
  display: flex;
  gap: 6px;
  padding: 4px 0 6px;
}

.panel-chapter-nav-btn {
  padding: 3px 10px;
  border: 1px solid rgba(80,140,255,0.15);
  border-radius: 4px;
  background: rgba(80,140,255,0.06);
  color: rgba(200,215,240,0.7);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.panel-chapter-nav-btn:hover:not(:disabled) {
  background: rgba(80,140,255,0.12);
  border-color: rgba(80,140,255,0.3);
}

.panel-chapter-nav-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.panel-reader-chapter .verse-row {
  padding: 3px 6px;
  font-size: 12px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.12s;
}

.panel-reader-chapter .verse-row:hover {
  background: rgba(80,140,255,0.06);
}

.panel-reader-chapter .verse-row.selected {
  background: rgba(80,140,255,0.14);
}

.panel-reader-chapter .verse-num {
  font-size: 10px;
  min-width: 20px;
}

/* ── FOCUS SLOT ───────────────────────────────────────────── */

.focus-slot {
  position: fixed;
  top: calc(var(--banner-h) + var(--center-tabs-h) + var(--center-brand-h));
  bottom: 0;
  left: var(--panel-width);
  right: 0;
  z-index: 3;
  transition: left 0.3s ease;
}

/* Panel backdrop — a property of the CENTER PANEL, not of any one piece of
   content: an even darkness band behind the reading column so scripture,
   studies, and notebooks all sit on the same ground. Painted on a ::before
   that reaches up behind the brand strip ("Ritual / Levi Study Workbench")
   so the dark ground is continuous from the top of the brand down through
   the bottom of the panel. The band is vertically uniform, so it stays put
   while the reader column scrolls over it. */
.focus-slot::before {
  content: "";
  position: absolute;
  top: calc(-1 * var(--center-brand-h));
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -1;
  background: linear-gradient(
    to right,
    rgba(3, 6, 13, 0) 0%,
    rgba(3, 6, 13, 0.74) calc(50% - 340px),
    rgba(3, 6, 13, 0.74) calc(50% + 340px),
    rgba(3, 6, 13, 0) 100%
  );
}

body.panel-closed .focus-slot {
  left: 0;
}

.focus-back {
  position: absolute;
  top: 8px;
  left: 16px;
  z-index: 10;
  padding: 6px 14px;
  background: rgba(80, 140, 255, 0.1);
  border: 1px solid rgba(80, 140, 255, 0.2);
  border-radius: 6px;
  color: var(--accent);
  font-family: system-ui, sans-serif;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s;
}

.focus-back:hover {
  background: rgba(80, 140, 255, 0.2);
}

.focus-back.hidden {
  display: none;
}

.focus-content {
  display: none;
  width: 100%;
  height: 100%;
}

.focus-content.active {
  display: block;
}

/* ── COMING SOON (center tab placeholder) ─────────────────── */
.coming-soon-hero {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  user-select: none;
}
.coming-soon-emblem {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(210, 175, 90, 0.35);
  border-radius: 50%;
  color: rgba(210, 175, 90, 0.72);
  font-size: 26px;
  background: radial-gradient(circle at 50% 32%, rgba(210, 175, 90, 0.16), transparent 72%);
}
.coming-soon-title {
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-weight: bold;
  font-size: clamp(30px, 4vw, 42px);
  letter-spacing: 0.16em;
  text-indent: 0.16em;
  color: rgba(222, 233, 255, 0.92);
  margin: 0;
}
.coming-soon-sub {
  font-family: Georgia, "Palatino Linotype", "Times New Roman", serif;
  font-style: italic;
  font-size: 16px;
  letter-spacing: 0.05em;
  color: rgba(160, 175, 210, 0.55);
  margin: 0;
}

/* ── LEVI (center, full-width beautiful chat) ─────────────── */
.center-levi {
  height: 100%;
  display: flex;
  flex-direction: column;
  max-width: 820px;
  margin: 0 auto;
  padding: 26px 28px 44px;
}
.center-levi-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(80, 140, 255, 0.1);
}
.center-levi-title {
  font-family: "Palatino Linotype", Palatino, Georgia, serif;
  font-weight: bold;
  font-size: 20px;
  color: rgba(222, 233, 255, 0.92);
}
.center-levi-seed {
  font-style: italic;
  font-weight: normal;
  font-size: 14px;
  color: rgba(160, 175, 210, 0.5);
}
.center-levi-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.center-levi-messages {
  margin: 0 -4px;
  padding: 20px 16px;
}
.center-levi-input-row {
  border-radius: 10px;
  border: 1px solid rgba(80, 140, 255, 0.1);
}
@media (max-width: 640px) {
  .center-levi-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .center-levi-actions { width: 100%; justify-content: space-between; }
}

/* ── INTERLINEAR BIBLE (center Enrichment) ───────────────── */
.interlinear-bible {
  height: 100%;
  display: flex;
  flex-direction: column;
  max-width: 860px;
  margin: 0 auto;
  padding: 22px 28px 40px;
}
.ilb-header {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(80, 140, 255, 0.1);
}
.ilb-brand {
  font-family: "Palatino Linotype", Palatino, Georgia, serif;
  font-weight: bold;
  font-size: 17px;
  letter-spacing: 0.02em;
  color: rgba(222, 233, 255, 0.92);
  white-space: nowrap;
}
.ilb-brand .ilb-seed {
  display: block;
  font-style: italic;
  font-weight: normal;
  font-size: 12px;
  letter-spacing: 0.03em;
  color: rgba(160, 175, 210, 0.5);
}
.ilb-ref {
  margin-left: auto;
  font-family: Georgia, serif;
  font-size: 14px;
  color: rgba(180, 200, 235, 0.75);
}
.ilb-status { font-size: 11px; color: rgba(160, 175, 210, 0.5); min-width: 52px; }
.ilb-nav {
  width: 32px; height: 32px;
  border: 1px solid rgba(80, 140, 255, 0.18);
  border-radius: 8px;
  background: rgba(80, 140, 255, 0.08);
  color: rgba(200, 215, 240, 0.85);
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
}
.ilb-nav:hover:not(:disabled) { background: rgba(80, 140, 255, 0.16); }
.ilb-nav:disabled { opacity: 0.3; cursor: default; }
.ilb-list { flex: 1; overflow-y: auto; padding-top: 6px; }
.ilb-verse { padding: 16px 0; border-bottom: 1px solid rgba(80, 140, 255, 0.06); }
.ilb-meta { display: flex; gap: 12px; align-items: baseline; }
.ilb-vnum {
  color: var(--accent);
  font-family: ui-monospace, monospace;
  font-size: 11px;
  opacity: 0.7;
  min-width: 18px;
  text-align: right;
  flex-shrink: 0;
}
.ilb-kjv {
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-size: 15px;
  line-height: 1.6;
  color: rgba(210, 220, 240, 0.9);
  user-select: text;
}
.ilb-words {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 12px;
}
.ilb-word {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 7px 9px 8px;
  border: 1px solid rgba(120, 150, 210, 0.14);
  border-radius: 7px;
  background: rgba(12, 18, 32, 0.55);
  cursor: pointer;
  text-align: start;
  transition: border-color 0.15s, background 0.15s;
}
.ilb-word:hover { background: rgba(20, 30, 48, 0.8); border-color: rgba(120, 150, 210, 0.35); }
.ilb-word.active { background: rgba(30, 44, 70, 0.85); border-color: var(--accent); }
.ilb-surface {
  font-size: 18px;
  line-height: 1.25;
  color: rgba(228, 214, 160, 0.95);
}
.ilb-translit { font-size: 11px; color: rgba(150, 165, 195, 0.72); }
.ilb-gloss { font-size: 12px; color: rgba(190, 205, 230, 0.88); }
.ilb-strongs { font-size: 10px; font-family: ui-monospace, monospace; color: rgba(120, 150, 210, 0.6); }
.ilb-word-detail {
  margin-top: 10px;
  padding: 12px 14px;
  border-left: 2px solid var(--accent);
  background: rgba(12, 18, 30, 0.6);
  border-radius: 0 8px 8px 0;
  font-size: 13px;
  line-height: 1.55;
}
.ilb-wd-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.ilb-wd-surface { font-size: 18px; color: rgba(228, 214, 160, 0.95); }
.ilb-wd-translit { font-size: 12px; color: rgba(150, 165, 195, 0.72); }
.ilb-wd-strongs { font-size: 11px; font-family: ui-monospace, monospace; color: rgba(120, 150, 210, 0.7); }
.ilb-wd-gloss { color: rgba(210, 220, 240, 0.92); font-weight: 600; margin-bottom: 6px; }
.ilb-wd-def { color: rgba(185, 200, 225, 0.82); }
.ilb-wd-domains { margin-top: 8px; font-size: 12px; color: rgba(150, 170, 205, 0.7); font-style: italic; }

/* ── STUDIES GRAPH ────────────────────────────────────────── */
.studies-graph { height: 100%; display: flex; flex-direction: column; }
.studies-graph-head {
  display: flex; align-items: baseline; gap: 14px;
  padding: 18px 28px 0; flex-shrink: 0;
}
.studies-graph-title { font-family: "Palatino Linotype", Palatino, Georgia, serif; font-weight: bold; font-size: 17px; color: rgba(222, 233, 255, 0.92); }
.studies-graph-meta { font-size: 12px; color: rgba(160, 175, 210, 0.55); }
.studies-graph-body { flex: 1; position: relative; min-height: 0; }
.studies-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.studies-graph-empty {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 0 24px;
  font-family: Georgia, "Palatino Linotype", serif; font-style: italic; font-size: 15px;
  color: rgba(160, 175, 210, 0.5);
}
.studies-graph-empty.hidden { display: none; }
.studies-tip {
  position: absolute;
  left: 0; top: 0;
  z-index: 3;
  pointer-events: none;
  max-width: 300px;
  padding: 10px 14px;
  border: 1px solid rgba(120, 150, 210, 0.22);
  border-radius: 9px;
  background: rgba(10, 15, 28, 0.95);
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.studies-tip.hidden { display: none; }
.studies-tip-title { font-family: "Palatino Linotype", Palatino, Georgia, serif; font-weight: 600; font-size: 14px; color: rgba(232, 238, 250, 0.96); }
.studies-tip-meta { margin-top: 3px; font-family: system-ui, sans-serif; font-size: 11px; line-height: 1.5; color: rgba(165, 180, 205, 0.72); }

/* Interlinear ask-Levi + answer sheet */
.ilb-ask {
  margin-left: auto;
  flex-shrink: 0;
  align-self: center;
  font-family: system-ui, sans-serif;
  font-size: 11px;
  letter-spacing: 0;
  padding: 3px 10px;
  border: 1px solid rgba(210, 175, 90, 0.3);
  border-radius: 999px;
  background: rgba(210, 175, 90, 0.08);
  color: #e9dcb4;
  cursor: pointer;
  opacity: 0.75;
  transition: opacity 0.15s, background 0.15s;
}
.ilb-ask:hover { opacity: 1; background: rgba(210, 175, 90, 0.18); }
.ilb-wd-actions { margin-top: 10px; }
.ilb-wd-ask {
  font-family: system-ui, sans-serif;
  font-size: 12px;
  letter-spacing: 0;
  padding: 6px 12px;
  border: 1px solid rgba(210, 175, 90, 0.3);
  border-radius: 7px;
  background: rgba(210, 175, 90, 0.08);
  color: #e9dcb4;
  cursor: pointer;
}
.ilb-wd-ask:hover { background: rgba(210, 175, 90, 0.18); }

.ilb-answer {
  flex-shrink: 0;
  max-height: 46vh;
  display: flex;
  flex-direction: column;
  margin-top: 10px;
  border: 1px solid rgba(80, 140, 255, 0.16);
  border-radius: 10px;
  background: rgba(8, 12, 22, 0.86);
  backdrop-filter: blur(8px);
}
.ilb-answer.hidden { display: none; }
.ilb-answer-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(80, 140, 255, 0.1);
  flex-shrink: 0;
}
.ilb-answer-titles { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ilb-answer-title { font-family: "Palatino Linotype", Palatino, Georgia, serif; font-weight: 600; font-size: 14px; color: rgba(222, 233, 255, 0.92); }
.ilb-answer-subtitle { font-size: 11px; color: rgba(160, 175, 210, 0.55); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ilb-answer-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.6;
  color: rgba(200, 212, 232, 0.9);
  user-select: text;
}

/* ── STUDY FOCUS ──────────────────────────────────────────── */

.study-focus-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.study-focus-header {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px 24px;
  border-bottom: 1px solid rgba(80, 140, 255, 0.08);
  background: rgba(5, 8, 18, 0.4);
}

.study-focus-title {
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-size: 20px;
  font-weight: normal;
  color: rgba(200, 215, 245, 0.95);
  margin: 0;
}

.study-focus-content {
  flex: 1;
  overflow-y: auto;
  padding: 64px 32px 120px;
  max-width: 720px;
  margin: 0 auto;
  /* Same edge dissolves as the scripture reader — the study reader is the
     same reading surface, so text fades in at the top and out at the base. */
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0px,
    transparent 12px,
    rgba(0, 0, 0, 0.18) 24px,
    rgba(0, 0, 0, 0.6) 36px,
    black 64px,
    black calc(100% - 120px),
    rgba(0, 0, 0, 0.84) calc(100% - 88px),
    rgba(0, 0, 0, 0.5) calc(100% - 60px),
    rgba(0, 0, 0, 0.03) calc(100% - 40px),
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    transparent 0px,
    transparent 12px,
    rgba(0, 0, 0, 0.18) 24px,
    rgba(0, 0, 0, 0.6) 36px,
    black 64px,
    black calc(100% - 120px),
    rgba(0, 0, 0, 0.84) calc(100% - 88px),
    rgba(0, 0, 0, 0.5) calc(100% - 60px),
    rgba(0, 0, 0, 0.03) calc(100% - 40px),
    transparent 100%
  );
}

/* Markdown tables (study reader + chat share the same renderer) */
.md-table {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 16px 0;
  max-width: 100%;
  font-size: 14px;
  line-height: 1.55;
}
.md-table th,
.md-table td {
  padding: 8px 12px;
  border: 1px solid rgba(110, 150, 210, 0.18);
  text-align: left;
  vertical-align: top;
}
.md-table th {
  background: rgba(30, 42, 66, 0.5);
  color: rgba(200, 215, 240, 0.95);
  font-weight: 600;
  font-family: system-ui, sans-serif;
  font-size: 13px;
}
.md-table td {
  color: rgba(198, 210, 232, 0.88);
}
.md-table tr:nth-child(even) td { background: rgba(20, 28, 46, 0.35); }

.study-focus-notes {
  width: 500px;
  max-width: 45vw;
  position: fixed;
  top: calc(var(--banner-h) + var(--center-tabs-h) + var(--center-brand-h));
  bottom: 0;
  right: 0;
  overflow-y: auto;
  border-left: 1px solid rgba(80, 140, 255, 0.08);
  background: rgba(5, 8, 18, 0.6);
  backdrop-filter: blur(12px);
  padding: 16px;
}

.study-focus-notes.hidden {
  display: none;
}

/* ── NOTEBOOK FOCUS ───────────────────────────────────────── */

.nb-focus-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.nb-focus-header {
  padding: 16px 24px;
  border-bottom: 1px solid rgba(80, 140, 255, 0.08);
  background: rgba(5, 8, 18, 0.4);
}

.nb-focus-title {
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-size: 20px;
  font-weight: normal;
  color: rgba(200, 215, 245, 0.95);
  margin: 0;
}

.nb-focus-editor {
  flex: 1;
  width: 100%;
  padding: 24px 32px;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 16px;
  line-height: 1.7;
  resize: none;
  outline: none;
}

.nb-focus-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  border-top: 1px solid rgba(80, 140, 255, 0.08);
  background: rgba(5, 8, 18, 0.4);
}

/* ── LEVI CHAT ────────────────────────────────────────────── */

.levi-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.levi-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.levi-empty {
  margin: auto;
  text-align: center;
  font-family: system-ui, sans-serif;
  font-size: 13px;
  color: rgba(160, 175, 210, 0.4);
  padding: 40px 20px;
}

.levi-msg {
  position: relative;
  max-width: 90%;
  padding: 10px 14px;
  border-radius: 10px;
  font-family: "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  user-select: text;
  -webkit-user-select: text;
}

.levi-msg-copy {
  position: absolute;
  top: 6px;
  right: 8px;
  padding: 2px 8px;
  border: 1px solid rgba(110, 150, 210, 0.18);
  border-radius: 5px;
  background: rgba(10, 16, 30, 0.78);
  color: rgba(175, 198, 240, 0.7);
  font-family: system-ui, sans-serif;
  font-size: 10px;
  line-height: 1.5;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

.levi-msg:hover .levi-msg-copy,
.levi-msg-copy:focus-visible {
  opacity: 1;
  pointer-events: auto;
}

@media (hover: none) {
  .levi-msg-copy { opacity: 0.6; pointer-events: auto; }
}

.levi-msg.user {
  align-self: flex-end;
  background: rgba(80, 140, 255, 0.15);
  border: 1px solid rgba(80, 140, 255, 0.2);
  color: rgba(220, 230, 245, 0.9);
}

.levi-msg.assistant {
  align-self: flex-start;
  background: rgba(12, 18, 30, 0.7);
  border: 1px solid rgba(110, 150, 210, 0.1);
  color: rgba(200, 212, 232, 0.85);
}

.levi-msg.thinking {
  align-self: flex-start;
  background: rgba(12, 18, 30, 0.4);
  border: 1px solid rgba(110, 150, 210, 0.06);
  color: rgba(160, 175, 210, 0.4);
  font-style: italic;
  font-size: 12px;
}

.levi-msg.error {
  align-self: flex-start;
  background: rgba(180, 75, 70, 0.1);
  border: 1px solid rgba(180, 75, 70, 0.2);
  color: rgba(240, 150, 140, 0.8);
  font-size: 12px;
}

.levi-input-row {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid rgba(80, 140, 255, 0.08);
  background: rgba(5, 8, 18, 0.3);
}

.levi-input {
  flex: 1;
  resize: none;
  padding: 10px 12px;
  border: 1px solid rgba(120, 160, 215, 0.16);
  border-radius: 8px;
  background: rgba(12, 16, 28, 0.72);
  color: rgba(225, 232, 245, 0.9);
  font-family: system-ui, sans-serif;
  font-size: 13px;
  outline: none;
  min-height: 40px;
  max-height: 120px;
}

.levi-input::placeholder {
  color: rgba(160, 170, 190, 0.38);
}

.levi-send {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(80, 140, 255, 0.25);
  border-radius: 8px;
  background: rgba(80, 140, 255, 0.1);
  color: var(--accent);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.levi-send:hover {
  background: rgba(80, 140, 255, 0.2);
}

.levi-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.levi-instance {
  flex-shrink: 0;
  padding: 12px 16px;
  border-top: 1px solid rgba(80, 140, 255, 0.08);
}

.instance-warning {
  font-family: system-ui, sans-serif;
  font-size: 11px;
  line-height: 1.5;
  color: rgba(230, 190, 125, 0.65);
  margin-bottom: 8px;
}

.instance-new-btn {
  width: 100%;
  padding: 7px 12px;
  border: 1px solid rgba(210, 175, 90, 0.35);
  border-radius: 6px;
  background: rgba(210, 175, 90, 0.1);
  color: #e9dcb4;
  font-family: system-ui, sans-serif;
  font-size: 11px;
  cursor: pointer;
}

.instance-new-btn:hover {
  background: rgba(210, 175, 90, 0.18);
}

.instance-status-msg {
  margin-top: 6px;
  font-family: system-ui, sans-serif;
  font-size: 11px;
  color: rgba(150, 220, 180, 0.7);
}

/* ── NOTEBOOK EDITOR ──────────────────────────────────────── */

.nb-header {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(80, 140, 255, 0.08);
}

.nb-select {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid rgba(120, 160, 215, 0.16);
  border-radius: 6px;
  background: rgba(12, 16, 28, 0.72);
  color: rgba(225, 232, 245, 0.9);
  font-family: system-ui, sans-serif;
  font-size: 13px;
  outline: none;
}

.nb-action-btn {
  padding: 6px 12px;
  border: 1px solid rgba(210, 175, 90, 0.25);
  border-radius: 6px;
  background: rgba(180, 145, 70, 0.1);
  color: rgba(245, 235, 210, 0.88);
  font-family: system-ui, sans-serif;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.nb-action-btn:hover {
  background: rgba(195, 155, 75, 0.18);
}

.nb-action-btn.danger {
  border-color: rgba(200, 80, 70, 0.2);
  background: rgba(200, 80, 70, 0.06);
  color: rgba(240, 160, 150, 0.75);
}

.nb-action-btn.danger:hover {
  background: rgba(200, 80, 70, 0.12);
}

.nb-editor-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 12px 16px;
}

.nb-entries {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.nb-entry {
  padding: 8px 10px;
  border: 1px solid rgba(110, 150, 210, 0.08);
  border-radius: 6px;
  background: rgba(8, 12, 22, 0.5);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.nb-entry:hover {
  border-color: rgba(80, 140, 255, 0.15);
  background: rgba(12, 18, 30, 0.6);
}

.nb-entry.active {
  border-color: rgba(80, 140, 255, 0.3);
  background: rgba(15, 22, 38, 0.7);
}

.nb-entry-text {
  font-family: "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(200, 212, 232, 0.75);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nb-entry-tags {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.nb-entry-tag {
  padding: 1px 6px;
  border-radius: 8px;
  font-family: system-ui, sans-serif;
  font-size: 10px;
  background: rgba(80, 140, 255, 0.1);
  color: rgba(120, 180, 255, 0.7);
}

.nb-entry-tag.private {
  background: rgba(200, 80, 70, 0.1);
  color: rgba(240, 150, 140, 0.7);
}

.nb-entry {
  position: relative;
}

.nb-entry-focus-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  padding: 0;
  background: rgba(80, 140, 255, 0.1);
  border: 1px solid rgba(80, 140, 255, 0.2);
  border-radius: 4px;
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s, background 0.2s;
}

.nb-entry:hover .nb-entry-focus-btn {
  opacity: 1;
}

.nb-entry-focus-btn:hover {
  background: rgba(80, 140, 255, 0.2);
}

.nb-entry-actions {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.nb-tag-btn {
  padding: 4px 10px;
  border: 1px solid rgba(110, 150, 210, 0.12);
  border-radius: 5px;
  background: rgba(12, 18, 30, 0.5);
  color: rgba(180, 192, 214, 0.6);
  font-family: system-ui, sans-serif;
  font-size: 11px;
  cursor: pointer;
}

.nb-tag-btn:hover {
  background: rgba(80, 140, 255, 0.1);
  color: rgba(200, 220, 255, 0.8);
}

.nb-tag-btn.private {
  border-color: rgba(200, 80, 70, 0.15);
  color: rgba(240, 150, 140, 0.6);
}

.nb-tag-btn.private:hover {
  background: rgba(200, 80, 70, 0.1);
}

.nb-entry-editor {
  width: 100%;
  min-height: 120px;
  max-height: 300px;
  resize: vertical;
  padding: 10px 12px;
  border: 1px solid rgba(120, 160, 215, 0.16);
  border-radius: 7px;
  background: rgba(12, 16, 28, 0.72);
  color: rgba(225, 232, 245, 0.9);
  font-family: "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 13px;
  line-height: 1.55;
  outline: none;
}

.nb-entry-editor::placeholder {
  color: rgba(160, 170, 190, 0.35);
}

.nb-editor-footer {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.nb-save-status {
  margin-left: auto;
  font-family: system-ui, sans-serif;
  font-size: 11px;
  color: rgba(150, 220, 180, 0.6);
  opacity: 0;
  transition: opacity 0.3s;
}

.nb-save-status.visible {
  opacity: 1;
}

.nb-new-form {
  padding: 12px 16px;
  border-top: 1px solid rgba(80, 140, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nb-new-form.hidden {
  display: none;
}

.nb-new-form input {
  padding: 8px 10px;
  border: 1px solid rgba(120, 160, 215, 0.16);
  border-radius: 6px;
  background: rgba(12, 16, 28, 0.72);
  color: rgba(225, 232, 245, 0.9);
  font-family: system-ui, sans-serif;
  font-size: 13px;
  outline: none;
}

.nb-new-form input::placeholder {
  color: rgba(160, 170, 190, 0.38);
}

.nb-form-actions {
  display: flex;
  gap: 8px;
}

/* ── RECALL TAB ───────────────────────────────────────────── */

.recall-subtabs {
  display: flex;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(80, 140, 255, 0.06);
  background: rgba(5, 8, 18, 0.3);
  overflow-x: auto;
}

.recall-subtab {
  flex: 1;
  padding: 10px 6px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: rgba(160, 175, 210, 0.45);
  font-family: system-ui, sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s;
}

.recall-subtab:hover {
  color: rgba(200, 210, 230, 0.65);
}

.recall-subtab.active {
  color: rgba(225, 232, 245, 0.85);
  border-bottom-color: var(--accent);
}

.recall-section {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  flex-direction: column;
}

.recall-section.active {
  display: flex;
}

.recall-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.recall-card {
  padding: 10px 12px;
  border: 1px solid rgba(110, 150, 210, 0.1);
  border-radius: 7px;
  background: rgba(8, 12, 22, 0.55);
}

.recall-card-kicker {
  font-family: system-ui, sans-serif;
  font-size: 10px;
  color: rgba(150, 190, 220, 0.5);
  margin-bottom: 4px;
}

.recall-card-title {
  font-family: system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: rgba(230, 236, 246, 0.88);
}

.recall-card-body {
  margin-top: 4px;
  font-family: "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(200, 212, 232, 0.7);
}

.recall-card-action {
  margin-top: 8px;
}

/* ── Recall decks (deck builder) ─────────────────────────────── */
.recall-workbench { display: flex; flex-direction: column; height: 100%; }
.recall-head { display: flex; align-items: baseline; gap: 14px; padding: 18px 28px 0; flex-shrink: 0; }
.recall-title { font-family: "Palatino Linotype", Palatino, Georgia, serif; font-weight: bold; font-size: 17px; color: rgba(222, 233, 255, 0.92); }
.recall-stats { font-size: 12px; color: rgba(160, 175, 210, 0.55); }
.recall-spacer { flex: 1; }
.recall-actions { display: flex; gap: 8px; }
.recall-btn {
  font-family: system-ui, sans-serif; font-size: 12px; letter-spacing: 0.02em;
  padding: 5px 12px; border: 1px solid rgba(120, 150, 210, 0.25); border-radius: 6px;
  background: rgba(20, 28, 44, 0.7); color: rgba(215, 225, 240, 0.9); cursor: pointer;
}
.recall-btn:hover { background: rgba(30, 40, 60, 0.9); }
.recall-btn.primary { color: #f5e9c8; border-color: rgba(216, 178, 80, 0.45); background: rgba(210, 175, 90, 0.12); }
.recall-btn.danger { color: rgba(255, 150, 150, 0.85); border-color: rgba(225, 95, 95, 0.4); }
.recall-decks { display: flex; flex-direction: column; gap: 8px; padding: 6px 28px 0; }
.recall-word-body { max-height: 130px; overflow-y: auto; }
.recall-word-line { margin: 2px 0; }
.recall-word-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; color: rgba(150, 190, 220, 0.45); margin-right: 6px; }
.recall-deck {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border: 1px solid rgba(110, 150, 210, 0.12); border-radius: 8px; background: rgba(8, 12, 22, 0.55);
}
.recall-deck-title { font-family: system-ui, sans-serif; font-size: 14px; font-weight: 600; color: rgba(230, 236, 246, 0.9); flex: 1; }
.recall-deck-meta { font-family: system-ui, sans-serif; font-size: 11px; color: rgba(150, 190, 220, 0.5); }
.recall-deck-actions { display: flex; gap: 6px; }
.recall-editor { display: flex; flex-direction: column; gap: 12px; padding: 12px; border: 1px solid rgba(110, 150, 210, 0.15); border-radius: 10px; background: rgba(8, 12, 22, 0.4); }
.recall-editor.hidden { display: none; }
.recall-editor-head { display: flex; gap: 8px; align-items: center; }
.recall-input {
  flex: 1; font-family: system-ui, sans-serif; font-size: 14px; color: #e8eefc;
  background: rgba(20, 30, 55, 0.6); border: 1px solid rgba(120, 150, 210, 0.25); border-radius: 7px; padding: 7px 10px; outline: none;
}
.recall-editor-cards { display: flex; flex-direction: column; gap: 6px; }
.recall-card-row { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 1px solid rgba(110, 150, 210, 0.1); border-radius: 6px; background: rgba(8, 12, 22, 0.5); }
.recall-card-label { flex: 1; font-size: 12.5px; color: rgba(200, 212, 232, 0.8); }
.recall-editor-add { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.recall-add-section { display: flex; flex-direction: column; gap: 6px; }
.recall-add-title { font-family: system-ui, sans-serif; font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: rgba(150, 190, 220, 0.5); }
.recall-add-list { display: flex; flex-direction: column; gap: 4px; max-height: 240px; overflow-y: auto; }
.recall-add-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid rgba(110, 150, 210, 0.08); border-radius: 6px; background: rgba(8, 12, 22, 0.4); }
.recall-add-label { flex: 1; font-size: 12px; color: rgba(190, 205, 230, 0.75); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.recall-form {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.recall-form input {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid rgba(120, 160, 215, 0.16);
  border-radius: 6px;
  background: rgba(12, 16, 28, 0.72);
  color: rgba(225, 232, 245, 0.9);
  font-family: system-ui, sans-serif;
  font-size: 12px;
  outline: none;
}

.recall-form input::placeholder {
  color: rgba(160, 170, 190, 0.38);
}

.recall-form button {
  padding: 6px 12px;
  border: 1px solid rgba(210, 175, 90, 0.25);
  border-radius: 6px;
  background: rgba(180, 145, 70, 0.1);
  color: rgba(245, 235, 210, 0.88);
  font-family: system-ui, sans-serif;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

/* Quiz panel in recall */
.recall-quiz-panel {
  margin-top: 12px;
}

.recall-quiz-panel .quiz-front {
  font-size: 20px;
  margin-bottom: 12px;
}

.recall-quiz-panel .quiz-back {
  font-size: 15px;
  margin-bottom: 12px;
  padding: 10px;
  border-left: 3px solid var(--accent);
  background: rgba(80, 140, 255, 0.05);
}

.recall-quiz-panel .quiz-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.recall-quiz-panel .quiz-actions button {
  flex: 1;
  min-width: 60px;
  padding: 8px 10px;
  border: 1px solid rgba(110, 150, 210, 0.15);
  border-radius: 6px;
  background: rgba(12, 18, 30, 0.6);
  color: rgba(200, 212, 232, 0.75);
  font-family: system-ui, sans-serif;
  font-size: 12px;
  cursor: pointer;
}

.recall-quiz-panel .quiz-actions button:hover {
  background: rgba(80, 140, 255, 0.1);
  border-color: rgba(80, 140, 255, 0.25);
}

/* ── BETA BANNER ──────────────────────────────────────────── */

.beta-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--banner-h);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  background: rgba(5, 8, 18, 0.9);
  border-bottom: 1px solid rgba(80, 140, 255, 0.12);
  backdrop-filter: blur(10px);
  color: rgba(160, 170, 200, 0.6);
  font-size: 11px;
  font-family: system-ui, sans-serif;
  letter-spacing: 0.03em;
}

.banner-actions {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.beta-banner.degraded {
  color: rgba(230, 190, 125, 0.76);
  border-bottom-color: rgba(210, 160, 80, 0.2);
}

@media (max-width: 900px) {
  .beta-banner { left: 0; }
}

/* ── APP SHELL ────────────────────────────────────────────── */

.app-shell {
  margin-left: var(--panel-width);
  min-height: 100vh;
  transition: margin-left 0.3s ease;
}

body.panel-closed .app-shell {
  margin-left: 0;
}

@media (max-width: 900px) {
  .app-shell { margin-left: 0; }
}

/* ── QUERY BAR ────────────────────────────────────────────── */

.query-bar {
  position: fixed;
  bottom: 0;
  left: var(--panel-width);
  right: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: rgba(8, 8, 16, 0.92);
  border-top: 1px solid rgba(80, 140, 255, 0.12);
  backdrop-filter: blur(12px);
  transition: left 0.3s ease;
}

body.panel-closed .query-bar {
  left: 0;
}

body.study-active .query-bar {
  display: none;
}

@media (max-width: 900px) {
  .query-bar { left: 0; }
}

.query-bar input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid rgba(120, 160, 215, 0.18);
  border-radius: 8px;
  background: rgba(12, 16, 28, 0.8);
  color: rgba(225, 232, 245, 0.9);
  font-family: "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 15px;
  outline: none;
}

.query-bar input::placeholder {
  color: rgba(160, 170, 190, 0.35);
}

.query-bar input:focus {
  border-color: rgba(80, 140, 255, 0.3);
}

.query-status {
  font-family: system-ui, sans-serif;
  font-size: 12px;
  color: rgba(160, 175, 210, 0.5);
  white-space: nowrap;
}

.query-status.generating {
  color: var(--accent);
}

/* ── ORB FIELD ────────────────────────────────────────────── */

#orb-field {
  position: fixed;
  top: 0;
  left: var(--panel-width);
  right: 0;
  bottom: 0;
  z-index: 2;
  pointer-events: none;
}

@media (max-width: 900px) {
  #orb-field { left: 0; }
}

/* ── HEALTH PANEL (legacy, now in recall) ─────────────────── */

.health-panel {
  padding: 14px 15px;
  border: 1px solid rgba(110, 150, 210, 0.12);
  border-radius: 8px;
  background: rgba(8, 12, 22, 0.62);
}

/* ── INSTANCE MANAGEMENT (legacy ref) ─────────────────────── */

.empty-state {
  padding: 16px;
  border: 1px dashed rgba(120, 160, 215, 0.16);
  border-radius: 8px;
  color: rgba(165, 176, 196, 0.52);
  font-family: system-ui, sans-serif;
  font-size: 13px;
}

.highlight-gold { border-left: 3px solid rgba(230, 185, 80, 0.75); }
.highlight-blue { border-left: 3px solid rgba(95, 155, 230, 0.75); }
.highlight-violet { border-left: 3px solid rgba(170, 130, 230, 0.75); }
.highlight-green { border-left: 3px solid rgba(100, 200, 145, 0.75); }
.highlight-red { border-left: 3px solid rgba(225, 95, 95, 0.75); }

.health-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  font-family: system-ui, sans-serif;
}

.health-summary strong {
  color: rgba(225, 232, 245, 0.9);
  font-size: 15px;
}

.health-summary span {
  color: rgba(210, 175, 90, 0.78);
  font-size: 12px;
}

.health-block {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
  font-family: system-ui, sans-serif;
  font-size: 12px;
}

.health-block b {
  width: 100%;
  color: rgba(225, 232, 245, 0.82);
}

.health-block span {
  padding: 4px 7px;
  border-radius: 10px;
  background: rgba(180, 145, 70, 0.13);
  color: rgba(230, 195, 125, 0.8);
}

.health-block.bad span {
  background: rgba(180, 75, 70, 0.16);
  color: rgba(240, 150, 140, 0.82);
}

.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.health-grid div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 9px;
  border-radius: 7px;
  background: rgba(16, 22, 34, 0.58);
  font-family: system-ui, sans-serif;
  font-size: 12px;
}

.health-grid span {
  color: rgba(180, 192, 214, 0.66);
}

.health-grid b {
  color: rgba(150, 220, 180, 0.72);
  font-weight: 500;
}

/* ── INSTANCE MANAGEMENT ─────────────────────────────────── */

.instance-section {
  margin-bottom: 16px;
  padding: 14px;
  border-radius: 9px;
  background: rgba(16, 22, 34, 0.65);
  border: 1px solid rgba(210, 175, 90, 0.18);
}

.instance-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-family: system-ui, sans-serif;
  font-size: 13px;
}

.instance-header strong {
  color: rgba(225, 232, 245, 0.9);
}

.instance-id {
  font-family: monospace;
  font-size: 11px;
  color: rgba(180, 192, 214, 0.5);
}

.instance-warning {
  font-family: system-ui, sans-serif;
  font-size: 11px;
  line-height: 1.5;
  color: rgba(230, 190, 125, 0.72);
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(210, 175, 90, 0.06);
  border: 1px solid rgba(210, 175, 90, 0.12);
}

.instance-new-btn {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid rgba(210, 175, 90, 0.4);
  border-radius: 6px;
  background: rgba(210, 175, 90, 0.12);
  color: #e9dcb4;
  font-family: system-ui, sans-serif;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.instance-new-btn:hover {
  background: rgba(210, 175, 90, 0.18);
  border-color: rgba(210, 175, 90, 0.55);
}

.instance-new-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.instance-status-msg {
  margin-top: 8px;
  font-family: system-ui, sans-serif;
  font-size: 11px;
  color: rgba(180, 192, 214, 0.6);
}

.instance-ok {
  color: rgba(150, 220, 180, 0.82);
}

.quiz-panel {
  margin-top: 16px;
}

.quiz-front {
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-size: 24px;
  line-height: 1.3;
  color: rgba(230, 236, 246, 0.94);
  overflow-wrap: anywhere;
}

.quiz-back {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(110, 150, 210, 0.12);
  font-size: 16px;
  line-height: 1.6;
  color: rgba(205, 218, 235, 0.82);
  overflow-wrap: anywhere;
}

.quiz-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.reader-chapter-nav {
  position: absolute;
  bottom: 72px;
  left: 20px;
  right: 20px;
  z-index: 8;
  display: grid;
  grid-template-columns: 1fr 1.25fr 1fr;
  gap: 8px;
  max-width: 640px;
  margin: 0 auto;
  padding: 10px;
  border: 1px solid rgba(110, 150, 210, 0.14);
  border-radius: 8px;
  background: rgba(7, 10, 20, 0.9);
  backdrop-filter: blur(12px);
}

/* ── Enrichment pane pull-tab (mirror of the left panel-toggle) ─ */
.enrich-toggle {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  z-index: 8;
  width: 24px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: rgba(5, 8, 18, 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(80, 140, 255, 0.12);
  border-right: none;
  border-radius: 6px 0 0 6px;
  color: rgba(160, 175, 210, 0.5);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: right 0.3s ease, color 0.2s ease;
}

.enrich-toggle:hover {
  color: rgba(225, 232, 245, 0.9);
}

/* When the pane is open, the tab rides its left border. */
body.enrich-open .enrich-toggle {
  right: 500px;
}

@media (max-width: 900px) {
  .enrich-toggle { display: none; }
}

.reader-chapter-nav[hidden] {
  display: none;
}

.reader-chapter-nav button {
  min-width: 0;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid rgba(120, 160, 215, 0.18);
  border-radius: 7px;
  background: rgba(20, 28, 44, 0.68);
  color: rgba(215, 225, 240, 0.84);
  font-family: system-ui, sans-serif;
  font-size: 12px;
  letter-spacing: 0;
  cursor: pointer;
}

.reader-chapter-nav button:disabled {
  opacity: 0.36;
  cursor: not-allowed;
}

.wd-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(80,140,255,0.08);
}

.wd-actions .wd-btn {
  font-family: system-ui, sans-serif;
  font-size: 12px;
  letter-spacing: 0;
  padding: 6px 12px;
  border: 1px solid rgba(120, 160, 215, 0.25);
  border-radius: 7px;
  background: rgba(30, 40, 62, 0.6);
  color: rgba(200, 215, 240, 0.85);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.wd-actions .wd-btn:hover { background: rgba(40, 55, 85, 0.8); border-color: rgba(120, 160, 215, 0.4); }
.wd-actions .wd-btn-gold {
  border-color: rgba(210, 175, 90, 0.4);
  background: rgba(210, 175, 90, 0.12);
  color: #e9dcb4;
}
.wd-actions .wd-btn-gold:hover { background: rgba(210, 175, 90, 0.22); }

@media (max-width: 600px) {
  .read-left {
    padding-left: 12px;
    padding-right: 12px;
  }

  .reader-chapter-nav {
    grid-template-columns: 1fr;
  }
}

/* ── FEEDBACK + SUPPORT MODAL ───────────────────────────────── */
.feedback-dialog {
  position: relative;
  width: min(460px, calc(100vw - 48px));
  padding: 28px 28px 22px;
  background: rgba(10, 15, 28, 0.97);
  border: 1px solid rgba(120, 150, 210, 0.22);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.feedback-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 30px; height: 30px;
  border: none; border-radius: 6px;
  background: transparent;
  color: rgba(180, 195, 220, 0.6);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.feedback-close:hover { color: rgba(230, 238, 250, 0.95); background: rgba(40, 55, 85, 0.5); }
.feedback-title { margin: 0 0 4px; font-family: "Palatino Linotype", Palatino, Georgia, serif; font-size: 21px; color: rgba(228, 236, 250, 0.96); }
.feedback-sub { margin: 0 0 18px; font-family: Georgia, serif; font-style: italic; font-size: 13px; color: rgba(160, 175, 210, 0.6); }
.feedback-input, .feedback-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid rgba(120, 160, 215, 0.18);
  border-radius: 8px;
  background: rgba(12, 16, 28, 0.72);
  color: rgba(225, 232, 245, 0.92);
  font-family: system-ui, sans-serif;
  font-size: 13px;
  outline: none;
}
.feedback-input { margin-bottom: 10px; }
.feedback-textarea { resize: vertical; min-height: 108px; line-height: 1.5; }
.feedback-input:focus, .feedback-textarea:focus { border-color: rgba(80, 140, 255, 0.4); }
.feedback-input::placeholder, .feedback-textarea::placeholder { color: rgba(160, 170, 190, 0.4); }
.feedback-kinds { display: flex; gap: 8px; margin: 12px 0 16px; }
.feedback-kind {
  font-family: system-ui, sans-serif;
  font-size: 12px;
  padding: 5px 14px;
  border: 1px solid rgba(120, 160, 215, 0.25);
  border-radius: 999px;
  background: rgba(24, 32, 50, 0.6);
  color: rgba(190, 205, 230, 0.8);
  cursor: pointer;
}
.feedback-kind.active { border-color: rgba(210, 175, 90, 0.5); background: rgba(210, 175, 90, 0.16); color: #efdfb6; }
.feedback-send {
  width: 100%;
  padding: 10px 0;
  border: 1px solid rgba(210, 175, 90, 0.4);
  border-radius: 8px;
  background: rgba(210, 175, 90, 0.14);
  color: #e9dcb4;
  font-family: system-ui, sans-serif;
  font-size: 13px;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.feedback-send:hover { background: rgba(210, 175, 90, 0.24); }
.feedback-send:disabled { opacity: 0.5; cursor: default; }
.feedback-status { display: block; min-height: 16px; margin-top: 10px; font-family: system-ui, sans-serif; font-size: 12px; color: rgba(170, 185, 210, 0.7); }
.feedback-status.ok { color: rgba(120, 200, 150, 0.9); }
.feedback-status.error { color: rgba(235, 140, 130, 0.9); }
.feedback-foot { margin: 10px 0 2px; font-family: Georgia, serif; font-style: italic; font-size: 12px; color: rgba(150, 165, 195, 0.5); }

/* ── AUTH (Supabase email + password) ───────────────────────── */
.auth-modal {
  position: fixed;
  inset: 0;
  background: rgba(2, 4, 10, 0.72);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
}
.auth-modal.hidden { display: none; }

.auth-card {
  width: min(400px, calc(100vw - 32px));
  background: #0a101d;
  border: 1px solid rgba(120, 150, 210, 0.22);
  border-radius: 14px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  font-family: system-ui, sans-serif;
}
.auth-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 0;
}
.auth-title {
  color: #d2af5a;
  font-size: 15px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.auth-close {
  background: none;
  border: none;
  color: rgba(170, 185, 210, 0.7);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
}
.auth-close:hover { color: #fff; }

.auth-body { padding: 12px 18px 18px; }
.auth-section { display: flex; flex-direction: column; gap: 10px; }

.auth-input {
  width: 100%;
  box-sizing: border-box;
  background: rgba(8, 14, 26, 0.9);
  border: 1px solid rgba(120, 150, 210, 0.25);
  border-radius: 8px;
  color: #e6edf7;
  font-size: 13.5px;
  padding: 9px 11px;
  outline: none;
}
.auth-input:focus { border-color: rgba(210, 175, 90, 0.6); }

.auth-btn {
  background: rgba(120, 150, 210, 0.14);
  border: 1px solid rgba(120, 150, 210, 0.3);
  border-radius: 8px;
  color: #dfe8f5;
  font-size: 13px;
  padding: 8px 16px;
  cursor: pointer;
}
.auth-btn:hover { background: rgba(120, 150, 210, 0.24); }
.auth-btn.primary { background: rgba(210, 175, 90, 0.16); border-color: rgba(210, 175, 90, 0.45); }
.auth-btn.primary:hover { background: rgba(210, 175, 90, 0.28); }

.auth-info {
  color: rgba(190, 205, 230, 0.92);
  font-size: 13px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(120, 150, 210, 0.12);
}
.auth-info strong { color: #fff; }
.auth-hint { color: rgba(150, 165, 190, 0.6); font-size: 11.5px; line-height: 1.4; }

.auth-link {
  background: none;
  border: none;
  color: rgba(140, 170, 230, 0.85);
  font-size: 12.5px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.auth-link:hover { color: #d2af5a; }

.auth-status { font-size: 12.5px; min-height: 16px; color: rgba(255,150,150,0.9); }
.auth-error { color: rgba(255, 150, 150, 0.9); font-size: 12.5px; padding: 10px; }
.auth-footer-row { margin-top: 2px; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(150, 165, 190, 0.5);
  font-size: 11px;
}
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: rgba(120, 150, 210, 0.15); }

.auth-input.code {
  font-family: ui-monospace, monospace;
  font-size: 18px;
  letter-spacing: 8px;
  text-align: center;
}

/* ── Top-chrome auth button ─────────────────────────────────── */
.auth-top-btn {
  background: rgba(210, 175, 90, 0.14);
  border: none;
  border-left: 1px solid rgba(210, 175, 90, 0.4);
  border-radius: 0;
  color: #e9dcb4;
  font-size: 12.5px;
  letter-spacing: 0.06em;
  padding: 0 18px;
  height: 100%;
  cursor: pointer;
}
.auth-top-btn:hover { background: rgba(210, 175, 90, 0.26); }

/* ── Levi balance chip ───────────────────────────────────────── */
.credits-chip {
  background: rgba(210, 175, 90, 0.1);
  border: 1px solid rgba(210, 175, 90, 0.35);
  border-radius: 999px;
  color: #e9dcb4;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  padding: 5px 12px;
  cursor: pointer;
}
.credits-chip.hidden { display: none; }
.credits-chip:hover { background: rgba(210, 175, 90, 0.2); }

.auth-balance {
  color: #d2af5a;
  font-size: 14px;
  font-family: ui-monospace, monospace;
  padding: 2px 0 4px;
  border-bottom: 1px solid rgba(120, 150, 210, 0.12);
}

.auth-userbar { display: flex; flex-direction: column; gap: 2px; }

.auth-notes {
  max-height: 52vh;
  overflow-y: auto;
  padding: 4px 2px;
  font-size: 13.5px;
  line-height: 1.55;
  color: rgba(205, 218, 240, 0.9);
}
.auth-notes h2 { font-size: 16px; color: #e9dcb4; margin: 4px 0 8px; letter-spacing: 0.02em; }
.auth-notes h3 { font-size: 14.5px; color: #dfe9ff; margin: 10px 0 6px; }
.auth-notes h4 { font-size: 13px; color: rgba(190, 205, 230, 0.95); margin: 8px 0 4px; }
.auth-notes p { margin: 6px 0; }
.auth-notes ul, .auth-notes ol { margin: 6px 0 6px 20px; }
.auth-notes li { margin: 3px 0; }
.auth-notes code { font-family: ui-monospace, monospace; background: rgba(30, 40, 60, 0.6); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.auth-notes strong { color: #fff; }
.auth-notes em { color: #d2af5a; }

/* ── Version chip (hover-reveal on top bar) ─────────────────── */
.version-chip {
  opacity: 0;
  transition: opacity 0.25s ease;
  color: rgba(150, 165, 190, 0.55);
  font-size: 10.5px;
  font-family: ui-monospace, monospace;
  letter-spacing: 0.05em;
  padding: 4px 8px;
  border: 1px solid rgba(120, 150, 210, 0.15);
  border-radius: 6px;
  cursor: pointer;
  user-select: text;
}
.version-chip.hidden { display: none; }
.top-chrome:hover .version-chip { opacity: 1; }

/* ── Dev pane (behind the version chip) ─────────────────────── */
.dev-panel {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(2, 4, 10, 0.6);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
.dev-panel.hidden { display: none; }
.dev-card {
  width: min(560px, calc(100vw - 32px));
  max-height: 70vh; overflow-y: auto;
  background: #0a101d; border: 1px solid rgba(120,150,210,0.22);
  border-radius: 12px; padding: 14px 18px 18px;
  font-family: system-ui, sans-serif;
}
.dev-head { display: flex; align-items: center; justify-content: space-between; }
.dev-title { color: #d2af5a; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; }
.dev-close { background: none; border: none; color: rgba(170,185,210,0.7); font-size: 20px; cursor: pointer; }
.dev-build { color: rgba(190,205,230,0.9); font-size: 12.5px; margin: 8px 0 12px; }
.dev-mono { font-family: ui-monospace, monospace; color: #e6edf7; }
.dev-sub { color: rgba(150,165,190,0.55); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 6px; }
.dev-errors { display: flex; flex-direction: column; gap: 6px; }
.dev-err {
  font-family: ui-monospace, monospace; font-size: 11px; line-height: 1.45;
  color: rgba(255, 170, 170, 0.9); background: rgba(255, 90, 90, 0.06);
  border: 1px solid rgba(255, 120, 120, 0.15); border-radius: 6px; padding: 6px 9px;
  word-break: break-word;
}
.dev-err-meta { display: block; color: rgba(150,165,190,0.5); font-size: 10px; margin-top: 3px; }
.dev-empty { color: rgba(150,165,190,0.6); font-size: 12px; }

/* ── December Pro-credits offer banner ───────────────────────── */
.credits-banner {
  position: relative;
  z-index: 6;
  background: linear-gradient(90deg, rgba(210,175,90,0.16), rgba(210,175,90,0.06));
  border-bottom: 1px solid rgba(210,175,90,0.25);
  color: #e9dcb4;
  font-size: 12.5px;
  letter-spacing: 0.02em;
  text-align: center;
  padding: 7px 16px;
}
.credits-banner.hidden { display: none; }

/* ── Pro-study consent action ───────────────────────────────── */
.levi-pro-action { display: flex; justify-content: flex-start; margin: 2px 0 6px; }
.levi-pro-btn {
  background: rgba(210,175,90,0.12);
  border: 1px solid rgba(210,175,90,0.4);
  border-radius: 8px;
  color: #e9dcb4;
  font-size: 12px;
  padding: 5px 12px;
  cursor: pointer;
}
.levi-pro-btn:hover { background: rgba(210,175,90,0.24); }

/* ── Free/Pro chat switcher ─────────────────────────────────── */
.levi-mode { display: flex; gap: 4px; align-items: center; }
.levi-mode-btn {
  background: rgba(120,150,210,0.08);
  border: 1px solid rgba(120,150,210,0.22);
  border-radius: 999px;
  color: rgba(170,185,210,0.7);
  font-size: 11px;
  letter-spacing: 0.05em;
  padding: 4px 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.levi-mode-btn.active {
  background: rgba(210,175,90,0.16);
  border-color: rgba(210,175,90,0.5);
  color: #e9dcb4;
}

/* ── Chat toolbar (switcher + usage + new session) ──────────── */
.levi-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  padding: 8px 2px;
  border-bottom: 1px solid rgba(120,150,210,0.12);
}
.levi-usage {
  color: rgba(170,185,210,0.8);
  font-size: 11.5px;
  white-space: nowrap;
}
.levi-instance { padding: 4px 2px; }
.instance-status-msg { font-size: 11px; color: rgba(150,165,190,0.7); }

.levi-session-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 2px 2px;
  border-top: 1px solid rgba(120,150,210,0.12);
}
.levi-session-row .instance-new-btn { white-space: nowrap; }

/* ── Offer banner (lives on the original beta strip) ────────── */
.beta-banner.offer-active {
  background: rgba(210, 175, 90, 0.14);
  border-bottom: 1px solid rgba(210, 175, 90, 0.4);
  color: #e9dcb4;
  font-size: 12px;
  letter-spacing: 0.04em;
}

/* ── Study link cards (Levi's saved studies in chat) ─────────── */
.study-link-card {
  margin: 8px 0;
  display: flex;
  flex-direction: column;
  width: 340px;
  max-width: 100%;
  border: 1px solid rgba(210, 175, 90, 0.35);
  border-radius: 8px;
  background: rgba(210, 175, 90, 0.07);
  overflow: hidden;
}

.study-link-card.expanded {
  width: min(620px, 100%);
}

.slc-main {
  display: flex;
  align-items: stretch;
  gap: 12px;
  padding: 12px 12px 0;
}

/* A gold page: tall rectangle, folded corner, drop-cap yod + text lines. */
.slc-doc {
  position: relative;
  width: 112px;
  flex-shrink: 0;
  box-sizing: border-box;
  border: 1px solid rgba(210, 175, 90, 0.55);
  border-radius: 6px;
  background: linear-gradient(160deg, rgba(210, 175, 90, 0.18), rgba(210, 175, 90, 0.07));
  overflow: hidden;
}

.slc-doc::before {
  content: "";
  position: absolute;
  top: -1px;
  right: -1px;
  width: 0;
  height: 0;
  border-top: 26px solid #d2af5a;
  border-left: 26px solid transparent;
  z-index: 1;
}

/* Drop cap: the yod sits top-left like the opening initial of a page. */
.slc-yod {
  position: absolute;
  top: 2px;
  left: 6px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 58px;
  line-height: 1;
  color: #e9dcb4;
}

/* Fake text lines: the first starts right of the drop cap, the rest run below. */
.slc-lines {
  position: absolute;
  top: 34px;
  left: 12px;
  right: 12px;
  bottom: 12px;
}

.slc-lines i {
  position: absolute;
  height: 2px;
  border-radius: 1px;
  background: rgba(210, 175, 90, 0.45);
}

.slc-lines i:nth-child(1) { left: 30px; right: 0; top: 0; }
.slc-lines i:nth-child(2) { left: 0; right: 0; top: 22%; }
.slc-lines i:nth-child(3) { left: 0; right: 14px; top: 44%; }
.slc-lines i:nth-child(4) { left: 0; right: 4px; top: 66%; }
.slc-lines i:nth-child(5) { left: 0; right: 22px; top: 88%; }

.slc-actions {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.slc-btn {
  display: block;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  padding: 5px 10px;
  font-family: system-ui, sans-serif;
  font-size: 11.5px;
  border: 1px solid rgba(210, 175, 90, 0.4);
  border-radius: 5px;
  background: rgba(210, 175, 90, 0.1);
  color: #e9dcb4;
  cursor: pointer;
  user-select: none;
}

.slc-btn:hover {
  background: rgba(210, 175, 90, 0.2);
}

.slc-title {
  padding: 10px 12px 12px;
  font-family: "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 13px;
  font-style: italic;
  color: #e9dcb4;
  text-align: left;
  overflow-wrap: anywhere;
}

.slc-body {
  padding: 10px 12px;
  border-top: 1px solid rgba(210, 175, 90, 0.2);
  max-height: 320px;
  overflow-y: auto;
}

/* ── Splash screen ────────────────────────────────────────────── */
.splash {
  position: fixed;
  inset: 0;
  z-index: 999;
  background:
    radial-gradient(ellipse at 50% 36%, rgba(60, 110, 220, 0.18), transparent 62%),
    #050812;
  transition: opacity 0.6s ease;
}

.splash-done {
  opacity: 0;
  pointer-events: none;
}

/* The seraph owns the center of the screen, oversized and slightly raised. */
.splash-img {
  position: absolute;
  top: 38.1875vh;
  left: 50%;
  transform: translate(-50%, -50%);
  height: 93.75vh;
  width: auto;
  z-index: 0;
  filter: drop-shadow(0 0 60px rgba(80, 140, 255, 0.28));
}

/* The text lives in the bottom third, layered over the art. */
.splash-title {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 13vh;
  text-align: center;
  z-index: 1;
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-weight: bold;
  font-size: clamp(56px, 11vw, 116px);
  letter-spacing: 0.32em;
  text-indent: 0.32em;
  /* "UAL" is ~40px (0.34em) wider than "RIT" in this proportional serif, so
     the ink box centers but the T|U gap falls left of center. Shift right by
     half that imbalance so the middle letter-gap sits on the seraph's axis. */
  transform: translateX(0.17em);
  color: rgba(222, 233, 255, 0.98);
  text-shadow: 0 0 26px rgba(5, 8, 18, 0.85), 0 0 55px rgba(70, 130, 255, 0.5);
}

.splash-sub {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 6.5vh;
  text-align: center;
  z-index: 1;
  font-family: Georgia, "Palatino Linotype", "Times New Roman", serif;
  font-style: italic;
  font-size: clamp(16px, 2.2vw, 23px);
  letter-spacing: 0.18em;
  text-indent: 0.18em;
  color: rgba(175, 195, 235, 0.72);
  text-shadow: 0 0 18px rgba(5, 8, 18, 0.9);
}

/* ── Memorial footer ─────────────────────────────────────────── */
.memorial {
  position: fixed;
  bottom: 12px;
  left: 0;
  right: 0;
  text-align: center;
  font-family: Georgia, "Palatino Linotype", "Times New Roman", serif;
  font-size: 13px;
  font-style: italic;
  letter-spacing: 0.12em;
  color: rgba(150, 170, 210, 0.5);
  pointer-events: none;
  user-select: none;
  z-index: 5;
}

.chrome-actions {
  display: flex;
  flex-shrink: 0;
  gap: 8px;
}

.icon-button {
  background: none;
  border: 1px solid rgba(80, 140, 255, 0.12);
  color: rgba(160, 180, 220, 0.5);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  transition: color 0.2s, border-color 0.2s;
}

.icon-button:hover {
  color: rgba(160, 180, 220, 0.8);
  border-color: rgba(80, 140, 255, 0.3);
}

/* ── Focus headers clear the floating back button ─────────────── */
.nb-focus-header {
  padding-top: 52px;
}


/* ── Center panel tabs ───────────────────────────────────────── */
.center-tabs {
  position: fixed;
  top: var(--banner-h);
  left: var(--panel-width);
  right: 0;
  height: var(--center-tabs-h);
  z-index: 20;
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid rgba(80, 140, 255, 0.08);
  background: rgba(5, 8, 18, 0.4);
  transition: left 0.3s ease;
}

body.panel-closed .center-tabs {
  left: 0;
}

.center-tab {
  flex: 1;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: rgba(160, 175, 210, 0.5);
  font-family: system-ui, sans-serif;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
  transition: color 0.2s, border-color 0.2s;
}

.center-tab:hover {
  color: rgba(215, 230, 255, 0.85);
}

.center-tab.active {
  color: rgba(205, 225, 255, 0.95);
  border-bottom-color: var(--accent);
}


/* ── Center brand (under the tabs) ───────────────────────────── */
.center-brand {
  position: fixed;
  top: calc(var(--banner-h) + var(--center-tabs-h));
  left: var(--panel-width);
  right: 0;
  height: var(--center-brand-h);
  z-index: 19;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: left 0.3s ease;
}

body.panel-closed .center-brand {
  left: 0;
}

.center-brand .brand {
  font-size: 20px;
  letter-spacing: 2px;
  color: rgba(180, 210, 255, 0.85);
  text-shadow: 0 0 20px rgba(40, 80, 200, 0.4);
}

.center-brand .garden-line {
  font-size: 12px;
  color: rgba(136, 150, 190, 0.4);
  letter-spacing: 0.5px;
}


/* ── Center chrome respects the right panel when it opens ────── */
body.enrich-open .center-tabs,
body.enrich-open .center-brand,
body.enrich-open .focus-slot {
  right: min(500px, 45vw);
}

/* ── Brain gaze (user-studies graph view) ─────────────────────────────── */
.gaze-toggle {
  margin-left: auto;
  align-self: center;
  font-family: inherit;
  font-style: italic;
  font-size: 12.5px;
  letter-spacing: 0.03em;
  line-height: 1;
  color: rgba(150, 175, 245, 0.55);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.gaze-toggle:hover {
  color: rgba(210, 225, 255, 0.95);
  border-color: rgba(150, 185, 255, 0.55);
  background: rgba(25, 45, 90, 0.35);
}
.gaze-toggle:focus-visible {
  outline: 1px solid rgba(150, 185, 255, 0.7);
  outline-offset: 2px;
}

/* Gaze mode: the studies-blob graph stays, but every ground-shadow and
   glass layer over the brain goes away so the 3D model is the whole room. */
body.gaze .focus-slot::before { display: none; }
body.gaze .studies-graph,
body.gaze .studies-graph-head,
body.gaze .studies-graph-meta,
body.gaze .focus-content,
body.gaze .studies-tip {
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-shadow: none !important;
}
body.gaze .studies-tip { border-color: rgba(150, 185, 255, 0.12); }

/* The blob graph itself leaves the room too — only the whisper-quiet head
   row (with the toggle) stays so the brain is genuinely alone on screen. */
body.gaze .studies-graph-body {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s ease;
}
body.gaze .studies-graph-head { opacity: 0.55; transition: opacity 0.45s ease; }
body.gaze .studies-graph-head:hover { opacity: 1; }

/* ── Enrichment / interlinear: selectable + direction + outlines ───── */
.ilb-words,
.ilb-word,
.ilb-word-detail,
.word-detail,
.interlinear-words,
.iw-float,
.wd-original,
.wd-meaning,
.ilb-wd-def {
  user-select: text;
  -webkit-user-select: text;
}
.ilb-words .ilb-word { user-select: text; -webkit-user-select: text; }

/* Hebrew flow follows the master config; default LTR for English readers. */
.ilb-words,
.interlinear-words { direction: ltr; }
html[data-hebdir="rtl"] .ilb-words,
html[data-hebdir="rtl"] .interlinear-words { direction: rtl; }
html[data-hebdir="rtl"] .wd-original,
html[data-hebdir="rtl"] .ilb-wd-surface { direction: rtl; unicode-bidi: isolate; }

/* Lexicon outlines parsed live from the stored string (no DB writes). */
.lex-outline { max-height: 190px; overflow-y: auto; padding-right: 4px; }
.lex-line { padding-left: calc(var(--lex-depth, 0) * 15px); margin: 3px 0; line-height: 1.55; }
.lex-marker { color: rgba(216, 178, 80, 0.78); font-family: ui-monospace, monospace; font-size: 11px; margin-right: 6px; }
.lex-text { color: inherit; }
.recall-word-body .lex-outline { max-height: none; overflow: visible; }

/* Interlinear highlight tints (verse-anchored) */
.ilb-word.hl-gold { border-color: rgba(216, 178, 80, 0.75); background: rgba(216, 178, 80, 0.14); }
.ilb-word.hl-blue { border-color: rgba(95, 155, 230, 0.75); background: rgba(95, 155, 230, 0.14); }
.ilb-word.hl-violet { border-color: rgba(170, 130, 230, 0.75); background: rgba(170, 130, 230, 0.14); }
.ilb-word.hl-green { border-color: rgba(100, 200, 145, 0.75); background: rgba(100, 200, 145, 0.14); }
.ilb-word.hl-red { border-color: rgba(225, 95, 95, 0.75); background: rgba(225, 95, 95, 0.14); }

/* ── Settings card ─────────────────────────────────────────────── */
.settings-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.settings-copy { min-width: 0; }
.settings-label { font-family: system-ui, sans-serif; font-size: 13px; color: rgba(230, 236, 246, 0.92); margin-bottom: 3px; }
.settings-hint { font-size: 11.5px; line-height: 1.4; color: rgba(150, 165, 190, 0.6); }
.settings-seg { display: flex; gap: 6px; flex-shrink: 0; }
.settings-seg button {
  font-family: system-ui, sans-serif; font-size: 11.5px; padding: 6px 10px;
  border: 1px solid rgba(120, 150, 210, 0.25); border-radius: 6px;
  background: rgba(20, 28, 44, 0.7); color: rgba(215, 225, 240, 0.85); cursor: pointer;
}
.settings-seg button.active { border-color: rgba(216, 178, 80, 0.6); background: rgba(210, 175, 90, 0.14); color: #f5e9c8; }
.settings-note { font-size: 11px; color: rgba(150, 165, 190, 0.4); margin-top: 6px; }

/* ── Recall study session ─────────────────────────────────────── */
.recall-workbench.studying #recall-decks,
.recall-workbench.studying #recall-editor { display: none; }
.recall-session { flex: 1; display: flex; flex-direction: column; min-height: 0; position: relative; padding: 18px 28px 26px; }
.recall-session.hidden { display: none; }
.recall-session-head { display: flex; align-items: baseline; gap: 14px; flex-shrink: 0; }
.recall-session-title { font-family: "Palatino Linotype", Palatino, Georgia, serif; font-weight: bold; font-size: 17px; color: rgba(222, 233, 255, 0.92); flex: 1; }
.recall-session-progress { font-size: 12px; color: rgba(160, 175, 210, 0.55); }
.recall-stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; min-height: 0; }
.recall-face {
  width: min(680px, 100%); min-height: 210px; max-height: 56vh; overflow-y: auto;
  padding: 26px 30px; border: 1px solid rgba(120, 150, 210, 0.18); border-radius: 14px;
  background: linear-gradient(160deg, rgba(16, 22, 38, 0.92), rgba(9, 13, 24, 0.92));
  cursor: pointer; transition: border-color 0.2s;
}
.recall-face.flipped { border-color: rgba(216, 178, 80, 0.35); }
.recall-face-kicker { font-family: system-ui, sans-serif; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em; color: rgba(150, 190, 220, 0.5); margin-bottom: 10px; }
.recall-face-front { font-family: "Palatino Linotype", Palatino, Georgia, serif; font-size: 25px; line-height: 1.45; color: #eef2fb; }
.recall-face.flipped .recall-face-front { font-size: 15px; color: rgba(180, 195, 220, 0.62); margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid rgba(120, 150, 210, 0.12); }
.recall-face-back { font-size: 17px; line-height: 1.65; color: rgba(225, 232, 245, 0.92); }
.recall-face-back.hidden { display: none; }
.recall-face [contenteditable="true"] { outline: 1px dashed rgba(216, 178, 80, 0.55); border-radius: 4px; padding: 2px 4px; }
.recall-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center; }
.recall-grade { display: flex; gap: 8px; }
.recall-controls kbd { font-family: ui-monospace, monospace; font-size: 10px; opacity: 0.45; margin-left: 5px; }
.recall-session-hint { font-size: 11.5px; color: rgba(150, 170, 200, 0.45); }
.recall-done { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.recall-done-num { font-family: "Palatino Linotype", Palatino, Georgia, serif; font-size: 72px; color: #e9c766; text-shadow: 0 0 42px rgba(216, 178, 80, 0.35); line-height: 1; }
.recall-done-num span { font-size: 26px; color: rgba(160, 175, 210, 0.5); }
.recall-done-label { font-size: 13px; color: rgba(190, 205, 230, 0.7); }
.recall-done-sub { font-size: 12px; color: rgba(150, 170, 200, 0.5); }
.recall-done-actions { display: flex; gap: 8px; margin-top: 10px; }

/* Golden 777 — placeholder right-answer effect (modular) */
.recall-777 { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 14px; pointer-events: none; overflow: hidden; }
.recall-777 span {
  font-family: "Palatino Linotype", Palatino, Georgia, serif; font-weight: bold; font-size: 150px; line-height: 1;
  color: #e9c766; text-shadow: 0 0 30px rgba(233, 199, 102, 0.65), 0 0 80px rgba(216, 178, 80, 0.35);
  opacity: 0; transform: translateY(-120vh) scale(0.85);
}
.recall-777.play span { animation: recall777 1.7s cubic-bezier(0.22, 0.75, 0.3, 1) forwards; }
.recall-777.play span:nth-child(2) { animation-delay: 0.1s; }
.recall-777.play span:nth-child(3) { animation-delay: 0.2s; }
@keyframes recall777 {
  0% { opacity: 0; transform: translateY(-120vh) scale(0.85); }
  32% { opacity: 1; transform: translateY(0) scale(1); }
  62% { opacity: 1; transform: translateY(0) scale(1.05); }
  100% { opacity: 0; transform: translateY(120vh) scale(0.9); }
}

/* Recall editor breathing room + search */
.recall-decks { flex: 1; overflow-y: auto; padding-bottom: 24px; }
.recall-editor { flex: 1; overflow-y: auto; padding: 16px 28px 28px; gap: 16px; border-left: none; border-right: none; border-radius: 0; background: rgba(8, 12, 22, 0.25); }
.recall-editor-head { position: sticky; top: 0; z-index: 2; padding: 2px 0 12px; background: rgba(10, 10, 18, 0.96); }
.recall-editor-srs { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-family: system-ui, sans-serif; font-size: 11.5px; color: rgba(160, 180, 210, 0.7); }
.recall-editor-srs label { display: inline-flex; align-items: center; gap: 6px; }
.recall-editor-srs input { width: 64px; padding: 4px 6px; border: 1px solid rgba(120, 150, 210, 0.22); border-radius: 5px; background: rgba(20, 30, 55, 0.6); color: #e8eefc; font-size: 11.5px; outline: none; }
.recall-srs-label { text-transform: uppercase; letter-spacing: 0.06em; font-size: 10px; color: rgba(216, 178, 80, 0.6); }
.recall-search { width: 100%; padding: 6px 9px; border: 1px solid rgba(120, 150, 210, 0.18); border-radius: 6px; background: rgba(12, 16, 28, 0.7); color: rgba(225, 232, 245, 0.9); font-family: system-ui, sans-serif; font-size: 12px; outline: none; }
.recall-search::placeholder { color: rgba(160, 170, 190, 0.38); }
.recall-add-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.recall-add-wide { grid-column: 1 / -1; }
.recall-coming { font-size: 10px; letter-spacing: 0.04em; color: rgba(150, 165, 190, 0.35); text-transform: none; }

/* Side-panel enrichment interlinear highlight tints */
.iw-float.hl-gold .iw-original { color: rgba(233, 205, 130, 0.98); text-shadow: 0 0 16px rgba(216, 178, 80, 0.55); }
.iw-float.hl-blue .iw-original { color: rgba(150, 190, 250, 0.98); text-shadow: 0 0 16px rgba(95, 155, 230, 0.55); }
.iw-float.hl-violet .iw-original { color: rgba(200, 170, 245, 0.98); text-shadow: 0 0 16px rgba(170, 130, 230, 0.55); }
.iw-float.hl-green .iw-original { color: rgba(150, 225, 185, 0.98); text-shadow: 0 0 16px rgba(100, 200, 145, 0.55); }
.iw-float.hl-red .iw-original { color: rgba(250, 160, 160, 0.98); text-shadow: 0 0 16px rgba(225, 95, 95, 0.55); }

/* Recall: one centered column like the interlinear; clean session stage */
.recall-workbench { align-items: stretch; }
.recall-workbench .recall-head,
.recall-workbench .recall-decks,
.recall-workbench .recall-editor,
.recall-workbench .recall-session { width: min(860px, 100%); margin-left: auto; margin-right: auto; }
.recall-workbench.studying .recall-head { display: none; }
.recall-deck { transition: border-color 0.15s, background 0.15s; }
.recall-deck:hover { border-color: rgba(120, 160, 220, 0.28); background: rgba(12, 17, 30, 0.7); }
.recall-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 64px 24px; text-align: center; border: 1px dashed rgba(110, 150, 210, 0.16); border-radius: 14px;
  margin-top: 8px;
}
.recall-empty-title { font-family: "Palatino Linotype", Palatino, Georgia, serif; font-size: 17px; color: rgba(222, 233, 255, 0.8); }
.recall-empty-sub { font-size: 12.5px; color: rgba(150, 170, 200, 0.55); max-width: 360px; line-height: 1.5; }
.panel-list .recall-empty { padding: 26px 14px; border: none; margin-top: 0; }
.panel-list .recall-empty-title { font-size: 14.5px; }
.panel-list .recall-empty-sub { font-size: 11.5px; }
.recall-workbench.editing .recall-decks { display: none; }
.recall-workbench.editing .recall-editor { flex: 1; }
.recall-workbench.editing .recall-head { display: none; }
.recall-editor-head { background: linear-gradient(rgba(10, 12, 20, 0.98) 78%, rgba(10, 12, 20, 0)); padding-bottom: 14px; }
.recall-btn.gold { color: #f2e2b4; border-color: rgba(216, 178, 80, 0.32); background: rgba(210, 175, 90, 0.08); }
.recall-btn.gold:hover { background: rgba(210, 175, 90, 0.18); }
.recall-due { color: rgba(226, 196, 120, 0.85); }

/* ── Notebooks: continuous documents ─────────────────────────────── */
.nb-doc { display: flex; flex-direction: column; height: 100%; width: min(880px, 100%); margin: 0 auto; padding: 18px 28px 16px; }
.nb-doc-head { display: flex; align-items: center; gap: 14px; flex-shrink: 0; padding-bottom: 12px; border-bottom: 1px solid rgba(80, 140, 255, 0.1); }
.nb-doc-title {
  flex: 1; min-width: 0; background: transparent; border: none; outline: none;
  font-family: "Palatino Linotype", Palatino, Georgia, serif; font-weight: bold; font-size: 19px;
  color: rgba(230, 238, 252, 0.95); letter-spacing: 0.01em;
}
.nb-doc-title::placeholder { color: rgba(160, 175, 210, 0.3); }
.nb-doc-meta { font-size: 11.5px; color: rgba(160, 175, 210, 0.45); white-space: nowrap; }
.nb-doc-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.nb-mode-seg { display: flex; border: 1px solid rgba(120, 150, 210, 0.22); border-radius: 6px; overflow: hidden; }
.nb-mode-btn {
  font-family: system-ui, sans-serif; font-size: 11.5px; padding: 5px 10px; border: none;
  background: rgba(20, 28, 44, 0.7); color: rgba(200, 212, 232, 0.7); cursor: pointer;
}
.nb-mode-btn.active { background: rgba(210, 175, 90, 0.16); color: #f2e2b4; }
.nb-private-btn.active { color: #f2c9c9; border-color: rgba(225, 95, 95, 0.45); background: rgba(225, 95, 95, 0.1); }
.nb-doc-body { flex: 1; min-height: 0; display: flex; margin-top: 12px; }
.nb-doc-editor {
  flex: 1; width: 100%; resize: none; outline: none; border: none;
  background: transparent; color: rgba(222, 230, 245, 0.92);
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 13.5px; line-height: 1.75;
  caret-color: var(--accent); padding: 2px 6px 20px 2px;
}
.nb-doc-editor::placeholder { color: rgba(150, 165, 195, 0.33); }
.nb-doc-preview {
  flex: 1; width: 100%; overflow-y: auto; padding: 2px 6px 26px 2px;
  font-family: "Palatino Linotype", Palatino, Georgia, serif; font-size: 16px; line-height: 1.75;
  color: rgba(222, 230, 245, 0.92);
}
.nb-doc-footer { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; padding-top: 8px; border-top: 1px solid rgba(80, 140, 255, 0.08); }
.nb-doc-status { font-size: 11px; color: rgba(150, 190, 220, 0.55); min-height: 14px; }
.nb-doc-counts { font-size: 11px; color: rgba(150, 170, 200, 0.4); }

/* Preview typography */
.nb-doc-preview h1, .nb-doc-preview h2, .nb-doc-preview h3, .nb-doc-preview h4 { color: #eef2fb; margin: 18px 0 8px; line-height: 1.3; }
.nb-doc-preview h1 { font-size: 26px; }
.nb-doc-preview h2 { font-size: 21px; }
.nb-doc-preview h3 { font-size: 17.5px; }
.nb-doc-preview h4 { font-size: 15.5px; color: rgba(222, 233, 255, 0.85); }
.nb-doc-preview p { margin: 8px 0; }
.nb-doc-preview ul, .nb-doc-preview ol { margin: 8px 0 8px 24px; }
.nb-doc-preview li { margin: 4px 0; }
.nb-doc-preview blockquote {
  margin: 12px 0; padding: 8px 16px; border-left: 2px solid rgba(216, 178, 80, 0.45);
  background: rgba(210, 175, 90, 0.05); border-radius: 0 8px 8px 0;
  font-style: italic; color: rgba(223, 228, 240, 0.86);
}
.nb-doc-preview blockquote p { margin: 3px 0; }
.nb-doc-preview hr { border: none; border-top: 1px solid rgba(120, 150, 210, 0.16); margin: 18px 0; }
.nb-doc-preview code { font-family: ui-monospace, monospace; font-size: 13px; background: rgba(30, 44, 68, 0.55); padding: 1px 6px; border-radius: 4px; }
.nb-doc-preview pre { background: rgba(8, 12, 22, 0.7); border: 1px solid rgba(110, 150, 210, 0.12); border-radius: 8px; padding: 12px 14px; overflow-x: auto; margin: 12px 0; }
.nb-doc-preview pre code { background: none; padding: 0; }
.nb-doc-preview a { color: rgba(140, 180, 255, 0.9); }
.nb-preview-empty { color: rgba(150, 170, 200, 0.4); font-style: italic; }

/* Clickable references + verse embeds */
.nb-ref { color: rgba(226, 196, 120, 0.95); border-bottom: 1px dotted rgba(226, 196, 120, 0.45); cursor: pointer; }
.nb-ref:hover { background: rgba(216, 178, 80, 0.1); }
.nb-embed {
  display: block; margin: 12px 0; padding: 10px 14px;
  border-left: 2px solid rgba(216, 178, 80, 0.5); background: rgba(210, 175, 90, 0.05);
  border-radius: 0 8px 8px 0; cursor: pointer;
}
.nb-embed-ref { display: block; font-family: system-ui, sans-serif; font-size: 10.5px; letter-spacing: 0.05em; text-transform: uppercase; color: rgba(216, 178, 80, 0.7); margin-bottom: 4px; }
.nb-embed-text { font-style: italic; color: rgba(223, 228, 240, 0.88); }
.nb-doc-preview mark { color: inherit; border-radius: 2px; padding: 0 1px; }

/* Panel notebook list */
.nb-panel-tools { display: flex; gap: 6px; padding: 8px 14px 6px; }
.nb-panel-tools .panel-search-input { flex: 1; }
.nb-list { display: flex; flex-direction: column; gap: 6px; padding: 4px 14px 18px; overflow-y: auto; }
.nb-list-item {
  padding: 9px 11px; border: 1px solid rgba(110, 150, 210, 0.1); border-radius: 8px;
  background: rgba(8, 12, 22, 0.45); cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.nb-list-item:hover { background: rgba(14, 20, 34, 0.7); border-color: rgba(120, 160, 220, 0.24); }
.nb-list-item.active { border-color: rgba(216, 178, 80, 0.35); background: rgba(210, 175, 90, 0.06); }
.nb-list-title { font-family: system-ui, sans-serif; font-size: 13px; font-weight: 600; color: rgba(230, 236, 246, 0.9); display: flex; align-items: center; gap: 6px; }
.nb-list-snippet { font-size: 11.5px; color: rgba(170, 185, 210, 0.55); margin-top: 3px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.nb-lock { font-size: 11px; opacity: 0.7; }
.nb-panel-empty { padding: 18px 14px; font-size: 12.5px; color: rgba(150, 170, 200, 0.45); }

/* Highlight bar: note row + wrapping */
.highlight-bar { flex-direction: column; align-items: stretch; gap: 7px; }
.hl-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.hl-note {
  width: min(460px, 78vw); resize: vertical; min-height: 38px; max-height: 140px;
  font-family: "Palatino Linotype", Palatino, Georgia, serif; font-size: 13px; line-height: 1.5;
  background: rgba(20, 28, 44, 0.72); border: 1px solid rgba(120, 150, 210, 0.24); border-radius: 6px;
  color: #e8eefc; padding: 7px 9px; outline: none;
}
.hl-note:focus { border-color: rgba(216, 178, 80, 0.55); }
.hl-note.hidden { display: none; }

/* Notebook context menu */
.nb-ctx {
  position: fixed; z-index: 320; display: flex; flex-direction: column; min-width: 210px;
  padding: 5px; background: rgba(10, 15, 28, 0.98); border: 1px solid rgba(120, 150, 210, 0.24);
  border-radius: 8px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55); backdrop-filter: blur(8px);
}
.nb-ctx.hidden { display: none; }
.nb-ctx button {
  text-align: left; font-family: system-ui, sans-serif; font-size: 12px; padding: 7px 10px;
  border: none; border-radius: 5px; background: transparent; color: rgba(215, 225, 240, 0.88); cursor: pointer;
}
.nb-ctx button:hover:not(:disabled) { background: rgba(80, 140, 255, 0.14); }
.nb-ctx button:disabled { opacity: 0.35; cursor: default; }
.recall-card-note-link { cursor: pointer; }
.recall-card-note { margin-top: 6px; padding-top: 6px; border-top: 1px dashed rgba(120, 150, 210, 0.16); font-size: 12px; color: rgba(160, 190, 225, 0.8); font-style: italic; }
.nb-notebook-link { color: rgba(150, 200, 255, 0.95); border-bottom: 1px solid rgba(150, 200, 255, 0.35); cursor: pointer; }
.nb-notebook-link:hover { background: rgba(80, 140, 255, 0.12); }
.nb-doc-editor.hidden, .nb-doc-preview.hidden { display: none; }

/* Notes across side panels + center picker */
.nb-panel { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.nb-panel-head { gap: 8px; }
.nb-panel-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb-panel-note {
  flex: 1; overflow-y: auto; padding: 12px 16px 28px;
  font-family: "Palatino Linotype", Palatino, Georgia, serif; font-size: 14.5px; line-height: 1.7;
  color: rgba(222, 230, 245, 0.9); user-select: text; -webkit-user-select: text;
}
.nb-panel-note h1, .nb-panel-note h2, .nb-panel-note h3, .nb-panel-note h4 { color: #eef2fb; margin: 14px 0 6px; line-height: 1.3; }
.nb-panel-note h1 { font-size: 20px; }
.nb-panel-note h2 { font-size: 18px; }
.nb-panel-note h3 { font-size: 16px; }
.nb-panel-note h4 { font-size: 14.5px; }
.nb-panel-note p { margin: 7px 0; }
.nb-panel-note ul, .nb-panel-note ol { margin: 7px 0 7px 22px; }
.nb-panel-note li { margin: 3px 0; }
.nb-panel-note blockquote { margin: 10px 0; padding: 6px 12px; border-left: 2px solid rgba(216, 178, 80, 0.45); background: rgba(210, 175, 90, 0.05); font-style: italic; }
.nb-panel-note blockquote p { margin: 2px 0; }
.nb-panel-note code { font-family: ui-monospace, monospace; font-size: 12px; background: rgba(30, 44, 68, 0.55); padding: 1px 4px; border-radius: 4px; }
.nb-panel-note pre { background: rgba(8, 12, 22, 0.7); border: 1px solid rgba(110, 150, 210, 0.12); border-radius: 8px; padding: 10px 12px; overflow-x: auto; }
.nb-panel-note .nb-embed { margin: 10px 0; padding: 8px 12px; }
.nb-panel-note mark { color: inherit; border-radius: 2px; padding: 0 1px; }

.nb-doc-select {
  max-width: 180px; flex-shrink: 1; min-width: 90px;
  font-family: system-ui, sans-serif; font-size: 11.5px; padding: 5px 8px;
  background: rgba(20, 28, 44, 0.7); color: rgba(210, 222, 240, 0.85);
  border: 1px solid rgba(120, 150, 210, 0.22); border-radius: 6px; outline: none; cursor: pointer;
}

/* Notes: searchable picker popover */
.nb-picker { position: relative; flex-shrink: 0; }
.nb-picker-btn {
  display: inline-flex; align-items: center; gap: 6px; max-width: 190px;
  font-family: system-ui, sans-serif; font-size: 11.5px; padding: 6px 10px;
  background: rgba(20, 28, 44, 0.7); color: rgba(210, 222, 240, 0.88);
  border: 1px solid rgba(120, 150, 210, 0.22); border-radius: 6px; cursor: pointer;
}
.nb-picker-btn:hover { background: rgba(30, 40, 60, 0.85); }
#nb-picker-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb-picker-caret { font-size: 9px; opacity: 0.6; }
.nb-picker-pop {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 90;
  width: min(320px, 82vw); display: flex; flex-direction: column; gap: 6px;
  padding: 8px; background: rgba(10, 15, 28, 0.98); border: 1px solid rgba(120, 150, 210, 0.24);
  border-radius: 10px; box-shadow: 0 14px 40px rgba(0, 0, 0, 0.6); backdrop-filter: blur(8px);
}
.nb-picker-pop.hidden { display: none; }
.nb-picker-list { display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow-y: auto; }
.nb-picker-item { padding: 7px 9px; border-radius: 6px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.nb-picker-item:hover { background: rgba(80, 140, 255, 0.12); }
.nb-picker-item.active { background: rgba(210, 175, 90, 0.1); }
.nb-picker-title { font-family: system-ui, sans-serif; font-size: 12.5px; color: rgba(230, 236, 246, 0.92); display: flex; gap: 6px; align-items: center; }
.nb-picker-snippet { font-size: 11px; color: rgba(160, 175, 205, 0.55); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nb-picker-new {
  font-family: system-ui, sans-serif; font-size: 11.5px; padding: 7px 9px; text-align: left;
  border: 1px dashed rgba(120, 150, 210, 0.28); border-radius: 6px; background: transparent;
  color: rgba(200, 215, 240, 0.75); cursor: pointer;
}
.nb-picker-new:hover { border-color: rgba(216, 178, 80, 0.5); color: #f2e2b4; }

/* Notes: side-panel write mode, filters, highlight results */
.nb-panel-editor {
  flex: 1; width: 100%; resize: none; outline: none; border: none; background: transparent;
  color: rgba(222, 230, 245, 0.92); font-family: ui-monospace, Menlo, monospace;
  font-size: 12.5px; line-height: 1.7; padding: 12px 16px 20px;
}
.nb-panel-editor.hidden, .nb-panel-note.hidden { display: none; }
.nb-panel-status { min-height: 18px; padding: 0 16px 8px; font-size: 10.5px; color: rgba(150, 190, 220, 0.55); }
.nb-search-filters { display: flex; align-items: center; gap: 6px; padding: 0 14px 6px; flex-wrap: wrap; }
.nb-filter-chip {
  font-family: system-ui, sans-serif; font-size: 10.5px; letter-spacing: 0.03em; padding: 3px 8px;
  border: 1px solid rgba(120, 150, 210, 0.2); border-radius: 999px;
  background: rgba(20, 28, 44, 0.5); color: rgba(190, 205, 230, 0.65); cursor: pointer;
}
.nb-filter-chip.active { border-color: rgba(216, 178, 80, 0.5); background: rgba(210, 175, 90, 0.12); color: #f2e2b4; }
.nb-filter-dot {
  width: 14px; height: 14px; padding: 0; border-radius: 50%; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: var(--dot, gold); opacity: 0.55;
}
.nb-filter-dot[data-note-filter="gold"] { background: rgba(216, 178, 80, 0.85); }
.nb-filter-dot[data-note-filter="blue"] { background: rgba(95, 155, 230, 0.85); }
.nb-filter-dot[data-note-filter="violet"] { background: rgba(170, 130, 230, 0.85); }
.nb-filter-dot[data-note-filter="green"] { background: rgba(100, 200, 145, 0.85); }
.nb-filter-dot[data-note-filter="red"] { background: rgba(225, 95, 95, 0.85); }
.nb-filter-dot.active { opacity: 1; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.55); }
.nb-hl-item { border-left: 3px solid rgba(216, 178, 80, 0.5); }
.nb-hl-kicker { font-size: 10.5px; letter-spacing: 0.04em; color: rgba(150, 190, 220, 0.6); }
.nb-hl-note { font-style: italic; color: rgba(160, 190, 225, 0.7); }

/* Generated-content refs (studies/chat) + note markdown extras */
.md-ref { color: rgba(226, 196, 120, 0.92); border-bottom: 1px dotted rgba(226, 196, 120, 0.4); cursor: pointer; }
.md-ref:hover { background: rgba(216, 178, 80, 0.1); }
.md-embed { cursor: pointer; }
li[style*="--md-depth"] { padding-left: calc(var(--md-depth, 0) * 18px); }
.md-task { margin-right: 6px; color: rgba(216, 178, 80, 0.8); }
.nb-doc-preview del, .nb-panel-note del { color: rgba(170, 185, 210, 0.55); }
.nb-word {
  display: inline-flex; align-items: baseline; gap: 4px; padding: 0 5px;
  border-bottom: 1px dotted rgba(140, 180, 255, 0.5); cursor: pointer; color: rgba(200, 218, 245, 0.95);
}
.nb-word:hover { background: rgba(80, 140, 255, 0.1); }
.nb-word.missing { opacity: 0.6; cursor: default; }
.nb-word-lemma { color: rgba(228, 214, 160, 0.95); }
.nb-word-xlit { font-size: 0.82em; font-style: italic; color: rgba(150, 170, 205, 0.65); }
.nb-word-gloss { font-size: 0.86em; color: rgba(190, 205, 230, 0.75); }

/* Ask Levi across notes */
.nb-ask-card { width: min(580px, calc(100vw - 32px)); }
.nb-ask-body { display: flex; flex-direction: column; gap: 10px; }
.nb-ask-list {
  display: flex; flex-direction: column; gap: 2px; max-height: 270px; overflow-y: auto;
  border: 1px solid rgba(120, 150, 210, 0.16); border-radius: 8px; padding: 6px; background: rgba(8, 12, 22, 0.4);
}
.nb-ask-row {
  display: grid; grid-template-columns: 18px 1fr; gap: 2px 8px; align-items: center;
  padding: 6px 8px; border-radius: 6px; cursor: pointer;
}
.nb-ask-row:hover { background: rgba(80, 140, 255, 0.08); }
.nb-ask-row input { grid-row: span 2; margin: 0; accent-color: #d8b250; }
.nb-ask-title { font-family: system-ui, sans-serif; font-size: 12.5px; color: rgba(230, 236, 246, 0.9); display: flex; gap: 6px; align-items: center; }
.nb-ask-snippet { grid-column: 2; font-size: 11px; color: rgba(160, 175, 205, 0.55); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nb-ask-row.private { opacity: 0.55; cursor: default; }
.nb-ask-prompt {
  width: 100%; resize: vertical; min-height: 64px; max-height: 180px;
  font-family: "Palatino Linotype", Palatino, Georgia, serif; font-size: 13.5px; line-height: 1.5;
  background: rgba(20, 30, 55, 0.6); border: 1px solid rgba(120, 150, 210, 0.24); border-radius: 8px;
  color: #e8eefc; padding: 9px 11px; outline: none;
}
.nb-ask-prompt:focus { border-color: rgba(216, 178, 80, 0.55); }
.nb-ask-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.nb-ask-meta { font-size: 10.5px; color: rgba(150, 175, 205, 0.55); }

/* Highlight embeds */
.nb-hl-embed {
  display: flex; flex-direction: column; gap: 2px; margin: 10px 0; padding: 8px 12px;
  border-left: 3px solid rgba(216, 178, 80, 0.6); background: rgba(210, 175, 90, 0.05);
  border-radius: 0 8px 8px 0; cursor: pointer;
}
.nb-hl-embed:hover { background: rgba(210, 175, 90, 0.09); }
.nb-hl-embed-ref { font-family: system-ui, sans-serif; font-size: 10.5px; letter-spacing: 0.05em; text-transform: uppercase; color: rgba(190, 205, 235, 0.6); }
.nb-hl-embed-text { font-style: italic; color: rgba(223, 228, 240, 0.9); }
.nb-hl-embed-note { font-size: 12px; color: rgba(160, 190, 225, 0.75); }
.hl-edge-gold { border-left-color: rgba(216, 178, 80, 0.7); background: rgba(216, 178, 80, 0.05); }
.hl-edge-blue { border-left-color: rgba(95, 155, 230, 0.7); background: rgba(95, 155, 230, 0.05); }
.hl-edge-violet { border-left-color: rgba(170, 130, 230, 0.7); background: rgba(170, 130, 230, 0.05); }
.hl-edge-green { border-left-color: rgba(100, 200, 145, 0.7); background: rgba(100, 200, 145, 0.05); }
.hl-edge-red { border-left-color: rgba(225, 95, 95, 0.7); background: rgba(225, 95, 95, 0.05); }
#hl-embed.hidden { display: none; }
