/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #ede5d0;
  --text: #1a1612;
  --muted: #6b6055;
  --muted-light: #9a8e82;
  --border: #e0d8cc;
  --border-light: #ede7df;
  --card-bg: #f7f0de;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
  --shadow-md: 0 4px 20px rgba(0,0,0,.09), 0 1px 4px rgba(0,0,0,.05);
  --shadow-lg: 0 12px 48px rgba(0,0,0,.13), 0 4px 12px rgba(0,0,0,.06);
  --radius: 12px;
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-serif: 'Lora', Georgia, serif;
  --font-ui: 'Inter', system-ui, -apple-system, sans-serif;
  --gold: #b8952a;
  --gold-warm: #c9a84c;
  --header-bg: #111009;
  --header-text: #f0e8d8;
  --header-accent: #c9a84c;
  --assistant-bubble: #f0ece3;
}

/* ── Dark mode ── */
html.dark {
  --bg: #131110;
  --text: #e8dfd0;
  --muted: #8a7f70;
  --muted-light: #5a5248;
  --border: #282420;
  --border-light: #201d1a;
  --card-bg: #1a1714;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.3), 0 2px 8px rgba(0,0,0,.2);
  --shadow-md: 0 4px 20px rgba(0,0,0,.4), 0 1px 4px rgba(0,0,0,.2);
  --shadow-lg: 0 12px 48px rgba(0,0,0,.55), 0 4px 12px rgba(0,0,0,.3);
  --header-bg: #0c0a08;
  --header-text: #e8dfd0;
  --header-accent: #b09050;
  --assistant-bubble: #1e1b17;
}

html.dark .premium-section { background: #1a1714; border-color: #3a3018; }
html.dark .premium-select { background: #13110e; border-color: #4a3a18; color: var(--text); }
html.dark .chat-message.user { background: #1f1c16; }
html.dark .section-progress-bar-wrap { background: var(--border); }
html.dark .book-selector-wrap select { background: var(--bg); color: var(--text); border-color: var(--border); }
html.dark .work-card { border-color: var(--border); }
html.dark .continue-banner { background: var(--card-bg); }
/* Dark mode: remove texture and vignette — dark bg has its own depth */
html.dark body { background-image: none; }

html { font-size: 17px; }

body {
  background-color: var(--bg);
  /* subtle grain tiles over the parchment base — scroll-attached to avoid repaint jank */
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.07'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  color: var(--text);
  font-family: var(--font-ui);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ── Dark mode toggle ── */
.theme-toggle {
  background: none;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 20px;
  color: var(--header-text);
  cursor: pointer;
  font-size: .88rem;
  line-height: 1;
  padding: .35rem .72rem;
  transition: background .2s, border-color .2s;
}
.theme-toggle:hover {
  background: rgba(255,255,255,.09);
  border-color: rgba(255,255,255,.38);
}

/* ── Header actions (auth links + theme toggle) ── */
.header-actions {
  position: absolute;
  top: 1.1rem;
  right: 1.4rem;
  display: flex;
  align-items: center;
  gap: .75rem;
}

.header-account {
  font-size: .7rem;
  color: var(--header-accent);
  letter-spacing: .04em;
  opacity: .8;
}

.header-auth-link {
  font-family: var(--font-ui);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--header-text);
  opacity: .75;
  transition: opacity .15s;
}
.header-auth-link:hover { opacity: 1; }
.header-auth-link--primary {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  padding: .32rem .7rem;
  border-radius: 20px;
  opacity: 1;
}
.header-auth-link--primary:hover { background: rgba(255,255,255,.18); }

/* Reader nav toggle */
.nav-right { display: flex; align-items: center; gap: .75rem; }
.theme-toggle--nav { font-size: .82rem; padding: .22rem .56rem; }

/* ═══════════════════════════════
   HAMBURGER + SIDE DRAWER
═══════════════════════════════ */

/* ── Hamburger button ── */
.menu-btn {
  position: absolute;
  top: 1.1rem;
  left: 1.4rem;
  background: none;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px;
  color: var(--header-text);
  cursor: pointer;
  padding: .45rem .55rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, border-color .2s;
  z-index: 10;
}
.menu-btn:hover {
  background: rgba(255,255,255,.09);
  border-color: rgba(255,255,255,.38);
}

/* ── Backdrop ── */
.menu-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 299;
  animation: backdropIn .22s ease forwards;
}
@keyframes backdropIn { from { opacity: 0; } to { opacity: 1; } }

/* ── Drawer ── */
.menu-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(380px, 92vw);
  background: var(--card-bg);
  z-index: 300;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: translateX(-100%);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}
.menu-drawer.is-open {
  transform: translateX(0);
}

.menu-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.4rem 1.1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--header-bg);
}
.menu-drawer-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 400;
  letter-spacing: .06em;
  color: var(--header-text);
}
.menu-drawer-close {
  background: none;
  border: none;
  color: var(--header-text);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: .25rem .4rem;
  opacity: .65;
  transition: opacity .15s;
  border-radius: 4px;
}
.menu-drawer-close:hover { opacity: 1; }

.menu-drawer-body {
  overflow-y: auto;
  flex: 1;
  padding: .5rem 0 2rem;
}

/* ── Accordion sections ── */
.menu-section {
  border-bottom: 1px solid var(--border-light);
}
.menu-section:last-child { border-bottom: none; }

.menu-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.05rem 1.4rem;
  font-family: var(--font-ui);
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: color .15s;
}
.menu-section-title::-webkit-details-marker { display: none; }
.menu-section-title::after {
  content: '+';
  font-size: 1.1rem;
  font-weight: 300;
  color: var(--muted);
  transition: transform .2s;
  flex-shrink: 0;
}
.menu-section[open] > .menu-section-title::after {
  content: '−';
}
.menu-section-title:hover { color: var(--gold); }

