/*
======================================================================
NOVELS

1. Modern Swiss-editorial stylesheet for the protected Canvas novel
   bookshelf and two-column outline reader (Light & Dark themes only,
   persistent desktop chapter outline sidebar, mobile slide-over
   drawer, clean typographic covers, and anti-copy/anti-print guards).
2. Used by docs/novels/index.html and docs/novels/reader.html.
3. Modification history:
   - 2026-12-04 v1: Initial paper/light/night theme.
   - 2026-12-04 v2: Complete visual redesign — removed Xuan paper
     theme, added persistent desktop outline sidebar, modern editorial
     gallery for 8 books, and crisp Light/Dark palettes.

    Author: Zi Liang <zi1415926.liang@connect.polyu.hk>
    Copyright © 2026, Zi Liang, all rights reserved.
    Created:  4 December 2026
======================================================================
*/

:root,
[data-theme="light"] {
  --bg-page: #ffffff;
  --bg-sidebar: #f7f8fa;
  --bg-surface: #ffffff;
  --bg-elevated: rgba(255, 255, 255, 0.88);
  --bg-subtle: #f2f4f7;
  --bg-hover: rgba(17, 24, 39, 0.045);
  --bg-active: rgba(37, 99, 235, 0.08);
  --ink-primary: #14161a;
  --ink-secondary: #4b5260;
  --ink-muted: #848c99;
  --border-subtle: #e6e8ed;
  --border-strong: #d1d5de;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.14);
  --badge-ongoing-bg: #ecfdf3;
  --badge-ongoing-ink: #027a48;
  --badge-ongoing-dot: #12b76a;
  --badge-done-bg: #f2f4f7;
  --badge-done-ink: #475467;
  --canvas-ink: #16181d;
  --canvas-watermark: rgba(20, 24, 31, 0.024);
  --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.04),
    0 6px 20px rgba(16, 24, 40, 0.04);
  --shadow-card-hover: 0 4px 12px rgba(16, 24, 40, 0.06),
    0 14px 32px rgba(16, 24, 40, 0.08);
  --shadow-popover: 0 12px 36px rgba(16, 24, 40, 0.14);
}

[data-theme="dark"] {
  --bg-page: #0e1014;
  --bg-sidebar: #14171d;
  --bg-surface: #161920;
  --bg-elevated: rgba(14, 16, 20, 0.88);
  --bg-subtle: #1d212b;
  --bg-hover: rgba(255, 255, 255, 0.06);
  --bg-active: rgba(96, 165, 250, 0.13);
  --ink-primary: #e8eaef;
  --ink-secondary: #9ba3b2;
  --ink-muted: #687080;
  --border-subtle: #232732;
  --border-strong: #323846;
  --accent: #60a5fa;
  --accent-soft: rgba(96, 165, 250, 0.18);
  --badge-ongoing-bg: rgba(16, 185, 129, 0.14);
  --badge-ongoing-ink: #34d399;
  --badge-ongoing-dot: #10b981;
  --badge-done-bg: #1f242f;
  --badge-done-ink: #9ca3af;
  --canvas-ink: #e2e5ec;
  --canvas-watermark: rgba(235, 240, 250, 0.022);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.25), 0 8px 24px rgba(0, 0, 0, 0.25);
  --shadow-card-hover: 0 8px 28px rgba(0, 0, 0, 0.42);
  --shadow-popover: 0 16px 44px rgba(0, 0, 0, 0.55);
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg-page);
  color: var(--ink-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "PingFang SC",
    "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
  transition: background-color 0.2s ease, color 0.2s ease;
}

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

button,
select {
  font-family: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

/* ====================================================================
   ANTI-COPY & ANTI-PRINT GUARDS
   ==================================================================== */
.protected-surface,
.protected-surface * {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-touch-callout: none;
}

@media print {
  body {
    display: none !important;
  }
}

/* ====================================================================
   SHARED STATUS PILLS & UTILITY BUTTONS
   ==================================================================== */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.status-badge--ongoing {
  background: var(--badge-ongoing-bg);
  color: var(--badge-ongoing-ink);
}

.status-badge--ongoing::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--badge-ongoing-dot);
}

.status-badge--completed {
  background: var(--badge-done-bg);
  color: var(--badge-done-ink);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-secondary);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.icon-btn:hover,
.icon-btn.is-active {
  background: var(--bg-hover);
  color: var(--ink-primary);
}

/* ====================================================================
   BOOKSHELF PAGE (/novels/)
   ==================================================================== */
.shelf-header {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 58px;
  background: var(--bg-elevated);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
}

.shelf-header-inner {
  max-width: 1140px;
  height: 100%;
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.shelf-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.shelf-brand-mark {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--ink-primary);
  color: var(--bg-page);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "Noto Serif SC", "Songti SC", Georgia, serif;
  font-size: 13px;
  font-weight: 700;
}

.shelf-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.shelf-nav a {
  padding: 6px 10px;
  border-radius: 7px;
  font-size: 13.5px;
  color: var(--ink-secondary);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.shelf-nav a:hover {
  background: var(--bg-hover);
  color: var(--ink-primary);
}

.shelf-container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 40px 28px 80px;
}

