/* ==========================================================================
   UNDICIDE — CONTEMPORARY ACADEMIC LIBRARY DESIGN SYSTEM
   Editorial Archival Palette & Environmental Theme Tokens
   ========================================================================== */

:root {
  --bg-primary: #08090c;
  --bg-dark: #08090c;
  --bg-surface: #0f1117;
  --bg-card: rgba(15, 21, 34, 0.75);
  --bg-card-hover: rgba(22, 30, 48, 0.85);
  --bg-inner: rgba(10, 14, 23, 0.9);
  
  --border-outer: rgba(255, 255, 255, 0.08);
  --border-inner: rgba(255, 255, 255, 0.05);
  --border-active: rgba(197, 168, 128, 0.4);
  --border-gold: rgba(197, 168, 128, 0.35);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-main: #f8fafc;
  --text-muted: #a3b1c6;
  --text-dim: #94a3b8;
  --on-accent: #0b0e14;
  
  --accent-primary: #c5a880;
  --accent-primary-hover: #b3976f;
  --accent-gold: #c5a880;
  --accent-gold-hover: #b3976f;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;

  --font-editorial: 'Cormorant Garamond', Georgia, serif;
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-reading: 'Source Serif 4', Georgia, serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --radius-outer: 1.5rem;
  --radius-inner: calc(1.5rem - 0.375rem);
  --radius-pill: 9999px;
  
  --transition-fluid: all 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
  --shadow-subtle: 0 4px 20px -2px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 35px -5px rgba(197, 160, 89, 0.12);
  --shadow-gold-glow: 0 0 35px -5px rgba(245, 158, 11, 0.18);
}

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

html {
  font-family: var(--font-sans);
  background-color: var(--bg-dark);
  color: var(--text-main);
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  width: 100%;
  max-width: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  width: 100%;
  max-width: 100%;
  background-color: var(--bg-canvas, #08090c);
  color: var(--text-primary, #f8fafc);
  font-family: var(--font-sans);
}

/* Subtle Film Grain */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.02'/%3E%3C/svg%3E");
  z-index: 99;
}

/* Container */
.container {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ---------------- FLOATING PILL NAVBAR ---------------- */
.navbar-wrapper {
  position: sticky;
  top: 1.25rem;
  z-index: 50;
  padding: 0 1rem;
  margin-bottom: 2rem;
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1.25rem;
  background: rgba(12, 16, 26, 0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-outer);
  border-radius: var(--radius-pill);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.6);
  max-width: 1200px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-main);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.brand-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #c5a880;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0b0e14;
  border: 1px solid var(--border-gold);
}

.brand-badge {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-gold);
  border: 1px solid var(--border-gold);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  list-style: none;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition-fluid);
  position: relative;
  cursor: pointer;
}

.nav-link:hover, .nav-link.active {
  color: var(--text-main);
}

.nav-link.active::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-primary);
  border-radius: 2px;
  box-shadow: 0 0 8px var(--accent-primary);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ---------------- BUTTONS & HAPTIC ISLANDS ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-pill);
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition-fluid);
  border: 1px solid transparent;
  outline: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent-primary, #c2410c);
  color: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.15);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  font-weight: 600;
}

.btn-primary:hover {
  filter: brightness(1.12);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transform: translateY(-1px);
}

[data-theme="night"] .btn-primary {
  background: #c2410c;
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="day"] .btn-primary {
  background: #9a3412;
  color: #ffffff;
  border-color: #7c2d12;
}

[data-theme="sepia"] .btn-primary {
  background: #9a3412;
  color: #ffffff;
  border-color: #7c2d12;
}

[data-theme="sage"] .btn-primary {
  background: #234e34;
  color: #f1f7f3;
  border-color: #38734f;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid var(--border-outer);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.btn-gold {
  background: #c5a880;
  color: #0b0e14;
  font-weight: 700;
  border: 1px solid rgba(197, 168, 128, 0.65);
  transition: transform 0.22s var(--ease-spring), background-color 0.2s ease, box-shadow 0.22s ease;
}

.btn-gold:hover {
  background: #d4b68c;
  box-shadow: 0 6px 20px rgba(197, 168, 128, 0.28);
  transform: translateY(-1px);
}

/* Button-in-Button Trailing Icon */
.btn-nested {
  padding-right: 0.5rem;
}

.btn-nested .icon-circle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
}

.btn-gold .icon-circle {
  background: rgba(0, 0, 0, 0.2);
}

.btn:hover .icon-circle {
  transform: translateX(2px) translateY(-1px);
}

/* ---------------- DOUBLE-BEZEL CARD ARCHITECTURE ---------------- */
.outer-bezel {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-outer);
  padding: 0.4rem;
  border-radius: var(--radius-outer);
  transition: var(--transition-fluid);
  position: relative;
}

.outer-bezel:hover {
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.inner-core {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-inner);
  border-radius: var(--radius-inner);
  padding: 1.5rem;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* ---------------- EYEBROW & BADGES ---------------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-pill);
  background: rgba(197, 160, 89, 0.12);
  border: 1px solid rgba(197, 160, 89, 0.3);
  color: var(--accent-gold);
  margin-bottom: 1rem;
}

.badge-tag {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-inner);
  color: var(--text-muted);
}

/* ---------------- HERO SECTION ---------------- */
.hero {
  padding: 3rem 0 4.5rem;
  text-align: center;
  position: relative;
}

.hero-title {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.035em;
  margin-bottom: 1.25rem;
  color: var(--text-primary);
}

.hero-description {
  font-size: clamp(1rem, 1.8vw, 1.2rem);
  color: var(--text-muted);
  max-width: 720px;
  margin: 0 auto 2.5rem;
  line-height: 1.6;
}

/* Hero Search & Instant Query Bar */
.search-container {
  max-width: 680px;
  margin: 0 auto 2rem;
  position: relative;
}

.search-box {
  display: flex;
  align-items: center;
  background: rgba(15, 21, 34, 0.85);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-outer);
  border-radius: var(--radius-pill);
  padding: 0.4rem 0.5rem 0.4rem 1.25rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  transition: var(--transition-fluid);
}

.search-box:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 25px rgba(197, 160, 89, 0.25);
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 0.95rem;
  font-family: var(--font-sans);
}

.search-input::placeholder {
  color: var(--text-dim);
}

/* Metric / Trust Bar */
.trust-metrics {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3rem;
  margin-top: 3.5rem;
  flex-wrap: wrap;
}

.metric-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.metric-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: #fff;
  font-family: var(--font-sans);
  letter-spacing: -0.02em;
}

.metric-label {
  font-size: 0.8rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: var(--font-mono);
}

/* ---------------- CATALOG & FILTERS BAR ---------------- */
.catalog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.catalog-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.filters-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.category-pills {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  margin-bottom: 2rem;
  scrollbar-width: none;
}

.category-pills::-webkit-scrollbar {
  display: none;
}

.cat-pill {
  padding: 0.45rem 1rem;
  border-radius: var(--radius-pill);
  background: var(--bg-surface-elevated, rgba(255, 255, 255, 0.03));
  border: 1px solid var(--border-inner, var(--border-outer));
  color: var(--text-secondary, var(--text-muted));
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-fluid);
}

.cat-pill:hover {
  background: var(--accent-muted, rgba(197, 160, 89, 0.14));
  border-color: var(--accent-primary, var(--accent-gold));
  color: var(--text-primary);
}

.cat-pill.active {
  background: var(--accent-primary, var(--accent-gold));
  border-color: var(--accent-primary, var(--accent-gold));
  color: var(--on-accent, #0b0e14);
  font-weight: 700;
}

.sort-select {
  background: var(--bg-surface);
  border: 1px solid var(--border-outer);
  color: var(--text-main);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-family: var(--font-sans);
  outline: none;
  cursor: pointer;
}

/* ---------------- PRODUCT GRID ---------------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  margin-bottom: 4rem;
}

/* ==========================================================================
   UNDICIDE QUESTION 6: APPROVED OPTION 5 CUSTOM HYBRID PRODUCT CARD SYSTEM
   ========================================================================== */
.product-card-wrap {
  background: var(--bg-card, #161B22);
  border: 1px solid var(--border-inner, rgba(255, 255, 255, 0.08));
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s, border-color 0.2s;
  position: relative;
}
.product-card-wrap:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
  border-color: var(--accent-gold, #C5A880);
}

/* Adaptive Top Context Strip */
.card-top-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  min-height: 38px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 11px;
}
.strip-pill {
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--badge-paid-color, #f3d79b);
  font-weight: 700;
  background: var(--badge-paid-bg, rgba(197, 168, 128, 0.14));
  padding: 2px 7px;
  border-radius: 3px;
  white-space: nowrap;
  max-width: 58%;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}
.strip-pill-free {
  color: var(--badge-free-color, #34d399) !important;
  background: var(--badge-free-bg, rgba(16, 185, 129, 0.14)) !important;
  border: 1px solid var(--badge-free-bg, rgba(16, 185, 129, 0.35));
}
.strip-content {
  font-family: 'Source Serif 4', Georgia, serif;
  font-style: italic;
  font-size: 12px;
  color: var(--text-muted, #8E95A5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
  text-align: right;
}

/* Cover Stage & 3D Book Diorama */
.card-cover-stage {
  height: 200px;
  background: radial-gradient(ellipse at 50% 30%, rgba(255, 255, 255, 0.06) 0%, rgba(0, 0, 0, 0.45) 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  perspective: 1200px;
  transform-style: preserve-3d;
  cursor: pointer;
  overflow: visible;
}

/* Floor Contact & Cast Shadow */
.book-3d-shadow {
  position: absolute;
  bottom: 14px;
  left: 50%;
  width: 110px;
  height: 18px;
  margin-left: -55px;
  background: radial-gradient(ellipse at 50% 50%, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0) 75%);
  border-radius: 50%;
  filter: blur(5px);
  pointer-events: none;
  transform-origin: center center;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  opacity: 0.6;
  z-index: 1;
}

.mini-book-specimen {
  width: clamp(118px, 32vw, 134px);
  height: clamp(148px, 38vw, 162px);
  background: var(--bg-surface, #161B22);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 3px 8px 8px 3px;
  box-shadow: -4px 8px 20px rgba(0, 0, 0, 0.5), inset 2px 0 5px rgba(255, 255, 255, 0.12);
  position: relative;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-left: 5px solid var(--accent-gold, #C5A880);
  transform-style: preserve-3d;
  transform-origin: center center;
  transform: rotateY(-6deg) rotateX(3deg) translateZ(0);
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.32s ease, border-color 0.2s ease;
  z-index: 2;
  will-change: transform;
}

/* Left Spine Crease & Stitch Line */
.mini-book-specimen::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 9px;
  width: 1.5px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22) 0%, rgba(0, 0, 0, 0.4) 100%);
  pointer-events: none;
  z-index: 4;
}

/* 3D Fore-Edge Paper Pages Thickness */
.mini-book-specimen::after {
  content: '';
  position: absolute;
  top: 3px;
  bottom: 3px;
  right: -7px;
  width: 7px;
  background: repeating-linear-gradient(
    180deg,
    #e8e4dc 0px,
    #ded8cc 1px,
    #f4f1ea 2px,
    #c9c2b4 3px
  );
  border-radius: 0 3px 3px 0;
  box-shadow: 2px 3px 8px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  transform: translateZ(-2px);
  z-index: -1;
}

/* Dynamic Specular Glare Layer */
.book-specular-glare {
  position: absolute;
  inset: 0;
  border-radius: 3px 8px 8px 3px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.28) 0%, rgba(255, 255, 255, 0) 70%);
  mix-blend-mode: overlay;
  z-index: 5;
}

/* Hover & Focus-within state */
.product-card-wrap:hover .mini-book-specimen,
.product-card-wrap:focus-within .mini-book-specimen {
  box-shadow: -10px 18px 32px rgba(0, 0, 0, 0.65), 0 0 24px rgba(197, 168, 128, 0.25);
  border-color: rgba(197, 168, 128, 0.4);
}

.product-card-wrap:hover .book-3d-shadow,
.product-card-wrap:focus-within .book-3d-shadow {
  transform: scale(1.15) translateY(4px);
  opacity: 0.8;
  filter: blur(7px);
}