.menu-section-body {
  padding: .25rem 1.4rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: .85rem;
}
.menu-section-body p {
  font-family: var(--font-serif);
  font-size: .88rem;
  line-height: 1.72;
  color: var(--muted);
}

/* ── Reading plan list ── */
.reading-plan-intro {
  font-style: italic;
}
.reading-plan-list {
  list-style: none;
  counter-reset: plan;
  display: flex;
  flex-direction: column;
  gap: .9rem;
  padding: 0;
}
.reading-plan-list li {
  counter-increment: plan;
  display: grid;
  grid-template-columns: 1.6rem 1fr auto;
  gap: .1rem .5rem;
  font-size: .85rem;
}
.reading-plan-list li::before {
  content: counter(plan);
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--gold);
  line-height: 1.3;
  grid-row: 1 / 3;
  padding-top: .05rem;
}
.reading-plan-list strong {
  font-family: var(--font-ui);
  font-size: .8rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: .02em;
  display: block;
}
.reading-plan-list span {
  font-family: var(--font-serif);
  font-size: .82rem;
  color: var(--muted);
  line-height: 1.55;
  display: block;
}
.reading-plan-item {
  cursor: pointer;
  border-radius: 6px;
  padding: .3rem .4rem .3rem 0;
  margin: -.3rem -.4rem -.3rem 0;
  transition: background .15s;
}
.reading-plan-item:hover { background: var(--border-light); }
.reading-plan-item strong::after {
  content: ' ›';
  color: var(--gold);
  font-weight: 400;
}

/* ── Reading plan detail modal ── */
.plan-modal-wrap[hidden] { display: none; }
.plan-modal-wrap {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: backdropIn .2s ease forwards;
}
.plan-modal-backdrop-inner {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.52);
}
.plan-modal {
  position: relative;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 800px;
  max-height: 88vh;
  overflow-y: auto;
  z-index: 1;
  animation: modalSlideUp .25s cubic-bezier(.2,.8,.4,1) forwards;
}
@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
.plan-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 1.75rem 1.2rem;
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  background: var(--card-bg);
  z-index: 1;
}
.plan-modal-title {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 400;
  color: var(--text);
  letter-spacing: .03em;
}
.plan-modal-subtitle {
  font-family: var(--font-ui);
  font-size: .7rem;
  color: var(--muted);
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-top: .25rem;
}
.plan-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--muted);
  padding: .3rem .45rem;
  border-radius: 6px;
  flex-shrink: 0;
  transition: color .15s, background .15s;
  margin-top: .1rem;
}
.plan-modal-close:hover { color: var(--text); background: var(--border-light); }

.plan-modal-body {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.1rem;
  padding: 1.5rem 1.75rem 2rem;
}
@media (max-width: 600px) {
  .plan-modal-body { grid-template-columns: 1fr; }
}

