:root {
  --night: #080e1b;
  --night2: #101b30;
  --ink: #eee6d7;
  --muted: #aaa9a7;
  --line: rgba(238, 230, 215, 0.2);
  --gold: #e8d7b5;
  --serif: "Playfair Display", Georgia, serif;
  --mono: "DM Mono", monospace;
  --verse-scale: 1;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--night);
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

button, a { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* Hero Section */
.hero {
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, #080e1b 0%, #111d34 50%, #1e283d 78%, #6a4740 100%);
  padding: 0 clamp(18px, 6vw, 64px) clamp(28px, 6vh, 48px);
  display: flex;
  flex-direction: column;
}

.hero-sky {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 12% 14%, #f5e8d4 99%, transparent),
    radial-gradient(1px 1px at 24% 28%, #f5e8d4 99%, transparent),
    radial-gradient(1.5px 1.5px at 38% 12%, #f5e8d4 99%, transparent),
    radial-gradient(1px 1px at 56% 22%, #f5e8d4 99%, transparent),
    radial-gradient(1px 1px at 70% 15%, #f5e8d4 99%, transparent),
    radial-gradient(1.5px 1.5px at 82% 30%, #f5e8d4 99%, transparent),
    radial-gradient(1px 1px at 92% 18%, #f5e8d4 99%, transparent);
  opacity: 0.75;
  pointer-events: none;
}

.hero-moon {
  position: absolute;
  right: clamp(10%, 15vw, 18%);
  top: clamp(12%, 16vh, 20%);
  width: clamp(54px, 8vw, 76px);
  height: clamp(54px, 8vw, 76px);
  border-radius: 50%;
  background: #eee1c5;
  box-shadow: 0 0 45px rgba(237, 221, 187, 0.22);
  pointer-events: none;
}

.hero-moon:after {
  content: "";
  position: absolute;
  left: 28%;
  top: -10%;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #111b2d;
}

.hero-nav {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: clamp(18px, 4vh, 32px) 0 0;
}

.hero-author {
  font: 10px var(--mono);
  letter-spacing: 0.18em;
  color: #b8b3a9;
}

.nav-about {
  font: 10px var(--mono);
  letter-spacing: 0.14em;
  color: #d6d0c6;
  padding: 6px 0;
}

.nav-about b {
  margin-left: 6px;
  color: var(--gold);
}

.hero-content {
  position: relative;
  z-index: 2;
  margin: clamp(24px, 6vh, 48px) 0;
  max-width: 660px;
}

.eyebrow {
  font: 9.5px var(--mono);
  letter-spacing: 0.2em;
  color: #c9bda9;
  text-transform: uppercase;
  margin: 0 0 14px;
}

.time-whisper {
  font: italic clamp(12px, 2vw, 13.5px) var(--serif);
  color: #c8b38e;
  margin: -6px 0 18px;
  opacity: 0.85;
  letter-spacing: 0.02em;
}

h1 {
  font-size: clamp(2.3rem, 6.8vw, 5.4rem);
  line-height: 1.05;
  font-weight: 400;
  letter-spacing: -0.04em;
  margin: 0 0 20px;
  word-break: break-word;
}

h1 em, h2 em {
  font-weight: 400;
  font-style: italic;
  color: #e4d4ba;
}

.hero-deck {
  font-size: clamp(16px, 2.5vw, 19px);
  line-height: 1.6;
  color: #d4d0c8;
  margin: 0 0 28px;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.button-primary {
  border: 1px solid #cbb998;
  background: #e6d7bc;
  color: #111827;
  padding: 14px 22px;
  font: 10px var(--mono);
  letter-spacing: 0.14em;
  transition: transform 0.2s, background 0.2s;
  display: inline-flex;
  align-items: center;
}

.button-primary:hover {
  background: #fff2d7;
  transform: translateY(-2px);
}

.button-primary span {
  margin-left: 18px;
}

.button-text {
  background: none;
  border: 0;
  color: #e4d9c7;
  font: 10px var(--mono);
  letter-spacing: 0.13em;
  padding: 10px 4px;
  transition: color 0.2s;
}

.button-text:hover {
  color: #fff;
}

.button-text span {
  margin-left: 8px;
}

.button-wander {
  background: rgba(16, 27, 46, 0.65);
  border: 1px solid rgba(232, 215, 181, 0.45);
  color: #e8d7b5;
  padding: 14px 18px;
  font: 10px var(--mono);
  letter-spacing: 0.14em;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
}

.button-wander:hover {
  background: rgba(232, 215, 181, 0.16);
  border-color: #e8d7b5;
  transform: translateY(-2px);
}

.resume-banner {
  font: italic 13px var(--serif);
  color: #bbb3a6;
  margin-top: 18px;
  letter-spacing: 0.01em;
}

.resume-banner a {
  color: #e8d7b5;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  margin-left: 6px;
}


/* Sections */
.intro-section, .journey-section {
  padding: clamp(48px, 8vw, 90px) clamp(18px, 7vw, 64px);
}

/* Intro Section */
.intro-section {
  background: #f0e9dc;
  color: #1b2230;
}

.intro-section .eyebrow {
  color: #8a7863;
}

.intro-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(24px, 6vw, 64px);
  align-items: start;
  max-width: 1140px;
  margin: 0 auto;
}

.intro-grid h2, .journey-heading h2 {
  font-size: clamp(1.9rem, 4.2vw, 3.4rem);
  line-height: 1.15;
  font-weight: 400;
  letter-spacing: -0.035em;
  margin: 12px 0 0;
}

.intro-grid h2 em {
  color: #8b6e4e;
}

.intro-copy {
  font-size: clamp(16px, 2.2vw, 18px);
  line-height: 1.8;
  color: #4a4d53;
}

.intro-copy p {
  margin: 0 0 18px;
}

.intro-copy .signature {
  font-style: italic;
  color: #85725a;
  margin-top: 24px;
}

/* Journey Section */
.journey-section {
  background: #0b1323;
}

.journey-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: clamp(24px, 4vw, 38px);
  max-width: 1140px;
  margin-left: auto;
  margin-right: auto;
}

.journey-hint {
  font: 9px var(--mono);
  letter-spacing: 0.15em;
  color: #9f9a8f;
  margin-bottom: 6px;
}

.section-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  max-width: 1140px;
  margin: 0 auto;
}

.section-card {
  position: relative;
  display: flex;
  flex-direction: column;
  text-align: left;
  background: #101b2e;
  border: 1px solid rgba(231, 220, 199, 0.15);
  color: var(--ink);
  overflow: hidden;
  padding: 0;
  transition: transform 0.25s, border-color 0.25s;
}

.section-card:hover {
  transform: translateY(-4px);
  border-color: #c9b48f;
}

.section-card img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  display: block;
  opacity: 0.9;
  filter: saturate(0.85);
  background: #0b1323;
}

.card-info {
  padding: 18px 20px 22px;
  display: flex;
  flex-direction: column;
}

.card-number {
  font: 9.5px var(--mono);
  letter-spacing: 0.18em;
  color: #cbb998;
  margin-bottom: 6px;
}

.card-title {
  font-size: clamp(20px, 2.5vw, 24px);
  margin-bottom: 4px;
  line-height: 1.25;
}

.card-desc {
  font: 9px var(--mono);
  letter-spacing: 0.1em;
  color: #aaa9a7;
}

.card-arrow {
  position: absolute;
  right: 18px;
  bottom: 20px;
  color: #d7c29e;
  font-size: 14px;
}

/* Journey Tabbed Poem Index (Option A) */
.journey-index {
  margin-top: clamp(28px, 4.5vw, 42px);
  background: #0d1627;
  border: 1px solid rgba(238, 230, 215, 0.14);
  padding: clamp(20px, 3.5vw, 32px);
  max-width: 1140px;
  margin-left: auto;
  margin-right: auto;
}

.index-nav-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.index-tab {
  background: rgba(8, 14, 27, 0.65);
  border: 1px solid rgba(238, 230, 215, 0.12);
  color: #9f9a8f;
  padding: 12px 10px;
  text-align: center;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.index-tab:hover {
  border-color: rgba(232, 215, 181, 0.4);
  color: #eee6d7;
}

.index-tab.active {
  background: #172640;
  border-color: rgba(232, 215, 181, 0.65);
  color: #e8d7b5;
}

.tab-part {
  font: 9.5px var(--mono);
  letter-spacing: 0.16em;
  opacity: 0.85;
}

.tab-title {
  font-size: 14.5px;
  font-weight: 400;
}

.tab-count {
  font: 9px var(--mono);
  opacity: 0.75;
}

.index-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(238, 230, 215, 0.12);
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.index-panel-title {
  font-size: clamp(18px, 2.5vw, 22px);
  font-weight: 400;
  margin: 0;
  color: #eee6d7;
}

.index-panel-sub {
  font: italic 13.5px var(--serif);
  color: #aaa9a7;
  margin: 4px 0 0;
}

.index-start-part {
  background: none;
  border: 1px solid rgba(232, 215, 181, 0.4);
  color: #e8d7b5;
  font: 9.5px var(--mono);
  letter-spacing: 0.12em;
  padding: 8px 14px;
  transition: background 0.2s, border-color 0.2s;
  display: inline-flex;
  align-items: center;
}

.index-start-part:hover {
  background: rgba(232, 215, 181, 0.12);
  border-color: #e8d7b5;
}

.index-start-part span {
  margin-left: 6px;
}

.index-poems-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  column-gap: 32px;
  row-gap: 4px;
}

.index-poem-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: none;
  border: 0;
  border-bottom: 1px solid rgba(238, 230, 215, 0.08);
  padding: 9px 4px;
  text-align: left;
  color: rgba(238, 230, 215, 0.9);
  font: 14.5px var(--serif);
  transition: color 0.2s, border-color 0.2s;
  width: 100%;
}

.index-poem-item:hover {
  color: #e8d7b5;
  border-color: rgba(232, 215, 181, 0.35);
}

.index-poem-title {
  display: flex;
  align-items: baseline;
}

.index-poem-num {
  font: 9.5px var(--mono);
  color: #9f9a8f;
  margin-right: 8px;
  flex-shrink: 0;
}

.index-poem-arrow {
  font: 9.5px var(--mono);
  color: #cbb998;
  opacity: 0.4;
  transition: opacity 0.2s, transform 0.2s;
  margin-left: 8px;
}

.index-poem-item:hover .index-poem-arrow {
  opacity: 1;
  transform: translateX(2px);
}

/* Quote & Final CTA Section */
.quote-section {
  position: relative;
  text-align: center;
  padding: clamp(55px, 8vw, 95px) 20px;
  background: linear-gradient(180deg, #101b2e 0%, #080e1b 100%);
  border-top: 1px solid rgba(238, 230, 215, 0.08);
}

.quote-section blockquote {
  font-size: clamp(1.8rem, 3.8vw, 3.2rem);
  line-height: 1.35;
  font-style: italic;
  margin: 22px auto 32px;
  max-width: 760px;
  color: #ebdcc4;
}

.quote-cta {
  margin-top: 24px;
}

/* Footer */
footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px clamp(18px, 6vw, 64px);
  background: #060a12;
  border-top: 1px solid rgba(238, 230, 215, 0.1);
  color: #898982;
  font: 8.5px var(--mono);
  letter-spacing: 0.15em;
  flex-wrap: wrap;
  gap: 12px;
}

/* Reading Room Modal / Fullscreen */
.reading-room {
  display: none;
  position: fixed;
  z-index: 30;
  inset: 0;
  background: #f0e9dc;
  color: #202633;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.reading-room.visible {
  display: block;
}

body.reading-active {
  overflow: hidden;
}

.reader-topbar {
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(12px, 4vw, 36px);
  background: rgba(240, 233, 220, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(25, 31, 42, 0.14);
}

.reader-brand, .reader-tools button {
  background: none;
  border: 0;
  color: #323945;
  font: 9.5px var(--mono);
  letter-spacing: 0.12em;
  padding: 8px 10px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, opacity 0.2s;
}

.reader-brand span {
  margin-left: 6px;
}

.reader-book-title {
  font: 9.5px var(--mono);
  letter-spacing: 0.16em;
  color: #77766f;
}

.reader-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.reader-tools button:hover, .reader-controls button:hover {
  color: #8b6e4e;
}

#bookmark-toggle.active {
  color: #cbb998;
}

body[data-theme="night"] #bookmark-toggle.active {
  color: #e8d7b5;
}

.reader-wander-btn {
  font-size: 13.5px !important;
}

.progress-track {
  height: 2px;
  background: rgba(30, 36, 46, 0.1);
}

.progress-track div {
  height: 100%;
  width: 0;
  background: #a58a65;
  transition: width 0.25s ease-out;
}

@keyframes verseFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.reader-animating {
  animation: verseFadeIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.reader-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  max-width: 1200px;
  margin: 0 auto;
  min-height: calc(100vh - 62px);
}

.reader-sidebar {
  padding: 40px 24px;
  border-right: 1px solid rgba(25, 31, 42, 0.12);
}

.reader-sidebar h3 {
  font-size: 26px;
  font-weight: 400;
  margin: 6px 0 24px;
}

.toc-group {
  margin-bottom: 24px;
}

.toc-group-saved {
  border-left: 2px solid #cbb998;
  padding-left: 10px;
  margin-bottom: 24px;
}

.toc-group-saved .toc-kicker {
  color: #7c5c38;
}

.toc-kicker {
  font: 8px var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #9a8264;
  margin: 0 0 8px;
}

.toc-link {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  background: none;
  border: 0;
  border-bottom: 1px solid rgba(30, 36, 46, 0.08);
  padding: 8px 0;
  color: #55565a;
  font: 14.5px var(--serif);
}

.toc-link i {
  font-style: normal;
  opacity: 0;
  transition: opacity 0.2s;
}

.toc-link:hover, .toc-link.active {
  color: #8b6d48;
}

.toc-link.active i, .toc-link:hover i {
  opacity: 1;
}

.reader-main {
  max-width: 720px;
  width: 100%;
  padding: 50px clamp(20px, 6vw, 80px) 45px;
  margin: 0 auto;
}

.reader-overline, .reader-meta {
  display: flex;
  justify-content: space-between;
  font: 9.5px var(--mono);
  letter-spacing: 0.14em;
  color: #8e816f;
  text-transform: uppercase;
}

.poem-title {
  font-size: clamp(1.8rem, 4vw, 3.2rem);
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 1.15;
  margin: 40px 0 32px;
  color: #1d2635;
  word-break: break-word;
}

.poem-lines {
  font-size: calc(clamp(16px, 2.2vw, 18.5px) * var(--verse-scale, 1));
  line-height: 1.85;
  color: #2b323c;
}

.poem-lines span {
  display: block;
  min-height: 1.25em;
}

.reader-end {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  border-top: 1px solid rgba(30, 36, 46, 0.15);
  margin-top: 55px;
  padding-top: 18px;
  font: italic 13px var(--serif);
  color: #8a7d6d;
}

.reader-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(30, 36, 46, 0.15);
  margin-top: 40px;
  padding-top: 18px;
  gap: 12px;
}

.reader-controls button {
  background: none;
  border: 1px solid rgba(30, 36, 46, 0.16);
  padding: 10px 16px;
  min-height: 40px;
  font: 9.5px var(--mono);
  letter-spacing: 0.12em;
  color: #3b424a;
  transition: all 0.2s;
}

.reader-controls button:disabled {
  opacity: 0.25;
  cursor: not-allowed;
  border-color: transparent;
}

.reader-controls span {
  font: italic 13px var(--serif);
  color: #8a7d6d;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#toc-scrim { display: none; }
.toc-panel { display: none; }

/* Desktop: Contents sidebar is permanently visible on the left; hide mobile drawer button */
@media (min-width: 801px) {
  #open-toc {
    display: none !important;
  }
}

/* Night Theme inside Reader */
body[data-theme="night"] .reading-room {
  background: #0b1322;
  color: #eee6d7;
}

body[data-theme="night"] .reader-topbar {
  background: rgba(11, 19, 34, 0.94);
  border-color: rgba(238, 230, 215, 0.14);
}

body[data-theme="night"] .reader-brand,
body[data-theme="night"] .reader-tools button {
  color: #d9d0c0;
}

body[data-theme="night"] .reader-sidebar {
  border-color: rgba(238, 230, 215, 0.14);
}

body[data-theme="night"] .reader-sidebar h3,
body[data-theme="night"] .poem-title {
  color: #eee6d7;
}

body[data-theme="night"] .toc-group-saved .toc-kicker {
  color: #e8d7b5;
}

body[data-theme="night"] .toc-link {
  color: #bcb6aa;
  border-color: rgba(238, 230, 215, 0.08);
}

body[data-theme="night"] .toc-link:hover,
body[data-theme="night"] .toc-link.active {
  color: #f3dfc1;
  border-color: rgba(238, 230, 215, 0.28);
}

body[data-theme="night"] .poem-lines {
  color: #e2daca;
}

body[data-theme="night"] .reader-end,
body[data-theme="night"] .reader-controls {
  border-color: rgba(238, 230, 215, 0.15);
}

body[data-theme="night"] .reader-controls button {
  color: #d9d0c0;
  border-color: rgba(238, 230, 215, 0.2);
}

/* Section interludes between parts */
.breathing-page {
  position: relative;
  min-height: calc(100vh - 180px);
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #0b1425;
  color: #eee6d7;
  margin: 10px 0 25px;
  border: 1px solid rgba(238, 230, 215, 0.15);
}

.breathing-art {
  position: absolute;
  inset: 0;
  z-index: 1;
  background-image: linear-gradient(180deg, rgba(7, 13, 25, 0.3), rgba(7, 13, 25, 0.65)), var(--interlude-art);
  background-size: cover;
  background-position: center;
  background-color: #0b1425;
  opacity: 0.85;
}

.breathing-content {
  position: relative;
  z-index: 2;
  max-width: 500px;
  text-align: center;
  padding: 40px 24px;
}

.breathing-kicker, .breathing-footer {
  font: 9px var(--mono);
  letter-spacing: 0.2em;
  color: #d1c4ae;
}

.breathing-content h2 {
  font: 400 clamp(1.8rem, 4vw, 3rem)/1.2 var(--serif);
  letter-spacing: -0.03em;
  margin: 16px auto 10px;
}

.breathing-subtitle {
  font: italic 15px var(--serif);
  color: #d2c8ba;
  margin: 0;
}

.breathing-rule {
  width: 36px;
  height: 1px;
  background: #c8b38e;
  margin: 24px auto;
}

.breathing-enter {
  margin-top: 20px;
  background: rgba(11, 20, 37, 0.7);
  border: 1px solid rgba(232, 215, 181, 0.8);
  padding: 13px 22px;
  color: #f0e5d2;
  font: 9.5px var(--mono);
  letter-spacing: 0.14em;
  backdrop-filter: blur(8px);
  transition: background 0.2s;
}

.breathing-enter:hover {
  background: rgba(232, 215, 181, 0.18);
}

.breathing-enter span {
  margin-left: 12px;
}

/* ========================================================
   Mobile & Responsive Adjustments (320px, 375px, 420px, 800px)
   ======================================================== */
@media (max-width: 800px) {
  /* Hero */
  .hero {
    min-height: 100dvh;
    padding: 0 5vw clamp(24px, 5vh, 36px);
  }
  .hero-nav {
    padding-top: 18px;
  }

  /* Intro Section */
  .intro-section, .journey-section {
    padding: 42px 5vw;
  }
  .intro-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .intro-copy {
    font-size: 15.5px;
    line-height: 1.7;
  }

  /* Journey Cards: Smooth Horizontal Scroll-Snap (no 1200px scroll) */
  .journey-heading {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 20px;
  }
  .section-cards {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 14px;
    padding: 4px 5vw 18px;
    margin: 0 -5vw;
    scrollbar-width: none;
  }
  .section-cards::-webkit-scrollbar {
    display: none;
  }
  .section-card {
    flex: 0 0 min(280px, 78vw);
    scroll-snap-align: start;
  }
  .section-card img {
    aspect-ratio: 4/3;
  }
  .card-info {
    padding: 14px 16px 18px;
  }
  .card-title {
    font-size: 19px;
  }

  /* Journey Tabbed Index Mobile */
  .journey-index {
    padding: 16px 14px;
    margin-top: 20px;
  }
  .index-nav-tabs {
    gap: 6px;
    margin-bottom: 16px;
  }
  .index-tab {
    padding: 9px 4px;
  }
  .tab-title {
    display: none;
  }
  .index-panel-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 12px;
  }
  .index-poems-grid {
    grid-template-columns: 1fr;
    row-gap: 2px;
  }
  .index-poem-item {
    font-size: 14px;
    padding: 8px 2px;
  }

  /* Quote */
  .quote-section {
    padding: 45px 16px;
  }
  .quote-section blockquote {
    margin: 16px auto 24px;
  }

  /* Reader Topbar on Small Screens */
  .reader-topbar {
    height: 52px;
    padding: 0 8px;
    gap: 4px;
  }
  .reader-book-title {
    display: none;
  }
  .reader-brand {
    font-size: 8.5px;
    padding: 6px 6px;
    letter-spacing: 0.08em;
  }
  .reader-tools {
    gap: 3px;
  }
  .bm-text {
    display: none;
  }
  .reader-tools button {
    font-size: 8px;
    padding: 6px 6px;
    min-height: 34px;
    letter-spacing: 0.06em;
  }

  /* Reader Main Content */
  .reader-layout {
    display: block;
  }
  .reader-sidebar {
    display: none;
  }
  .reader-main {
    padding: 35px 5vw 30px;
  }
  .poem-title {
    margin: 30px 0 24px;
  }
  .reader-end {
    flex-direction: column;
    gap: 6px;
    margin-top: 40px;
  }
  .reader-controls span {
    display: none;
  }
  .reader-controls button {
    padding: 8px 14px;
    min-height: 38px;
  }

  /* Mobile Contents Drawer */
  .toc-panel {
    display: block;
    position: fixed;
    z-index: 40;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(88vw, 340px);
    padding: 20px;
    background: #f0e9dc;
    color: #202633;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateX(105%);
    transition: transform 0.25s ease-out;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.2);
  }
  .toc-panel.open {
    transform: translateX(0);
  }
  .toc-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font: 10px var(--mono);
    letter-spacing: 0.15em;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(25, 31, 42, 0.12);
  }
  .toc-panel-head button {
    border: 0;
    background: none;
    font: 9.5px var(--mono);
    padding: 6px;
  }
  #toc-scrim.visible {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 35;
    backdrop-filter: blur(2px);
  }
  body[data-theme="night"] .toc-panel {
    background: #0d1728;
    color: #eee6d7;
  }
  body[data-theme="night"] .toc-panel-head {
    border-color: rgba(238, 230, 215, 0.12);
  }
  body[data-theme="night"] .toc-panel-head button {
    color: #eee6d7;
  }
}