/* Floating Action Controls (Behance Style) */
.card-stage-float-hud {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  z-index: 25;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.24s cubic-bezier(0.16, 1, 0.3, 1), transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.product-card-wrap:hover .card-stage-float-hud,
.product-card-wrap:focus-within .card-stage-float-hud,
.card-stage-float-hud.always-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.btn-card-float {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(15, 20, 32, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-gold, rgba(197, 168, 128, 0.35));
  color: var(--text-primary, #F4F2ED);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), background 0.18s, color 0.18s, border-color 0.18s;
  padding: 0;
}

.btn-card-float:hover {
  background: var(--accent-gold, #C5A880);
  color: #0b0e14;
  border-color: #fff;
  transform: scale(1.12);
  box-shadow: 0 6px 18px rgba(197, 168, 128, 0.45);
}

.btn-card-float:active {
  transform: scale(0.92);
}

.btn-card-float.active-wishlist {
  color: #ef4444;
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.18);
}

/* Floating Bottom Reveal Pill */
.card-stage-reveal-pill {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: rgba(15, 20, 32, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(197, 168, 128, 0.3);
  border-radius: 20px;
  padding: 4px 12px;
  font-family: var(--font-mono, monospace);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  color: var(--accent-gold, #C5A880);
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  z-index: 15;
}

.product-card-wrap:hover .card-stage-reveal-pill,
.product-card-wrap:focus-within .card-stage-reveal-pill {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.mini-book-top {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent-gold, #C5A880);
  text-transform: uppercase;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 3px;
  display: flex;
  justify-content: space-between;
}
.mini-book-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-main, #F4F2ED);
  margin: 6px 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mini-book-author {
  font-size: 9px;
  color: var(--text-dim, #64748b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mini-book-ribbon {
  position: absolute;
  top: 0;
  right: 12px;
  width: 8px;
  height: 20px;
  background: #B26A4A;
  border-radius: 0 0 3px 3px;
}
.mini-book-footer-stamp {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-family: var(--font-mono, monospace);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.stamp-paid {
  color: var(--accent-gold, #C5A880);
}
.stamp-free {
  color: #3FB950;
}

/* Card Body Content */
.card-body-content {
  padding: 18px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}
.card-category-lead {
  font-size: 10px;
  font-family: var(--font-mono, monospace);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-gold, #C5A880);
  margin-bottom: 6px;
  font-weight: 700;
}
.card-heading-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
  min-height: 2.6em;
  color: var(--text-main, #F4F2ED);
  margin-bottom: 6px;
  cursor: pointer;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.15s ease;
}
.card-heading-title:hover {
  color: var(--accent-gold, #C5A880);
}
.card-subtitle-desc {
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
  line-height: 1.45;
  min-height: 2.9em;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Contributor Row */
.card-contributor-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 10px;
}
.contrib-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.contrib-info {
  font-size: 11.5px;
  line-height: 1.3;
  min-width: 0;
}
.contrib-name {
  font-weight: 600;
  color: var(--text-main, #F4F2ED);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.contrib-role-tag {
  font-size: 10px;
  color: var(--badge-paid-color, #f3d79b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Volume Specs */
.card-specs-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-dim, #64748b);
  font-family: var(--font-mono, monospace);
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.verified-rating-pill {
  color: var(--accent-gold, #C5A880);
  font-weight: bold;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

/* Inline Table of Contents Expander */
.card-toc-accordion {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
  margin-top: auto;
  margin-bottom: 12px;
  overflow: hidden;
}
.toc-accordion-btn {
  width: 100%;
  padding: 10px 12px;
  min-height: 42px;
  background: transparent;
  border: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
  touch-action: manipulation;
}
.toc-accordion-btn:hover {
  color: var(--accent-gold, #C5A880);
}
.toc-arrow {
  font-size: 10px;
  transition: transform 0.2s ease;
}
.card-toc-accordion.open .toc-arrow {
  transform: rotate(180deg);
}
.toc-list-drawer {
  display: none;
  padding: 0 11px 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.card-toc-accordion.open .toc-list-drawer {
  display: block;
}
.toc-entry {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  padding: 4px 0;
  color: var(--text-muted, #94a3b8);
  border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
}
.toc-entry:last-child {
  border-bottom: none;
}
.toc-entry-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80%;
  color: var(--text-main, #F4F2ED);
}
.toc-entry-pg {
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  color: var(--accent-gold, #C5A880);
}

/* Pricing & Action Row */
.card-footer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  gap: 10px;
}
.card-toc-accordion + .card-footer-actions {
  margin-top: 0;
}
.price-block {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex-shrink: 1;
}
.price-val {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main, #F4F2ED);
  line-height: 1;
}
.price-val.free {
  color: var(--badge-free-color, #34d399);
}
.price-sub {
  font-size: 9px;
  color: var(--text-dim, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 3px;
  white-space: nowrap;
}
.actions-pair {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.btn-sample-ghost {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-main, #F4F2ED);
  padding: 0 11px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  height: 36px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  touch-action: manipulation;
  transition: all 0.2s ease;
}
.btn-sample-ghost:hover {
  border-color: var(--accent-gold, #C5A880);
  color: var(--accent-gold, #C5A880);
}
.btn-acquire-solid {
  background: var(--text-main, #F4F2ED);
  color: var(--bg-canvas, #0D1117);
  border: 1px solid var(--text-main, #F4F2ED);
  padding: 0 13px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  height: 36px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  text-decoration: none;
  touch-action: manipulation;
  transition: all 0.2s ease;
}
.btn-acquire-solid:hover {
  opacity: 0.9;
}
.btn-free-solid {
  background: #047857;
  color: #FFFFFF;
  border-color: #047857;
}
.btn-free-solid:hover {
  background: #065f46;
  border-color: #065f46;
  color: #FFFFFF;
}

@media (max-width: 600px) {
  .btn-sample-ghost,
  .btn-acquire-solid {
    min-height: 42px;
    padding: 8px 12px;
  }
}

@media (max-width: 480px) {
  .card-footer-actions {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }
  .card-footer-actions .price-block {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: baseline !important;
    width: 100% !important;
  }
  .card-footer-actions .actions-pair {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    width: 100% !important;
  }
  .card-footer-actions .actions-pair .btn-sample-ghost,
  .card-footer-actions .actions-pair .btn-acquire-solid {
    width: 100% !important;
    min-height: 42px !important;
    padding: 8px 6px !important;
    font-size: 11.5px !important;
    text-align: center !important;
    justify-content: center !important;
  }
}

/* Specimen Preview Sheet Modal */
.specimen-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(7, 10, 14, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.specimen-modal-backdrop.open {
  display: flex;
}
.specimen-modal-card {
  background: var(--bg-surface, #161B22);
  border: 1px solid var(--border-inner, rgba(255, 255, 255, 0.1));
  border-radius: 10px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0,0,0,0.7);
  padding: 22px;
}
.specimen-modal-card .modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 12px;
  margin-bottom: 14px;
}
.specimen-modal-card .modal-head h3 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 19px;
  color: var(--text-main, #F4F2ED);
}
.specimen-modal-card .modal-close {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted, #94a3b8);
  width: 30px;
  height: 30px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.authentic-paper-sheet {
  background: #FAF8F2;
  color: #1A1A1A;
  border: 1px solid #D5D5D5;
  border-radius: 4px;
  padding: 20px;
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 13px;
  line-height: 1.6;
  margin: 12px 0;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}
.sheet-meta-bar {
  font-family: var(--font-mono, monospace);
  font-size: 9.5px;
  font-weight: 700;
  color: #666;
  border-bottom: 1px solid #E5E5E5;
  padding-bottom: 6px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.sheet-callout-box {
  background: #F7F5F0;
  border-left: 3px solid #C85A32;
  padding: 8px 12px;
  margin: 10px 0;
  font-style: italic;
  font-size: 12px;
  color: #333;
}
.reader-status-notice {
  font-size: 11px;
  color: var(--text-dim, #64748b);
  padding: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  margin-top: 12px;
  line-height: 1.45;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.5rem;
  line-height: 1.35;
  letter-spacing: -0.015em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 1.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.card-author {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-inner);
}

.author-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-outer);
}

.author-info {
  display: flex;
  flex-direction: column;
}

.author-name {
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-main);
}

.author-role {
  font-size: 0.725rem;
  color: var(--text-dim);
}

.card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.price-box {
  display: flex;
  flex-direction: column;
}

.current-price {
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
  font-family: var(--font-sans);
}

.original-price {
  font-size: 0.8rem;
  color: var(--text-dim);
  text-decoration: line-through;
  font-family: var(--font-mono);
}

/* ---------------- PRODUCT DETAIL VIEW ---------------- */
.product-detail-view {
  padding: 2rem 0 5rem;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 2rem;
  transition: var(--transition-fluid);
}

.back-btn:hover {
  color: #fff;
  transform: translateX(-3px);
}

.detail-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 2.5rem;
  align-items: start;
}

.detail-main {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.detail-header {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.detail-title {
  font-size: clamp(1.45rem, 4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #fff;
  line-height: 1.2;
}

.detail-meta-bar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* PDF PREVIEW CAROUSEL / READER WINDOW */
.pdf-viewer-window {
  background: #080b12;
  border: 1px solid var(--border-outer);
  border-radius: var(--radius-outer);
  padding: 1.5rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-inner);
}

.viewer-page-counter {
  font-size: 0.85rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.preview-pages-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.pdf-preview-sheet {
  background: #ffffff;
  color: #111827;
  border-radius: 8px;
  padding: 2.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  position: relative;
  min-height: 380px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.pdf-preview-sheet.locked {
  filter: blur(4px);
  user-select: none;
  pointer-events: none;
}

.locked-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(7, 9, 14, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 8px;
  z-index: 10;
  padding: 2rem;
  text-align: center;
  border: 1px solid var(--border-gold);
}

.lock-icon-glow {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid var(--accent-gold);
  color: var(--accent-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-gold-glow);
}

.pdf-canvas-container {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #ffffff;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.pdf-render-canvas {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
}

.sandbox-warning-banner {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  color: #fbbf24;
  font-size: 0.8rem;
  line-height: 1.5;
}

.live-gateway-banner {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  color: #6ee7b7;
  font-size: 0.8rem;
  line-height: 1.5;
}

/* Sticky Action Sidebar */
.detail-sidebar {
  position: sticky;
  top: 6rem;
}

.purchase-card {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.specs-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-size: 0.85rem;
  margin: 1rem 0;
  border-top: 1px solid var(--border-inner);
  border-bottom: 1px solid var(--border-inner);
  padding: 1rem 0;
}

.spec-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.spec-key {
  color: var(--text-dim);
}

.spec-val {
  color: var(--text-main);
  font-family: var(--font-mono);
  font-weight: 500;
}

/* ---------------- CHECKOUT & MODAL SYSTEM ---------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

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

.modal-card {
  width: 100%;
  max-width: 520px;
  background: var(--bg-surface);
  border: 1px solid var(--border-outer);
  border-radius: var(--radius-outer);
  padding: 2rem;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8);
  position: relative;
  transform: translateY(20px);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.open .modal-card {
  transform: translateY(0);
}

.modal-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-inner);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fluid);
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
}

.form-label {
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-input {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-outer);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition-fluid);
}

.form-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 15px rgba(197, 160, 89, 0.25);
}

/* Coupon Box */
.coupon-box {
  display: flex;
  gap: 0.5rem;
}

.coupon-box .form-input {
  flex: 1;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

/* ---------------- ADMIN DASHBOARD ---------------- */
.admin-view {
  padding: 2rem 0 5rem;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}

.kpi-card {
  padding: 1.25rem;
}

.kpi-val {
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.25rem;
}

.kpi-title {
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
  text-transform: uppercase;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin-top: 1rem;
}

.admin-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-outer);
}

.admin-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-inner);
  color: var(--text-muted);
}

.admin-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-main);
}

/* ---------------- USER LIBRARY VIEW ---------------- */
.library-view {
  padding: 2rem 0 5rem;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

/* ---------------- FOOTER ---------------- */
footer {
  margin-top: auto;
  border-top: 1px solid var(--border-outer);
  padding: 3.5rem 0 2.5rem;
  background: #05070a;
}

.footer-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.footer-nav {
  display: flex;
  gap: 1.5rem;
}

.footer-nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.85rem;
  transition: var(--transition-fluid);
}

.footer-nav a:hover {
  color: var(--text-main);
}

/* ---------------- MOBILE DRAWER & RESPONSIVENESS ---------------- */
.hamburger-btn {
  display: none;
  background: var(--bg-surface-elevated, rgba(255, 255, 255, 0.05));
  border: 1px solid var(--border-inner, var(--border-outer));
  color: var(--text-primary, var(--text-main));
  cursor: pointer;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition-fluid);
  padding: 0;
}

.hamburger-btn:hover {
  background: var(--accent-muted, rgba(255, 255, 255, 0.1));
  border-color: var(--accent-primary, var(--border-gold));
}

/* Mobile Drawer Backdrop */
.mobile-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 6, 12, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

/* Mobile Navigation Drawer Sheet */
.mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(340px, 86vw);
  background: rgba(12, 16, 26, 0.98);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border-left: 1px solid var(--border-outer);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.8);
  z-index: 999;
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.35s ease;
  overflow-y: auto;
  overflow-x: hidden;
}

.mobile-drawer.open {
  transform: translateX(0);
  visibility: visible;
}

.mobile-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-inner);
  margin-bottom: 1.25rem;
}

#mobile-drawer-close,
.mobile-drawer-close {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-inner);
  color: var(--text-muted);
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
  transition: var(--transition-fluid);
  touch-action: manipulation;
}

#mobile-drawer-close:hover,
.mobile-drawer-close:hover {
  color: #fff;
  border-color: var(--accent-gold);
  background: rgba(245, 158, 11, 0.1);
}

.mobile-drawer-search {
  margin-bottom: 1.25rem;
}

.mobile-drawer-search .search-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-inner);
  border-radius: var(--radius-pill);
  padding: 0.5rem 0.85rem;
  display: flex;
  align-items: center;
}

.mobile-drawer-search .search-input {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 0.875rem;
  width: 100%;
  outline: none;
}

.mobile-drawer-nav {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
}

.mobile-nav-item,
.mobile-nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  min-height: 44px;
  border-radius: var(--radius-inner);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  transition: var(--transition-fluid);
  touch-action: manipulation;
}

.mobile-nav-item:hover,
.mobile-nav-link:hover,
.mobile-nav-item.active,
.mobile-nav-link.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
}

.mobile-nav-item.active,
.mobile-nav-link.active {
  border-left: 3px solid var(--accent-gold);
  background: rgba(245, 158, 11, 0.08);
}

.mobile-nav-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
}

.mobile-drawer-categories {
  border-top: 1px solid var(--border-inner);
  padding-top: 1.25rem;
  margin-bottom: 1.5rem;
}

.mobile-section-heading {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.75rem;
}

.mobile-category-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.mobile-cat-item {
  color: var(--text-muted);
  font-size: 0.82rem;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  text-decoration: none;
  transition: var(--transition-fluid);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mobile-cat-item:hover {
  color: var(--accent-gold);
  background: rgba(255, 255, 255, 0.03);
}

.mobile-drawer-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-inner);
  padding-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.mobile-auth-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.mobile-drawer-meta {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-dim);
  text-align: center;
  padding: 0.25rem 0;
}

@media (max-width: 900px) {
  .nav-links {
    display: none;
  }
  
  .hamburger-btn {
    display: flex;
  }

  .detail-layout {
    grid-template-columns: 1fr;
  }
  
  .detail-sidebar {
    position: static;
  }
}

@media (max-width: 768px) {
  .hero-title {
    font-size: 2.15rem;
  }

  .trust-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    width: 100%;
  }

  .metric-item {
    text-align: center;
  }

  .product-grid {
    grid-template-columns: 1fr;
  }

  .outer-bezel {
    border-radius: 1.25rem;
    padding: 0.25rem;
  }

  .inner-core {
    border-radius: calc(1.25rem - 0.25rem);
    padding: 1.25rem;
  }

  .catalog-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
}

@media (max-width: 640px) {
  .navbar-wrapper {
    padding: 0 0.5rem;
    top: 0.5rem;
  }

  .navbar {
    padding: 0.5rem 0.85rem;
  }

  .brand-badge {
    display: none;
  }

  .brand {
    font-size: 1rem;
    gap: 0.5rem;
  }

  .brand-icon {
    width: 28px;
    height: 28px;
  }

  .hero-title {
    font-size: 1.85rem;
    line-height: 1.15;
  }

  .hero-description {
    font-size: 0.88rem;
    line-height: 1.5;
  }

  .search-box {
    padding: 0.4rem 0.6rem;
  }

  .search-box button {
    padding: 0.45rem 0.8rem !important;
    font-size: 0.78rem !important;
  }

  .trust-metrics {
    gap: 0.75rem;
  }

  .metric-value {
    font-size: 1.35rem;
  }

  .metric-label {
    font-size: 0.7rem;
  }

  .modal {
    width: 94vw;
    padding: 1.25rem;
    max-height: 92vh;
  }
}

@media (max-width: 420px) {
  .outer-bezel {
    border-radius: 1rem;
    padding: 0.2rem;
  }

  .inner-core {
    border-radius: calc(1rem - 0.2rem);
    padding: 0.95rem;
  }

  .card-bottom {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }

  .card-bottom .btn {
    width: 100%;
  }

  .detail-layout {
    gap: 1.25rem;
  }

  .category-pills {
    padding-bottom: 0.35rem;
  }

  .cat-pill {
    padding: 0.4rem 0.85rem;
    font-size: 0.78rem;
  }
}

@media (max-width: 380px) {
  .hero-title {
    font-size: 1.65rem;
  }

  .trust-metrics {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }

  .metric-item {
    padding: 0.6rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
  }

  .navbar {
    padding: 0.45rem 0.65rem;
  }
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  border-radius: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-outer);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  color: var(--text-primary);
  font-size: 0.875rem;
  animation: slideInUp 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.toast-success {
  border-color: var(--accent-emerald);
}

.toast-error {
  border-color: var(--accent-rose);
}

@keyframes slideInUp {
  from {
    transform: translateY(14px) scale(0.97);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* ==========================================================================
   UNDICIDE Q9 — STUDENT DASHBOARD & MY LIBRARY (THE CONTEMPORARY EDITORIAL LIBRARY)
   Four-Theme Matrix & Responsive Scholarly Repository
   ========================================================================== */

[data-theme="day"] {
  --bg-dark: #F7F5F0;
  --bg-surface: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F9F7F2;
  --bg-inner: #F0EDE4;
  --border-outer: rgba(0, 0, 0, 0.10);
  --border-inner: rgba(0, 0, 0, 0.05);
  --text-main: #16191F;
  --text-muted: #565C68;
  --text-dim: #5e5549;
  --accent-gold: #8C6430;
  --accent-gold-hover: #8C6430;
  --border-gold: rgba(160, 120, 64, 0.25);
  --accent-emerald: #065f46;
  --accent-rose: #C03535;
}

[data-theme="sepia"] {
  --bg-dark: #F4EFE6;
  --bg-surface: #FAF7F2;
  --bg-card: #FAF7F2;
  --bg-card-hover: #F0E8D9;
  --bg-inner: #EDE5D8;
  --border-outer: rgba(80, 60, 40, 0.12);
  --border-inner: rgba(80, 60, 40, 0.06);
  --text-main: #26201A;
  --text-muted: #5c4e40;
  --text-dim: #594429;
  --accent-gold: #8C6534;
  --accent-gold-hover: #755227;
  --border-gold: rgba(140, 101, 52, 0.25);
  --accent-emerald: #25663E;
  --accent-rose: #AA3232;
}

[data-theme="sage"] {
  --bg-dark: #0D1411;
  --bg-surface: #131E19;
  --bg-card: rgba(19, 30, 25, 0.85);
  --bg-card-hover: rgba(26, 40, 34, 0.95);
  --bg-inner: #1A2822;
  --border-outer: rgba(180, 210, 190, 0.12);
  --border-inner: rgba(180, 210, 190, 0.06);
  --text-main: #EEF4F0;
  --text-muted: #a9bdb2;
  --text-dim: #9ab0a4;
  --accent-gold: #9C8052;
  --accent-gold-hover: #B09260;
  --border-gold: rgba(156, 128, 82, 0.28);
  --accent-emerald: #3DA36E;
  --accent-rose: #D94E4E;
}

/* Meridian Mark SVG */
.meridian-mark-svg {
  width: 24px;
  height: 26px;
  flex-shrink: 0;
  display: inline-block;
}
.meridian-mark-svg .stem { fill: currentColor; }
.meridian-mark-svg .ribbon { fill: var(--accent-gold); }

/* Dashboard Container */
.dashboard-container {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2rem;
  align-items: start;
  width: 100%;
}

.dashboard-sidebar {
  background: var(--bg-surface);
  border: 1px solid var(--border-outer);
  border-radius: 1.25rem;
  padding: 1.25rem;
  position: sticky;
  top: 5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nav-section-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 0.5rem 0.65rem 0.25rem 0.65rem;
}

.nav-item-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: var(--transition-fluid);
}

.nav-item-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
}

.nav-item-btn.active {
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent-gold);
  font-weight: 600;
  border-left: 3px solid var(--accent-gold);
}

.nav-badge-pill {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
  background: var(--bg-inner);
  color: var(--text-dim);
}

.nav-item-btn.active .nav-badge-pill {
  background: var(--accent-gold);
  color: #0A0D12;
  font-weight: 700;
}

.sidebar-account-box {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-inner);
  font-size: 0.72rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.dashboard-main {
  min-width: 0;
  width: 100%;
}

.welcome-hero {
  background: var(--bg-surface);
  border: 1px solid var(--border-outer);
  border-radius: 1.25rem;
  padding: 1.75rem;
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.welcome-title {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.welcome-sub {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.metrics-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-outer);
  border-radius: 1rem;
  padding: 1.15rem;
  text-align: left;
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.35rem;
}

.stat-value {
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.1;
}

.stat-note {
  font-size: 0.72rem;
  color: var(--accent-gold);
  font-family: var(--font-mono);
  margin-top: 0.25rem;
}

.continue-reading-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-outer);
  border-left: 4px solid var(--accent-gold);
  border-radius: 1rem;
  padding: 1.5rem;
  margin-bottom: 2rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1.5rem;
  align-items: center;
}

.reader-mini-cover {
  width: 75px;
  height: 105px;
  background: #121722;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 3px 8px 8px 3px;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: -4px 6px 12px rgba(0,0,0,0.4);
  position: relative;
}

.reader-mini-cover::before {
  content: "";
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 7px;
  background: rgba(0,0,0,0.35);
  border-right: 1px solid rgba(255,255,255,0.06);
}

.progress-bar-wrap {
  width: 100%;
  height: 6px;
  background: var(--bg-inner);
  border-radius: 9999px;
  overflow: hidden;
  margin: 0.65rem 0;
  border: 1px solid var(--border-inner);
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent-gold);
  border-radius: 9999px;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.library-book-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-outer);
  border-radius: 1.15rem;
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  transition: var(--transition-fluid);
  position: relative;
}

.library-book-card:hover {
  border-color: var(--accent-gold);
  box-shadow: 0 10px 25px rgba(0,0,0,0.3);
  transform: translateY(-2px);
}

.card-top-row {
  display: flex;
  gap: 1rem;
  align-items: start;
}

.card-book-meta {
  flex: 1;
  min-width: 0;
}

.card-category-badge {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-weight: 600;
  display: inline-block;
  margin-bottom: 0.35rem;
}

.badge-paid-entry { background: rgba(245, 158, 11, 0.15); color: var(--accent-gold); border: 1px solid var(--border-gold); }
.badge-free-entry { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); border: 1px solid rgba(16, 185, 129, 0.3); }

.card-book-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
  margin-bottom: 0.35rem;
}

.card-details-line {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.card-action-cluster {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-inner);
}

.btn-action-primary {
  background: var(--accent-gold);
  color: #080B0F;
  border: none;
  padding: 0.55rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: var(--transition-fluid);
  flex: 1;
  justify-content: center;
  text-decoration: none;
}

.btn-action-primary:hover {
  background: var(--accent-gold-hover);
}

.btn-action-secondary {
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--border-outer);
  padding: 0.55rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: var(--transition-fluid);
  flex: 1;
  justify-content: center;
  text-decoration: none;
}

.btn-action-secondary:hover {
  border-color: var(--text-main);
}

.library-filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.search-input-box {
  flex: 1;
  min-width: 240px;
  position: relative;
}

.search-input-field {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-outer);
  border-radius: 9999px;
  padding: 0.55rem 1rem 0.55rem 2.25rem;
  font-size: 0.82rem;
  color: var(--text-main);
  outline: none;
  font-family: var(--font-sans);
}

.search-input-field:focus {
  border-color: var(--accent-gold);
}

.search-icon-fixed {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  color: var(--text-dim);
}

.filter-pills-row {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.filter-pill {
  background: var(--bg-surface);
  border: 1px solid var(--border-outer);
  color: var(--text-muted);
  padding: 0.4rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: var(--transition-fluid);
}

.filter-pill.active, .filter-pill:hover {
  background: var(--text-main);
  color: var(--bg-dark);
  font-weight: 600;
}

.ledger-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-outer);
  border-radius: 1rem;
  background: var(--bg-surface);
}

.ledger-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.82rem;
}

.ledger-table th {
  background: var(--bg-inner);
  padding: 0.85rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border-outer);
}

.ledger-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-inner);
  color: var(--text-main);
  vertical-align: middle;
}

.ledger-table tr:last-child td {
  border-bottom: none;
}

.status-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  display: inline-block;
}

.status-badge.completed { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); border: 1px solid rgba(16, 185, 129, 0.3); }
.status-badge.pending   { background: rgba(245, 158, 11, 0.15); color: var(--accent-gold); border: 1px solid var(--border-gold); }
.status-badge.failed    { background: rgba(244, 63, 94, 0.15); color: var(--accent-rose); border: 1px solid rgba(244, 63, 94, 0.3); }

.empty-state-card {
  text-align: center;
  padding: 4rem 1.5rem;
  max-width: 520px;
  margin: 0 auto;
}

.empty-icon-glyph {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.6;
}

.empty-state-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.empty-state-lead {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
  line-height: 1.6;
}