/* ── Plan cards ── */
.plan-card {
  border-radius: 10px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .95rem;
}
.plan-card--casual  { background: #fdf8f0; border: 1.5px solid #e0cca0; }
.plan-card--focused { background: #f5f5f8; border: 1.5px solid #d8d8e0; }
.plan-card--grind   { background: #fdf2ee; border: 1.5px solid #e0b8a8; }
html.dark .plan-card--casual  { background: #201c10; border-color: #3a3018; }
html.dark .plan-card--focused { background: #181820; border-color: #2a2a38; }
html.dark .plan-card--grind   { background: #201410; border-color: #3a2018; }

.plan-card-header {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
}
.plan-card-icon { font-size: 1.6rem; flex-shrink: 0; line-height: 1; }
.plan-card-name {
  font-family: var(--font-ui);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text);
}
.plan-card-tagline {
  font-family: var(--font-serif);
  font-size: .82rem;
  color: var(--muted);
  font-style: italic;
  margin-top: .15rem;
  line-height: 1.4;
}

.plan-card-stats {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .35rem .8rem;
  align-items: baseline;
}
.plan-card-stats dt {
  font-family: var(--font-ui);
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted-light);
  white-space: nowrap;
}
.plan-card-stats dd {
  font-family: var(--font-ui);
  font-size: .83rem;
  font-weight: 500;
  color: var(--text);
}

.plan-card-tip {
  font-family: var(--font-serif);
  font-size: .83rem;
  color: var(--muted);
  line-height: 1.68;
  border-top: 1px solid rgba(0,0,0,.07);
  padding-top: .9rem;
  margin: 0;
  flex: 1;
}
html.dark .plan-card-tip { border-color: rgba(255,255,255,.07); }

/* ── Feedback form ── */
.feedback-form {
  display: flex;
  flex-direction: column;
  gap: .9rem;
}
.feedback-field {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.feedback-field label {
  font-family: var(--font-ui);
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.feedback-optional {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  opacity: .75;
}
.feedback-field input,
.feedback-field textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-serif);
  font-size: .88rem;
  line-height: 1.55;
  padding: .6rem .85rem;
  resize: vertical;
  transition: border-color .15s;
  width: 100%;
}
.feedback-field input:focus,
.feedback-field textarea:focus {
  border-color: var(--gold);
  outline: none;
}
.feedback-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.feedback-submit {
  background: var(--header-bg);
  border: none;
  border-radius: 8px;
  color: var(--header-text);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .06em;
  padding: .6rem 1.2rem;
  text-transform: uppercase;
  transition: opacity .15s;
}
.feedback-submit:hover { opacity: .8; }
.feedback-submit:disabled { opacity: .45; cursor: not-allowed; }
.feedback-status {
  font-family: var(--font-serif);
  font-size: .82rem;
  color: var(--muted);
  font-style: italic;
}
.feedback-status.success { color: #3a7a3a; }
.feedback-status.error   { color: #b02020; }
html.dark .feedback-status.success { color: #6ab86a; }
html.dark .feedback-status.error   { color: #e06060; }

/* ═══════════════════════════════
   HOME PAGE
═══════════════════════════════ */

/* ── Site header ── */
.site-header {
  background: var(--header-bg);
  color: var(--header-text);
  padding: 4.5rem 2rem 3.75rem;
  text-align: center;
  overflow: hidden;
}

/* Warm radial glow behind title */
.site-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(201,168,76,.11) 0%, transparent 60%);
  pointer-events: none;
}

.header-inner { position: relative; }

.site-title {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 7vw, 4.5rem);
  font-weight: 300;
  letter-spacing: .06em;
  margin-bottom: .6rem;
  color: var(--header-text);
  line-height: 1.08;
}

.site-subtitle {
  font-family: var(--font-ui);
  font-size: .7rem;
  color: var(--header-accent);
  letter-spacing: .22em;
  text-transform: uppercase;
  opacity: .85;
}

/* ── Home main ── */
.home-main {
  max-width: 980px;
  margin: 0 auto;
  padding: 3.5rem 1.5rem 5rem;
}

/* ── Continue reading banner ── */
.continue-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.4rem;
  margin-bottom: 2.5rem;
  font-size: .82rem;
  color: var(--muted);
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}
.continue-icon { font-size: 1rem; flex-shrink: 0; }
.continue-label {
  font-size: .8rem;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.continue-select {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: .8rem;
  padding: .3rem .55rem;
  cursor: pointer;
  appearance: auto;
}
.continue-select:focus { outline: none; border-color: var(--gold); }
html.dark .continue-select { background: var(--card-bg); border-color: var(--border); }
.continue-link {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  letter-spacing: .02em;
  opacity: .75;
  transition: opacity .15s;
}
.continue-link:hover { opacity: 1; }

/* ── Section heading labels ── */
.section-label {
  font-family: var(--font-ui);
  font-size: .67rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Within guide / works sections */
.guide-section > .section-label,
.works-section > .section-label {
  display: block;
  margin-bottom: 1.5rem;
}

/* ── Guide section ── */
.guide-section { margin-bottom: 3.5rem; }

.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.guide-card {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  cursor: pointer;
  display: flex;
  gap: 1.1rem;
  align-items: flex-start;
  transition: border-color .2s, box-shadow .2s;
  box-shadow: var(--shadow-sm);
}

.guide-card input[type="radio"] { position: absolute; opacity: 0; }

/* Selected state: ring in the guide's color (set via --c on the label) */
.guide-card:has(input:checked) {
  border-color: var(--c, var(--text));
  box-shadow: 0 0 0 1px var(--c, var(--text)), var(--shadow-md);
}

.guide-card:hover:not(:has(input:checked)) {
  border-color: var(--muted-light);
  box-shadow: var(--shadow-md);
}

.guide-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 400;
  flex-shrink: 0;
  letter-spacing: 0;
}

.guide-info {
  display: flex;
  flex-direction: column;
  gap: .22rem;
}

.guide-name {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: .92rem;
  letter-spacing: .01em;
  color: var(--text);
}

.guide-epithet {
  font-size: .72rem;
  color: var(--muted);
  font-style: italic;
  line-height: 1.35;
}

.guide-desc {
  font-size: .79rem;
  color: var(--muted);
  margin-top: .3rem;
  line-height: 1.55;
}

/* Scholar avatar */
.scholar-avatar {
  font-size: 1.15rem;
}

/* ── Character toggle ── */
.character-toggle { margin-top: 1.25rem; }

.character-toggle-summary {
  font-size: .72rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  padding: .6rem 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: .5rem;
  user-select: none;
  letter-spacing: .05em;
}
.character-toggle-summary::-webkit-details-marker { display: none; }
.character-toggle-summary::before {
  content: "▸";
  font-size: .68rem;
  transition: transform .2s;
}
details[open] .character-toggle-summary::before { transform: rotate(90deg); }
.character-toggle-summary:hover { color: var(--text); }
.guide-grid--characters { margin-top: .75rem; }
.guide-card--character { opacity: .88; }

/* ── Premium guides ── */
.premium-section {
  margin-top: 1.5rem;
  padding: 1.25rem 1.5rem;
  background: #fef9ec;
  border: 1px solid #e8d890;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.premium-label {
  font-size: .67rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .12em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: .65rem;
}

.premium-badge {
  background: #b8952a;
  color: #fff;
  font-size: .64rem;
  padding: .2rem .52rem;
  border-radius: 4px;
  letter-spacing: .06em;
  font-weight: 700;
}

.premium-select {
  width: 100%;
  border: 1px solid #d4b84a;
  border-radius: 8px;
  padding: .6rem .85rem;
  font-size: .86rem;
  font-family: var(--font-ui);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  appearance: auto;
  transition: border-color .2s, box-shadow .2s;
}
.premium-select:focus {
  outline: none;
  border-color: #b8952a;
  box-shadow: 0 0 0 3px rgba(184,149,42,.14);
}

.premium-desc {
  font-size: .79rem;
  color: var(--muted);
  font-style: italic;
  line-height: 1.55;
  min-height: 1.2em;
}

/* ── Step quick-nav ── */
.step-nav {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 3.5rem;
  flex-wrap: wrap;
}

.step-pill {
  display: flex;
  align-items: center;
  gap: .65rem;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: .75rem 1.15rem;
  text-decoration: none;
  transition: border-color .18s, box-shadow .18s, transform .18s;
  box-shadow: var(--shadow-sm);
  flex: 1;
  min-width: 160px;
}
.step-pill:hover {
  border-color: var(--gold);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.step-pill-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--header-bg);
  color: var(--gold-warm);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-pill-label {
  font-family: var(--font-ui);
  font-size: .78rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: .02em;
}

.step-arrow {
  font-size: 1.3rem;
  color: var(--muted-light);
  flex-shrink: 0;
  user-select: none;
}

/* ── Step sections ── */
.step-section {
  padding-top: 3rem;
  margin-bottom: 1rem;
  border-top: 1px solid var(--border-light);
}
.step-section:first-of-type { border-top: none; padding-top: 0; }

.step-heading {
  display: flex;
  align-items: center;
  gap: .9rem;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 400;
  letter-spacing: .04em;
  color: var(--text);
  margin-bottom: 1.75rem;
}

.step-heading-num {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--header-bg);
  color: var(--gold-warm);
  font-size: 1.2rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ── Works category labels ── */
.works-category-label {
  font-family: var(--font-ui);
  font-size: .67rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-bottom: 1rem;
}
.works-category-label--spaced { margin-top: 2.25rem; }

.works-category-label--premium { color: var(--gold); }
.works-premium-badge {
  display: inline-block;
  background: var(--gold);
  color: #111009;
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .1em;
  padding: .15em .5em;
  border-radius: 3px;
  vertical-align: middle;
  margin-right: .35em;
}
.works-category-desc {
  font-family: var(--font-serif);
  font-size: .82rem;
  color: var(--muted);
  margin: -.4rem 0 1rem;
  font-style: italic;
}

/* Premium work cards */
.work-card--premium { border-color: rgba(184,149,42,.35); }
.work-card--premium:has(input:checked) { border-color: var(--gold); }
.work-card--premium:hover:not(:has(input:checked)) { border-color: rgba(184,149,42,.6); }
.work-premium-lock {
  position: absolute;
  top: .5rem;
  right: .5rem;
  font-size: .75rem;
  color: var(--gold);
  background: rgba(0,0,0,.45);
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ── Step 3 Begin ── */
.step-section--begin { padding-bottom: 2rem; }

.step-begin {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.25rem;
}

/* ── Plan picker ── */
.plan-picker {
  display: flex;
  flex-direction: column;
  gap: .65rem;
}
.plan-picker-label {
  font-family: var(--font-ui);
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.plan-picker-optional {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  opacity: .7;
}
.plan-chips {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
}
.plan-chip {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: .82rem;
  font-weight: 500;
  padding: .5rem 1rem;
  transition: border-color .15s, background .15s, color .15s;
}
.plan-chip:hover { border-color: var(--gold); }
.plan-chip.selected {
  background: var(--header-bg);
  border-color: var(--header-bg);
  color: var(--header-text);
}
.plan-chip-desc {
  font-family: var(--font-serif);
  font-size: .82rem;
  color: var(--muted);
  font-style: italic;
  min-height: 1.2em;
}

/* ── Plan card grid inside Step 3 ── */
.plan-cards-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  width: 100%;
}
@media (max-width: 720px) {
  .plan-cards-picker { grid-template-columns: 1fr; }
}
.plan-picker-hint {
  font-family: var(--font-serif);
  font-size: .88rem;
  color: var(--muted);
  font-style: italic;
  grid-column: 1 / -1;
}
.plan-cards-picker .plan-card {
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.plan-cards-picker .plan-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.plan-card--selected {
  outline: 2.5px solid var(--gold);
  outline-offset: 2px;
}

.step-begin-selection {
  font-family: var(--font-serif);
  font-size: .95rem;
  color: var(--muted);
  font-style: italic;
}

.btn-begin {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .85rem 2rem;
  background: var(--header-bg);
  color: var(--header-text);
  border-radius: 10px;
  font-family: var(--font-ui);
  font-size: .85rem;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  transition: opacity .18s, transform .18s;
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
.btn-begin:hover { opacity: .84; transform: translateY(-1px); }
.btn-begin.btn-begin--disabled {
  opacity: .4;
  pointer-events: none;
}

/* ── Version picker (Step 3 · abridged selection) ── */
.version-picker[hidden] { display: none; }
.version-picker { width: 100%; }

.version-picker-label {
  font-family: var(--font-ui);
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .65rem;
}

.version-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: .75rem;
}

.version-opt {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: .9rem 1rem;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  display: flex;
  flex-direction: column;
  gap: .38rem;
  user-select: none;
}
.version-opt:hover:not(.version-opt--locked) {
  border-color: var(--gold);
  box-shadow: var(--shadow-sm);
}
.version-opt--selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold), var(--shadow-sm);
}
.version-opt--locked { opacity: .72; cursor: default; }

.version-opt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}
.version-opt-name {
  font-family: var(--font-ui);
  font-size: .82rem;
  font-weight: 700;
  color: var(--text);
}
.version-opt-badge {
  font-family: var(--font-ui);
  font-size: .62rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}
.version-opt-stats {
  font-family: var(--font-ui);
  font-size: .72rem;
  font-weight: 500;
  color: var(--muted);
}
.version-opt-desc {
  font-family: var(--font-serif);
  font-size: .79rem;
  color: var(--muted);
  line-height: 1.5;
  font-style: italic;
}
.version-opt-upgrade {
  font-family: var(--font-ui);
  font-size: .7rem;
  margin-top: .1rem;
}
.version-opt-upgrade a {
  color: var(--gold);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Works sections ── */
.works-section { margin-bottom: 3rem; }

.works-grid { display: grid; gap: 1.25rem; }
.works-grid--2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.works-grid--4 { grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); }

/* ── Work card progress badge ── */
.work-progress-badge {
  position: absolute;
  top: .55rem;
  right: .55rem;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .65rem;
  font-weight: 700;
  color: #fff;
  z-index: 1;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
  title: attr(data-tooltip);
}
.work-progress-badge--on-track  { background: #3a8a3a; }
.work-progress-badge--behind     { background: #b88000; }
.work-progress-badge--far-behind { background: #b02020; }

.work-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1.5px solid var(--border-light);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: box-shadow .22s, transform .22s, border-color .18s;
  cursor: pointer;
}
.work-card input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.work-card:has(input:checked) {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold), var(--shadow-md);
}
.work-card:hover:not(:has(input:checked)) {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.work-cover {
  height: 154px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}
.work-cover svg { width: 84px; height: 84px; }

.work-info {
  padding: 1.2rem 1.4rem 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.work-info h3 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: .1rem;
  letter-spacing: .01em;
  line-height: 1.2;
}

.work-author {
  font-family: var(--font-ui);
  font-size: .67rem;
  color: var(--muted);
  margin-bottom: .8rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.work-desc {
  font-size: .8rem;
  color: var(--muted);
  line-height: 1.65;
  margin-bottom: .25rem;
  flex: 1;
}

.btn-read {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  align-self: flex-start;
  padding: .52rem 1.05rem;
  border-radius: 7px;
  background: var(--header-bg);
  color: var(--header-text);
  font-family: var(--font-ui);
  font-size: .73rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  transition: opacity .18s, transform .18s;
}
.btn-read::after { content: '→'; opacity: .6; transition: opacity .18s, transform .18s; }
.btn-read:hover { opacity: .82; }
.btn-read:hover::after { opacity: 1; transform: translateX(2px); }

/* ═══════════════════════════════
   AUTH PAGES
═══════════════════════════════ */

.auth-main {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 3.5rem 1.25rem 5rem;
  min-height: calc(100vh - 200px);
}

.auth-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 2.5rem 2.25rem;
  width: 100%;
  max-width: 420px;
}

.auth-heading {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 300;
  letter-spacing: .04em;
  margin-bottom: .5rem;
}

.auth-subheading {
  font-size: .82rem;
  color: var(--muted);
  margin-bottom: 1.75rem;
  line-height: 1.5;
}

.auth-body {
  font-size: .88rem;
  color: var(--muted);
  line-height: 1.65;
  margin-bottom: .75rem;
}

.auth-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #b91c1c;
  font-size: .82rem;
  padding: .75rem 1rem;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

html.dark .auth-error {
  background: #2d1515;
  border-color: #7f1d1d;
  color: #fca5a5;
}

.auth-notice {
  background: var(--assistant-bubble);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: .82rem;
  padding: .75rem 1rem;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.auth-notice--success {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #15803d;
}

html.dark .auth-notice--success {
  background: #14291c;
  border-color: #166534;
  color: #86efac;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  margin-bottom: 1.5rem;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: .45rem;
}

.auth-field label {
  font-family: var(--font-ui);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.auth-hint {
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  font-size: .7rem;
}

.auth-field input {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .62rem .85rem;
  font-size: .92rem;
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}

.auth-field input:focus {
  outline: none;
  border-color: var(--muted-light);
  box-shadow: 0 0 0 3px rgba(0,0,0,.06);
}

.auth-btn {
  display: inline-block;
  background: var(--header-bg);
  color: var(--header-text);
  border: none;
  border-radius: 8px;
  padding: .7rem 1.4rem;
  font-family: var(--font-ui);
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity .15s;
  text-align: center;
  text-decoration: none;
  margin-top: .35rem;
}
.auth-btn:hover { opacity: .82; }

.auth-switch {
  font-size: .82rem;
  color: var(--muted);
  text-align: center;
}
.auth-switch a { color: var(--text); text-decoration: underline; text-underline-offset: 2px; }

.auth-link {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Chat sign-in prompt (unauthenticated users) ── */
.chat-signin-prompt {
  font-size: .82rem;
  color: var(--muted);
  text-align: center;
  padding: 1rem .5rem;
  line-height: 1.6;
}
.chat-signin-prompt a {
  color: var(--text);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Footer ── */
.site-footer {
  text-align: center;
  padding: 2.5rem 1rem;
  font-size: .7rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  letter-spacing: .04em;
}
.site-footer a { text-decoration: underline; text-underline-offset: 2px; }

/* ═══════════════════════════════
   READER PAGE
═══════════════════════════════ */

/* ── Reader nav ── */
.reader-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  color: var(--header-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .8rem 1.6rem;
  font-size: .82rem;
  gap: 1rem;
}
.nav-home {
  color: var(--header-accent);
  transition: color .15s;
  font-size: .75rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-family: var(--font-ui);
  font-weight: 600;
}
.nav-home:hover { color: #fff; }
.nav-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 300;
  text-align: center;
  flex: 1;
  letter-spacing: .04em;
}
.nav-guide {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-align: right;
  font-family: var(--font-ui);
}

/* ── Reading mode tabs (Full / Abridged / Super Abridged) ── */
.mode-tabs {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0 1.6rem;
}
.mode-tabs-inner {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  gap: 0;
}
.mode-tab {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .5rem 1rem;
  font-family: var(--font-ui);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .05em;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2.5px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.mode-tab:hover { color: var(--text); }
.mode-tab--active { color: var(--text); border-bottom-color: var(--gold); }
.mode-tab--premium.mode-tab--active { color: var(--gold-warm); }
.mode-tab-lock {
  font-size: .63rem;
  font-weight: 400;
  font-style: italic;
  color: var(--muted-light);
}

/* ── Book navigation bar ── */
.book-nav {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: .72rem 1.6rem;
}
.book-nav-inner {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.book-nav-btn {
  font-size: .76rem;
  font-weight: 600;
  font-family: var(--font-ui);
  color: var(--muted);
  transition: color .15s;
  white-space: nowrap;
  letter-spacing: .02em;
}
.book-nav-btn:not(.disabled):hover { color: var(--text); }
.book-nav-btn.disabled { visibility: hidden; }

.book-selector-wrap {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .8rem;
  color: var(--muted);
  font-family: var(--font-ui);
}
.book-selector-wrap select {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .3rem .6rem;
  font-size: .8rem;
  font-family: var(--font-ui);
  background: var(--bg);
  cursor: pointer;
}
.book-of { white-space: nowrap; }

/* ── Section progress bar ── */
.section-progress-bar-wrap {
  height: 2px;
  background: var(--border);
  width: 100%;
}
.section-progress-bar-fill {
  height: 100%;
  background: var(--gold);
  transition: width .4s ease;
  width: 0%;
}

/* ── Section navigation ── */
.section-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2rem 0 2.5rem;
  gap: 1rem;
}
.section-nav-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .5rem 1rem;
  font-size: .76rem;
  font-weight: 600;
  font-family: var(--font-ui);
  color: var(--muted);
  cursor: pointer;
  letter-spacing: .04em;
  transition: color .15s, border-color .15s, background .15s;
}
.section-nav-btn:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--muted);
  background: rgba(0,0,0,.03);
}
.section-nav-btn:disabled { opacity: .28; cursor: default; }

/* Reader-specific section label (overrides the block style above) */
.section-nav .section-label {
  display: inline;
  margin-bottom: 0;
  white-space: nowrap;
  font-size: .72rem;
}

/* ── Highlight-to-ask button ── */
.highlight-ask-btn {
  position: absolute;
  z-index: 500;
  background: var(--guide-color, #1a1208);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: .45rem 1rem;
  font-size: .73rem;
  font-weight: 600;
  font-family: var(--font-ui);
  letter-spacing: .05em;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  white-space: nowrap;
  transition: transform .1s, box-shadow .1s;
}
.highlight-ask-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(0,0,0,.3);
}

/* ── Epic text ── */
.reader-main {
  max-width: 700px;
  margin: 0 auto;
  padding: 3rem 1.75rem 8rem;
}

.book-heading {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 300;
  font-style: italic;
  margin-bottom: 2.25rem;
  color: var(--muted);
  text-align: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1.25rem;
  letter-spacing: .04em;
}

.book-body {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.9;
  color: var(--text);
}
.book-body p { margin-bottom: 1.25em; }

/* ═══════════════════════════════
   CHAT
═══════════════════════════════ */

.chat-fab {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,0,0,.28);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  transition: transform .15s, box-shadow .15s;
}
.chat-fab:hover {
  transform: scale(1.07) translateY(-1px);
  box-shadow: 0 8px 30px rgba(0,0,0,.35);
}
.chat-fab svg { width: 22px; height: 22px; }

.chat-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 1rem;
  pointer-events: none;
}
.chat-overlay:not([hidden]) { pointer-events: auto; }

.chat-panel {
  width: min(420px, 100vw - 2rem);
  max-height: min(600px, 90vh);
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px);
  opacity: 0;
  transition: transform .24s ease, opacity .24s ease;
}
.chat-overlay:not([hidden]) .chat-panel {
  transform: translateY(0);
  opacity: 1;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.1rem;
  color: #fff;
  flex-shrink: 0;
}
.chat-header-left { display: flex; align-items: center; gap: .85rem; }
.chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 400;
  flex-shrink: 0;
}
.chat-guide-name {
  font-weight: 700;
  font-size: .9rem;
  font-family: var(--font-ui);
  letter-spacing: .02em;
}
.chat-guide-epithet {
  font-size: .69rem;
  opacity: .72;
  font-style: italic;
  font-family: var(--font-ui);
}
.chat-close {
  background: none;
  border: none;
  color: #fff;
  font-size: .92rem;
  cursor: pointer;
  opacity: .6;
  padding: .35rem;
  transition: opacity .15s;
  line-height: 1;
}
.chat-close:hover { opacity: 1; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: .8rem;
  scroll-behavior: smooth;
}

.chat-message {
  max-width: 88%;
  padding: .7rem 1rem;
  border-radius: 14px;
  font-size: .86rem;
  line-height: 1.6;
}
.chat-message.assistant {
  align-self: flex-start;
  background: var(--assistant-bubble);
  border-bottom-left-radius: 4px;
  font-family: var(--font-serif);
}
.chat-message.user {
  align-self: flex-end;
  background: #1a1208;
  color: #f0e8d8;
  border-bottom-right-radius: 4px;
  font-family: var(--font-ui);
}
.chat-message.thinking {
  align-self: flex-start;
  background: var(--assistant-bubble);
  color: var(--muted);
  font-style: italic;
  font-size: .8rem;
}

.chat-footer {
  padding: .85rem 1.1rem 1.1rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-remaining {
  font-size: .67rem;
  color: var(--muted);
  margin-bottom: .55rem;
  text-align: right;
  font-family: var(--font-ui);
  letter-spacing: .04em;
}
.chat-input-row { display: flex; gap: .5rem; align-items: flex-end; }
.chat-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .55rem .85rem;
  font-size: .86rem;
  font-family: var(--font-ui);
  resize: none;
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
  transition: border-color .15s, box-shadow .15s;
}
.chat-input:focus {
  outline: none;
  border-color: var(--muted-light);
  box-shadow: 0 0 0 3px rgba(0,0,0,.05);
}
.chat-input:disabled { opacity: .4; cursor: not-allowed; }
.chat-send {
  border: none;
  border-radius: 10px;
  color: #fff;
  padding: .55rem 1rem;
  font-size: .78rem;
  font-weight: 600;
  font-family: var(--font-ui);
  letter-spacing: .05em;
  cursor: pointer;
  transition: opacity .15s, transform .12s;
  white-space: nowrap;
}
.chat-send:hover:not(:disabled) { opacity: .86; transform: translateY(-1px); }
.chat-send:disabled { opacity: .32; cursor: not-allowed; }

/* ── Guide nudge bubble ── */
.nudge-bubble {
  position: fixed;
  bottom: 5.25rem;
  right: 2rem;
  color: #fff;
  padding: .65rem 1rem;
  border-radius: 12px 12px 4px 12px;
  font-size: .82rem;
  font-family: var(--font-ui);
  max-width: 210px;
  line-height: 1.4;
  box-shadow: 0 4px 20px rgba(0,0,0,.28);
  cursor: pointer;
  z-index: 199;
  animation: nudgeIn .3s ease forwards;
  user-select: none;
}
.nudge-bubble::after {
  content: '';
  position: absolute;
  bottom: -7px;
  right: 16px;
  width: 14px;
  height: 7px;
  background: inherit;
  clip-path: polygon(0 0, 100% 0, 100% 0, 50% 100%);
}
.nudge-bubble--out {
  animation: nudgeOut .3s ease forwards;
}
@keyframes nudgeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes nudgeOut {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(8px); }
}

/* ── Responsive ── */
@media (max-width: 500px) {
  .chat-overlay { padding: 0; }
  .chat-panel { width: 100vw; border-radius: 16px 16px 0 0; max-height: 80vh; }
  .chat-fab { bottom: 1.2rem; right: 1.2rem; }
  .nav-guide { display: none; }
}

/* ═══════════════════════════════
   NOTES & QUOTES
═══════════════════════════════ */

/* hidden override for flex/grid containers */
.highlight-actions[hidden],
.notes-overlay[hidden],
.note-compose[hidden] { display: none; }

/* ── Notes toggle button (in reader nav) ── */
.notes-toggle-btn {
  position: relative;
  background: none;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px;
  color: var(--header-text);
  cursor: pointer;
  padding: .32rem .5rem;
  display: flex;
  align-items: center;
  gap: .3rem;
  transition: background .2s, border-color .2s;
  line-height: 1;
}
.notes-toggle-btn:hover {
  background: rgba(255,255,255,.09);
  border-color: rgba(255,255,255,.38);
}

/* Count badge on the notes button */
.notes-badge {
  position: absolute;
  top: -.35rem;
  right: -.35rem;
  min-width: 1.1rem;
  height: 1.1rem;
  border-radius: 999px;
  background: var(--gold);
  color: #fff;
  font-size: .6rem;
  font-weight: 700;
  font-family: var(--font-ui);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 .22rem;
  line-height: 1;
}

/* ── Highlight action popup ── */
.highlight-actions {
  position: absolute;
  z-index: 500;
  display: flex;
  gap: .45rem;
  align-items: center;
}

.highlight-ask-btn {
  background: var(--guide-color, #1a1208);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: .45rem 1rem;
  font-size: .73rem;
  font-weight: 600;
  font-family: var(--font-ui);
  letter-spacing: .05em;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  white-space: nowrap;
  transition: transform .1s, box-shadow .1s;
}
.highlight-ask-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(0,0,0,.3);
}

.highlight-save-btn {
  background: var(--card-bg);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: .45rem 1rem;
  font-size: .73rem;
  font-weight: 600;
  font-family: var(--font-ui);
  letter-spacing: .05em;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
  white-space: nowrap;
  transition: transform .1s, box-shadow .1s, border-color .15s;
}
.highlight-save-btn:hover {
  border-color: var(--gold);
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(0,0,0,.22);
}

/* ── Note compose dialog ── */
.note-compose {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(0,0,0,.38);
  animation: backdropIn .18s ease forwards;
}

.note-compose-inner {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 1.5rem 1.75rem 1.75rem;
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: .9rem;
  animation: modalSlideUp .22s cubic-bezier(.2,.8,.4,1) forwards;
}

.note-compose-label {
  font-family: var(--font-ui);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}

.note-compose-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .7rem .9rem;
  font-family: var(--font-serif);
  font-size: .95rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  resize: vertical;
  transition: border-color .15s, box-shadow .15s;
}
.note-compose-input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(184,149,42,.12);
}

.note-compose-actions {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.note-compose-save {
  background: var(--header-bg);
  color: var(--header-text);
  border: none;
  border-radius: 8px;
  padding: .55rem 1.2rem;
  font-family: var(--font-ui);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity .15s;
}
.note-compose-save:hover { opacity: .82; }

.note-compose-cancel {
  background: none;
  border: none;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: .78rem;
  cursor: pointer;
  transition: color .15s;
  padding: .55rem .2rem;
}
.note-compose-cancel:hover { color: var(--text); }

.note-compose-hint {
  font-family: var(--font-ui);
  font-size: .7rem;
  color: var(--muted-light);
  margin-left: auto;
}

/* ── Notes panel (slides in from right) ── */
.notes-overlay {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  background: rgba(0,0,0,.38);
  animation: backdropIn .2s ease forwards;
}

.notes-panel {
  width: min(400px, 100vw);
  background: var(--card-bg);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: notesSlideIn .25s cubic-bezier(.4,0,.2,1) forwards;
  overflow: hidden;
}
@keyframes notesSlideIn {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

.notes-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.4rem 1.1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--header-bg);
}

.notes-panel-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--header-text);
  letter-spacing: .04em;
}