.shelf-intro {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.shelf-intro h1 {
  margin: 0 0 6px;
  font-family: "Noto Serif SC", "Songti SC", Georgia, serif;
  font-size: clamp(26px, 3.6vw, 34px);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.shelf-intro p {
  margin: 0;
  font-size: 14.5px;
  color: var(--ink-secondary);
}

.shelf-filters {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  background: var(--bg-subtle);
}

.filter-tab {
  padding: 6px 13px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-secondary);
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.filter-tab:hover {
  color: var(--ink-primary);
}

.filter-tab.is-active {
  background: var(--bg-surface);
  color: var(--ink-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.book-card {
  display: grid;
  grid-template-columns: 144px 1fr;
  gap: 22px;
  padding: 20px;
  border-radius: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.book-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--border-strong);
}

/* Curated architectural editorial book covers */
.book-cover {
  position: relative;
  aspect-ratio: 3 / 4.25;
  border-radius: 8px;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #f8fafc;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12),
    0 8px 18px rgba(0, 0, 0, 0.14);
}

.book-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.12) 0%,
    rgba(255, 255, 255, 0) 48%,
    rgba(0, 0, 0, 0.22) 100%
  );
  pointer-events: none;
}

.book-cover--obsidian {
  background: linear-gradient(160deg, #1b1f2a 0%, #10131a 100%);
}
.book-cover--slate {
  background: linear-gradient(160deg, #273449 0%, #172030 100%);
}
.book-cover--teal {
  background: linear-gradient(160deg, #1d4044 0%, #12282c 100%);
}
.book-cover--iron {
  background: linear-gradient(160deg, #323741 0%, #1c2026 100%);
}
.book-cover--crimson {
  background: linear-gradient(160deg, #52232c 0%, #2d1218 100%);
}
.book-cover--umber {
  background: linear-gradient(160deg, #4b382c 0%, #2b2019 100%);
}
.book-cover--pine {
  background: linear-gradient(160deg, #1f3b31 0%, #13251f 100%);
}
.book-cover--indigo {
  background: linear-gradient(160deg, #283052 0%, #171c33 100%);
}

.cover-top {
  position: relative;
  z-index: 1;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(248, 250, 252, 0.65);
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  padding-bottom: 8px;
}

.cover-title {
  position: relative;
  z-index: 1;
  font-family: "Noto Serif SC", "Songti SC", Georgia, serif;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0.04em;
  margin: auto 0;
  padding: 10px 0;
}

.cover-bottom {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10.5px;
  color: rgba(248, 250, 252, 0.72);
}

.book-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.book-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.book-genre {
  font-size: 12px;
  color: var(--ink-muted);
  font-weight: 500;
}

.book-title {
  margin: 0 0 4px;
  font-family: "Noto Serif SC", "Songti SC", Georgia, serif;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.3;
}

.book-title a:hover {
  color: var(--accent);
}

.book-subtitle {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--ink-muted);
}

.book-tagline {
  margin: 0 0 14px;
  font-size: 13.5px;
  color: var(--ink-secondary);
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 12.5px;
  color: var(--ink-muted);
  margin-bottom: 14px;
}

.book-progress-bar {
  height: 3px;
  border-radius: 999px;
  background: var(--bg-subtle);
  overflow: hidden;
  margin-bottom: 12px;
}

.book-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

.book-actions {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.btn-read {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  background: var(--ink-primary);
  color: var(--bg-page);
  font-size: 13px;
  font-weight: 500;
  max-width: 100%;
  transition: opacity 0.15s ease;
}

.btn-read span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-read:hover {
  opacity: 0.86;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  font-size: 12.5px;
  color: var(--ink-secondary);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--ink-primary);
}

.shelf-footer {
  margin-top: 56px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  color: var(--ink-muted);
}

/* ====================================================================
   READER LAYOUT: PERSISTENT OUTLINE SIDEBAR + MAIN READING AREA
   ==================================================================== */
.reading-progress-track {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 90;
  pointer-events: none;
}

.reading-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.08s linear;
}

.reader-app {
  display: flex;
  min-height: 100vh;
}

/* Persistent Desktop Left Outline Sidebar */
.outline-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  z-index: 60;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    background-color 0.2s ease, border-color 0.2s ease;
}

.reader-app.is-sidebar-collapsed .outline-sidebar {
  transform: translateX(-100%);
}

.sidebar-top {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-secondary);
  padding: 4px 6px;
  border-radius: 6px;
}

.sidebar-back-link:hover {
  background: var(--bg-hover);
  color: var(--ink-primary);
}

.sidebar-close-mobile {
  display: none;
}

.book-switcher {
  width: 100%;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-primary);
  outline: none;
}

.book-switcher:focus {
  border-color: var(--accent);
}

.sidebar-book-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-muted);
}

.outline-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px 32px;
}