.demo-data-disclaimer {
  background: var(--bg-surface);
  border: 1px solid var(--border-outer);
  border-left: 4px solid var(--accent-gold);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 2rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

@media (max-width: 1024px) {
  .dashboard-container {
    grid-template-columns: 1fr;
  }
  .dashboard-sidebar {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    padding: 0.75rem;
    border-radius: 1rem;
  }
  .nav-section-label, .sidebar-account-box {
    display: none;
  }
  .nav-item-btn {
    width: auto;
    white-space: nowrap;
    padding: 0.45rem 0.75rem;
  }
  .metrics-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .dashboard-container {
    padding: 0 !important;
    gap: 1.25rem !important;
  }
  .welcome-hero {
    padding: 1.25rem 1rem !important;
  }
  .continue-reading-card {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .continue-reading-card .reader-mini-cover {
    margin: 0 auto;
  }
  .metrics-stats-grid {
    grid-template-columns: 1fr;
  }
  .library-grid {
    grid-template-columns: 1fr;
  }
  .card-top-row {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .card-details-line {
    justify-content: center;
  }
}

@media (max-width: 375px) {
  .welcome-title {
    font-size: 1.45rem !important;
  }
  .stat-value {
    font-size: 1.5rem !important;
  }
}


/* ==========================================================================
   UNDICIDE APPROVED HOMEPAGE & EDITORIAL DESIGN SYSTEM (Q5, Q6, Q7, Q8, Q9)
   ========================================================================== */

    /* ==========================================================================
       UNDICIDE APPROVED DESIGN TOKENS & FOUR ENVIRONMENTAL THEMES
       ========================================================================== */
    :root {
      /* Typography Pairing */
      --font-editorial: 'Cormorant Garamond', Georgia, serif;
      --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      --font-ui-tight: 'Inter Tight', 'Inter', sans-serif;
      --font-reading: 'Source Serif 4', Georgia, serif;
      --font-mono: 'JetBrains Mono', monospace;
      --font-hand: 'Caveat', cursive;

      /* Motion */
      --transition-smooth: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
      --radius-sm: 4px;
      --radius-md: 8px;
      --radius-lg: 12px;
      --radius-pill: 9999px;
    }

    /* THEME 1: NIGHT — ARCHIVAL MONOGRAPH (Default) */
    [data-theme="night"] {
      --bg-canvas: #0b0e14;
      --bg-surface: #111622;
      --bg-surface-elevated: #182030;
      --bg-surface-alt: #141b29;
      --border-outer: #1e283c;
      --border-inner: #29354e;
      --border-accent: rgba(197, 160, 89, 0.4);
      --text-primary: #f1f4f9;
      --text-secondary: #c5cedd;
      --text-muted: #9eadc4;
      --text-dim: #94a3b8;
      --accent-primary: #c5a059;
      --on-accent: #0b0e14;
      --accent-hover: #dbb56e;
      --accent-muted: rgba(197, 160, 89, 0.12);
      --accent-emerald: #10b981;
      --accent-emerald-muted: rgba(16, 185, 129, 0.12);
      --accent-terracotta: #b34d28;
      --card-shadow: 0 12px 32px -4px rgba(0, 0, 0, 0.5);
      --badge-free-bg: rgba(16, 185, 129, 0.15);
      --badge-free-color: #34d399;
      --badge-paid-bg: rgba(197, 160, 89, 0.18);
      --badge-paid-color: #f3d79b;
      --book-cover-bg: #151a24;
      --book-edge: #d1c8b8;
    }

    /* THEME 2: DAY — CONTINENTAL PRESS */
    [data-theme="day"] {
      --bg-canvas: #f9f8f5;
      --bg-surface: #ffffff;
      --bg-surface-elevated: #f2efe9;
      --bg-surface-alt: #eae5dc;
      --border-outer: #e6e2d8;
      --border-inner: #ded8cb;
      --border-accent: rgba(179, 77, 40, 0.35);
      --text-primary: #241e17;
      --text-secondary: #42382c;
      --text-muted: #5e5549;
      --text-dim: #5e5549;
      --accent-primary: #b34d28;
      --on-accent: #ffffff;
      --accent-hover: #983e1e;
      --accent-muted: rgba(179, 77, 40, 0.08);
      --accent-emerald: #059669;
      --accent-emerald-muted: rgba(5, 150, 105, 0.08);
      --accent-terracotta: #b34d28;
      --card-shadow: 0 10px 28px -4px rgba(36, 30, 23, 0.08);
      --badge-free-bg: rgba(5, 150, 105, 0.1);
      --badge-free-color: #065f46;
      --badge-paid-bg: rgba(179, 77, 40, 0.1);
      --badge-paid-color: #983e1e;
      --book-cover-bg: #2a221b;
      --book-edge: #f5f0e6;
    }

    /* THEME 3: SEPIA — TUSCAN PARCHMENT */
    [data-theme="sepia"] {
      --bg-canvas: #f4ecd8;
      --bg-surface: #ede0c4;
      --bg-surface-elevated: #e2d2b0;
      --bg-surface-alt: #d8c6a0;
      --border-outer: #dfd3b9;
      --border-inner: #d1c3a5;
      --border-accent: rgba(138, 90, 43, 0.4);
      --text-primary: #2c2214;
      --text-secondary: #473822;
      --text-muted: #5c482c;
      --text-dim: #594429;
      --accent-primary: #8a5a2b;
      --on-accent: #ffffff;
      --accent-hover: #704720;
      --accent-muted: rgba(138, 90, 43, 0.12);
      --accent-emerald: #2e7d32;
      --accent-emerald-muted: rgba(46, 125, 50, 0.12);
      --accent-terracotta: #a04020;
      --card-shadow: 0 12px 30px -4px rgba(44, 34, 20, 0.1);
      --badge-free-bg: rgba(46, 125, 50, 0.12);
      --badge-free-color: #14532d;
      --badge-paid-bg: rgba(138, 90, 43, 0.15);
      --badge-paid-color: #5c3b17;
      --book-cover-bg: #382a1a;
      --book-edge: #efe2c8;
    }

    /* THEME 4: SAGE STUDY — BOTANICAL ACADEMIC */
    [data-theme="sage"] {
      --bg-canvas: #edf2ed;
      --bg-surface: #e1eae1;
      --bg-surface-elevated: #d2dfd2;
      --bg-surface-alt: #c4d4c4;
      --border-outer: #c8d8c8;
      --border-inner: #b9ccb9;
      --border-accent: rgba(61, 122, 90, 0.4);
      --text-primary: #1b2b1e;
      --text-main: #1b2b1e;
      --text-secondary: #324a36;
      --text-muted: #3f5944;
      --text-dim: #3d5642;
      --accent-primary: #3d7a5a;
      --on-accent: #ffffff;
      --accent-hover: #2f5f46;
      --accent-muted: rgba(61, 122, 90, 0.12);
      --accent-emerald: #2e7d32;
      --accent-emerald-muted: rgba(46, 125, 50, 0.12);
      --accent-terracotta: #a65032;
      --card-shadow: 0 12px 30px -4px rgba(27, 43, 30, 0.08);
      --badge-free-bg: rgba(46, 125, 50, 0.12);
      --badge-free-color: #14532d;
      --badge-paid-bg: rgba(61, 122, 90, 0.16);
      --badge-paid-color: #274e3a;
      --book-cover-bg: #1e3324;
      --book-edge: #e6efe6;
    }

    /* BASE RESET & STRUCTURE */
    *, *::before, *::after {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
    }

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

    body {
      background-color: var(--bg-canvas);
      color: var(--text-primary);
      font-family: var(--font-ui);
      font-size: 15px;
      line-height: 1.6;
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
      overflow-x: hidden;
      transition: background-color 0.3s ease, color 0.3s ease;
    }

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

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

    .container {
      width: 100%;
      max-width: 1360px;
      margin: 0 auto;
      padding: 0 2rem;
    }

    @media (max-width: 768px) {
      .container {
        padding: 0 1.25rem;
      }
    }

    @media (max-width: 390px) {
      .container {
        padding: 0 0.85rem;
      }
    }

    /* ==========================================================================
       EDITORIAL TOP BAR & NAVBAR
       ========================================================================== */
    .archival-ticker {
      background: var(--bg-surface-elevated);
      border-bottom: 1px solid var(--border-outer);
      padding: 0.45rem 0;
      font-family: var(--font-mono);
      font-size: 0.72rem;
      color: var(--text-muted);
      letter-spacing: 0.04em;
    }

    .ticker-inner {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 1rem;
      flex-wrap: wrap;
    }

    .ticker-left {
      display: flex;
      align-items: center;
      gap: 0.75rem;
    }

    .ticker-pill {
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
      padding: 0.15rem 0.5rem;
      background: var(--accent-muted);
      color: var(--accent-primary);
      border-radius: var(--radius-pill);
      font-size: 0.68rem;
      font-weight: 600;
      text-transform: uppercase;
    }

    .ticker-right {
      display: flex;
      align-items: center;
      gap: 1rem;
    }

    .theme-selector-group {
      display: inline-flex;
      background: var(--bg-surface);
      border: 1px solid var(--border-inner);
      border-radius: var(--radius-pill);
      padding: 2px;
    }

    .theme-btn {
      padding: 0.2rem 0.65rem;
      font-size: 0.68rem;
      font-family: var(--font-ui-tight);
      font-weight: 600;
      color: var(--text-muted);
      border-radius: var(--radius-pill);
      transition: var(--transition-smooth);
    }

    .theme-btn.active, .theme-btn:hover {
      background: var(--accent-primary);
      color: #fff;
    }

    /* MAIN NAVBAR */
    .editorial-navbar,
    .editorial-navbar.navbar-wrapper {
      background: var(--bg-surface);
      border-bottom: 1px solid var(--border-outer);
      position: sticky;
      top: 0;
      padding: 0;
      margin-bottom: 0;
      z-index: 100;
      backdrop-filter: blur(12px);
      transition: background-color 0.3s ease;
    }

    .navbar-inner {
      display: flex;
      align-items: center;
      justify-content: space-between;
      min-height: 70px;
      gap: clamp(0.5rem, 1vw, 1rem);
      min-width: 0;
    }

    /* EXACT APPROVED LOGO LOCKUP */
    .brand-lockup {
      display: inline-flex;
      align-items: center;
      gap: 0.75rem;
      text-decoration: none;
      flex-shrink: 0;
      min-width: 0;
    }

    .logo-svg-box {
      width: 40px;
      height: 40px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }

    .brand-text-col {
      display: flex;
      flex-direction: column;
      min-width: 0;
    }

    .brand-wordmark {
      font-family: var(--font-editorial);
      font-size: 1.65rem;
      font-weight: 600;
      letter-spacing: 0.16em;
      line-height: 1;
      color: var(--text-primary);
      white-space: nowrap;
    }

    .brand-descriptor {
      font-family: var(--font-ui-tight);
      font-size: 0.6rem;
      font-weight: 600;
      letter-spacing: 0.2em;
      text-transform: uppercase;
      color: var(--accent-primary);
      margin-top: 0.2rem;
      white-space: nowrap;
    }

    /* NAV LINKS */
    .nav-routes {
      display: flex;
      align-items: center;
      gap: clamp(0.65rem, 1vw, 1.1rem);
      list-style: none;
      flex-wrap: nowrap;
      white-space: nowrap;
      min-width: 0;
    }

    .nav-item-link {
      font-family: var(--font-ui-tight);
      font-size: 0.84rem;
      font-weight: 500;
      color: var(--text-muted);
      transition: color 0.2s ease;
      position: relative;
      padding: 0.4rem 0;
      white-space: nowrap;
      flex-shrink: 0;
      line-height: 1.2;
    }

    .nav-item-link:hover, .nav-link.active, .nav-item-link.active {
      color: var(--text-primary);
    }

    .nav-item-link.active::after {
      content: '';
      position: absolute;
      bottom: 0;
      left: 0;
      width: 100%;
      height: 2px;
      background: var(--accent-primary);
    }

    .nav-actions {
      display: flex;
      align-items: center;
      gap: 0.45rem;
      flex-wrap: nowrap;
      flex-shrink: 0;
      min-width: 0;
    }

    .nav-auth-container,
    #nav-auth-actions {
      display: inline-flex;
      align-items: center;
      gap: 0.45rem;
      flex-wrap: nowrap;
      flex-shrink: 0;
      min-width: 0;
    }

    .nav-auth-container .btn,
    #nav-auth-actions .btn,
    .btn-archival {
      white-space: nowrap;
      flex-shrink: 0;
      line-height: 1.2;
    }

    .user-profile-menu {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      min-width: 0;
    }

    .nav-user-btn {
      display: inline-flex;
      align-items: center;
      gap: 0.55rem;
      background: transparent;
      border: 1px solid transparent;
      padding: 0.2rem 0.35rem;
      border-radius: 8px;
      cursor: pointer;
      text-align: left;
      min-width: 0;
      max-width: 175px;
      transition: border-color 0.18s ease, background-color 0.18s ease;
    }

    .nav-user-btn:hover {
      border-color: var(--border-inner);
      background: rgba(255, 255, 255, 0.04);
    }

    .nav-user-avatar {
      width: 30px;
      height: 30px;
      border-radius: 50%;
      object-fit: cover;
      flex-shrink: 0;
      border: 1px solid var(--border-gold);
    }

    .nav-user-meta {
      display: flex;
      flex-direction: column;
      min-width: 0;
    }

    .nav-user-name-row {
      display: inline-flex;
      align-items: center;
      min-width: 0;
    }

    .nav-user-name {
      font-size: 0.8rem;
      font-weight: 700;
      color: var(--text-primary);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 120px;
    }

    .nav-user-sub {
      font-size: 0.64rem;
      font-family: var(--font-mono);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 120px;
    }

    .nav-logout-btn {
      padding: 0.36rem 0.68rem !important;
      font-size: 0.74rem !important;
      line-height: 1.2 !important;
      white-space: nowrap;
      flex-shrink: 0;
    }

    .btn-archival {
      display: inline-flex;
      align-items: center;
      gap: 0.45rem;
      padding: 0.46rem 0.85rem;
      font-family: var(--font-ui-tight);
      font-size: 0.82rem;
      font-weight: 600;
      border-radius: var(--radius-sm);
      border: 1px solid var(--border-inner);
      color: var(--text-secondary);
      background: var(--bg-surface-elevated);
      transition: var(--transition-smooth);
    }

    .btn-archival:hover {
      border-color: var(--accent-primary);
      color: var(--accent-primary);
    }

    .btn-primary-folio {
      display: inline-flex;
      align-items: center;
      gap: 0.5rem;
      padding: 0.55rem 1.25rem;
      font-family: var(--font-ui-tight);
      font-size: 0.84rem;
      font-weight: 600;
      border-radius: var(--radius-sm);
      background: var(--accent-primary);
      color: #fff;
      transition: var(--transition-smooth);
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    }

    .btn-primary-folio:hover {
      background: var(--accent-hover);
      transform: translateY(-1px);
    }

    /* ==========================================================================
       HERO SECTION — Q5 APPROVED EDITORIAL SPLIT
       ========================================================================== */
    .editorial-hero-section {
      padding: 3.5rem 0 3.25rem 0;
      position: relative;
      border-bottom: 1px solid var(--border-outer);
      background: var(--bg-canvas);
    }

    .hero-editorial-split {
      display: grid;
      grid-template-columns: 1.15fr 0.85fr;
      gap: 3.5rem;
      align-items: start;
    }

    .hero-folio-showcase {
      margin-top: 1.25rem;
    }

    #category-pills-home .cat-pill {
      padding: 0.25rem 0.72rem;
      font-size: 0.75rem;
    }

    /* LEFT WING: ACADEMIC DOSSIER */
    .hero-dossier {
      min-width: 0;
    }

    .academic-curriculum-badge {
      display: inline-flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 0.35rem 0.5rem;
      padding: 0.32rem 0.85rem;
      background: var(--bg-surface-elevated);
      border: 1px solid var(--border-inner);
      border-left: 3px solid var(--accent-primary);
      border-radius: var(--radius-sm);
      font-family: var(--font-mono);
      font-size: 0.74rem;
      line-height: 1.35;
      font-weight: 500;
      color: var(--text-secondary);
      margin-bottom: 1.25rem;
    }

    .hero-headline {
      font-family: var(--font-editorial);
      font-size: clamp(1.85rem, 5vw, 3.35rem);
      font-weight: 600;
      line-height: 1.1;
      color: var(--text-primary);
      margin-bottom: 1.25rem;
      letter-spacing: -0.015em;
    }

    .hero-headline em {
      font-style: italic;
      color: var(--accent-primary);
      font-weight: 500;
    }

    .hero-subheadline {
      font-family: var(--font-ui);
      font-size: 1.05rem;
      line-height: 1.65;
      color: var(--text-muted);
      margin-bottom: 2rem;
      max-width: 620px;
    }

    /* FUNCTIONAL CURRICULAR SEARCH */
    .hero-search-wrapper {
      background: var(--bg-surface);
      border: 1px solid var(--border-inner);
      border-radius: var(--radius-md);
      padding: 0.4rem 0.4rem 0.4rem 1rem;
      display: flex;
      align-items: center;
      gap: 0.75rem;
      box-shadow: var(--card-shadow);
      margin-bottom: 1.5rem;
      max-width: 620px;
      transition: border-color 0.2s ease;
    }

    .hero-search-wrapper:focus-within {
      border-color: var(--accent-primary);
    }

    .search-icon-box {
      color: var(--text-dim);
      display: flex;
      align-items: center;
    }

    .hero-search-input {
      flex: 1;
      border: none;
      background: none;
      font-family: var(--font-ui);
      font-size: 0.95rem;
      color: var(--text-primary);
      outline: none;
    }

    .hero-search-input::placeholder {
      color: var(--text-dim);
    }

    .hero-search-btn {
      padding: 0.65rem 1.35rem;
      background: var(--accent-primary);
      color: #fff;
      font-family: var(--font-ui-tight);
      font-size: 0.84rem;
      font-weight: 600;
      border-radius: var(--radius-sm);
      transition: var(--transition-smooth);
    }

    .hero-search-btn:hover {
      background: var(--accent-hover);
    }

    /* DISCIPLINE SHORTCUT CHIPS */
    .hero-curriculum-chips {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      flex-wrap: wrap;
      margin-bottom: 2rem;
    }

    .chip-label {
      font-family: var(--font-mono);
      font-size: 0.72rem;
      color: var(--text-dim);
      text-transform: uppercase;
      margin-right: 0.25rem;
    }

    .curriculum-chip {
      padding: 0.25rem 0.75rem;
      font-size: 0.75rem;
      font-family: var(--font-ui-tight);
      font-weight: 500;
      background: var(--bg-surface-elevated);
      border: 1px solid var(--border-inner);
      border-radius: var(--radius-pill);
      color: var(--text-secondary);
      transition: var(--transition-smooth);
    }

    .curriculum-chip:hover {
      border-color: var(--accent-primary);
      color: var(--accent-primary);
      background: var(--bg-surface);
    }

    .curriculum-chip.active {
      border-color: var(--accent-primary);
      color: var(--accent-primary);
      background: var(--accent-muted, rgba(197, 160, 89, 0.15));
      font-weight: 600;
    }

    /* VERIFIABLE FACTUAL PROOFS ONLY (NO FABRICATED RATINGS OR REVIEWS) */
    .factual-proof-strip {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 1.25rem;
      padding-top: 1.5rem;
      border-top: 1px solid var(--border-outer);
    }

    .proof-item {
      display: flex;
      flex-direction: column;
    }

    .proof-heading {
      font-family: var(--font-mono);
      font-size: 0.82rem;
      font-weight: 600;
      color: var(--text-primary);
      display: flex;
      align-items: center;
      gap: 0.35rem;
    }

    .proof-desc {
      font-size: 0.76rem;
      color: var(--text-muted);
      line-height: 1.45;
      margin-top: 0.2rem;
    }

    /* RIGHT WING: GRAND ACADEMIC FOLIO SHOWCASE */
    .hero-folio-showcase {
      display: flex;
      justify-content: center;
      align-items: center;
      position: relative;
    }

    .folio-stage-frame {
      width: 100%;
      max-width: 440px;
      background: var(--bg-surface);
      border: 1px solid var(--border-outer);
      border-radius: var(--radius-lg);
      padding: 1.75rem;
      box-shadow: var(--card-shadow);
      position: relative;
    }

    .stage-header-meta {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 0.75rem;
      padding-bottom: 0.9rem;
      margin-bottom: 1.25rem;
      border-bottom: 1px solid var(--border-inner);
      font-family: var(--font-mono);
      font-size: 0.68rem;
      letter-spacing: 0.04em;
      color: var(--text-muted);
    }

    .stage-header-meta > span:last-child {
      white-space: nowrap;
      flex-shrink: 0;
    }

    .stage-accession {
      color: var(--accent-primary);
      font-weight: 600;
      min-width: 0;
    }

    /* 3D FOLIO BOOK COMPONENT */
    .academic-book-presentation {
      display: flex;
      gap: 1.5rem;
      align-items: center;
      margin-bottom: 1.5rem;
    }

    .book-3d-wrapper {
      perspective: 1000px;
      flex-shrink: 0;
    }

    .book-folio-3d {
      width: 140px;
      height: 196px;
      background: var(--book-cover-bg);
      border-radius: 3px 8px 8px 3px;
      box-shadow: -4px 6px 16px rgba(0, 0, 0, 0.4), inset 3px 0 6px rgba(255, 255, 255, 0.1);
      position: relative;
      border-left: 5px solid var(--accent-primary);
      padding: 1rem 0.85rem;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      color: #fff;
      transform: rotateY(-8deg) rotateX(4deg);
      transition: transform 0.4s ease;
    }

    .book-folio-3d:hover {
      transform: rotateY(0deg) rotateX(0deg) translateY(-4px);
    }

    .book-spine-line {
      position: absolute;
      left: 10px;
      top: 0;
      bottom: 0;
      width: 1px;
      background: rgba(255, 255, 255, 0.15);
    }

    .book-cover-title {
      font-family: var(--font-editorial);
      font-size: 0.88rem;
      line-height: 1.2;
      font-weight: 600;
      color: #f8f5ee;
    }

    .book-cover-cat {
      font-family: var(--font-mono);
      font-size: 0.58rem;
      color: #e6c88a;
      text-transform: uppercase;
      letter-spacing: 0.08em;
    }

    .book-cover-author {
      font-family: var(--font-ui-tight);
      font-size: 0.62rem;
      color: #cbd5e1;
    }

    .folio-details-col {
      flex: 1;
      min-width: 0;
    }

    .specimen-pill {
      display: inline-block;
      font-family: var(--font-mono);
      font-size: 0.65rem;
      font-weight: 600;
      padding: 0.15rem 0.5rem;
      background: var(--badge-paid-bg);
      color: var(--badge-paid-color);
      border-radius: var(--radius-sm);
      margin-bottom: 0.4rem;
    }

    .folio-title-mini {
      font-family: var(--font-editorial);
      font-size: 1.2rem;
      font-weight: 600;
      line-height: 1.25;
      color: var(--text-primary);
      margin-bottom: 0.35rem;
    }

    .folio-meta-specs {
      font-family: var(--font-mono);
      font-size: 0.72rem;
      color: var(--text-muted);
      margin-bottom: 0.85rem;
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 0.25rem 0.4rem;
    }

    .folio-meta-specs > span {
      white-space: nowrap;
    }

    .folio-action-buttons {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      flex-wrap: wrap;
    }

    .btn-preview-modal {
      padding: 0.42rem 0.85rem;
      min-height: 36px;
      display: inline-flex;
      align-items: center;
      gap: 0.4rem;
      white-space: nowrap;
      font-size: 0.76rem;
      font-family: var(--font-ui-tight);
      font-weight: 600;
      border: 1px solid var(--border-inner);
      background: var(--bg-surface-elevated);
      color: var(--text-secondary);
      border-radius: var(--radius-sm);
      transition: var(--transition-smooth);
    }

    .btn-preview-modal:hover {
      border-color: var(--accent-primary);
      color: var(--accent-primary);
    }

    .btn-direct-buy {
      padding: 0.4rem 0.85rem;
      font-size: 0.76rem;
      font-family: var(--font-ui-tight);
      font-weight: 600;
      background: var(--accent-primary);
      color: var(--on-accent, #0b0e14);
      border-radius: var(--radius-sm);
      transition: var(--transition-smooth);
    }

    .btn-direct-buy:hover {
      background: var(--accent-hover);
    }

    .stage-footnote {
      font-family: var(--font-reading);
      font-style: italic;
      font-size: 0.78rem;
      color: var(--text-dim);
      border-top: 1px solid var(--border-inner);
      padding-top: 0.85rem;
      line-height: 1.45;
    }

    /* ==========================================================================
       SECTION 2: CURRICULAR TRACKS & DISCIPLINE DISCOVERY
       ========================================================================== */
    .academic-tracks-section {
      padding: 4rem 0;
      border-bottom: 1px solid var(--border-outer);
    }

    .section-eyebrow {
      font-family: var(--font-mono);
      font-size: 0.75rem;
      font-weight: 600;
      color: var(--accent-primary);
      text-transform: uppercase;
      letter-spacing: 0.12em;
      margin-bottom: 0.4rem;
    }

    .section-title,
    .section-headline {
      font-family: var(--font-editorial);
      font-size: clamp(1.45rem, 3.8vw, 2.25rem);
      font-weight: 600;
      color: var(--text-primary);
      margin-bottom: 0.75rem;
      line-height: 1.2;
    }

    .section-desc {
      font-size: 0.95rem;
      color: var(--text-muted);
      max-width: 650px;
      margin-bottom: 2.5rem;
    }

    .tracks-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 1.5rem;
    }

    .track-card {
      background: var(--bg-surface);
      border: 1px solid var(--border-outer);
      border-radius: var(--radius-md);
      padding: 1.5rem;
      transition: var(--transition-smooth);
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      height: 100%;
    }

    .track-card:hover {
      border-color: var(--accent-primary);
      transform: translateY(-2px);
      box-shadow: var(--card-shadow);
    }

    .track-top-meta {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 1rem;
      font-family: var(--font-mono);
      font-size: 0.7rem;
      color: var(--text-dim);
    }

    .track-icon {
      font-size: 1.5rem;
      margin-bottom: 0.75rem;
    }

    .track-name {
      font-family: var(--font-editorial);
      font-size: 1.35rem;
      font-weight: 600;
      color: var(--text-primary);
      margin-bottom: 0.5rem;
      line-height: 1.2;
      min-height: 2.4em;
    }

    .track-summary {
      font-size: 0.82rem;
      color: var(--text-muted);
      line-height: 1.5;
      margin-bottom: 1.25rem;
    }

    .track-stats {
      font-family: var(--font-mono);
      font-size: 0.72rem;
      color: var(--accent-primary);
      border-top: 1px solid var(--border-inner);
      padding-top: 0.75rem;
      display: flex;
      justify-content: space-between;
    }

    .track-link-action {
      display: inline-block;
      margin-top: auto;
      padding-top: 1rem;
      font-family: var(--font-mono);
      font-size: 0.8rem;
      font-weight: 600;
      color: var(--accent-primary);
      text-decoration: none;
      transition: var(--transition-smooth, all 0.2s ease);
    }

    .track-link-action:hover {
      text-decoration: underline;
      color: var(--accent-hover, #dbb56e);
    }

    /* ==========================================================================
       SECTION 3: REAL PRODUCT CATALOG — Q6 APPROVED HYBRID CARDS
       ========================================================================== */
    .catalog-showcase-section {
      padding: 4.5rem 0;
      border-bottom: 1px solid var(--border-outer);
      background: var(--bg-canvas);
    }

    .catalog-filter-bar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 2rem;
      flex-wrap: wrap;
      gap: 1rem;
    }

    .filter-tabs {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      flex-wrap: wrap;
    }

    .filter-tab-btn {
      padding: 0.45rem 1rem;
      min-height: 38px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-family: var(--font-ui-tight);
      font-size: 0.82rem;
      font-weight: 500;
      border-radius: var(--radius-pill);
      background: var(--bg-surface);
      border: 1px solid var(--border-inner);
      color: var(--text-muted);
      transition: var(--transition-smooth);
      white-space: nowrap;
      touch-action: manipulation;
    }

    .filter-tab-btn.active, .filter-tab-btn:hover {
      background: var(--accent-primary);
      color: var(--on-accent, #0b0e14);
      border-color: var(--accent-primary);
    }

    .catalog-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 1.75rem;
    }

    /* OXFORD ARCHIVAL DOSSIER HYBRID CARD */
    .hybrid-product-card {
      background: var(--bg-surface);
      border: 1px solid var(--border-outer);
      border-radius: var(--radius-md);
      overflow: hidden;
      display: flex;
      flex-direction: column;
      transition: var(--transition-smooth);
      position: relative;
    }

    .hybrid-product-card:hover {
      border-color: var(--border-accent);
      box-shadow: var(--card-shadow);
      transform: translateY(-2px);
    }

    .card-top-strip {
      background: var(--bg-surface-elevated);
      padding: 0.65rem 1.15rem;
      border-bottom: 1px solid var(--border-inner);
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-family: var(--font-mono);
      font-size: 0.7rem;
    }

    .curriculum-ref-code {
      color: var(--accent-primary);
      font-weight: 600;
    }

    .entitlement-badge {
      padding: 0.15rem 0.5rem;
      border-radius: var(--radius-sm);
      font-weight: 600;
      font-size: 0.65rem;
      text-transform: uppercase;
    }

    .badge-free {
      background: var(--badge-free-bg);
      color: var(--badge-free-color);
    }

    .badge-paid {
      background: var(--badge-paid-bg);
      color: var(--badge-paid-color);
    }

    .card-body {
      padding: 1.35rem 1.15rem;
      flex: 1;
      display: flex;
      flex-direction: column;
    }

    .card-meta-line {
      font-family: var(--font-mono);
      font-size: 0.68rem;
      color: var(--text-dim);
      margin-bottom: 0.4rem;
      text-transform: uppercase;
    }

    .card-title {
      font-family: var(--font-editorial);
      font-size: 1.3rem;
      font-weight: 600;
      line-height: 1.25;
      color: var(--text-primary);
      margin-bottom: 0.5rem;
      min-height: 2.5em;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }

    .card-subtitle {
      font-size: 0.82rem;
      color: var(--text-muted);
      line-height: 1.5;
      margin-bottom: 1rem;
      flex: 1;
    }

    /* EXPANDABLE TABLE OF CONTENTS DRAWER */
    .card-toc-drawer {
      border-top: 1px dashed var(--border-inner);
      padding-top: 0.75rem;
      margin-bottom: 1rem;
    }

    .toc-toggle-btn {
      font-family: var(--font-mono);
      font-size: 0.72rem;
      color: var(--accent-primary);
      display: flex;
      align-items: center;
      gap: 0.35rem;
      font-weight: 500;
    }

    .toc-items-list {
      display: none;
      list-style: none;
      margin-top: 0.5rem;
      padding-left: 0.5rem;
      border-left: 1px solid var(--border-inner);
      font-size: 0.75rem;
      color: var(--text-muted);
    }

    .toc-items-list.open {
      display: block;
    }

    .toc-items-list li {
      padding: 0.2rem 0;
    }

    /* CARD FOOTER & ACTIONS */
    .card-footer {
      padding: 0.85rem 1.15rem;
      background: var(--bg-surface-elevated);
      border-top: 1px solid var(--border-inner);
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.75rem;
    }

    .price-block {
      display: flex;
      flex-direction: column;
    }

    .price-amount {
      font-family: var(--font-mono);
      font-size: 1.25rem;
      font-weight: 700;
      color: var(--text-primary);
    }

    .price-note {
      font-size: 0.65rem;
      color: var(--text-dim);
      font-family: var(--font-ui-tight);
    }

    .card-action-row {
      display: flex;
      align-items: center;
      gap: 0.4rem;
    }

    .btn-card-inspect {
      padding: 0.4rem 0.65rem;
      font-size: 0.75rem;
      font-family: var(--font-ui-tight);
      font-weight: 600;
      border: 1px solid var(--border-inner);
      border-radius: var(--radius-sm);
      color: var(--text-secondary);
      background: var(--bg-surface);
      transition: var(--transition-smooth);
    }

    .btn-card-inspect:hover {
      border-color: var(--accent-primary);
      color: var(--accent-primary);
    }

    .btn-card-buy {
      padding: 0.42rem 0.85rem;
      font-size: 0.75rem;
      font-family: var(--font-ui-tight);
      font-weight: 600;
      background: var(--accent-primary);
      color: #fff;
      border-radius: var(--radius-sm);
      transition: var(--transition-smooth);
    }

    .btn-card-buy:hover {
      background: var(--accent-hover);
    }

    /* ==========================================================================
       SECTION 4: VERIFIABLE ACADEMIC INTEGRITY & QUALITY DOSSIER
       (PHASE 5 CLEANED — ZERO FABRICATED CLAIMS)
       ========================================================================== */
    .academic-integrity-section {
      padding: 4.5rem 0;
      border-bottom: 1px solid var(--border-outer);
      background: var(--bg-surface);
    }

    .integrity-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 1.5rem;
    }

    .integrity-pillar-card {
      padding: 1.5rem;
      border: 1px solid var(--border-inner);
      border-radius: var(--radius-md);
      background: var(--bg-canvas);
      height: 100%;
      display: flex;
      flex-direction: column;
    }

    .pillar-num {
      font-family: var(--font-mono);
      font-size: 0.8rem;
      font-weight: 600;
      color: var(--accent-primary);
      margin-bottom: 0.5rem;
    }

    .pillar-title {
      font-family: var(--font-editorial);
      font-size: 1.2rem;
      font-weight: 600;
      color: var(--text-primary);
      margin-bottom: 0.4rem;
    }

    .pillar-body {
      font-size: 0.82rem;
      color: var(--text-muted);
      line-height: 1.55;
    }

    /* ==========================================================================
       SECTION 5: STUDENT USER JOURNEY & HOW UNDICIDE WORKS
       ========================================================================== */
    .student-journey-section {
      padding: 4.5rem 0;
      border-bottom: 1px solid var(--border-outer);
    }

    .journey-steps-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 1.5rem;
    }

    .journey-step-card {
      position: relative;
      padding: 1.5rem;
      background: var(--bg-surface);
      border: 1px solid var(--border-inner);
      border-radius: var(--radius-md);
      height: 100%;
      display: flex;
      flex-direction: column;
    }

    .step-marker {
      width: 32px;
      height: 32px;
      border-radius: var(--radius-pill);
      background: var(--accent-muted);
      color: var(--accent-primary);
      display: flex;
      align-items: center;
      justify-content: center;
      font-family: var(--font-mono);
      font-weight: 700;
      font-size: 0.85rem;
      margin-bottom: 1rem;
    }

    .step-name {
      font-family: var(--font-editorial);
      font-size: 1.25rem;
      font-weight: 600;
      color: var(--text-primary);
      margin-bottom: 0.4rem;
    }

    .step-details {
      font-size: 0.82rem;
      color: var(--text-muted);
      line-height: 1.55;
    }

    /* ==========================================================================
       EDITORIAL FOOTER
       ========================================================================== */
    .editorial-footer {
      background: var(--bg-surface);
      border-top: 1px solid var(--border-outer);
      padding: 4rem 0 2rem 0;
      font-size: 0.85rem;
      color: var(--text-muted);
    }

    .footer-columns-grid {
      display: grid;
      grid-template-columns: 1.5fr repeat(3, 1fr);
      gap: 2.5rem;
      margin-bottom: 3.5rem;
    }

    .footer-brand-col p {
      margin-top: 0.85rem;
      line-height: 1.6;
      max-width: 340px;
      font-size: 0.84rem;
    }

    .footer-col-title {
      font-family: var(--font-mono);
      font-size: 0.72rem;
      font-weight: 600;
      color: var(--text-primary);
      text-transform: uppercase;
      letter-spacing: 0.12em;
      margin-bottom: 1.25rem;
    }

    .footer-links-list {
      list-style: none;
      display: flex;
      flex-direction: column;
      gap: 0.65rem;
    }

    .footer-links-list a:hover {
      color: var(--accent-primary);
    }

    .footer-bottom-bar {
      padding-top: 2rem;
      border-top: 1px solid var(--border-inner);
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-family: var(--font-mono);
      font-size: 0.72rem;
      color: var(--text-dim);
      flex-wrap: wrap;
      gap: 1rem;
    }

    /* ==========================================================================
       SAMPLE FOLIO INSPECTION MODAL (DEMO & REAL PREVIEW)
       ========================================================================== */
    .modal-overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.78);
      backdrop-filter: blur(8px);
      z-index: 1000;
      padding: 1.5rem 1rem;
      overflow-y: auto;
      overflow-x: hidden;
      -webkit-overflow-scrolling: touch;
    }

    .modal-overlay.open {
      display: flex !important;
      flex-direction: column;
      align-items: center;
      justify-content: flex-start;
      min-height: 100%;
      animation: undicideBackdropFade 0.22s var(--ease-spring) forwards;
    }

    .modal-overlay.open .modal-card,
    .modal-overlay.open .modal-dossier-window,
    .modal-overlay.open .cmd-palette-card,
    .modal-overlay.open .undicide-reader-window,
    .auth-setup-modal.open .auth-setup-card {
      animation: undicideModalSpring 0.28s var(--ease-spring) forwards;
    }

    @keyframes undicideBackdropFade {
      from { opacity: 0; }
      to { opacity: 1; }
    }

    @keyframes undicideModalSpring {
      from {
        opacity: 0;
        transform: translateY(10px) scale(0.97);
      }
      to {
        opacity: 1;
        transform: translateY(0) scale(1);
      }
    }

    .modal-card {
      margin: auto 0;
      margin-top: auto;
      margin-bottom: auto;
      max-height: calc(100vh - 2.5rem);
      max-height: calc(100dvh - 2.5rem);
      display: flex;
      flex-direction: column;
    }

    .modal-header {
      flex-shrink: 0;
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      gap: 1rem;
    }

    .modal-body {
      flex: 1 1 auto;
      min-height: 0;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
    }

    .modal-dossier-window {
      background: var(--bg-surface);
      border: 1px solid var(--border-outer);
      border-radius: var(--radius-lg);
      width: 100%;
      max-width: 780px;
      max-height: 90vh;
      display: flex;
      flex-direction: column;
      box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
      overflow: hidden;
    }

    .modal-top-bar {
      padding: 1rem 1.5rem;
      background: var(--bg-surface-elevated);
      border-bottom: 1px solid var(--border-inner);
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    .modal-title {
      font-family: var(--font-editorial);
      font-size: 1.25rem;
      font-weight: 600;
      color: var(--text-primary);
    }

    .modal-close-btn {
      color: var(--text-muted);
      font-size: 1.4rem;
      width: 40px;
      height: 40px;
      min-width: 40px;
      min-height: 40px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border-radius: var(--radius-sm, 6px);
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid var(--border-inner, rgba(255, 255, 255, 0.08));
      cursor: pointer;
      line-height: 1;
      transition: all 0.2s ease;
      touch-action: manipulation;
    }

    .modal-close-btn:focus-visible,
    button:focus-visible,
    a:focus-visible,
    input:focus-visible,
    select:focus-visible,
    textarea:focus-visible {
      outline: 2px solid var(--accent-gold, #c5a880);
      outline-offset: 2px;
    }

    .modal-close-btn:hover {
      color: var(--text-primary, #f8fafc);
      background: rgba(255, 255, 255, 0.12);
      border-color: var(--accent-primary, #C5A880);
    }

    .modal-specimen-body {
      padding: 2rem;
      overflow-y: auto;
      font-family: var(--font-reading);
      line-height: 1.7;
      color: var(--text-primary);
    }

    .specimen-sheet {
      background: var(--bg-canvas);
      border: 1px solid var(--border-inner);
      border-radius: var(--radius-sm);
      padding: 2.5rem;
      box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.03);
    }

    .specimen-header {
      border-bottom: 1px solid var(--border-inner);
      padding-bottom: 1rem;
      margin-bottom: 1.5rem;
      font-family: var(--font-mono);
      font-size: 0.72rem;
      color: var(--text-dim);
      display: flex;
      justify-content: space-between;
    }

    .specimen-text {
      font-size: 0.95rem;
      margin-bottom: 1.25rem;
    }

    /* ==========================================================================
       RESPONSIVE MATRIX (320px to 1920px) — ZERO OVERFLOW OR CLIPPING
       ========================================================================== */
    @media (max-width: 1540px) {
      .brand-descriptor {
        display: none;
      }
      .brand-wordmark {
        font-size: 1.4rem;
        letter-spacing: 0.13em;
      }
    }

    @media (max-width: 1480px) {
      .container {
        padding: 0 1.4rem;
      }
      .nav-routes {
        gap: 0.65rem;
      }
      .nav-item-link {
        font-size: 0.79rem;
      }
      #nav-library-link {
        display: none !important;
      }
      .btn-archival {
        padding: 0.38rem 0.65rem;
        font-size: 0.76rem;
      }
      .btn-nav-util {
        padding: 0.36rem 0.56rem;
        font-size: 0.75rem;
      }
      #nav-auth-actions .btn {
        padding: 0.42rem 0.78rem;
        font-size: 0.78rem;
      }
      .nav-user-name,
      .nav-user-sub {
        max-width: 110px;
      }
    }

    @media (max-width: 1220px) {
      #btn-open-command-search .nav-kbd-hint {
        display: none;
      }
      .nav-routes {
        gap: 0.52rem;
      }
      .nav-item-link {
        font-size: 0.75rem;
      }
    }

    @media (max-width: 1120px) {
      .nav-routes {
        display: none;
      }
      .hamburger-btn {
        display: flex;
      }
    }

    @media (max-width: 1024px) {
      .hero-editorial-split {
        grid-template-columns: 1fr;
        gap: 2.5rem;
      }
      .tracks-grid {
        grid-template-columns: repeat(2, 1fr);
      }
      .catalog-grid {
        grid-template-columns: repeat(2, 1fr);
      }
      .integrity-grid, .journey-steps-grid {
        grid-template-columns: repeat(2, 1fr);
      }
      .footer-columns-grid {
        grid-template-columns: 1fr 1fr;
      }
    }

    @media (max-width: 768px) {
      .navbar-inner {
        min-height: 58px;
        gap: 0.45rem;
      }
      .nav-routes {
        display: none; /* Mobile Drawer Toggle */
      }
      .brand-descriptor {
        display: none;
      }
      .editorial-navbar .theme-switcher-pills {
        display: none;
      }
      .brand-wordmark {
        font-size: 1.15rem;
        letter-spacing: 0.08em;
      }
      .nav-actions {
        gap: 0.42rem;
        margin-left: auto;
      }
      .nav-actions .btn-primary-folio,
      .nav-actions .theme-switcher-pills,
      .nav-actions #nav-auth-actions,
      .nav-actions #btn-pwa-install,
      .nav-actions .btn-archival {
        display: none !important;
      }
      .editorial-hero-section {
        padding: 1.65rem 0 2rem 0 !important;
      }
      .library-view,
      .admin-view,
      .product-detail-view {
        padding: 1rem 0 3.5rem !important;
      }
      .academic-tracks-section,
      .catalog-showcase-section,
      .academic-integrity-section,
      .student-journey-section {
        padding: 2.25rem 0 !important;
      }
      .catalog-filter-bar {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
      }
      .filter-tabs {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        padding-bottom: 8px !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
      }
      .filter-tabs::-webkit-scrollbar {
        display: none !important;
      }
      .ticker-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.35rem;
      }
      .ticker-left {
        font-size: 0.68rem;
        flex-wrap: wrap;
      }
      .hero-headline {
        font-size: 2.35rem;
      }
      /* Balanced 2-Column Responsive Layouts for Tablet (601px - 768px - 820px) */
      .catalog-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 1.25rem !important;
      }
      .factual-proof-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 1rem !important;
      }
      .tracks-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 1.25rem !important;
      }
      .integrity-grid, .journey-steps-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 1.25rem !important;
      }
      .footer-columns-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 2rem !important;
      }
      .footer-bottom-bar {
        flex-direction: column;
        align-items: flex-start;
      }
    }

    @media (max-width: 640px) {
      .container {
        padding: 0 0.85rem;
      }
      .logo-svg-box {
        width: 30px;
        height: 30px;
      }
      .brand-lockup {
        gap: 0.45rem;
      }
      .brand-wordmark {
        font-size: 1.02rem;
        letter-spacing: 0.08em;
      }
      .nav-actions {
        gap: 0.35rem;
      }
      #btn-open-command-search .nav-search-label {
        display: none;
      }
      .btn-nav-util {
        padding: 0.36rem 0.52rem;
        min-height: 34px;
      }
      .hamburger-btn {
        width: 36px;
        height: 36px;
      }
      .catalog-grid {
        grid-template-columns: 1fr !important;
      }
      .factual-proof-strip {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
      }
      .tracks-grid {
        grid-template-columns: 1fr !important;
      }
      .integrity-grid, .journey-steps-grid {
        grid-template-columns: 1fr !important;
      }
      .footer-columns-grid {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
      }
    }

    @media (max-width: 560px) {
      .hero-search-wrapper {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.55rem 0.6rem;
        padding: 0.55rem 0.65rem;
      }
      .hero-search-wrapper .search-icon-box {
        flex-shrink: 0;
      }
      .hero-search-wrapper .hero-search-input {
        flex: 1 1 180px;
        min-width: 0;
        font-size: 0.9rem;
      }
      .hero-search-btn {
        width: 100%;
        flex: 1 0 100%;
        text-align: center;
        justify-content: center;
      }
      .folio-stage-frame {
        padding: 1.25rem 0.85rem;
      }
      .book-folio-3d {
        transform: none !important;
        margin: 0 auto;
      }
      .academic-book-presentation {
        flex-direction: column;
        align-items: center;
        text-align: center;
      }
      .folio-action-buttons {
        justify-content: center;
      }
      .modal-overlay {
        padding: 0.5rem !important;
      }
      .modal-card {
        padding: 1.25rem 1rem !important;
        max-width: 100% !important;
        width: 100% !important;
        border-radius: var(--radius-md) !important;
      }
      .modal-dossier-window {
        max-height: 94vh !important;
        border-radius: var(--radius-md) !important;
      }
      .modal-header {
        padding: 1rem !important;
      }
      .modal-body {
        padding: 1rem !important;
      }
      .modal-footer {
        padding: 1rem !important;
        flex-direction: column-reverse !important;
      }
      .modal-footer .btn {
        width: 100% !important;
      }
    }

    @media (max-width: 390px) {
      .hero-headline {
        font-size: 1.85rem;
      }
      .container {
        padding: 0 0.75rem;
      }
    }

    /* ==========================================================================
       THEME SWITCHER PILLS & WCAG 2.2 AA CONTRAST STYLES
       ========================================================================== */
    .theme-switcher-pills {
      display: inline-flex;
      align-items: center;
      background: var(--bg-surface, #111622);
      border: 1px solid var(--border-subtle, #2D333F);
      border-radius: var(--radius-sm, 4px);
      padding: 3px;
      gap: 3px;
    }

    .theme-pill-btn {
      background: transparent;
      border: 1px solid var(--border-inner, rgba(255, 255, 255, 0.08));
      color: var(--text-secondary, #A0AEC0) !important;
      font-family: var(--font-ui, sans-serif);
      font-size: 0.8rem;
      font-weight: 500;
      padding: 0.45rem 0.65rem;
      min-height: 38px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border-radius: var(--radius-sm, 6px);
      cursor: pointer;
      transition: all 0.2s ease;
      touch-action: manipulation;
    }

    .theme-pill-btn:hover {
      color: var(--text-primary, #F4F2ED) !important;
      background: rgba(255, 255, 255, 0.08);
    }

    .theme-pill-btn.active {
      background: var(--accent-primary, #C5A880) !important;
      color: #08090C !important; /* High contrast dark on gold: > 9:1 ratio */
      font-weight: 600 !important;
    }

    .btn-primary-folio {
      background: var(--accent-primary, #C5A880) !important;
      font-weight: 600 !important;
    }

    [data-theme="night"] .btn-primary-folio,
    [data-theme="sage"] .btn-primary-folio {
      color: #08090C !important;
    }

    [data-theme="day"] .btn-primary-folio,
    [data-theme="sepia"] .btn-primary-folio {
      color: #FFFFFF !important;
    }

    [data-theme="night"] .footer-bottom-bar,
    [data-theme="sage"] .footer-bottom-bar {
      color: #94A3B8 !important;
    }

    [data-theme="day"] .footer-bottom-bar,
    [data-theme="sepia"] .footer-bottom-bar {
      color: #4A5568 !important;
    }
  

    /* ==========================================================================
       UNIFIED REFINED ICON-ONLY THEME SWITCHER (28px × 28px)
       ========================================================================== */
    .undicide-theme-switcher {
      position: relative;
      display: inline-flex;
      align-items: center;
      user-select: none;
      margin-right: 0.5rem;
    }

    /* 1. Main Navbar Trigger: 28px × 28px */
    .theme-trigger-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 28px;
      height: 28px;
      padding: 0;
      border-radius: 7px;
      background: var(--bg-surface, #0f1117);
      border: 1px solid var(--border-gold, rgba(197, 168, 128, 0.35));
      color: var(--text-main, #F4F2ED);
      cursor: pointer;
      position: relative;
      transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
      box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
      outline: none;
    }

    /* Accessible Touch Target: 44px x 44px hit area meeting WCAG 2.5.5 */
    .theme-trigger-btn::after {
      content: '';
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      width: 44px;
      height: 44px;
      pointer-events: auto;
    }

    .theme-trigger-btn:hover {
      border-color: var(--accent-gold, #c5a880);
      transform: translateY(-1px);
      box-shadow: 0 3px 12px rgba(197, 168, 128, 0.25);
    }

    .theme-trigger-btn:focus-visible {
      border-color: var(--accent-gold, #c5a880);
      box-shadow: 0 0 0 2px var(--bg-dark, #08090c), 0 0 0 3.5px var(--accent-gold, #c5a880);
    }

    .theme-trigger-btn[aria-expanded="true"] {
      border-color: var(--accent-gold, #c5a880);
      background: var(--bg-card-hover, rgba(22, 30, 48, 0.95));
      box-shadow: 0 0 12px rgba(197, 168, 128, 0.32);
    }

    /* 2. Active Theme Icon: 16px × 16px */
    .theme-trigger-icon {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 16px;
      height: 16px;
      transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    .theme-trigger-btn:hover .theme-trigger-icon {
      transform: scale(1.1) rotate(3deg);
    }

    .theme-trigger-icon svg {
      width: 16px;
      height: 16px;
      display: block;
    }

    /* 3. Floating Popover (78px width, 5px padding) */
    .theme-popover {
      position: absolute;
      top: calc(100% + 6px);
      right: 0;
      z-index: 1050;
      padding: 5px;
      background: var(--bg-surface, #0f1117);
      border: 1px solid var(--border-gold, rgba(197, 168, 128, 0.35));
      border-radius: 10px;
      box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.04);
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
      opacity: 0;
      visibility: hidden;
      transform: translateY(-6px) scale(0.95);
      transform-origin: top right;
      transition: opacity 0.18s cubic-bezier(0.16, 1, 0.3, 1),
                  transform 0.18s cubic-bezier(0.16, 1, 0.3, 1),
                  visibility 0.18s;
      pointer-events: none;
    }

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

    .theme-popover-header {
      padding: 2px 4px 4px 4px;
      margin-bottom: 4px;
      border-bottom: 1px solid var(--border-inner, rgba(255, 255, 255, 0.05));
      text-align: center;
    }

    .theme-popover-title {
      font-family: var(--font-ui-tight, 'Plus Jakarta Sans', sans-serif);
      font-size: 0.58rem;
      font-weight: 700;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: var(--text-dim, #848B98);
      display: block;
    }

    /* 4. 2x2 Grid of 30px x 30px options with 6px gap */
    .theme-options-grid {
      display: grid;
      grid-template-columns: repeat(2, 30px);
      grid-template-rows: repeat(2, 30px);
      gap: 6px;
    }

    /* 5. Popover Option Button (30px × 30px) */
    .theme-option-btn {
      position: relative;
      display: flex;
      align-items: center;
      justify-content: center;
      width: 30px;
      height: 30px;
      padding: 0;
      background: var(--bg-card, rgba(15, 21, 34, 0.75));
      border: 1px solid var(--border-inner, rgba(255, 255, 255, 0.06));
      border-radius: 6px;
      cursor: pointer;
      color: var(--text-main, #F4F2ED);
      transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
      outline: none;
    }

    .theme-option-btn:hover {
      background: var(--bg-card-hover, rgba(22, 30, 48, 0.85));
      border-color: var(--accent-gold, #c5a880);
      transform: scale(1.08);
      box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
    }

    .theme-option-btn:focus-visible {
      border-color: var(--accent-gold, #c5a880);
      box-shadow: 0 0 0 2px var(--bg-dark, #08090c), 0 0 0 3px var(--accent-gold, #c5a880);
    }

    .theme-option-btn.active {
      background: rgba(197, 168, 128, 0.18);
      border-color: var(--accent-gold, #c5a880);
      box-shadow: 0 0 10px rgba(197, 168, 128, 0.35), inset 0 0 6px rgba(197, 168, 128, 0.15);
    }

    .theme-option-indicator {
      position: absolute;
      top: 2px;
      right: 2px;
      width: 3.5px;
      height: 3.5px;
      border-radius: 50%;
      background: var(--accent-gold, #c5a880);
      box-shadow: 0 0 4px var(--accent-gold, #c5a880);
      opacity: 0;
      transform: scale(0.4);
      transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    .theme-option-btn.active .theme-option-indicator {
      opacity: 1;
      transform: scale(1);
    }

    .theme-option-icon {
      width: 17px;
      height: 17px;
      display: flex;
      align-items: center;
      justify-content: center;
      pointer-events: none;
      transition: transform 0.18s ease;
    }

    .theme-option-btn:hover .theme-option-icon {
      transform: scale(1.1);
    }

    .theme-option-icon svg {
      width: 17px;
      height: 17px;
      display: block;
    }

    /* Desktop Hover Micro-Tooltip */
    .theme-option-tooltip {
      position: absolute;
      bottom: calc(100% + 5px);
      left: 50%;
      transform: translateX(-50%) translateY(3px);
      background: var(--bg-dark, #08090c);
      color: var(--text-main, #F4F2ED);
      border: 1px solid var(--border-gold, rgba(197, 168, 128, 0.35));
      padding: 2px 6px;
      border-radius: 4px;
      font-family: var(--font-ui-tight, 'Plus Jakarta Sans', sans-serif);
      font-size: 0.62rem;
      font-weight: 600;
      white-space: nowrap;
      pointer-events: none;
      opacity: 0;
      transition: opacity 0.15s ease, transform 0.15s ease;
      box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
      z-index: 1060;
    }

    .theme-option-tooltip::after {
      content: '';
      position: absolute;
      top: 100%;
      left: 50%;
      transform: translateX(-50%);
      border: 3px solid transparent;
      border-top-color: var(--border-gold, rgba(197, 168, 128, 0.35));
    }

    @media (hover: hover) and (pointer: fine) {
      .theme-option-btn:hover .theme-option-tooltip {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
      }
    }

    @media (prefers-reduced-motion: reduce) {
      .theme-trigger-btn,
      .theme-popover,
      .theme-option-btn,
      .theme-trigger-icon,
      .theme-option-icon,
      .theme-option-tooltip {
        transition: none !important;
        transform: none !important;
        animation: none !important;
      }
    }

    /* Ensure unified theme switcher is visible on mobile navbars */
    @media (max-width: 900px) {
      .editorial-navbar .undicide-theme-switcher {
        display: inline-flex !important;
      }
    }


    /* ==========================================================================
       UNDICIDE CONCEPT B BRAND MARK STYLING
       ========================================================================== */
    .brand-mark-img {
      width: 36px;
      height: 36px;
      object-fit: contain;
      display: block;
      transition: opacity 0.2s ease;
      filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.2));
    }

    .mobile-drawer .brand-mark-img {
      width: 28px;
      height: 28px;
    }

    /* ==========================================================================
       UNDICIDE SCHOLAR AUTHENTICATION REDESIGN & SEGMENTED TABS
       ========================================================================== */
    .auth-modal-card {
      max-width: 460px;
      width: 100%;
      margin: auto 0;
      margin-top: auto;
      margin-bottom: auto;
      max-height: calc(100vh - 2.5rem);
      max-height: calc(100dvh - 2.5rem);
      display: flex;
      flex-direction: column;
      background: var(--bg-card, #0f131c);
      border: 1px solid var(--border-gold, rgba(197, 168, 128, 0.35));
      border-radius: 12px;
      box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
      overflow: hidden;
      animation: authModalFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
      position: relative;
    }

    .auth-modal-card .modal-header {
      flex-shrink: 0;
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      gap: 1rem;
    }

    .auth-modal-card .modal-body {
      flex: 1 1 auto;
      min-height: 0;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      scrollbar-width: thin;
      scrollbar-color: rgba(197, 168, 128, 0.35) transparent;
    }

    /* Short Viewports (Laptops with taskbar + browser tabs/address bar: height 600px - 740px) */
    @media (max-height: 740px) {
      .auth-modal-card {
        max-height: calc(100vh - 1.5rem);
        max-height: calc(100dvh - 1.5rem);
      }
      .auth-modal-card .modal-header {
        padding: 0.85rem 1.25rem 0.65rem 1.25rem !important;
      }
      .auth-modal-card .modal-body {
        padding: 0.85rem 1.25rem 1rem 1.25rem !important;
      }
      .auth-modal-card #auth-modal-title {
        font-size: 1.15rem !important;
      }
      .auth-modal-card .form-group {
        margin-bottom: 0.6rem !important;
      }
      .auth-modal-card .auth-divider {
        margin: 0.65rem 0 !important;
      }
      .auth-modal-card .btn-oauth-google {
        padding: 0.55rem 0.75rem !important;
        margin-top: 0.5rem !important;
      }
      .auth-modal-card .auth-alt-grid {
        gap: 6px !important;
      }
      .auth-modal-card .auth-alt-btn {
        padding: 0.5rem 0.4rem !important;
      }
    }

    @media (max-height: 620px) {
      .auth-modal-card .modal-header {
        padding: 0.65rem 1rem 0.5rem 1rem !important;
      }
      .auth-modal-card .modal-body {
        padding: 0.65rem 1rem 0.75rem 1rem !important;
      }
      .auth-modal-card #auth-modal-desc {
        display: none !important;
      }
    }

    .auth-modal-card .modal-body::-webkit-scrollbar {
      width: 6px;
    }
    .auth-modal-card .modal-body::-webkit-scrollbar-track {
      background: transparent;
    }
    .auth-modal-card .modal-body::-webkit-scrollbar-thumb {
      background: rgba(197, 168, 128, 0.35);
      border-radius: 3px;
    }

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

    /* Segmented Tab Controller (Equal Symmetrical Active-State Design) */
    .auth-segmented-tabs {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 6px;
      background: var(--bg-surface, #08090c);
      padding: 4px;
      border-radius: 8px;
      border: 1px solid var(--border-inner, rgba(255, 255, 255, 0.08));
      margin-bottom: 1.25rem;
    }

    .auth-tab-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 0.45rem;
      padding: 0.65rem 1rem;
      border-radius: 6px;
      border: 1px solid transparent;
      background: transparent;
      color: var(--text-muted, #94a3b8);
      font-family: var(--font-ui, 'Plus Jakarta Sans', sans-serif);
      font-size: 0.85rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
      outline: none;
      user-select: none;
    }

    .auth-tab-btn:hover:not(.active) {
      color: var(--text-main, #f4f2ed);
      background: rgba(255, 255, 255, 0.04);
    }

    /* Active Tab: Exact same terracotta/orange accent on both Sign In and Create Account */
    .auth-tab-btn.active {
      background: #c2410c !important;
      color: #ffffff !important;
      font-weight: 700;
      border-color: rgba(255, 255, 255, 0.2) !important;
      box-shadow: 0 2px 8px rgba(194, 65, 12, 0.4) !important;
    }

    [data-theme="day"] .auth-tab-btn.active {
      background: #c2410c !important;
      color: #ffffff !important;
      border-color: #9a3412 !important;
      box-shadow: 0 2px 8px rgba(194, 65, 12, 0.35) !important;
    }

    [data-theme="sepia"] .auth-tab-btn.active {
      background: #c2410c !important;
      color: #ffffff !important;
      border-color: #9a3412 !important;
      box-shadow: 0 2px 8px rgba(194, 65, 12, 0.35) !important;
    }

    [data-theme="sage"] .auth-tab-btn.active {
      background: #c2410c !important;
      color: #ffffff !important;
      border-color: #9a3412 !important;
      box-shadow: 0 2px 8px rgba(194, 65, 12, 0.35) !important;
    }

    /* Fast OAuth: Google Sign-In */
    .btn-oauth-google {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 0.75rem;
      width: 100%;
      height: 42px;
      padding: 0 1rem;
      border-radius: 8px;
      background: var(--bg-surface, #0f1117);
      border: 1px solid var(--border-gold, rgba(197, 168, 128, 0.35));
      color: var(--text-main, #f4f2ed);
      font-family: var(--font-ui, 'Plus Jakarta Sans', sans-serif);
      font-size: 0.88rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .btn-oauth-google:hover {
      background: var(--bg-card-hover, rgba(255, 255, 255, 0.05));
      border-color: var(--accent-gold, #c5a880);
      transform: translateY(-1px);
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    }

    /* Divider */
    .auth-divider {
      display: flex;
      align-items: center;
      gap: 0.75rem;
      margin: 1.1rem 0;
      color: var(--text-dim, #848b98);
      font-size: 0.72rem;
      font-family: var(--font-ui-tight, 'Plus Jakarta Sans', sans-serif);
      font-weight: 700;
      letter-spacing: 0.08em;
      text-transform: uppercase;
    }

    .auth-divider::before,
    .auth-divider::after {
      content: '';
      flex: 1;
      height: 1px;
      background: var(--border-inner, rgba(255, 255, 255, 0.08));
    }

    /* Alternative Methods Grid */
    .auth-alt-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 8px;
      margin-top: 0.5rem;
    }

    .auth-alt-btn {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 0.35rem;
      padding: 0.65rem 0.5rem;
      border-radius: 8px;
      background: var(--bg-surface, #08090c);
      border: 1px solid var(--border-inner, rgba(255, 255, 255, 0.08));
      color: var(--text-main, #f4f2ed);
      font-family: var(--font-ui, 'Plus Jakarta Sans', sans-serif);
      font-size: 0.74rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.18s ease;
      text-align: center;
    }

    .auth-alt-btn:hover {
      background: var(--bg-card-hover, rgba(255, 255, 255, 0.05));
      border-color: var(--accent-gold, #c5a880);
      transform: translateY(-1px);
    }

    .auth-alt-icon {
      font-size: 1.15rem;
      display: block;
    }

    /* Federation Row (Apple, Microsoft, LinkedIn) */
    .auth-fed-row {
      display: flex;
      gap: 8px;
      margin-top: 0.65rem;
    }

    .auth-fed-btn {
      flex: 1;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 0.45rem;
      height: 36px;
      padding: 0 0.65rem;
      border-radius: 6px;
      background: var(--bg-surface, #08090c);
      border: 1px solid var(--border-inner, rgba(255, 255, 255, 0.08));
      color: var(--text-main, #f4f2ed);
      font-family: var(--font-ui, 'Plus Jakarta Sans', sans-serif);
      font-size: 0.75rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.18s ease;
    }

    .auth-fed-btn:hover {
      background: var(--bg-card-hover, rgba(255, 255, 255, 0.05));
      border-color: var(--accent-gold, #c5a880);
    }

    /* Diagnostic Configuration Banner */
    .auth-diag-banner {
      background: rgba(245, 158, 11, 0.08);
      border: 1px solid rgba(245, 158, 11, 0.25);
      border-radius: 8px;
      padding: 0.65rem 0.85rem;
      margin-bottom: 1rem;
      font-size: 0.78rem;
      color: #fcd34d;
      display: flex;
      align-items: flex-start;
      gap: 0.5rem;
    }

    .auth-diag-icon {
      font-size: 1rem;
      line-height: 1;
    }

    /* Subview Headers (Phone OTP, Magic Link, Forgot Password) */
    .auth-subview-header {
      display: flex;
      align-items: center;
      gap: 0.65rem;
      margin-bottom: 1rem;
    }

    .auth-back-btn {
      background: transparent;
      border: none;
      color: var(--accent-gold, #c5a880);
      font-size: 0.82rem;
      font-weight: 600;
      cursor: pointer;
      padding: 0;
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
    }

    .auth-back-btn:hover {
      text-decoration: underline;
    }

    /* Password Input Visibility Toggle */
    .auth-input-wrapper {
      position: relative;
      display: flex;
      align-items: center;
    }

    .auth-input-wrapper input {
      width: 100%;
      padding-right: 2.5rem !important;
    }

    .auth-toggle-pwd {
      position: absolute;
      right: 0.65rem;
      background: transparent;
      border: none;
      color: var(--text-dim, #848b98);
      cursor: pointer;
      padding: 4px;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .auth-toggle-pwd:hover {
      color: var(--text-main, #f4f2ed);
    }

    /* Terms & Privacy Note */
    .auth-terms-note {
      font-size: 0.72rem;
      color: var(--text-dim, #848b98);
      line-height: 1.45;
      margin-top: 0.85rem;
      text-align: center;
    }

    .auth-terms-note a {
      color: var(--accent-gold, #c5a880);
      text-decoration: none;
    }

    .auth-terms-note a:hover {
      text-decoration: underline;
    }

    /* Setup dialog modal for unconfigured providers */
    .auth-setup-modal {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.75);
      backdrop-filter: blur(4px);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 1100;
      padding: 1rem;
    }

    .auth-setup-modal.open {
      display: flex;
    }

    .auth-setup-card {
      background: var(--bg-card, #0f131c);
      border: 1px solid var(--border-gold, rgba(197, 168, 128, 0.35));
      border-radius: 12px;
      padding: 1.5rem;
      max-width: 480px;
      width: 100%;
      box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
    }

    /* Responsive Overrides for Compact Mobile */
    @media (max-width: 440px) {
      .auth-modal-card {
        margin: 0.5rem;
        max-width: 100%;
      }
      .auth-alt-grid {
        grid-template-columns: 1fr;
        gap: 6px;
      }
      .auth-fed-row {
        flex-direction: column;
        gap: 6px;
      }
    }

    /* ==========================================================================
       TOP UNIVERSAL ANNOUNCEMENT BAR
       ========================================================================== */
    .universal-announcement-bar {
      background: #121622;
      border-bottom: 1px solid rgba(197, 168, 128, 0.25);
      color: var(--text-main, #f4f2ed);
      font-size: 0.78rem;
      padding: 0.45rem 1rem;
      position: relative;
      z-index: 99;
    }
    .announcement-inner {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 0.75rem;
      flex-wrap: wrap;
      text-align: center;
    }
    .announcement-badge {
      background: var(--accent-primary, #c5a880);
      color: var(--on-accent, #0b0e17);
      font-weight: 800;
      font-size: 0.65rem;
      padding: 2px 7px;
      border-radius: 4px;
      letter-spacing: 0.08em;
      flex-shrink: 0;
    }
    .announcement-text {
      color: rgba(244, 242, 237, 0.9);
      letter-spacing: 0.02em;
    }
    @media (max-width: 640px) {
      .universal-announcement-bar {
        font-size: 0.7rem;
        padding: 0.36rem 0.65rem;
      }
      .announcement-inner {
        display: block;
        text-align: center;
        line-height: 1.4;
      }
      .announcement-badge {
        display: inline-block;
        vertical-align: middle;
        margin-right: 0.4rem;
        font-size: 0.6rem;
        padding: 1px 6px;
      }
    }

    /* ==========================================================================
       IN-BROWSER UNDICIDE FOLIO READER ARCHITECTURE
       ========================================================================== */
    .undicide-reader-window {
      display: flex;
      flex-direction: column;
      width: 100%;
      max-width: 1240px;
      margin: auto 0;
      margin-top: auto;
      margin-bottom: auto;
      height: 94vh;
      max-height: calc(100vh - 2rem);
      max-height: calc(100dvh - 2rem);
      background: var(--bg-card, #0f131c);
      border: 1px solid var(--border-gold, rgba(197, 168, 128, 0.35));
      border-radius: 14px;
      overflow: hidden;
      box-shadow: 0 30px 90px rgba(0, 0, 0, 0.75);
      position: relative;
    }

    .undicide-reader-window:fullscreen,
    .undicide-reader-window:-webkit-full-screen {
      width: 100vw !important;
      max-width: 100vw !important;
      height: 100vh !important;
      max-height: 100vh !important;
      border-radius: 0 !important;
      border: none !important;
      margin: 0 !important;
    }

    @media (max-width: 768px) {
      #reader-modal.modal-overlay {
        padding: 0 !important;
      }
      .undicide-reader-window {
        height: 100vh !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        border: none !important;
        margin: 0 !important;
      }
    }

    /* Reader Top Toolbar */
    .reader-top-toolbar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.75rem;
      padding: 0.55rem 1rem;
      background: #0b0e15;
      border-bottom: 1px solid rgba(255, 255, 255, 0.08);
      flex-wrap: wrap;
      min-height: 52px;
      z-index: 20;
    }
    .reader-toolbar-left {
      display: flex;
      align-items: center;
      gap: 0.85rem;
      min-width: 0;
      flex: 1 1 240px;
    }
    .reader-back-btn {
      background: rgba(255, 255, 255, 0.06);
      border: 1px solid rgba(255, 255, 255, 0.12);
      color: #fff;
      border-radius: 8px;
      padding: 0.35rem 0.65rem;
      font-size: 0.78rem;
      font-weight: 600;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
      min-height: 34px;
      white-space: nowrap;
      flex-shrink: 0;
      transition: all 0.15s ease;
    }
    .reader-back-btn:hover {
      background: rgba(197, 168, 128, 0.2);
      border-color: var(--accent-gold);
    }
    .reader-meta-title-box {
      min-width: 0;
    }
    .reader-meta-title {
      font-family: var(--font-editorial, serif);
      font-size: 0.95rem;
      font-weight: 700;
      color: #fff;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      margin: 0;
    }
    .reader-meta-sub {
      font-size: 0.7rem;
      color: var(--text-dim, #848b98);
      font-family: var(--font-mono, monospace);
    }

    /* Reader Navigation Controls */
    .reader-nav-cluster {
      display: flex;
      align-items: center;
      gap: 0.4rem;
      background: rgba(255, 255, 255, 0.04);
      padding: 0.25rem 0.5rem;
      border-radius: 8px;
      border: 1px solid rgba(255, 255, 255, 0.08);
    }
    .reader-nav-btn {
      background: transparent;
      border: none;
      color: #fff;
      width: 32px;
      height: 32px;
      border-radius: 6px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1rem;
      transition: background 0.15s ease;
    }
    .reader-nav-btn:hover:not(:disabled) {
      background: rgba(255, 255, 255, 0.12);
    }
    .reader-nav-btn:disabled {
      opacity: 0.3;
      cursor: not-allowed;
    }
    .reader-page-indicator {
      font-family: var(--font-mono, monospace);
      font-size: 0.78rem;
      color: var(--accent-gold, #c5a880);
      font-weight: 700;
      display: flex;
      align-items: center;
      gap: 0.35rem;
      white-space: nowrap;
    }
    .reader-page-input {
      width: 38px;
      padding: 2px 4px;
      background: #0f131c;
      border: 1px solid rgba(197, 168, 128, 0.3);
      border-radius: 4px;
      color: #fff;
      font-family: var(--font-mono, monospace);
      font-size: 0.78rem;
      text-align: center;
    }

    /* Reader Action Controls (Right Cluster) */
    .reader-toolbar-right {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      flex-wrap: wrap;
    }
    .reader-toolbar-divider {
      width: 1px;
      height: 18px;
      background: rgba(255, 255, 255, 0.14);
      margin: 0 0.15rem;
    }

    .reader-theme-pills {
      display: flex;
      background: rgba(0, 0, 0, 0.4);
      border-radius: 6px;
      padding: 2px;
      border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .reader-mode-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 0.45rem;
    }

    .reader-theme-pill {
      background: rgba(255, 255, 255, 0.04);
      border: 1px solid rgba(255, 255, 255, 0.12);
      color: var(--text-secondary, #cbd5e1);
      font-size: 0.74rem;
      font-weight: 600;
      padding: 0.45rem 0.6rem;
      border-radius: 7px;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 0.45rem;
      transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    }

    .reader-theme-pill:hover {
      border-color: var(--accent-gold, #c5a880);
      color: #fff;
    }

    .reader-theme-pill.active {
      background: rgba(197, 168, 128, 0.22);
      border-color: var(--accent-gold, #c5a880);
      color: var(--accent-gold, #c5a880);
    }

    .mode-swatch {
      width: 14px;
      height: 14px;
      border-radius: 50%;
      border: 1px solid rgba(255, 255, 255, 0.25);
      flex-shrink: 0;
    }

    .reader-tool-btn {
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid rgba(255, 255, 255, 0.1);
      color: #fff;
      border-radius: 7px;
      padding: 0.35rem 0.65rem;
      font-size: 0.75rem;
      font-weight: 600;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
      min-height: 32px;
      transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    }
    .reader-tool-btn:hover {
      background: rgba(197, 168, 128, 0.18);
      border-color: var(--accent-gold);
    }
    .reader-tool-btn.active {
      background: var(--accent-gold, #c5a880);
      color: #0b0e14;
      border-color: var(--accent-gold, #c5a880);
    }
    .reader-audio-btn.speaking {
      background: #9a3412 !important;
      color: #fff !important;
      border-color: #9a3412 !important;
      animation: pulse-audio 1.8s infinite;
    }
    @keyframes pulse-audio {
      0% { box-shadow: 0 0 0 0 rgba(154, 52, 18, 0.55); }
      70% { box-shadow: 0 0 0 8px rgba(154, 52, 18, 0); }
      100% { box-shadow: 0 0 0 0 rgba(154, 52, 18, 0); }
    }

    @media (max-width: 1023px) {
      .reader-spread-toggle {
        display: none !important;
      }
    }

    /* Reader Stage Area */
    .reader-stage-area {
      flex: 1;
      display: flex;
      overflow: hidden;
      position: relative;
      min-height: 0;
    }
    .reader-stage-main {
      flex: 1;
      overflow-y: auto;
      overflow-x: auto;
      display: flex;
      flex-direction: column;
      align-items: center;
      padding: 1.5rem 2rem;
      transition: background-color 0.25s ease;
      position: relative;
    }

    .reader-placement-banner {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.85rem;
      flex-wrap: wrap;
      width: 100%;
      max-width: 780px;
      margin-bottom: 1rem;
      padding: 0.55rem 0.9rem;
      border-radius: 8px;
      background: rgba(197, 168, 128, 0.16);
      border: 1px solid var(--accent-gold, #c5a880);
      color: #f8fafc;
      font-size: 0.8rem;
    }

    /* Book Frame & Tactile Page Surface */
    .reader-book-frame {
      position: relative;
      display: flex;
      align-items: stretch;
      justify-content: center;
      perspective: 1800px;
      transform-style: preserve-3d;
      margin-bottom: 1.25rem;
      max-width: 100%;
      touch-action: pan-y;
      user-select: text;
    }

    .reader-book-frame.is-placing-note {
      cursor: crosshair;
    }

    .reader-canvas-card {
      background: #F6F1E7;
      border-radius: 4px;
      box-shadow:
        0 18px 46px rgba(0, 0, 0, 0.45),
        0 2px 6px rgba(0, 0, 0, 0.25),
        inset -2px 0 8px rgba(60, 44, 24, 0.08);
      position: relative;
      max-width: 100%;
      overflow: hidden;
      transform-origin: center center;
      transition: transform 0.26s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)), box-shadow 0.26s ease, filter 0.25s ease;
      will-change: transform;
    }

    .reader-book-frame.is-spread-view {
      gap: 0;
      box-shadow: 0 26px 65px rgba(0, 0, 0, 0.55);
      border-radius: 6px;
    }

    .reader-book-frame.is-spread-view .reader-sheet-verso {
      border-radius: 5px 0 0 5px;
      box-shadow: inset -18px 0 28px -14px rgba(24, 18, 10, 0.26);
    }

    .reader-book-frame.is-spread-view .reader-sheet-recto {
      border-radius: 0 5px 5px 0;
      box-shadow: inset 18px 0 28px -14px rgba(24, 18, 10, 0.26);
    }

    .reader-book-spine {
      width: 18px;
      flex-shrink: 0;
      background: linear-gradient(
        to right,
        rgba(35, 25, 14, 0.24) 0%,
        rgba(12, 9, 5, 0.52) 45%,
        rgba(255, 250, 240, 0.2) 52%,
        rgba(12, 9, 5, 0.48) 58%,
        rgba(35, 25, 14, 0.24) 100%
      );
      pointer-events: none;
      position: relative;
      z-index: 4;
    }

    /* Subtle Paper Grain Overlay */
    .reader-paper-grain {
      position: absolute;
      inset: 0;
      pointer-events: none;
      z-index: 2;
      opacity: 0;
      background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
      mix-blend-mode: multiply;
    }

    #reader-canvas-main,
    #reader-canvas-spread-right {
      display: block;
      max-width: 100%;
      height: auto;
      position: relative;
      z-index: 1;
    }

    /* GPU 3D Book Page-Turn / Curl Animation */
    .reader-page-flip-leaf {
      position: absolute;
      inset: 0;
      pointer-events: none;
      opacity: 0;
      z-index: 9;
      backface-visibility: hidden;
      border-radius: 4px;
      background: linear-gradient(
        to left,
        rgba(246, 241, 231, 0.92) 0%,
        rgba(222, 206, 178, 0.78) 65%,
        rgba(30, 22, 12, 0.24) 100%
      );
      box-shadow: -12px 0 32px rgba(0, 0, 0, 0.35);
      transform-origin: left center;
    }

    .reader-page-flip-leaf.turning-next {
      transform-origin: left center;
      animation: pageTurnNext3D 0.36s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    }

    .reader-page-flip-leaf.turning-prev {
      transform-origin: right center;
      background: linear-gradient(
        to right,
        rgba(246, 241, 231, 0.92) 0%,
        rgba(222, 206, 178, 0.78) 65%,
        rgba(30, 22, 12, 0.24) 100%
      );
      box-shadow: 12px 0 32px rgba(0, 0, 0, 0.35);
      animation: pageTurnPrev3D 0.36s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    }

    @keyframes pageTurnNext3D {
      0% { opacity: 0.92; transform: rotateY(0deg) translateZ(1px); }
      50% { opacity: 0.75; transform: rotateY(-24deg) translateZ(8px) scaleX(0.94); }
      100% { opacity: 0; transform: rotateY(-56deg) translateZ(0px) scaleX(0.86); }
    }

    @keyframes pageTurnPrev3D {
      0% { opacity: 0.92; transform: rotateY(0deg) translateZ(1px); }
      50% { opacity: 0.75; transform: rotateY(24deg) translateZ(8px) scaleX(0.94); }
      100% { opacity: 0; transform: rotateY(56deg) translateZ(0px) scaleX(0.86); }
    }

    .reader-canvas-card.page-curl-next {
      transform: perspective(1400px) rotateY(-4deg) scale(0.99);
    }

    .reader-canvas-card.page-curl-prev {
      transform: perspective(1400px) rotateY(4deg) scale(0.99);
    }

    .reader-page-curl-corner {
      position: absolute;
      right: 0;
      bottom: 0;
      width: 28px;
      height: 28px;
      z-index: 6;
      cursor: pointer;
      background: linear-gradient(135deg, transparent 48%, rgba(110, 88, 60, 0.22) 50%, rgba(255, 252, 245, 0.78) 72%, rgba(0, 0, 0, 0.14) 100%);
      border-top-left-radius: 6px;
      opacity: 0.7;
      transition: width 0.18s ease, height 0.18s ease, opacity 0.18s ease;
    }

    .reader-page-curl-corner:hover {
      width: 38px;
      height: 38px;
      opacity: 1;
    }

    .reader-edge-turn {
      position: absolute;
      top: 0;
      bottom: 0;
      width: 36px;
      background: transparent;
      border: none;
      cursor: pointer;
      z-index: 5;
      opacity: 0;
      transition: opacity 0.2s ease, background 0.2s ease;
    }
    .reader-edge-prev { left: -42px; }
    .reader-edge-next { right: -42px; }

    @media (hover: hover) and (pointer: fine) {
      .reader-edge-turn:hover {
        opacity: 1;
        background: radial-gradient(circle at center, rgba(197, 168, 128, 0.18) 0%, transparent 70%);
      }
    }

    @media (max-width: 900px) {
      .reader-edge-turn {
        display: none;
      }
      .reader-stage-main {
        padding: 1rem 0.65rem;
      }
    }

    /* 4 Curated Editorial Reading Modes */
    /* 1. Warm Paper (#F6F1E7 ivory with subtle paper grain texture) */
    .undicide-reader-window[data-reader-theme="warm-paper"] .reader-stage-main {
      background: #1D1914;
    }
    .undicide-reader-window[data-reader-theme="warm-paper"] .reader-canvas-card {
      background: #F6F1E7;
    }
    .undicide-reader-window[data-reader-theme="warm-paper"] .reader-paper-grain {
      opacity: 0.045;
    }
    .undicide-reader-window[data-reader-theme="warm-paper"] #reader-canvas-main,
    .undicide-reader-window[data-reader-theme="warm-paper"] #reader-canvas-spread-right {
      filter: sepia(0.08) brightness(0.97) contrast(1.01);
      mix-blend-mode: multiply;
    }

    /* 2. Crisp Editorial (#FAF9F6 off-white gallery page) */
    .undicide-reader-window[data-reader-theme="crisp-editorial"] .reader-stage-main {
      background: #DFDDD7;
    }
    .undicide-reader-window[data-reader-theme="crisp-editorial"] .reader-canvas-card {
      background: #FAF9F6;
      box-shadow: 0 18px 46px rgba(24, 24, 27, 0.18), 0 2px 6px rgba(24, 24, 27, 0.08);
    }
    .undicide-reader-window[data-reader-theme="crisp-editorial"] .reader-paper-grain {
      opacity: 0.015;
    }
    .undicide-reader-window[data-reader-theme="crisp-editorial"] #reader-canvas-main,
    .undicide-reader-window[data-reader-theme="crisp-editorial"] #reader-canvas-spread-right {
      mix-blend-mode: multiply;
    }
    .undicide-reader-window[data-reader-theme="crisp-editorial"] .reader-placement-banner {
      background: rgba(154, 52, 18, 0.12);
      color: #191A1D;
    }

    /* 3. Sepia Archival (#EFE4CE parchment) */
    .undicide-reader-window[data-reader-theme="sepia-archival"] .reader-stage-main,
    .undicide-reader-window[data-reader-theme="sepia"] .reader-stage-main {
      background: #282016;
    }
    .undicide-reader-window[data-reader-theme="sepia-archival"] .reader-canvas-card,
    .undicide-reader-window[data-reader-theme="sepia"] .reader-canvas-card {
      background: #EFE4CE;
    }
    .undicide-reader-window[data-reader-theme="sepia-archival"] .reader-paper-grain,
    .undicide-reader-window[data-reader-theme="sepia"] .reader-paper-grain {
      opacity: 0.06;
    }
    .undicide-reader-window[data-reader-theme="sepia-archival"] #reader-canvas-main,
    .undicide-reader-window[data-reader-theme="sepia-archival"] #reader-canvas-spread-right,
    .undicide-reader-window[data-reader-theme="sepia"] #reader-canvas-main {
      filter: sepia(0.28) brightness(0.95) contrast(1.03);
      mix-blend-mode: multiply;
    }

    /* 4. OLED Midnight (#0E0E10 with warm low-glare text) */
    .undicide-reader-window[data-reader-theme="oled-midnight"] .reader-stage-main,
    .undicide-reader-window[data-reader-theme="night"] .reader-stage-main {
      background: #060608;
    }
    .undicide-reader-window[data-reader-theme="oled-midnight"] .reader-canvas-card,
    .undicide-reader-window[data-reader-theme="night"] .reader-canvas-card {
      background: #0E0E10;
      border: 1px solid rgba(255, 255, 255, 0.08);
      box-shadow: 0 20px 55px rgba(0, 0, 0, 0.85);
    }
    .undicide-reader-window[data-reader-theme="oled-midnight"] #reader-canvas-main,
    .undicide-reader-window[data-reader-theme="oled-midnight"] #reader-canvas-spread-right {
      filter: invert(0.92) hue-rotate(180deg) sepia(0.14) brightness(0.92) contrast(0.94);
    }
    .undicide-reader-window[data-reader-theme="oled-midnight"] .reader-page-curl-corner {
      background: linear-gradient(135deg, transparent 48%, rgba(255, 255, 255, 0.08) 50%, rgba(255, 255, 255, 0.16) 72%, rgba(0, 0, 0, 0.4) 100%);
    }

    /* Inline Sticky Notes Overlay & Pins */
    .reader-inline-margin-cta {
      position: absolute;
      top: 10px;
      right: 10px;
      z-index: 7;
      padding: 0.28rem 0.6rem;
      border-radius: 9999px;
      background: rgba(15, 19, 28, 0.84);
      border: 1px solid rgba(197, 168, 128, 0.45);
      color: #f6f1e7;
      font-family: var(--font-mono, monospace);
      font-size: 0.68rem;
      font-weight: 700;
      cursor: pointer;
      transition: transform 0.15s ease, background 0.15s ease;
    }
    .reader-inline-margin-cta:hover {
      background: #9a3412;
      border-color: #9a3412;
      color: #fff;
    }

    .reader-page-notes-layer {
      position: absolute;
      inset: 0;
      z-index: 6;
      pointer-events: none;
    }

    .reader-sticky-pin {
      position: absolute;
      transform: translate(-50%, -50%);
      pointer-events: auto;
      min-width: 26px;
      height: 26px;
      padding: 0 7px;
      border-radius: 9999px;
      border: 1.5px solid rgba(15, 17, 21, 0.45);
      font-family: var(--font-mono, monospace);
      font-size: 0.7rem;
      font-weight: 700;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 3px;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
      transition: transform 0.16s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1));
    }
    .reader-sticky-pin:hover,
    .reader-sticky-pin:focus-visible {
      transform: translate(-50%, -50%) scale(1.12);
      z-index: 12;
    }
    .reader-sticky-pin[data-color="amber"] { background: #f59e0b; color: #0b0e14; }
    .reader-sticky-pin[data-color="gold"] { background: #c5a880; color: #0b0e14; }
    .reader-sticky-pin[data-color="rose"] { background: #be123c; color: #fff; }
    .reader-sticky-pin[data-color="emerald"] { background: #065f46; color: #fff; }
    .reader-sticky-pin[data-color="ivory"] { background: #f6f1e7; color: #1c1917; }

    .reader-inline-note-editor {
      position: fixed;
      right: 2rem;
      bottom: 5.5rem;
      width: min(340px, calc(100vw - 2rem));
      background: #111622;
      border: 1px solid var(--accent-gold, #c5a880);
      border-radius: 12px;
      padding: 0.9rem;
      box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65);
      z-index: 35;
      color: #f8fafc;
      animation: modalPanelSpring 0.24s var(--ease-spring, cubic-bezier(0.22, 1, 0.36, 1)) both;
    }

    .reader-inline-note-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      font-family: var(--font-mono, monospace);
      font-size: 0.74rem;
      font-weight: 700;
      color: var(--accent-gold, #c5a880);
      margin-bottom: 0.6rem;
    }

    .reader-inline-note-textarea {
      width: 100%;
      padding: 0.6rem 0.7rem;
      border-radius: 8px;
      border: 1px solid rgba(255, 255, 255, 0.14);
      background: #0a0e17;
      color: #f8fafc;
      font-family: var(--font-sans);
      font-size: 0.84rem;
      line-height: 1.45;
      resize: vertical;
      margin-bottom: 0.65rem;
    }

    .reader-inline-note-actions {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.5rem;
    }

    .reader-note-color-dots {
      display: inline-flex;
      gap: 0.4rem;
      align-items: center;
    }

    .note-color-dot {
      width: 18px;
      height: 18px;
      border-radius: 50%;
      border: 2px solid transparent;
      cursor: pointer;
    }
    .note-color-dot[data-color="amber"] { background: #d97706; }
    .note-color-dot[data-color="gold"] { background: #c5a880; }
    .note-color-dot[data-color="rose"] { background: #be123c; }
    .note-color-dot[data-color="emerald"] { background: #047857; }
    .note-color-dot.active {
      border-color: #ffffff;
      transform: scale(1.12);
    }

    /* Reader Notes Drawer */
    .reader-notes-drawer {
      width: 330px;
      background: #0a0d14;
      border-left: 1px solid rgba(255, 255, 255, 0.1);
      display: none;
      flex-direction: column;
      position: relative;
      z-index: 15;
    }
    .reader-notes-drawer.open {
      display: flex;
    }
    .reader-notes-header {
      padding: 0.85rem 1rem;
      border-bottom: 1px solid rgba(255, 255, 255, 0.08);
      display: flex;
      align-items: center;
      justify-content: space-between;
      font-size: 0.85rem;
      font-weight: 700;
      color: #fff;
    }
    .reader-notes-bulk-bar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.4rem;
      padding: 0.55rem 0.75rem;
      border-bottom: 1px solid rgba(255, 255, 255, 0.08);
      background: rgba(255, 255, 255, 0.02);
      flex-wrap: wrap;
    }
    .reader-notes-list {
      flex: 1;
      overflow-y: auto;
      padding: 0.75rem;
      display: flex;
      flex-direction: column;
      gap: 0.65rem;
    }
    .reader-note-item {
      background: rgba(255, 255, 255, 0.03);
      border: 1px solid rgba(255, 255, 255, 0.08);
      border-radius: 8px;
      padding: 0.65rem 0.75rem;
      font-size: 0.8rem;
      position: relative;
    }
    .reader-note-page {
      font-family: var(--font-mono, monospace);
      font-size: 0.68rem;
      color: var(--accent-gold);
      font-weight: 700;
      margin-bottom: 0.25rem;
    }
    .reader-note-text {
      color: #f1f4f9;
      line-height: 1.45;
      font-size: 0.78rem;
      word-break: break-word;
    }
    .reader-note-del {
      position: absolute;
      top: 0.45rem;
      right: 0.45rem;
      background: transparent;
      border: none;
      color: #94a3b8;
      cursor: pointer;
      font-size: 0.78rem;
      padding: 2px 5px;
    }
    .reader-note-del:hover {
      color: #f43f5e;
    }
    .reader-notes-form {
      padding: 0.75rem;
      border-top: 1px solid rgba(255, 255, 255, 0.08);
      background: rgba(0, 0, 0, 0.25);
    }
    .reader-notes-input {
      width: 100%;
      height: 60px;
      background: #0f131c;
      border: 1px solid rgba(255, 255, 255, 0.12);
      border-radius: 6px;
      color: #fff;
      font-size: 0.78rem;
      padding: 0.5rem;
      resize: none;
      margin-bottom: 0.5rem;
    }

    /* Docked Studio Book Audio & Natural Neural TTS Bar */
    .reader-studio-audio-bar {
      background: #0b0e15;
      border-top: 1px solid rgba(197, 168, 128, 0.35);
      padding: 0.6rem 1rem;
      z-index: 22;
      color: #f8fafc;
    }
    .studio-audio-main-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.9rem;
      flex-wrap: wrap;
    }
    .studio-audio-transport {
      display: flex;
      align-items: center;
      gap: 0.35rem;
      flex-shrink: 0;
    }
    .studio-play-btn {
      display: inline-flex;
      align-items: center;
      gap: 0.4rem;
      padding: 0.38rem 0.85rem;
      border-radius: 9999px;
      background: #c5a880;
      color: #0b0e14;
      font-size: 0.76rem;
      font-weight: 700;
      cursor: pointer;
      border: none;
      min-height: 32px;
      white-space: nowrap;
    }
    .studio-audio-track-col {
      flex: 1 1 260px;
      min-width: 180px;
      display: flex;
      flex-direction: column;
      gap: 0.3rem;
    }
    .studio-audio-meta-top {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.6rem;
      flex-wrap: wrap;
      font-size: 0.74rem;
    }
    .studio-source-pills {
      display: inline-flex;
      background: rgba(255, 255, 255, 0.06);
      border-radius: 9999px;
      padding: 2px;
      gap: 2px;
    }
    .studio-src-pill {
      padding: 2px 8px;
      border-radius: 9999px;
      border: none;
      background: transparent;
      color: #94a3b8;
      font-size: 0.68rem;
      font-weight: 600;
      cursor: pointer;
    }
    .studio-src-pill.active {
      background: rgba(197, 168, 128, 0.25);
      color: #f3d79b;
    }
    .studio-now-playing {
      color: #e2e8f0;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 260px;
    }
    .studio-time-readout {
      font-family: var(--font-mono, monospace);
      font-size: 0.7rem;
      font-variant-numeric: tabular-nums;
      color: var(--accent-gold, #c5a880);
    }
    .studio-scrubber {
      width: 100%;
      accent-color: #c5a880;
      cursor: pointer;
      height: 5px;
    }
    .studio-audio-controls {
      display: flex;
      align-items: center;
      gap: 0.45rem;
      flex-wrap: wrap;
    }
    .studio-select {
      background: #131926;
      color: #f8fafc;
      border: 1px solid rgba(255, 255, 255, 0.16);
      border-radius: 6px;
      font-size: 0.72rem;
      padding: 0.28rem 0.45rem;
      max-width: 165px;
      flex-shrink: 0;
    }
    #reader-audio-speed {
      min-width: 64px;
    }
    #reader-audio-sleep-select {
      min-width: 96px;
    }
    .studio-sleep-wrap {
      display: inline-flex;
      align-items: center;
      gap: 0.3rem;
      color: #cbd5e1;
    }

    @media (prefers-reduced-motion: reduce) {
      .reader-page-flip-leaf,
      .reader-canvas-card,
      .reader-sticky-pin,
      .reader-inline-note-editor {
        animation: none !important;
        transition: none !important;
        transform: none !important;
      }
    }

    /* Mobile Bottom Reader Navigation */
    .reader-mobile-nav {
      display: none;
      align-items: center;
      justify-content: space-around;
      padding: 0.5rem;
      background: #0b0e15;
      border-top: 1px solid rgba(255, 255, 255, 0.1);
      z-index: 20;
    }
    @media (max-width: 640px) {
      .reader-mobile-nav {
        display: flex;
      }
      .reader-top-toolbar {
        padding: 0.45rem 0.65rem;
        gap: 0.45rem;
      }
      .reader-top-toolbar .reader-toolbar-left {
        flex: 1 1 auto;
        min-width: 0;
        gap: 0.55rem;
      }
      .reader-top-toolbar .reader-toolbar-right {
        width: 100%;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 2px;
        gap: 0.38rem;
      }
      .reader-top-toolbar .reader-toolbar-right::-webkit-scrollbar {
        display: none;
      }
      .reader-top-toolbar .reader-tool-btn,
      .reader-top-toolbar .reader-sync-pill {
        white-space: nowrap;
        flex-shrink: 0;
        font-size: 0.72rem;
        padding: 0.3rem 0.55rem;
      }
      .reader-top-toolbar .reader-nav-cluster {
        display: none;
      }
      .reader-notes-drawer {
        position: absolute;
        inset: 0;
        width: 100%;
      }
      .reader-meta-title {
        max-width: 175px;
        font-size: 0.85rem;
      }
      .reader-meta-sub {
        font-size: 0.64rem;
      }
      .reader-studio-audio-bar {
        padding: 0.5rem 0.7rem;
      }
      .studio-audio-controls {
        width: 100%;
        justify-content: space-between;
      }
    }

    /* ==========================================================================
       UNDICIDE REALISTIC DIGITAL BOOKSHELF & ADVANCED MOTION SYSTEM
       ========================================================================== */

    /* 1. Bookshelf Container & Toolbar */
    .digital-bookshelf-container {
      display: flex;
      flex-direction: column;
      gap: 3rem;
      margin: 1.5rem 0 2.5rem 0;
      perspective: 1400px;
      position: relative;
    }

    .bookshelf-toolbar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 1rem;
      padding: 0.85rem 1.25rem;
      background: var(--bg-card, #161B22);
      border: 1px solid var(--border-inner, rgba(255, 255, 255, 0.08));
      border-radius: var(--radius-md, 8px);
      margin-bottom: 1rem;
    }

    .bookshelf-mode-toggles {
      display: inline-flex;
      gap: 4px;
      background: rgba(0, 0, 0, 0.35);
      padding: 4px;
      border-radius: 6px;
      border: 1px solid rgba(255, 255, 255, 0.06);
    }

    .btn-shelf-toggle {
      background: transparent;
      border: none;
      color: var(--text-dim, #64748b);
      padding: 6px 14px;
      font-family: var(--font-mono, monospace);
      font-size: 0.78rem;
      font-weight: 600;
      border-radius: 4px;
      cursor: pointer;
      transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .btn-shelf-toggle:hover {
      color: var(--text-primary, #fff);
      background: rgba(255, 255, 255, 0.06);
    }

    .btn-shelf-toggle.active {
      background: var(--accent-gold, #C5A880);
      color: #0b0e14;
      font-weight: 700;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    }

    /* 2. Architectural Wooden Shelf Tier */
    .bookshelf-tier {
      position: relative;
      background: linear-gradient(180deg, rgba(22, 17, 13, 0.92) 0%, rgba(13, 10, 7, 0.98) 100%);
      border-radius: 6px 6px 4px 4px;
      padding: 2.75rem 2rem 0 2rem;
      box-shadow: inset 0 12px 30px rgba(0, 0, 0, 0.85), 0 12px 32px rgba(0, 0, 0, 0.55);
      border: 1px solid rgba(197, 168, 128, 0.22);
      overflow: visible;
    }

    .shelf-backwall-grooves {
      position: absolute;
      inset: 0;
      background: repeating-linear-gradient(
        90deg,
        transparent 0px,
        transparent 118px,
        rgba(255, 255, 255, 0.02) 119px,
        rgba(0, 0, 0, 0.35) 120px
      );
      pointer-events: none;
      border-radius: 6px;
    }

    .shelf-books-row {
      display: flex;
      align-items: flex-end;
      gap: 10px;
      min-height: 295px;
      position: relative;
      z-index: 5;
      transform-style: preserve-3d;
      padding-bottom: 4px;
      overflow-x: auto;
      overflow-y: visible;
      scrollbar-width: thin;
      scrollbar-color: rgba(197, 168, 128, 0.3) transparent;
      padding-left: 8px;
      padding-right: 8px;
    }

    .shelf-books-row::-webkit-scrollbar {
      height: 6px;
    }
    .shelf-books-row::-webkit-scrollbar-thumb {
      background: rgba(197, 168, 128, 0.3);
      border-radius: 3px;
    }

    /* 3. Individual Standing Book on Shelf */
    .shelf-book-stand {
      position: relative;
      transform-style: preserve-3d;
      transform-origin: bottom center;
      cursor: pointer;
      user-select: none;
      transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1), z-index 0s;
      flex-shrink: 0;
      outline: none;
    }

    .shelf-book-spine {
      border-radius: 3px 2px 2px 3px;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      align-items: center;
      padding: 10px 5px 8px 5px;
      position: relative;
      box-shadow: -4px 6px 14px rgba(0, 0, 0, 0.55), inset 3px 0 5px rgba(255, 255, 255, 0.16), inset -3px 0 5px rgba(0, 0, 0, 0.4);
      border-left: 2px solid rgba(255, 255, 255, 0.22);
      transform-style: preserve-3d;
      transition: all 0.32s cubic-bezier(0.16, 1, 0.3, 1);
    }

    /* 3D Pull-Out Interaction on Hover & Focus */
    .shelf-book-stand:hover,
    .shelf-book-stand:focus-visible,
    .shelf-book-stand.active-inspect {
      transform: translateY(-24px) translateZ(52px) rotateY(-24deg);
      z-index: 45;
    }

    .shelf-book-stand:hover .shelf-book-spine,
    .shelf-book-stand:focus-visible .shelf-book-spine,
    .shelf-book-stand.active-inspect .shelf-book-spine {
      box-shadow: -14px 22px 36px rgba(0, 0, 0, 0.7), 0 0 24px rgba(197, 168, 128, 0.3);
      border-color: var(--accent-gold, #C5A880);
    }

    /* Spine Detailing */
    .spine-top-band {
      width: 100%;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 4px;
    }

    .spine-ribbon-tag {
      width: 10px;
      height: 18px;
      border-radius: 0 0 3px 3px;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    }

    .spine-category-code {
      font-family: var(--font-mono, monospace);
      font-size: 7.5px;
      letter-spacing: 0.1em;
      color: var(--accent-gold, #C5A880);
      font-weight: 700;
      text-transform: uppercase;
    }

    .spine-title-vertical {
      writing-mode: vertical-rl;
      transform: rotate(180deg);
      font-family: 'Cormorant Garamond', Georgia, serif;
      font-size: 13px;
      font-weight: 700;
      letter-spacing: 0.08em;
      color: #fff;
      text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
      max-height: 155px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      margin: auto 0;
    }

    .spine-author-tag {
      writing-mode: vertical-rl;
      transform: rotate(180deg);
      font-family: var(--font-sans, sans-serif);
      font-size: 8px;
      letter-spacing: 0.05em;
      color: rgba(255, 255, 255, 0.65);
      max-height: 50px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .spine-bottom-mark {
      font-family: var(--font-mono, monospace);
      font-size: 7px;
      font-weight: 700;
      color: var(--accent-gold, #C5A880);
      border-top: 1px solid rgba(255, 255, 255, 0.15);
      padding-top: 3px;
      width: 100%;
      text-align: center;
    }

    /* 3D Book Thickness Edge visible when rotated */
    .shelf-book-thickness-edge {
      position: absolute;
      top: 2px;
      bottom: 2px;
      right: -10px;
      width: 10px;
      background: repeating-linear-gradient(
        180deg,
        #f4f1ea 0px,
        #ded8cc 1px,
        #eae5da 2px,
        #c4bdae 3px
      );
      border-radius: 0 2px 2px 0;
      box-shadow: 2px 4px 8px rgba(0, 0, 0, 0.5);
      transform: rotateY(90deg) translateZ(-5px);
      pointer-events: none;
      display: none;
    }

    /* 4. Wooden Shelf Plank */
    .shelf-plank {
      height: 28px;
      margin: 0 -2rem;
      background: linear-gradient(180deg, #422d1b 0%, #281a0e 100%);
      border-top: 3px solid rgba(197, 168, 128, 0.5);
      box-shadow: 0 16px 32px rgba(0, 0, 0, 0.8), inset 0 2px 4px rgba(255, 255, 255, 0.18);
      border-radius: 2px 2px 6px 6px;
      position: relative;
      z-index: 10;
    }
    .shelf-plank::after {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      height: 4px;
      background: linear-gradient(90deg, rgba(197, 168, 128, 0.5) 0%, rgba(255, 255, 255, 0.25) 50%, rgba(197, 168, 128, 0.5) 100%);
    }

    /* 5. Floating Bookshelf Dossier HUD */
    .shelf-floating-dossier {
      position: absolute;
      top: -140px;
      left: 50%;
      transform: translateX(-50%) translateY(10px) scale(0.96);
      background: rgba(15, 19, 28, 0.95);
      backdrop-filter: blur(14px);
      -webkit-backdrop-filter: blur(14px);
      border: 1px solid var(--accent-gold, #C5A880);
      border-radius: 10px;
      padding: 14px 20px;
      display: flex;
      align-items: center;
      gap: 18px;
      box-shadow: 0 20px 45px rgba(0, 0, 0, 0.75), 0 0 32px rgba(197, 168, 128, 0.22);
      z-index: 100;
      min-width: 380px;
      max-width: 90vw;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.24s cubic-bezier(0.16, 1, 0.3, 1), transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .shelf-floating-dossier.open {
      opacity: 1;
      pointer-events: auto;
      transform: translateX(-50%) translateY(0) scale(1);
    }

    .dossier-mini-cover {
      width: 44px;
      height: 60px;
      background: var(--bg-surface, #161B22);
      border: 1px solid var(--border-gold, rgba(197, 168, 128, 0.4));
      border-radius: 3px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 22px;
      flex-shrink: 0;
      box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    }

    .dossier-info-block {
      flex-grow: 1;
      min-width: 0;
    }

    .dossier-eyebrow {
      font-family: var(--font-mono, monospace);
      font-size: 8.5px;
      font-weight: 700;
      letter-spacing: 0.1em;
      color: var(--accent-gold, #C5A880);
      text-transform: uppercase;
      margin-bottom: 2px;
    }

    .dossier-title {
      font-family: 'Cormorant Garamond', Georgia, serif;
      font-size: 15px;
      font-weight: 700;
      color: #fff;
      line-height: 1.25;
      margin: 0 0 3px 0;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 280px;
    }

    .dossier-meta {
      font-size: 11px;
      color: var(--text-dim, #64748b);
      line-height: 1.3;
    }

    .dossier-progress-wrap {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-top: 6px;
    }

    .dossier-progress-bar {
      flex-grow: 1;
      height: 4px;
      background: rgba(255, 255, 255, 0.1);
      border-radius: 2px;
      overflow: hidden;
    }

    .dossier-progress-fill {
      height: 100%;
      background: var(--accent-gold, #C5A880);
      border-radius: 2px;
    }

    .dossier-progress-text {
      font-family: var(--font-mono, monospace);
      font-size: 9px;
      color: var(--accent-gold, #C5A880);
      font-weight: 600;
    }

    .dossier-actions {
      display: flex;
      flex-direction: column;
      gap: 6px;
      flex-shrink: 0;
    }

    .btn-dossier-read {
      background: var(--accent-gold, #C5A880);
      color: #0b0e14;
      border: 1px solid var(--accent-gold);
      padding: 6px 14px;
      border-radius: 4px;
      font-family: var(--font-mono, monospace);
      font-size: 11px;
      font-weight: 700;
      cursor: pointer;
      transition: all 0.15s ease;
      white-space: nowrap;
    }
    .btn-dossier-read:hover {
      background: #dfc49e;
      transform: scale(1.03);
    }

    .btn-dossier-inspect {
      background: transparent;
      color: var(--text-primary, #fff);
      border: 1px solid rgba(255, 255, 255, 0.18);
      padding: 5px 12px;
      border-radius: 4px;
      font-family: var(--font-mono, monospace);
      font-size: 10px;
      cursor: pointer;
      transition: all 0.15s ease;
      white-space: nowrap;
    }
    .btn-dossier-inspect:hover {
      border-color: var(--accent-gold, #C5A880);
      color: var(--accent-gold, #C5A880);
    }

    /* Empty Shelf State */
    .empty-shelf-notice {
      min-height: 240px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      text-align: center;
      padding: 2rem;
      color: var(--text-dim, #64748b);
    }
    .empty-shelf-glyph {
      font-size: 40px;
      margin-bottom: 0.75rem;
      opacity: 0.7;
    }

    /* 6. Buttons & Interactive Controls Micro-Interactions */
    .btn-primary,
    .btn-secondary,
    .btn-action-primary,
    .btn-action-secondary,
    .btn-acquire-solid,
    .btn-sample-ghost {
      transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
    }

    .btn-primary:hover,
    .btn-action-primary:hover,
    .btn-acquire-solid:hover {
      transform: translateY(-1.5px);
      box-shadow: 0 6px 18px rgba(197, 168, 128, 0.35);
    }

    .btn-primary:active,
    .btn-action-primary:active,
    .btn-acquire-solid:active,
    .btn-secondary:active,
    .btn-sample-ghost:active {
      transform: scale(0.97) translateY(0.5px);
    }

    .btn-secondary:hover,
    .btn-action-secondary:hover,
    .btn-sample-ghost:hover {
      transform: translateY(-1px);
      border-color: var(--accent-gold, #C5A880);
    }

    /* 7. Reduced Motion Accessibility */
    @media (prefers-reduced-motion: reduce) {
      .mini-book-specimen,
      .shelf-book-stand,
      .shelf-floating-dossier,
      .card-stage-float-hud,
      .book-3d-shadow {
        transition: none !important;
        transform: none !important;
      }
      .mini-book-specimen:hover,
      .shelf-book-stand:hover {
        transform: none !important;
        outline: 2px solid var(--accent-gold, #C5A880);
      }
    }

    /* 8. Responsive Bookshelf Rules */
    @media (max-width: 768px) {
      .bookshelf-tier {
        padding: 2rem 1rem 0 1rem;
      }
      .shelf-plank {
        margin: 0 -1rem;
      }
      .shelf-floating-dossier {
        min-width: 300px;
        top: -160px;
        padding: 10px 14px;
      }
      .dossier-title {
        max-width: 170px;
      }
    }

    /* ==========================================================================
       9. TAGLINE REVEAL SECTION (LANDING PAGE DESIGN SPECIFICATION B11)
       ========================================================================== */
    .tagline-reveal-section {
      padding: 6.5rem 1rem;
      background: var(--bg-canvas, #08090c);
      border-top: 1px solid var(--border-inner, rgba(255, 255, 255, 0.06));
      border-bottom: 1px solid var(--border-inner, rgba(255, 255, 255, 0.06));
      text-align: center;
      position: relative;
      overflow: hidden;
    }

    .tagline-reveal-inner {
      max-width: 960px;
      margin: 0 auto;
      display: flex;
      flex-direction: column;
      align-items: center;
    }

    .tagline-reveal-text {
      font-family: var(--font-editorial, 'Cormorant Garamond', serif);
      font-size: clamp(2rem, 3.8vw + 0.5rem, 3.6rem);
      font-weight: 500;
      line-height: 1.28;
      margin: 0 0 1.5rem 0;
      letter-spacing: -0.01em;
    }

    .reveal-line {
      display: block;
      margin-bottom: 0.35rem;
    }

    .reveal-word {
      display: inline-block;
      color: var(--text-primary, #f4f2ed);
      opacity: 0.62;
      transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1), color 0.45s cubic-bezier(0.16, 1, 0.3, 1), transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
      transform: translateY(2px);
      margin-right: 0.28em;
      will-change: opacity, transform;
    }

    .reveal-word.active {
      opacity: 1;
      transform: translateY(0);
    }

    .reveal-word.active.highlight {
      color: var(--accent-gold, #c5a880);
      text-shadow: 0 0 24px rgba(197, 168, 128, 0.25);
    }

    .tagline-subtext {
      font-family: var(--font-mono, monospace);
      font-size: 0.82rem;
      letter-spacing: 0.12em;
      text-transform: uppercase;
      color: var(--text-muted, #718096);
      margin: 0;
    }

    @media (prefers-reduced-motion: reduce) {
      .reveal-word {
        opacity: 1 !important;
        transform: none !important;
      }
    }

    @media (max-width: 640px) {
      .tagline-reveal-section {
        padding: 4rem 1rem;
      }
      .tagline-reveal-text {
        font-size: 1.75rem;
        line-height: 1.35;
      }
      .tagline-subtext {
        font-size: 0.72rem;
        letter-spacing: 0.08em;
      }
    }

    /* ==========================================================================
       10. LEGAL & ARCHIVAL GOVERNANCE MODAL
       ========================================================================== */
    .legal-content-pane {
      max-height: 52vh;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      padding-right: 0.5rem;
      scrollbar-width: thin;
      scrollbar-color: rgba(197, 168, 128, 0.35) transparent;
    }

    .legal-content-pane::-webkit-scrollbar {
      width: 5px;
    }
    .legal-content-pane::-webkit-scrollbar-thumb {
      background: rgba(197, 168, 128, 0.35);
      border-radius: 3px;
    }

    /* ==========================================================================
       11. EDITORIAL SVG ICONS, SKELETON LOADERS & ASYMMETRIC POETRY SPREAD
       ========================================================================== */
    .undicide-icon {
      display: inline-block;
      vertical-align: -0.15em;
      flex-shrink: 0;
    }

    .skeleton-card {
      background: var(--bg-surface, #111622);
      border: 1px solid var(--border-inner, rgba(255, 255, 255, 0.08));
      border-radius: 12px;
      padding: 1.25rem;
      display: flex;
      flex-direction: column;
      gap: 0.75rem;
    }

    .skeleton-cover {
      height: 190px;
      border-radius: 6px;
      background: rgba(255, 255, 255, 0.05);
      animation: undicideShimmer 1.6s ease-in-out infinite;
    }

    .skeleton-line {
      height: 12px;
      border-radius: 4px;
      background: rgba(255, 255, 255, 0.05);
      animation: undicideShimmer 1.6s ease-in-out infinite;
    }

    .skeleton-line-lg { width: 82%; height: 16px; }
    .skeleton-line-md { width: 60%; }
    .skeleton-line-sm { width: 40%; margin-top: 0.25rem; }

    @keyframes undicideShimmer {
      0%, 100% { opacity: 0.45; }
      50% { opacity: 0.85; }
    }

    @media (prefers-reduced-motion: reduce) {
      .skeleton-cover,
      .skeleton-line {
        animation: none;
        opacity: 0.55;
      }
    }

    .poetry-editorial-section {
      background: var(--bg-surface, #0f131c);
      padding: 4.5rem 0;
    }

    .poetry-asymmetric-spread {
      display: grid;
      grid-template-columns: 1.15fr 1fr;
      gap: 1.75rem;
      margin-top: 2.5rem;
      align-items: stretch;
    }

    .poetry-feature-folio {
      background: var(--bg-card, #111622);
      border: 1px solid rgba(197, 168, 128, 0.28);
      border-radius: 12px;
      padding: 2.25rem;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
    }

    .poetry-secondary-stack {
      display: flex;
      flex-direction: column;
      gap: 1.25rem;
    }

    .poetry-verse-excerpt {
      font-family: var(--font-reading, 'Source Serif 4', serif);
      font-style: italic;
      color: var(--text-primary);
      margin: 0.85rem 0;
      padding: 0.75rem 0;
      border-top: 1px solid var(--border-inner, rgba(255, 255, 255, 0.08));
      border-bottom: 1px solid var(--border-inner, rgba(255, 255, 255, 0.08));
      font-size: 0.94rem;
      line-height: 1.6;
    }

    .poetry-verse-featured {
      font-size: 1.12rem;
      padding: 1.15rem 0;
    }

    @media (max-width: 900px) {
      .poetry-asymmetric-spread {
        grid-template-columns: 1fr;
      }
      .poetry-feature-folio {
        padding: 1.5rem;
      }
    }



/* ==========================================================================
   PHASE 5: DESIGN-ENGINEERED INTERACTIONS, COMMAND SEARCH, CART & STUDIO
   Curated Aesthetic: site-resend, shadcn-command, 21st-checkout, site-supabase
   ========================================================================== */
:root {
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
}

.btn,
.btn-acquire-solid,
.btn-sample-ghost,
.btn-nav-util,
.auth-alt-btn {
  transition: background-color 160ms var(--ease-out), border-color 160ms var(--ease-out), color 160ms var(--ease-out), transform 130ms var(--ease-out);
}

.btn:active,
.btn-acquire-solid:active,
.btn-sample-ghost:active,
.btn-nav-util:active,
.auth-alt-btn:active {
  transform: scale(0.98);
}

@media (prefers-reduced-motion: reduce) {
  .btn:active,
  .btn-acquire-solid:active,
  .btn-sample-ghost:active,
  .btn-nav-util:active,
  .auth-alt-btn:active {
    transform: none;
  }
}

/* Navbar Utility Controls (Command Search Cmd+K, Multi-Book Cart, Install PWA) */
.btn-nav-util {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.42rem 0.75rem;
  border-radius: 9999px;
  background: var(--bg-surface, #0f1117);
  border: 1px solid var(--border-outer, rgba(255, 255, 255, 0.1));
  color: var(--text-secondary, #94a3b8);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.btn-nav-util:hover {
  color: var(--text-primary, #f8fafc);
  border-color: var(--border-active, rgba(197, 168, 128, 0.45));
}

.nav-kbd-hint {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  padding: 0.1rem 0.38rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-dim, #64748b);
}

.cart-count-pill {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-gold, #c5a880);
  color: #090b0f;
}

/* Command Search Palette (09-search-and-command-styles / shadcn-command) */
.cmd-palette-card {
  width: 100%;
  max-width: 680px;
  background: var(--bg-surface, #0c0f15);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65);
}

.cmd-input-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.95rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
}

.cmd-search-field {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary, #f8fafc);
  font-family: var(--font-ui);
  font-size: 0.96rem;
}

.cmd-search-field::placeholder {
  color: var(--text-dim, #64748b);
}

.cmd-results-list {
  max-height: 420px;
  overflow-y: auto;
  padding: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.cmd-result-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.85rem;
  align-items: center;
  padding: 0.8rem 0.9rem;
  border-radius: 10px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.015);
  cursor: pointer;
  transition: background-color 140ms var(--ease-out), border-color 140ms var(--ease-out);
}

.cmd-result-row:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(197, 168, 128, 0.28);
}

.cmd-result-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary, #f8fafc);
  margin-bottom: 0.2rem;
}

.cmd-result-snippet {
  font-size: 0.8rem;
  color: var(--text-secondary, #94a3b8);
  line-height: 1.45;
}

.cmd-result-snippet mark,
.fts-snippet mark,
.card-fts-match mark {
  background: rgba(197, 168, 128, 0.24);
  color: #f3e6cf;
  padding: 0 3px;
  border-radius: 3px;
}

.cmd-meta-pill {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--accent-gold, #c5a880);
  border: 1px solid rgba(197, 168, 128, 0.25);
  padding: 0.2rem 0.45rem;
  border-radius: 5px;
  white-space: nowrap;
}

/* FTS5 card match excerpt strip */
.card-fts-match {
  margin: 0.55rem 0 0.75rem 0;
  padding: 0.55rem 0.7rem;
  border-radius: 6px;
  background: rgba(197, 168, 128, 0.06);
  border: 1px solid rgba(197, 168, 128, 0.2);
  font-size: 0.76rem;
  color: var(--text-secondary, #94a3b8);
  line-height: 1.45;
}

.commission-badge-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--badge-free-color, #34d399);
  margin-top: 0.2rem;
}

/* Multi-Book Cart Grid (11-checkout-and-pricing-styles / 21st-checkout) */
.cart-checkout-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr;
  gap: 1.25rem;
  align-items: start;
}

.cart-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-outer, rgba(255, 255, 255, 0.08));
}

.btn-cart-mini {
  padding: 0 11px;
  height: 36px;
  min-height: 36px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary, #94a3b8);
  border: 1px solid var(--border-outer, rgba(255, 255, 255, 0.14));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  box-sizing: border-box;
  cursor: pointer;
}

.btn-cart-mini:hover {
  color: var(--text-primary, #f8fafc);
  border-color: var(--accent-gold, #c5a880);
}

/* Anti-Piracy Stream Canvas Protection & Offline Badge */
#reader-canvas-card,
#reader-canvas-main {
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

.reader-sync-pill {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent-emerald, #10b981);
  border: 1px solid rgba(16, 185, 129, 0.28);
  background: rgba(16, 185, 129, 0.08);
  padding: 0.22rem 0.55rem;
  border-radius: 9999px;
}

.quote-archive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.quote-card {
  background: var(--bg-surface, #0f1117);
  border: 1px solid var(--border-outer, rgba(255, 255, 255, 0.08));
  border-radius: 10px;
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.75rem;
}

.quote-card-excerpt {
  font-family: var(--font-reading, Georgia, serif);
  font-style: italic;
  font-size: 0.92rem;
  color: var(--text-primary, #f8fafc);
  line-height: 1.55;
}

@media (max-width: 780px) {
  .cart-checkout-grid {
    grid-template-columns: 1fr;
  }
  .btn-nav-util .nav-kbd-hint {
    display: none;
  }
}

/* Profile & Settings Editorial Workspace */
.profile-edit-layout {
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 1.5rem;
  align-items: start;
  margin-bottom: 1.75rem;
}

.profile-identity-panel,
.profile-form-panel,
.profile-subpanel {
  background: var(--bg-surface, #0f1117);
  border: 1px solid var(--border-outer, rgba(255, 255, 255, 0.08));
  border-radius: 12px;
  padding: 1.4rem;
}

.profile-identity-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.85rem;
}

.profile-avatar-wrap {
  position: relative;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 1px solid var(--border-gold, rgba(197, 168, 128, 0.4));
  overflow: hidden;
  background: var(--bg-inner, #0a0e17);
}

.profile-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.profile-avatar-skeleton {
  position: absolute;
  inset: 0;
  background: var(--bg-card-hover, #161e30);
  display: none;
  align-items: center;
  justify-content: center;
}

.profile-avatar-wrap.is-uploading .profile-avatar-skeleton {
  display: flex;
  animation: skeletonPulse 1.2s ease-in-out infinite;
}

@keyframes skeletonPulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 0.95; }
}

.profile-field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.1rem;
  margin-bottom: 1.1rem;
}

.profile-verification-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  margin-bottom: 0;
}

@media (max-width: 1160px) {
  .profile-verification-grid {
    grid-template-columns: 1fr;
  }
}

.admin-subnav-tabs {
  display: flex;
  gap: 0.45rem;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--border-inner);
  padding-bottom: 0.75rem;
  overflow-x: auto;
  flex-wrap: wrap;
  scrollbar-width: none;
}

.admin-subnav-tabs::-webkit-scrollbar {
  display: none;
}

.admin-subnav-tabs .btn {
  border-radius: 8px;
  white-space: nowrap;
  flex-shrink: 0;
  padding: 0.5rem 0.88rem;
  font-size: 0.8rem;
  line-height: 1.2;
}

@media (max-width: 900px) {
  .profile-edit-layout {
    grid-template-columns: 1fr;
  }
  .section-heading {
    font-size: clamp(1.32rem, 4.4vw, 1.8rem);
  }
  .admin-subnav-tabs {
    flex-wrap: nowrap;
  }
}

.profile-field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-secondary, #94a3b8);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.4rem;
}

.profile-input,
.profile-textarea {
  width: 100%;
  padding: 0.68rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--border-inner, var(--border-outer, rgba(255, 255, 255, 0.1)));
  background: var(--bg-canvas, #0a0e17);
  color: var(--text-primary, #f8fafc);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  box-sizing: border-box;
  transition: border-color 0.2s ease;
}

.profile-input {
  min-height: 42px;
}

input[type="file"].profile-input {
  padding: 0.42rem 0.65rem;
  line-height: 1.3;
}

.otp-inline-row .btn {
  min-height: 42px;
  white-space: nowrap;
  flex-shrink: 0;
}

.profile-textarea {
  resize: vertical;
  min-height: 92px;
  line-height: 1.5;
}

.profile-input:focus,
.profile-textarea:focus {
  outline: none;
  border-color: var(--accent-primary, #c5a880);
}

.profile-input:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.profile-char-counter {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim, #64748b);
}

.profile-char-counter.near-limit {
  color: var(--accent-primary, #c5a880);
}

.profile-char-counter.at-limit {
  color: var(--accent-rose, #f43f5e);
}

.profile-form-alert {
  padding: 0.7rem 0.9rem;
  border-radius: 8px;
  border: 1px solid rgba(244, 63, 94, 0.35);
  background: rgba(244, 63, 94, 0.08);
  color: var(--accent-rose, #f43f5e);
  font-size: 0.82rem;
  margin-bottom: 1rem;
  display: none;
}

@media (max-width: 860px) {
  .profile-edit-layout {
    grid-template-columns: 1fr;
  }
}

/* Complete Profile & Verification Controls + Reader Progress / Popovers */
.genre-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.genre-chip-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.42rem 0.8rem;
  border-radius: 9999px;
  border: 1px solid var(--border-outer, rgba(255, 255, 255, 0.12));
  background: var(--bg-inner, #0a0e17);
  color: var(--text-secondary, #94a3b8);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.18s var(--ease-spring), border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.genre-chip-toggle:hover {
  border-color: var(--border-gold, rgba(197, 168, 128, 0.45));
  color: var(--text-primary, #f8fafc);
}

.genre-chip-toggle.active {
  background: rgba(197, 168, 128, 0.16);
  border-color: var(--accent-gold, #c5a880);
  color: var(--accent-gold, #c5a880);
  font-weight: 600;
}

.verification-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid var(--border-outer, rgba(255, 255, 255, 0.14));
  color: var(--text-secondary, #94a3b8);
  background: rgba(255, 255, 255, 0.04);
}

.verification-status-pill.verified_author {
  color: var(--accent-emerald, #10b981);
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.1);
}

.verification-status-pill.pending {
  color: var(--accent-gold, #c5a880);
  border-color: rgba(197, 168, 128, 0.4);
  background: rgba(197, 168, 128, 0.12);
}

.otp-inline-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.profile-tab-subnav {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-inner, rgba(255, 255, 255, 0.08));
  padding-bottom: 0.85rem;
}

.reader-progress-track {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.reader-progress-fill {
  height: 100%;
  background: var(--accent-gold, #c5a880);
  transition: width 0.28s var(--ease-spring);
}

.reader-popover {
  position: absolute;
  top: 62px;
  right: 1rem;
  width: min(340px, calc(100vw - 2rem));
  max-height: 70vh;
  background: var(--bg-surface, #0f1117);
  border: 1px solid var(--border-gold, rgba(197, 168, 128, 0.4));
  border-radius: 12px;
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.65);
  z-index: 40;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: undicideModalSpring 0.22s var(--ease-spring) forwards;
}

.reader-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-inner, rgba(255, 255, 255, 0.08));
  font-family: var(--font-editorial, serif);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary, #f8fafc);
}

.reader-popover-body {
  padding: 0.9rem 1rem;
  overflow-y: auto;
}

.reader-toc-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  color: var(--text-secondary, #94a3b8);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.reader-toc-item:hover {
  background: rgba(197, 168, 128, 0.12);
  border-color: rgba(197, 168, 128, 0.3);
  color: var(--text-primary, #f8fafc);
}

.view-section.view-entering {
  animation: undicideViewEnter 0.26s var(--ease-spring) forwards;
}

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

@media (prefers-reduced-motion: reduce) {
  .modal-overlay.open,
  .modal-overlay.open .modal-card,
  .modal-overlay.open .modal-dossier-window,
  .modal-overlay.open .cmd-palette-card,
  .modal-overlay.open .undicide-reader-window,
  .auth-setup-modal.open .auth-setup-card,
  .reader-popover,
  .toast,
  .view-section.view-entering,
  .profile-avatar-wrap.is-uploading .profile-avatar-skeleton {
    animation: none !important;
    transition: none !important;
  }
}