.notes-panel-subtitle {
  font-family: var(--font-ui);
  font-size: .68rem;
  color: rgba(255,255,255,.5);
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-top: .2rem;
}

.notes-panel-close {
  background: none;
  border: none;
  color: var(--header-text);
  cursor: pointer;
  font-size: 1rem;
  opacity: .55;
  padding: .2rem .4rem;
  border-radius: 4px;
  transition: opacity .15s;
  flex-shrink: 0;
}
.notes-panel-close:hover { opacity: 1; }

.notes-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: .85rem;
}

.notes-empty {
  font-family: var(--font-serif);
  font-size: .88rem;
  color: var(--muted);
  font-style: italic;
  line-height: 1.65;
  text-align: center;
  padding: 2rem 1rem;
}

/* ── Individual note items ── */
.note-item {
  border-radius: 8px;
  padding: .9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .55rem;
}

.note-item--quote {
  background: var(--assistant-bubble);
  border-left: 3px solid var(--gold);
}

.note-item--note {
  background: var(--bg);
  border: 1px solid var(--border-light);
}

.note-quote-text {
  font-family: var(--font-serif);
  font-size: .88rem;
  font-style: italic;
  line-height: 1.65;
  color: var(--text);
  margin: 0;
  padding: 0;
}

.note-text {
  font-family: var(--font-serif);
  font-size: .88rem;
  line-height: 1.65;
  color: var(--text);
  margin: 0;
  white-space: pre-wrap;
}