.outline-section-label {
  padding: 12px 10px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.outline-item {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13.5px;
  color: var(--ink-secondary);
  border-left: 2px solid transparent;
  transition: background-color 0.14s ease, color 0.14s ease;
}

.outline-item:hover {
  background: var(--bg-hover);
  color: var(--ink-primary);
}

.outline-item.is-current {
  background: var(--bg-active);
  color: var(--accent);
  font-weight: 600;
  border-left-color: var(--accent);
}

.outline-item-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.outline-item-chars {
  font-size: 11px;
  color: var(--ink-muted);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.outline-sublist {
  margin: 2px 0 6px 14px;
  padding-left: 10px;
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.outline-subitem {
  width: 100%;
  text-align: left;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--ink-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.outline-subitem:hover {
  background: var(--bg-hover);
  color: var(--ink-primary);
}

/* Main Content Pane */
.reader-pane {
  flex: 1;
  min-width: 0;
  margin-left: 280px;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.reader-app.is-sidebar-collapsed .reader-pane {
  margin-left: 0;
}

.reader-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 54px;
  padding: 0 20px;
  background: var(--bg-elevated);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.topbar-breadcrumb {
  min-width: 0;
  flex: 1;
  font-size: 13.5px;
  color: var(--ink-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reader-main {
  width: 100%;
  max-width: var(--reader-width, 720px);
  margin: 0 auto;
  padding: 44px 28px 88px;
}

.chapter-masthead {
  margin-bottom: 34px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border-subtle);
}

.chapter-group-label {
  margin: 0 0 8px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.chapter-group-label:empty {
  display: none;
}

.chapter-title {
  margin: 0;
  font-family: "Noto Serif SC", "Songti SC", Georgia, serif;
  font-size: clamp(24px, 3.6vw, 32px);
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.3;
}

.chapter-meta {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  font-size: 12.5px;
  color: var(--ink-muted);
}

/* Razor-sharp Canvas stage */
.reader-stage {
  min-height: 55vh;
  position: relative;
}

.canvas-block {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
}

.canvas-block--p {
  margin-bottom: 0.9em;
}

.canvas-block--h3 {
  margin-top: 1.8em;
  margin-bottom: 0.85em;
  scroll-margin-top: 72px;
}

.canvas-block--li {
  margin-bottom: 0.55em;
}

.canvas-block--divider {
  margin: 1.4em 0;
}

.canvas-block canvas {
  display: block;
  pointer-events: none;
}

.reader-status {
  padding: 64px 0;
  text-align: center;
  font-size: 14px;
  color: var(--ink-secondary);
}

.loading-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 8px;
  animation: pulseDot 1.1s ease-in-out infinite;
}

@keyframes pulseDot {
  0%,
  100% {
    opacity: 0.25;
  }
  50% {
    opacity: 1;
  }
}

/* Bottom Prev / Next Cards */
.chapter-nav {
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--border-subtle);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.chapter-nav-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 18px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  text-align: left;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.chapter-nav-card--next {
  text-align: right;
}

.chapter-nav-card:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: var(--bg-hover);
}

.chapter-nav-card:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.nav-card-label {
  font-size: 11.5px;
  color: var(--ink-muted);
}

.nav-card-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copyright-note {
  margin-top: 32px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-muted);
}

/* ====================================================================
   SETTINGS POPOVER & OVERLAY BACKDROP
   ==================================================================== */
.overlay-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 16, 0.42);
  z-index: 55;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.overlay-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.settings-popover {
  position: fixed;
  top: 62px;
  right: 20px;
  width: min(300px, calc(100vw - 32px));
  z-index: 75;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  box-shadow: var(--shadow-popover);
  padding: 18px;
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.settings-popover.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.setting-row + .setting-row {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.setting-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
  margin-bottom: 9px;
}

.theme-toggle-pair {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.theme-choice {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-secondary);
}

.theme-choice.is-active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--bg-active);
}

.stepper-group {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
  gap: 8px;
}

.stepper-btn {
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  font-size: 15px;
  font-weight: 600;
}

.stepper-btn:hover {
  border-color: var(--border-strong);
}

.stepper-value {
  text-align: center;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.width-pills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.width-pill {
  padding: 7px 6px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  font-size: 12.5px;
  color: var(--ink-secondary);
}

.width-pill.is-active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--bg-active);
}

/* ====================================================================
   RESPONSIVE BREAKPOINTS (TABLET & MOBILE)
   ==================================================================== */
@media (max-width: 1023px) {
  .outline-sidebar {
    width: min(310px, 86vw);
    transform: translateX(-102%);
    box-shadow: var(--shadow-popover);
  }

  .outline-sidebar.is-mobile-open {
    transform: translateX(0);
  }

  .sidebar-close-mobile {
    display: inline-flex;
  }

  .reader-pane {
    margin-left: 0;
  }

  .reader-main {
    padding: 28px 18px 72px;
  }

  .setting-row--desktop-only {
    display: none;
  }
}

@media (max-width: 820px) {
  .book-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .shelf-header-inner {
    padding: 0 16px;
  }

  .shelf-container {
    padding: 26px 16px 60px;
  }

  .book-card {
    grid-template-columns: 108px 1fr;
    gap: 16px;
    padding: 16px;
  }

  .cover-title {
    font-size: 15px;
  }

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

  .chapter-nav-card--next {
    text-align: left;
  }
}