/* Extra small screens: 320px - 360px */
@media (max-width: 360px) {
  .hero-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .button-primary {
    justify-content: center;
    width: 100%;
  }
  .button-text {
    text-align: center;
  }
  .reader-topbar {
    padding: 0 4px;
  }
  .reader-brand span {
    display: none;
  }
  .reader-tools button {
    padding: 4px 4px;
    font-size: 7.5px;
  }
}

/* Share Story Modal */
.share-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 60;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.share-modal.open {
  display: flex;
}

.share-modal-scrim {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 16, 0.78);
  backdrop-filter: blur(8px);
}

.share-modal-dialog {
  position: relative;
  z-index: 2;
  background: #0f192b;
  border: 1px solid rgba(238, 230, 215, 0.18);
  border-radius: 12px;
  width: min(92vw, 420px);
  padding: 22px;
  color: #eee6d7;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65);
  animation: modalEnter 0.24s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modalEnter {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.share-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}

.share-kicker {
  font: 9px var(--mono);
  letter-spacing: 0.18em;
  color: #cbb998;
  display: block;
  margin-bottom: 3px;
}

.share-modal-title {
  font-size: 19px;
  font-weight: 400;
  margin: 0;
  color: #eee6d7;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.share-close-btn {
  background: none;
  border: 0;
  color: #aaa9a7;
  font: 14px var(--mono);
  padding: 4px;
  cursor: pointer;
  transition: color 0.2s;
}

.share-close-btn:hover {
  color: #fff;
}

.share-preview-wrapper {
  display: flex;
  justify-content: center;
  margin: 10px 0 18px;
  background: #080e1b;
  border: 1px solid rgba(238, 230, 215, 0.1);
  border-radius: 8px;
  padding: 10px;
}

.share-canvas-preview {
  height: 220px;
  width: auto;
  aspect-ratio: 9/16;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  display: block;
}

.share-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.share-btn-primary {
  width: 100%;
  border: 1px solid #cbb998;
  background: #e6d7bc;
  color: #111827;
  padding: 13px 16px;
  font: 9.5px var(--mono);
  letter-spacing: 0.14em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.share-btn-primary:hover {
  background: #fff2d7;
  transform: translateY(-1px);
}

.share-sub-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.share-btn-secondary {
  border: 1px solid rgba(238, 230, 215, 0.18);
  background: rgba(255, 255, 255, 0.04);
  color: #d8d0c3;
  padding: 10px 12px;
  font: 9px var(--mono);
  letter-spacing: 0.12em;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.share-btn-secondary:hover {
  border-color: #cbb998;
  color: #fff;
}

.share-feedback-msg {
  font: italic 12px var(--serif);
  color: #e8d7b5;
  text-align: center;
  min-height: 16px;
  margin: 2px 0 0;
}

@media (max-width: 360px) {
  .share-modal-dialog {
    padding: 16px 12px;
  }
  .share-canvas-preview {
    height: 170px;
  }
  .share-sub-actions {
    grid-template-columns: 1fr;
  }
}



/* ========================================================
   Atmosphere Lighting Themes (Night / Amber / Paper)
   ======================================================== */

/* Desktop Segmented Capsule */
.theme-segmented-desktop {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(238, 230, 215, 0.16);
  border-radius: 999px;
  padding: 2px;
  gap: 2px;
}

.theme-seg-btn {
  background: none;
  border: 0;
  border-radius: 999px;
  padding: 4px 8px !important;
  min-height: 26px !important;
  font: 500 8.5px var(--mono) !important;
  letter-spacing: 0.1em !important;
  color: #9c9588 !important;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.theme-seg-btn:hover {
  color: #fff !important;
}

.theme-seg-btn .theme-glyph {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

/* Active states for segmented buttons */
body[data-theme="night"] .theme-seg-btn[data-theme-val="night"] {
  background: rgba(203, 185, 152, 0.18) !important;
  border: 1px solid rgba(203, 185, 152, 0.45) !important;
  color: #f7eedf !important;
  box-shadow: 0 0 10px rgba(203, 185, 152, 0.15);
}

body[data-theme="amber"] .theme-seg-btn[data-theme-val="amber"] {
  background: rgba(212, 155, 88, 0.22) !important;
  border: 1px solid rgba(212, 155, 88, 0.5) !important;
  color: #f5b667 !important;
  box-shadow: 0 0 10px rgba(212, 155, 88, 0.2);
}

body[data-theme="paper"] .theme-seg-btn[data-theme-val="paper"] {
  background: rgba(0, 0, 0, 0.09) !important;
  border: 1px solid rgba(43, 50, 60, 0.22) !important;
  color: #1e242e !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

body[data-theme="paper"] .theme-segmented-desktop {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(43, 50, 60, 0.15);
}

body[data-theme="paper"] .theme-seg-btn {
  color: #717782 !important;
}

body[data-theme="paper"] .theme-seg-btn:hover {
  color: #111 !important;
}

/* Mobile: Option 1 Cyclic Smart Button */
.theme-cycle-mobile {
  display: none;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(238, 230, 215, 0.2) !important;
  border-radius: 999px !important;
  padding: 4px 7px !important;
  min-height: 28px !important;
  font: 500 8.5px var(--mono) !important;
  letter-spacing: 0.08em !important;
  color: #e5ded1 !important;
  cursor: pointer;
  transition: all 0.2s ease;
}

.theme-cycle-mobile .theme-glyph {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

body[data-theme="amber"] .theme-cycle-mobile {
  background: rgba(212, 155, 88, 0.15) !important;
  border-color: rgba(212, 155, 88, 0.45) !important;
  color: #f5b667 !important;
}

body[data-theme="paper"] .theme-cycle-mobile {
  background: rgba(0, 0, 0, 0.05) !important;
  border-color: rgba(43, 50, 60, 0.2) !important;
  color: #2b323c !important;
}

@media (max-width: 800px) {
  .theme-segmented-desktop {
    display: none !important;
  }
  .theme-cycle-mobile {
    display: inline-flex !important;
  }
}

/* ========================================================
   Amber / Candlelight Atmosphere Theme
   ======================================================== */
body[data-theme="amber"] .reading-room {
  background: #14100c;
  color: #f3e4cb;
}

body[data-theme="amber"] .toc-group-saved .toc-kicker {
  color: #f5b667;
}

body[data-theme="amber"] .reader-topbar {
  background: rgba(20, 16, 12, 0.95);
  border-color: rgba(229, 168, 85, 0.2);
}

body[data-theme="amber"] .reader-brand,
body[data-theme="amber"] .reader-tools button {
  color: #e0d0ba;
}

body[data-theme="amber"] .reader-tools button:hover,
body[data-theme="amber"] .reader-controls button:hover {
  color: #f5b667;
}

body[data-theme="amber"] .reader-sidebar {
  background: #100d0a;
  border-color: rgba(229, 168, 85, 0.18);
}

body[data-theme="amber"] .reader-sidebar h3,
body[data-theme="amber"] .poem-title {
  color: #f5e8d5;
}

body[data-theme="amber"] .toc-link {
  color: #c8b9a5;
  border-color: rgba(229, 168, 85, 0.1);
}

body[data-theme="amber"] .toc-link:hover,
body[data-theme="amber"] .toc-link.active {
  color: #f5b667;
  border-color: rgba(229, 168, 85, 0.35);
}

body[data-theme="amber"] .poem-lines {
  color: #f3e4cb;
}

body[data-theme="amber"] .reader-end,
body[data-theme="amber"] .reader-controls {
  border-color: rgba(229, 168, 85, 0.2);
}

body[data-theme="amber"] .reader-controls button {
  color: #e0d0ba;
  border-color: rgba(229, 168, 85, 0.25);
}

body[data-theme="amber"] #bookmark-toggle.active {
  color: #f5b667;
}

body[data-theme="amber"] .progress-track {
  background: rgba(212, 155, 88, 0.15);
}

body[data-theme="amber"] .progress-track div {
  background: #d49b58;
}

body[data-theme="amber"] .breathing-page {
  background: #18130e;
  color: #f5e8d5;
  border-color: rgba(229, 168, 85, 0.24);
}

body[data-theme="amber"] .toc-panel {
  background: #14100c;
  color: #f3e4cb;
}

body[data-theme="amber"] .toc-panel-head {
  border-color: rgba(229, 168, 85, 0.2);
}

body[data-theme="amber"] .toc-panel-head button {
  color: #f5b667;
}

/* ========================================================
   Floating Quote Selection Popover (Dual Mode)
   Desktop: Floating above text cursor
   Mobile: Docked bottom action pill (Thumb zone, zero OS menu collision)
   ======================================================== */
.quote-share-popover {
  position: fixed;
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #0d1728;
  color: #eee6d7;
  border: 1px solid rgba(203, 185, 152, 0.45);
  border-radius: 999px;
  padding: 8px 16px;
  font: 500 10px var(--mono);
  letter-spacing: 0.14em;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55), 0 0 14px rgba(203, 185, 152, 0.15);
  transform: translate(-50%, -100%);
  cursor: pointer;
  pointer-events: auto;
  user-select: none;
  opacity: 0;
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.quote-share-popover.visible {
  opacity: 1;
}

.quote-share-popover:hover {
  background: #152238;
  border-color: #cbb998;
  color: #fff;
  transform: translate(-50%, -102%) scale(1.02);
}

.quote-popover-icon {
  color: #d4a373;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

.quote-popover-arrow {
  color: #cbb998;
  font-weight: bold;
}

body[data-theme="amber"] .quote-share-popover {
  background: #16120e;
  color: #f3e4cb;
  border-color: rgba(212, 155, 88, 0.55);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.65), 0 0 16px rgba(212, 155, 88, 0.2);
}

body[data-theme="amber"] .quote-share-popover:hover {
  background: #211b15;
  border-color: #f5b667;
}

body[data-theme="amber"] .quote-popover-icon,
body[data-theme="amber"] .quote-popover-arrow {
  color: #f5b667;
}

body[data-theme="paper"] .quote-share-popover {
  background: #2b323c;
  color: #f7f4ee;
  border-color: rgba(203, 185, 152, 0.35);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

body[data-theme="paper"] .quote-share-popover:hover {
  background: #1a2029;
}

/* Mobile Bottom-Docked Action Bar */
@media (max-width: 768px) {
  .quote-share-popover {
    top: auto !important;
    left: 50% !important;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px)) !important;
    transform: translate(-50%, 20px) !important;
    padding: 11px 18px !important;
    font-size: 10px !important;
    letter-spacing: 0.1em !important;
    border-radius: 999px !important;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.8), 0 0 20px rgba(203, 185, 152, 0.25) !important;
    border: 1px solid rgba(203, 185, 152, 0.6) !important;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }

  .quote-share-popover.visible {
    transform: translate(-50%, 0) !important;
    opacity: 1 !important;
  }
}