.note-item-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}

.note-loc {
  font-family: var(--font-ui);
  font-size: .65rem;
  color: var(--muted-light);
  letter-spacing: .04em;
  text-transform: uppercase;
}

.note-delete-btn {
  background: none;
  border: none;
  color: var(--muted-light);
  cursor: pointer;
  font-size: .75rem;
  padding: .1rem .3rem;
  border-radius: 4px;
  transition: color .15s, background .15s;
  flex-shrink: 0;
  line-height: 1;
}
.note-delete-btn:hover {
  color: #b02020;
  background: rgba(176,32,32,.08);
}

.notes-panel-footer {
  padding: 1rem 1.2rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.notes-add-btn {
  width: 100%;
  background: none;
  border: 1.5px dashed var(--border);
  border-radius: 8px;
  padding: .65rem 1rem;
  font-family: var(--font-ui);
  font-size: .8rem;
  color: var(--muted);
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
  letter-spacing: .02em;
}
.notes-add-btn:hover {
  border-color: var(--gold);
  color: var(--text);
  background: var(--bg);
}

/* ── Notes loading / sign-in nudge ── */
.notes-loading {
  font-family: var(--font-serif);
  font-size: .88rem;
  color: var(--muted-light);
  font-style: italic;
  text-align: center;
  padding: 2rem 1rem;
}

.notes-signin-nudge {
  padding: .75rem 1.2rem;
  border-top: 1px solid var(--border-light);
  font-family: var(--font-serif);
  font-size: .8rem;
  color: var(--muted);
  font-style: italic;
  line-height: 1.6;
  text-align: center;
}
.notes-signin-nudge a {
  color: var(--text);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Save toast notification ── */
.save-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--header-bg);
  color: var(--header-text);
  font-family: var(--font-ui);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .05em;
  padding: .55rem 1.2rem;
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,.28);
  z-index: 600;
  opacity: 0;
  transition: opacity .22s ease, transform .22s ease;
  pointer-events: none;
  white-space: nowrap;
}
.save-toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 500px) {
  .notes-panel { width: 100vw; }
  .highlight-actions { flex-direction: column; gap: .3rem; }
}

/* ── Premium trial counter in chat footer ── */
.pm-trial-counter {
  color: var(--gold);
  font-weight: 600;
}
.pm-trial-exhausted a {
  text-underline-offset: 2px;
}

/* ── Reading streak badge (reader nav) ── */
.streak-badge {
  font-family: var(--font-ui);
  font-size: .75rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .01em;
  padding: .2rem .5rem;
  border-radius: 10px;
  background: var(--border-light);
  white-space: nowrap;
  user-select: none;
}
.streak-badge--hot {
  color: #b83010;
  background: rgba(184,80,20,.1);
}

/* ── Guide preview button (on guide cards) ── */
.guide-preview-btn {
  display: block;
  width: 100%;
  margin-top: .75rem;
  padding: .38rem .75rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--font-ui);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.guide-preview-btn:hover {
  border-color: var(--c, var(--gold));
  color: var(--c, var(--gold));
  background: rgba(0,0,0,.03);
}

/* ── Guide preview modal ── */
.guide-preview-wrap[hidden] { display: none; }
.guide-preview-wrap {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.guide-preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.52);
}
.guide-preview-panel {
  position: relative;
  background: var(--card-bg);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  overflow: hidden;
  animation: modalSlideUp .22s cubic-bezier(.2,.8,.4,1) forwards;
}
.guide-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 1.4rem;
  border-bottom: 1px solid var(--border-light);
}
.guide-preview-identity {
  display: flex;
  align-items: center;
  gap: .85rem;
}
.guide-preview-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 400;
  flex-shrink: 0;
}
.guide-preview-name {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: .9rem;
  color: var(--text);
}
.guide-preview-epithet {
  font-family: var(--font-ui);
  font-size: .7rem;
  color: var(--muted);
  margin-top: .1rem;
}
.guide-preview-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: .95rem;
  color: var(--muted);
  padding: .3rem .45rem;
  border-radius: 6px;
  transition: color .15s, background .15s;
}
.guide-preview-close:hover { color: var(--text); background: var(--border-light); }

.guide-preview-convo {
  padding: 1.2rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: .9rem;
  max-height: 38vh;
  overflow-y: auto;
}
.guide-preview-msg {
  display: flex;
  gap: .65rem;
  align-items: flex-start;
}
.guide-preview-msg--user {
  flex-direction: row-reverse;
}
.guide-preview-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #fff;
  font-family: var(--font-display);
  font-size: .9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.guide-preview-msg-text {
  font-family: var(--font-serif);
  font-size: .875rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--border-light);
  border-radius: 10px;
  padding: .65rem .9rem;
  max-width: 88%;
}
.guide-preview-msg--user .guide-preview-msg-text {
  background: var(--header-bg);
  color: var(--header-text);
  border-radius: 10px 10px 2px 10px;
}
.guide-preview-msg--guide .guide-preview-msg-text {
  border-radius: 2px 10px 10px 10px;
}

.guide-preview-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .9rem 1.4rem;
  border-top: 1px solid var(--border-light);
  gap: 1rem;
}
.guide-preview-hint {
  font-family: var(--font-ui);
  font-size: .7rem;
  color: var(--muted);
  letter-spacing: .04em;
  font-style: italic;
}
.guide-preview-select {
  background: var(--header-bg);
  color: var(--header-text);
  border: none;
  border-radius: 7px;
  padding: .55rem 1.1rem;
  font-family: var(--font-ui);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .05em;
  cursor: pointer;
  transition: opacity .15s, transform .15s;
}
.guide-preview-select:hover { opacity: .85; transform: translateY(-1px); }
