/* ==========================================================================
   HARSIDHI DIGITAL 3D FLIPBOOK - MASTER STYLESHEET
   Ultra-realistic 3D book opening animations, paper physics, and responsive controls
   ========================================================================== */

:root {
  --primary-gold: #e5b95f;
  --primary-gold-dark: #b88628;
  --primary-gold-light: #fef0cd;
  --primary-gold-glow: rgba(229, 185, 95, 0.4);

  --bg-deep: #0d0f14;
  --bg-surface: #141822;
  --bg-surface-elevated: #1b212f;
  --bg-glass: rgba(20, 24, 34, 0.78);
  --bg-glass-border: rgba(255, 255, 255, 0.1);

  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-accent: #e5b95f;

  --book-width: 520px;
  --book-height: 693px;
  --book-spine-color: #2b170e;
  --book-cover-color: #1f120a;

  --shadow-dramatic: 0 35px 90px -15px rgba(0, 0, 0, 0.85);
  --shadow-subtle: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --transition-smooth: cubic-bezier(0.25, 1, 0.5, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-deep);
  color: var(--text-main);
  user-select: none;
}

/* Background Atmosphere */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 50% 30%, rgba(229, 185, 95, 0.08) 0%, transparent 60%),
    radial-gradient(circle at 20% 80%, rgba(37, 99, 235, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(180, 83, 9, 0.08) 0%, transparent 50%),
    linear-gradient(145deg, #090b0e 0%, #11141c 45%, #090a0d 100%);
  z-index: 0;
  pointer-events: none;
}

/* Ambient Studio Light beneath the book */
.ambient-glow {
  position: absolute;
  width: 75vw;
  max-width: 1100px;
  height: 500px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -45%);
  background: radial-gradient(ellipse at center, rgba(229, 185, 95, 0.12) 0%, rgba(0, 0, 0, 0) 70%);
  filter: blur(50px);
  pointer-events: none;
  z-index: 1;
}

/* App Main Container */
#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  z-index: 2;
  overflow: hidden;
}

/* ==========================================================================
   VIEW 1: 3D CLOSED BOOK HERO / ENTRANCE
   ========================================================================== */
#hero-view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 50;
  transition: opacity 0.8s var(--transition-smooth), transform 0.8s var(--transition-smooth), visibility 0.8s;
  perspective: 1800px;
  padding: 20px;
}

#hero-view.hidden {
  opacity: 0;
  transform: scale(0.95) translateY(30px);
  visibility: hidden;
  pointer-events: none;
}

.hero-header {
  text-align: center;
  margin-bottom: 24px;
  animation: fadeInDown 0.9s ease both;
}

.hero-subtitle {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.9rem;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--primary-gold);
  margin-bottom: 6px;
  text-shadow: 0 0 12px var(--primary-gold-glow);
}

.hero-title {
  font-family: 'Cinzel', Georgia, serif;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 700;
  color: #fff;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #ffffff 30%, var(--primary-gold-light) 70%, var(--primary-gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
}

.hero-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* 3D Book Showcase */
.book-3d-scene {
  position: relative;
  width: 320px;
  height: 440px;
  perspective: 1800px;
  transform-style: preserve-3d;
  cursor: pointer;
  margin: 10px 0 30px;
  animation: bookFloat 4.5s ease-in-out infinite;
  transition: transform 0.4s var(--transition-smooth);
}

.book-3d-scene:hover {
  transform: rotateY(-8deg) rotateX(8deg) translateY(-8px);
}

@keyframes bookFloat {

  0%,
  100% {
    transform: rotateY(-18deg) rotateX(12deg) translateY(0);
  }

  50% {
    transform: rotateY(-14deg) rotateX(8deg) translateY(-12px);
  }
}

.book-3d {
  width: 100%;
  height: 100%;
  position: absolute;
  transform-style: preserve-3d;
  transition: transform 1.2s var(--transition-smooth);
}

/* 3D Book Cover Front */
.book-3d-cover {
  position: absolute;
  inset: 0;
  border-radius: 4px 14px 14px 4px;
  background: linear-gradient(135deg, #24140b 0%, #150c06 100%);
  box-shadow:
    inset 4px 0 10px rgba(0, 0, 0, 0.6),
    inset -2px 0 6px rgba(255, 255, 255, 0.08),
    20px 25px 45px rgba(0, 0, 0, 0.7);
  transform-origin: left center;
  transform-style: preserve-3d;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border: 1px solid rgba(229, 185, 95, 0.25);
  backface-visibility: hidden;
}

.book-3d-cover-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  filter: contrast(1.05) brightness(0.98);
}

/* Cover Sheen & Leather texture overlay */
.book-3d-cover-sheen {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0.02) 30%, transparent 60%),
    linear-gradient(to right, rgba(0, 0, 0, 0.6) 0%, transparent 8%, transparent 92%, rgba(0, 0, 0, 0.4) 100%);
  pointer-events: none;
  border-radius: inherit;
}

/* Golden Corner Ornaments */
.book-corner {
  position: absolute;
  width: 28px;
  height: 28px;
  border-color: var(--primary-gold);
  border-style: solid;
  opacity: 0.7;
  pointer-events: none;
  z-index: 5;
}

.book-corner.top-left {
  top: 8px;
  left: 8px;
  border-width: 2px 0 0 2px;
}

.book-corner.top-right {
  top: 8px;
  right: 8px;
  border-width: 2px 2px 0 0;
}

.book-corner.bottom-left {
  bottom: 8px;
  left: 8px;
  border-width: 0 0 2px 2px;
}

.book-corner.bottom-right {
  bottom: 8px;
  right: 8px;
  border-width: 0 2px 2px 0;
}

/* 3D Spine */
.book-3d-spine {
  position: absolute;
  top: 0;
  left: 0;
  width: 32px;
  height: 100%;
  background: linear-gradient(to right, #0d0704 0%, #30190e 50%, #0d0704 100%);
  transform: rotateY(-90deg) translateZ(16px);
  transform-origin: left center;
  border-radius: 4px 0 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.book-3d-spine::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(to bottom,
      transparent 0px,
      transparent 40px,
      rgba(229, 185, 95, 0.4) 41px,
      rgba(229, 185, 95, 0.4) 43px,
      transparent 44px);
}

/* 3D Page Edge Thickness (stacked pages) */
.book-3d-pages-right {
  position: absolute;
  top: 4px;
  right: 0;
  width: 28px;
  height: calc(100% - 8px);
  background: repeating-linear-gradient(to bottom,
      #f4ebd9 0px,
      #f4ebd9 2px,
      #dfd2b9 3px,
      #bfae91 4px);
  transform: rotateY(90deg) translateZ(14px);
  transform-origin: right center;
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
}

.book-3d-pages-bottom {
  position: absolute;
  bottom: 0;
  left: 4px;
  width: calc(100% - 8px);
  height: 28px;
  background: repeating-linear-gradient(to right,
      #f4ebd9 0px,
      #f4ebd9 2px,
      #dfd2b9 3px,
      #bfae91 4px);
  transform: rotateX(-90deg) translateZ(14px);
  transform-origin: center bottom;
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
}

/* Bookmark Ribbon */
.book-ribbon {
  position: absolute;
  top: 0;
  right: 45px;
  width: 14px;
  height: 120%;
  background: linear-gradient(to right, #991b1b, #dc2626, #7f1d1d);
  box-shadow: 2px 4px 8px rgba(0, 0, 0, 0.4);
  transform: translateZ(1px);
  clip-path: polygon(0 0, 100% 0, 100% 90%, 50% 100%, 0 90%);
  z-index: 6;
}

/* Book opening state (triggered by JS) */
.book-3d-scene.opening {
  animation: none;
  transform: scale(1.1) rotateY(-8deg) translateY(-8px);
  transition: transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}

.book-3d-scene.opening .book-3d-cover {
  transform: rotateY(-155deg);
  transition: transform 0.75s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: -20px 25px 45px rgba(0, 0, 0, 0.8);
}

#hero-view.opening-active .hero-header,
#hero-view.opening-active .hero-actions {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.35s ease, transform 0.35s ease;
  pointer-events: none;
}

/* Hero CTA Button */
.hero-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  animation: fadeInUp 0.9s ease both;
}

.btn-open-book {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 36px;
  background: linear-gradient(135deg, var(--primary-gold) 0%, var(--primary-gold-dark) 100%);
  color: #1a0e05;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  box-shadow: 0 10px 25px var(--primary-gold-glow), 0 2px 4px rgba(0, 0, 0, 0.3);
  transition: all 0.3s var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

.btn-open-book::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg,
      transparent 35%,
      rgba(255, 255, 255, 0.45) 50%,
      transparent 65%);
  transform: rotate(35deg) translateY(-100%);
  animation: btnShimmer 3.2s infinite;
}

@keyframes btnShimmer {
  0% {
    transform: rotate(35deg) translateY(-140%);
  }

  35%,
  100% {
    transform: rotate(35deg) translateY(140%);
  }
}

.btn-open-book:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 15px 35px var(--primary-gold-glow), 0 4px 8px rgba(0, 0, 0, 0.4);
}

.btn-open-book:active {
  transform: translateY(1px) scale(0.98);
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.hero-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ==========================================================================
   VIEW 2: INTERACTIVE 3D FLIPBOOK READER
   ========================================================================== */
#reader-view {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.96);
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.5s;
  z-index: 10;
}

#reader-view.active {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

/* Top Navigation Bar */
.top-bar {
  height: 56px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--bg-glass-border);
  z-index: 40;
  gap: 12px;
  position: relative;
}

.top-left {
  display: flex;
  align-items: center;
  min-width: 90px;
}

.top-nav-btn.btn-close-book {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-full);
  color: #fff;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s var(--transition-smooth);
}

.top-nav-btn.btn-close-book:hover {
  background: rgba(229, 185, 95, 0.2);
  border-color: var(--primary-gold);
  color: var(--primary-gold-light);
  transform: translateX(-2px);
}

.top-brand-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
}

.brand-title-center {
  font-family: 'Cinzel', Georgia, serif;
  font-size: clamp(1.05rem, 2.6vw, 1.35rem);
  font-weight: 800;
  letter-spacing: 2.2px;
  margin: 0;
  line-height: 1.15;
  background: linear-gradient(135deg, #ffffff 15%, #f2d08a 60%, #d49a3d 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 8px rgba(229, 185, 95, 0.25));
}

.brand-subtitle-center {
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: rgba(229, 185, 95, 0.75);
  text-transform: uppercase;
}

/* Top Actions */
.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 90px;
  justify-content: flex-end;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s var(--transition-smooth);
  position: relative;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--primary-gold);
  transform: translateY(-1px);
}

.icon-btn:active {
  transform: translateY(1px);
}

.icon-btn.active {
  background: var(--primary-gold);
  color: #120a04;
  border-color: var(--primary-gold);
}

/* Tooltips */
.icon-btn[data-tooltip]::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: -32px;
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  padding: 4px 8px;
  background: #11141c;
  color: #fff;
  font-size: 0.72rem;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 100;
}

.icon-btn:hover[data-tooltip]::before {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

/* ==========================================================================
   BOOK STAGE VIEWPORT
   ========================================================================== */
.stage-container {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 10px 15px;
}

.book-zoom-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: center center;
  transition: transform 0.2s ease-out;
}

/* Real Book Shadow on table */
.book-wrapper-shadow {
  position: absolute;
  width: 90%;
  max-width: 1100px;
  height: 40px;
  bottom: 2%;
  left: 50%;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.65) 0%, rgba(0, 0, 0, 0) 70%);
  filter: blur(12px);
  pointer-events: none;
  z-index: 1;
}

/* Container where StPageFlip creates its DOM */
#book-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

#book-container.previous-page-turn {
  transform: scaleX(-1);
}

#book-container.previous-page-turn .page-content {
  transform: scaleX(-1);
}

#book-container.is-zoomed {
  pointer-events: none;
}

/* Page Element Styles */
.page {
  padding: 0;
  background-color: #faf8f5;
  color: #333;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.08);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  will-change: transform;
  transform: translateZ(0);
}

.stf__item {
  will-change: transform, clip-path !important;
  -webkit-backface-visibility: hidden !important;
  backface-visibility: hidden !important;
}

.page[data-density="hard"] {
  background-color: #1a0f08;
  box-shadow:
    inset 0 0 15px rgba(0, 0, 0, 0.6),
    0 15px 35px rgba(0, 0, 0, 0.4);
}

.page-content {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #fff;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.page img.page-img {
  width: 100%;
  height: 100%;
  object-fit: fill;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
  transform: translateZ(0);
}

/* Portrait Mode Clean Page Appearance (Mobile) */
body.book-portrait .page {
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55), 0 0 1px rgba(255, 255, 255, 0.2);
}

body.book-portrait .page::after,
body.book-portrait .page::before {
  display: none !important;
}

/* Spine Crease Shadows (Left vs Right Page in Landscape Spread) */
.page::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 45px;
  pointer-events: none;
  z-index: 10;
  transition: opacity 0.3s;
}

.page.--left::after {
  right: 0;
  background: linear-gradient(to left, rgba(0, 0, 0, 0.22) 0%, rgba(0, 0, 0, 0.06) 45%, transparent 100%);
}

.page.--right::after {
  left: 0;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.22) 0%, rgba(0, 0, 0, 0.06) 45%, transparent 100%);
}

/* Outer Book Paper Edge Stack Effect */
.page.--left::before {
  content: '';
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  width: 5px;
  background: repeating-linear-gradient(to bottom,
      rgba(0, 0, 0, 0.06) 0px,
      rgba(0, 0, 0, 0.06) 1px,
      rgba(255, 255, 255, 0.4) 2px);
  box-shadow: inset 1px 0 3px rgba(0, 0, 0, 0.15);
  pointer-events: none;
  z-index: 10;
}

.page.--right::before {
  content: '';
  position: absolute;
  top: 3px;
  bottom: 3px;
  right: 0;
  width: 5px;
  background: repeating-linear-gradient(to bottom,
      rgba(0, 0, 0, 0.06) 0px,
      rgba(0, 0, 0, 0.06) 1px,
      rgba(255, 255, 255, 0.4) 2px);
  box-shadow: inset -1px 0 3px rgba(0, 0, 0, 0.15);
  pointer-events: none;
  z-index: 10;
}

/* Page Corner Curl Hint on Hover */
.page-corner-hint {
  position: absolute;
  width: 50px;
  height: 50px;
  bottom: 0;
  right: 0;
  background: linear-gradient(135deg, transparent 50%, rgba(229, 185, 95, 0.3) 100%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 15;
}

.page:hover .page-corner-hint {
  opacity: 1;
}

/* Floating Navigation Chevrons */
.nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(20, 24, 34, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 30;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
  transition: all 0.3s var(--transition-smooth);
}

.nav-arrow:hover {
  background: var(--primary-gold);
  color: #120902;
  border-color: var(--primary-gold);
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 12px 30px var(--primary-gold-glow);
}

.nav-arrow:active {
  transform: translateY(-50%) scale(0.95);
}

.nav-arrow.prev {
  left: 20px;
}

.nav-arrow.next {
  right: 20px;
}

.nav-arrow.disabled {
  opacity: 0.25;
  pointer-events: none;
  cursor: not-allowed;
}

/* Mobile Tap Navigation Overlays */
.mobile-tap-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 14%;
  z-index: 25;
  pointer-events: auto;
}

.mobile-tap-zone.left {
  left: 0;
}

.mobile-tap-zone.right {
  right: 0;
}

/* ==========================================================================
   BOTTOM TOOLBAR / CONTROLS
   ========================================================================== */
.bottom-bar {
  padding: 10px 20px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
}

.toolbar-panel {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 18px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--radius-full);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.5);
  max-width: 900px;
  width: auto;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.toolbar-separator {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.12);
  margin: 0 4px;
}

/* Interactive Page Slider Scrubber */
.slider-container {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  min-width: 160px;
}

.page-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.15);
  outline: none;
  cursor: pointer;
  transition: background 0.2s;
}

.page-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary-gold);
  cursor: pointer;
  box-shadow: 0 0 10px var(--primary-gold-glow);
  transition: transform 0.15s, background 0.2s;
}

.page-slider::-webkit-slider-thumb:hover {
  transform: scale(1.25);
  background: #fff;
}

.page-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary-gold);
  border: none;
  cursor: pointer;
}

/* Page Jump Input Form */
.page-jump-form {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.page-jump-input {
  width: 44px;
  height: 32px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: #fff;
  text-align: center;
  font-size: 0.88rem;
  font-weight: 600;
  outline: none;
  transition: border-color 0.2s;
}

.page-jump-input:focus {
  border-color: var(--primary-gold);
}

.page-jump-input::-webkit-inner-spin-button,
.page-jump-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Auto Play Progress Bar */
.autoplay-indicator {
  position: absolute;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: var(--primary-gold);
  transition: width linear;
  z-index: 60;
  display: none;
}

.autoplay-indicator.active {
  display: block;
}

/* ==========================================================================
   PAGE GALLERY MODAL (TOP-TO-BOTTOM SCROLLABLE)
   ========================================================================== */
.gallery-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.35s;
  padding: 24px;
}

.gallery-modal.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto !important;
}

.gallery-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 8, 12, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  cursor: pointer;
  pointer-events: auto;
}

.gallery-modal-panel {
  position: relative;
  width: min(1050px, 94vw);
  max-height: 88vh;
  max-height: 88dvh;
  background: rgba(18, 22, 32, 0.96);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid rgba(229, 185, 95, 0.3);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85), 0 0 25px rgba(229, 185, 95, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 2;
  transform: scale(0.96) translateY(20px);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.gallery-modal.open .gallery-modal-panel {
  transform: scale(1) translateY(0);
}

.gallery-modal-pull-bar {
  display: none;
}

.gallery-modal-header {
  padding: 16px 24px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  flex-shrink: 0;
}

.gallery-modal-title {
  font-family: 'Cinzel', serif;
  font-size: 1.2rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.gallery-modal-title svg {
  color: var(--primary-gold);
}

.gallery-total-badge {
  background: rgba(229, 185, 95, 0.18);
  color: var(--primary-gold);
  border: 1px solid rgba(229, 185, 95, 0.35);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 99px;
}

.gallery-modal-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Vertical Scrolling Gallery Grid (Top to Bottom) */
.gallery-grid {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px 24px 30px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  grid-auto-rows: max-content;
  gap: 16px;
  align-content: start;
}

.gallery-grid::-webkit-scrollbar {
  width: 8px;
}

.gallery-grid::-webkit-scrollbar-thumb {
  background: rgba(229, 185, 95, 0.35);
  border-radius: 4px;
}

.gallery-card {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 0.75;
  border-radius: 10px;
  overflow: hidden;
  background: #141822;
  border: 2px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: all 0.25s var(--transition-smooth);
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  box-sizing: border-box;
}

.gallery-card:hover {
  transform: translateY(-4px) scale(1.03);
  border-color: var(--primary-gold);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6), 0 0 15px var(--primary-gold-glow);
}

.gallery-card:active {
  transform: scale(0.97);
  border-color: var(--primary-gold-light);
}

.gallery-card.current {
  border-color: var(--primary-gold);
  box-shadow: 0 0 20px var(--primary-gold-glow);
}

.gallery-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background-color: #1a1e29;
  pointer-events: none;
}

.gallery-card-badge {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(14, 18, 26, 0.9);
  border: 1px solid rgba(229, 185, 95, 0.35);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  white-space: nowrap;
}

.gallery-card.current .gallery-card-badge {
  background: var(--primary-gold);
  color: #120a04;
  font-weight: 800;
}

/* ==========================================================================
   WHATSAPP & GALLERY BUTTONS
   ========================================================================== */
.btn-whatsapp {
  background: rgba(37, 211, 102, 0.15) !important;
  border-color: rgba(37, 211, 102, 0.4) !important;
  color: #25d366 !important;
  transition: all 0.25s var(--transition-smooth);
  text-decoration: none !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn-whatsapp:hover {
  background: #25d366 !important;
  color: #ffffff !important;
  box-shadow: 0 0 15px rgba(37, 211, 102, 0.5) !important;
  transform: translateY(-2px);
}

.btn-whatsapp:active {
  transform: scale(0.92);
  background: #1eb857 !important;
  color: #ffffff !important;
}

.btn-gallery {
  background: rgba(229, 185, 95, 0.12) !important;
  border-color: rgba(229, 185, 95, 0.35) !important;
  color: var(--primary-gold-light) !important;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn-gallery:hover,
.btn-gallery.active {
  background: var(--primary-gold) !important;
  color: #120a04 !important;
  box-shadow: 0 0 14px var(--primary-gold-glow) !important;
}

.mobile-bar-btn.whatsapp-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(37, 211, 102, 0.18);
  border: 1px solid rgba(37, 211, 102, 0.45);
  color: #25d366;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none !important;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.mobile-bar-btn.whatsapp-btn:hover {
  background: #25d366;
  color: #fff;
  border-color: #25d366;
  box-shadow: 0 0 12px rgba(37, 211, 102, 0.6);
}

.mobile-bar-btn.whatsapp-btn:active {
  background: #1eb857;
  color: #fff;
  transform: scale(0.92);
}

.mobile-bar-btn.gallery-btn {
  gap: 5px;
  padding: 6px 10px;
  height: 40px;
  background: rgba(229, 185, 95, 0.12);
  border: 1px solid rgba(229, 185, 95, 0.35);
  color: var(--primary-gold-light);
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.mobile-bar-btn.gallery-btn svg {
  color: var(--primary-gold);
}

.mobile-bar-btn.gallery-btn:hover,
.mobile-bar-btn.gallery-btn.active {
  background: var(--primary-gold);
  color: #120a04;
  border-color: var(--primary-gold);
  box-shadow: 0 0 14px var(--primary-gold-glow);
}

.mobile-bar-btn.gallery-btn.active svg {
  color: #120a04;
}

.mobile-bar-btn.index-btn:hover,
.mobile-bar-btn.index-btn.active {
  background: var(--primary-gold);
  color: #120a04;
  border-color: var(--primary-gold);
  box-shadow: 0 0 14px var(--primary-gold-glow);
}

.mobile-bar-btn.index-btn.active svg {
  color: #120a04;
}

/* ==========================================================================
   TOAST NOTIFICATION (PERMANENTLY SUPPRESSED AS REQUESTED)
   ========================================================================== */
#toast {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* ==========================================================================
   ANIMATIONS & KEYFRAMES
   ========================================================================== */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   MOBILE RESPONSIVE BREAKPOINTS (CRITICAL REQUIREMENT)
   ========================================================================== */
@media (max-width: 900px) {
  .top-bar {
    padding: 0 12px;
    height: 54px;
  }

  .book-title-tag {
    display: none;
  }

  .toolbar-panel {
    padding: 6px 12px;
    gap: 8px;
  }

  .slider-container {
    min-width: 120px;
  }

  .nav-arrow {
    width: 44px;
    height: 44px;
  }

  .nav-arrow.prev {
    left: 8px;
  }

  .nav-arrow.next {
    right: 8px;
  }
}

@media (max-width: 768px) {

  /* Mobile Portrait Book Optimization */
  .book-3d-scene {
    width: 250px;
    height: 350px;
  }

  .btn-open-book {
    padding: 14px 28px;
    font-size: 1rem;
  }

  .hero-title {
    font-size: 1.8rem;
  }

  .stage-container {
    padding: 6px 8px;
  }

  /* Compact Bottom Bar on Mobile */
  .bottom-bar {
    padding: 6px 10px 10px;
  }

  .toolbar-panel {
    gap: 6px;
    width: 100%;
    justify-content: space-between;
    border-radius: var(--radius-md);
  }

  .slider-container {
    min-width: 80px;
    flex: 1;
  }

  .page-jump-form span:last-child {
    display: none;
  }

  /* Hide non-essential toolbar buttons on small mobile */
  .btn-zoom-reset,
  .btn-last-page,
  .btn-first-page {
    display: none !important;
  }

  .nav-arrow {
    width: 38px;
    height: 38px;
    background: rgba(20, 24, 34, 0.85);
  }

  .nav-arrow.prev {
    left: 4px;
  }

  .nav-arrow.next {
    right: 4px;
  }

  #thumb-drawer {
    height: 210px;
  }

  .thumb-card {
    width: 90px;
    height: 120px;
  }
}

@media (max-width: 480px) {
  .page-indicator-badge {
    padding: 4px 10px;
    font-size: 0.8rem;
  }

  .icon-btn {
    width: 34px;
    height: 34px;
  }

  .btn-download-pdf {
    display: none !important;
  }

  .nav-arrow {
    display: none !important;
    /* Mobile users use swipe or tap zones */
  }
}

/* Support for safe-area insets on modern notched smartphones */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .bottom-bar {
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }

  .top-bar {
    padding-top: env(safe-area-inset-top);
  }
}

/* ==========================================================================
   BOTTOM-LEFT DIRECT INDEX BUTTON (QUICK JUMP)
   ========================================================================== */
.btn-quick-index {
  position: fixed;
  bottom: 16px;
  left: 18px;
  height: 44px;
  padding: 0 16px;
  background: rgba(18, 22, 32, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(229, 185, 95, 0.4);
  border-radius: var(--radius-full);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5), 0 0 15px rgba(229, 185, 95, 0.15);
  transition: all 0.3s var(--transition-smooth);
  z-index: 60;
}

.btn-quick-index:hover {
  background: rgba(28, 34, 48, 0.95);
  border-color: var(--primary-gold);
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6), 0 0 22px var(--primary-gold-glow);
  color: var(--primary-gold-light);
}

.btn-quick-index:active {
  transform: translateY(1px) scale(0.98);
}

.btn-quick-index svg {
  color: var(--primary-gold);
  flex-shrink: 0;
}

.btn-quick-index-count {
  background: linear-gradient(135deg, var(--primary-gold), var(--primary-gold-dark));
  color: #120a04;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  line-height: 1;
}

/* ==========================================================================
   TABLE OF CONTENTS / DIRECT PAGE SELECTOR MODAL
   ========================================================================== */
.index-modal {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s var(--transition-smooth), visibility 0.3s;
  padding: 16px;
}

.index-modal.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.index-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 7, 11, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.index-modal-panel {
  position: relative;
  width: min(920px, 95vw);
  max-height: 88vh;
  max-height: 88dvh;
  background: rgba(18, 22, 32, 0.96);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid rgba(229, 185, 95, 0.3);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.85), 0 0 35px rgba(229, 185, 95, 0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 2;
  transform: scale(0.96) translateY(15px);
  transition: transform 0.35s var(--transition-smooth);
}

.index-modal.open .index-modal-panel {
  transform: scale(1) translateY(0);
}

/* Modal Header */
.index-modal-header {
  padding: 18px 24px 14px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
}

.index-modal-title {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: 0.5px;
}

.index-modal-title svg {
  color: var(--primary-gold);
}

.index-modal-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.btn-modal-close {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-modal-close:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.5);
  color: #fff;
  transform: rotate(90deg);
}

/* Category Filters Toolbar */
.index-modal-toolbar {
  padding: 12px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(14, 17, 25, 0.6);
}

/* Category Filter Chips */
.index-category-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.index-category-chips::-webkit-scrollbar {
  height: 4px;
}

.index-category-chips::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
}

.cat-chip {
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.cat-chip:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.cat-chip.active {
  background: var(--primary-gold);
  color: #120a04;
  border-color: var(--primary-gold);
  box-shadow: 0 0 10px var(--primary-gold-glow);
}

/* Modal Content Grid */
.index-pages-grid {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  align-content: start;
}

.index-pages-grid::-webkit-scrollbar {
  width: 6px;
}

.index-pages-grid::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
}

.index-pages-grid::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 3px;
}

/* Individual Page Item Card */
.index-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.25s var(--transition-smooth);
  position: relative;
  text-align: left;
  font: inherit;
  color: inherit;
  width: 100%;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.index-card:hover {
  background: rgba(229, 185, 95, 0.1);
  border-color: rgba(229, 185, 95, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.index-card.current {
  background: rgba(229, 185, 95, 0.18);
  border-color: var(--primary-gold);
  box-shadow: 0 0 16px var(--primary-gold-glow);
}

.index-card-thumb-wrap {
  position: relative;
  width: 50px;
  height: 66px;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
  background: #181c26;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

.index-card-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.index-card-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.index-card-top {
  display: flex;
  align-items: center;
  gap: 6px;
}

.index-card-badge {
  background: rgba(229, 185, 95, 0.2);
  color: var(--primary-gold-light);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1.2;
}

.index-card.current .index-card-badge {
  background: var(--primary-gold);
  color: #120a04;
}

.index-card-code {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

.index-card-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.index-card-category {
  font-size: 0.72rem;
  color: #9ca3af;
}

.index-card-action {
  font-size: 0.95rem;
  color: var(--primary-gold);
  opacity: 0;
  transform: translateX(-4px);
  transition: all 0.2s;
}

.index-card:hover .index-card-action {
  opacity: 1;
  transform: translateX(0);
}

/* Empty search state */
.index-empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ==========================================================================
   DESKTOP VS MOBILE DISPLAY TOGGLES
   ========================================================================== */
.mobile-only {
  display: none !important;
}

@media (max-width: 768px) {
  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: flex !important;
  }

  .btn-quick-index.desktop-only {
    display: none !important;
  }
}

/* ==========================================================================
   ENHANCED MOBILE BOTTOM BAR (ALL SMARTPHONES)
   ========================================================================== */
.mobile-bottom-bar {
  width: min(440px, 96vw);
  height: 52px;
  background: rgba(18, 22, 32, 0.94);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid rgba(229, 185, 95, 0.35);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 15px rgba(229, 185, 95, 0.12);
  gap: 6px;
  z-index: 60;
  margin: 0 auto;
}

.mobile-bar-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s var(--transition-smooth);
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

.mobile-bar-btn:active {
  transform: scale(0.92);
  background: rgba(229, 185, 95, 0.25);
}

.mobile-bar-btn.index-btn {
  gap: 6px;
  padding: 6px 12px;
  height: 40px;
  background: rgba(229, 185, 95, 0.15);
  border-color: rgba(229, 185, 95, 0.4);
  color: var(--primary-gold-light);
  font-size: 0.82rem;
  font-weight: 700;
}

.mobile-bar-btn.index-btn svg {
  color: var(--primary-gold);
}

.mobile-count-pill {
  background: var(--primary-gold);
  color: #120a04;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 99px;
  line-height: 1.2;
}

.mobile-bar-btn.nav-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: #fff;
}

.mobile-bar-btn.icon-only {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: var(--text-muted);
}

.mobile-bar-btn.icon-only:hover,
.mobile-bar-btn.icon-only.active {
  color: var(--primary-gold);
  background: rgba(229, 185, 95, 0.2);
  border-color: var(--primary-gold);
}

.mobile-page-pill {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.mobile-page-pill .num {
  color: var(--primary-gold);
  font-size: 0.95rem;
  font-weight: 800;
}

.mobile-page-pill .divider {
  color: rgba(255, 255, 255, 0.4);
}

.mobile-page-pill .total {
  color: rgba(255, 255, 255, 0.7);
}

.mobile-bar-btn.disabled {
  opacity: 0.25;
  pointer-events: none;
  cursor: default;
}

/* Modal Pull Bar for Touch Swiping */
.index-modal-pull-bar {
  display: none;
  width: 44px;
  height: 5px;
  background: rgba(255, 255, 255, 0.28);
  border-radius: 99px;
  margin: 10px auto 4px;
}

/* ==========================================================================
   MOBILE TAP NAVIGATION ZONES
   ========================================================================== */
.mobile-tap-zone {
  display: none !important;
  pointer-events: none !important;
}

/* ==========================================================================
   SMARTPHONE RESPONSIVE BREAKPOINT (ALL PHONES & PORTRAIT TABLETS <= 768px)
   ========================================================================== */
@media (max-width: 768px) {

  /* Safe Area Inset Support */
  #app {
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  /* Compact Top Header */
  .top-bar {
    height: 48px;
    padding: 0 10px;
    gap: 6px;
  }

  .top-left {
    min-width: auto;
  }

  .top-nav-btn.btn-close-book {
    padding: 4px 10px;
    font-size: 0.74rem;
    gap: 4px;
  }

  .top-brand-center {
    display: flex !important;
  }

  .brand-title-center {
    font-size: clamp(0.86rem, 4.2vw, 1.05rem);
    letter-spacing: 1.2px;
  }

  .brand-subtitle-center {
    font-size: 0.55rem;
    letter-spacing: 1.2px;
  }

  .top-actions {
    min-width: auto;
    gap: 4px;
  }

  .icon-btn {
    width: 36px;
    height: 36px;
  }

  .icon-btn svg {
    width: 18px;
    height: 18px;
  }

  /* Stage Viewport Clamping (Maximized for 9:16 Mobile Viewports) */
  .stage-container {
    padding: 0;
    margin: 0;
    width: 100%;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Hide Desktop Nav Arrows on Mobile */
  .nav-arrow {
    display: none !important;
  }

  /* Bottom Controls on Mobile */
  .bottom-bar {
    padding: 2px 8px calc(4px + env(safe-area-inset-bottom, 0px));
  }

  /* Book Container Touch Optimization for Smooth Finger Peeling */
  #book-container {
    touch-action: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
  }

  /* Compact Hero Entrance on Mobile */
  #hero-view {
    padding: 16px 14px calc(20px + env(safe-area-inset-bottom, 0px));
    justify-content: center;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .hero-header {
    margin-bottom: 12px;
  }

  .hero-subtitle {
    font-size: 0.76rem;
    letter-spacing: 2.5px;
    margin-bottom: 4px;
  }

  .hero-title {
    font-size: clamp(1.4rem, 5.8vw, 2.1rem);
    letter-spacing: 0.5px;
  }

  .hero-desc {
    font-size: 0.82rem;
    padding: 0 8px;
    line-height: 1.4;
  }

  .book-3d-scene {
    width: min(220px, 62vw);
    height: min(293px, 82vw);
    max-height: 42vh;
    margin: 8px 0 16px;
  }

  .hero-actions {
    width: 100%;
    max-width: 320px;
  }

  .btn-open-book {
    width: 100%;
    justify-content: center;
    padding: 13px 20px;
    font-size: 1.02rem;
  }

  .hero-meta {
    justify-content: center;
    font-size: 0.76rem;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
  }

  /* Mobile Bottom Sheet Modal */
  .index-modal-pull-bar {
    display: block;
  }

  .index-modal {
    padding: 0;
    align-items: flex-end;
  }

  .index-modal-panel {
    width: 100vw;
    max-width: 100vw;
    max-height: 86dvh;
    max-height: 86vh;
    border-radius: 22px 22px 0 0;
    border-bottom: none;
    margin: 0;
    transform: translateY(100%);
    box-shadow: 0 -12px 45px rgba(0, 0, 0, 0.92);
    padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
  }

  .index-modal.open .index-modal-panel {
    transform: translateY(0);
  }

  .index-modal-header {
    padding: 10px 16px 8px;
  }

  .index-modal-title {
    font-size: 1.05rem;
    gap: 8px;
  }

  .index-modal-title svg {
    width: 20px;
    height: 20px;
  }

  .index-modal-desc {
    font-size: 0.76rem;
  }

  .index-modal-toolbar {
    padding: 6px 14px 10px;
    gap: 8px;
  }

  .index-pages-grid {
    grid-template-columns: 1fr;
    padding: 8px 12px 20px;
    gap: 8px;
  }

  .index-card {
    padding: 8px 12px;
    border-radius: 10px;
  }

  .index-card-thumb-wrap {
    width: 48px;
    height: 64px;
  }

  .index-card-title {
    font-size: 0.84rem;
  }

  /* Gallery Modal Bottom Sheet on Mobile */
  .gallery-modal {
    padding: 0;
    align-items: flex-end;
  }

  .gallery-modal-panel {
    width: 100vw;
    max-width: 100vw;
    max-height: 88vh;
    max-height: 88dvh;
    border-radius: 22px 22px 0 0;
    transform: translateY(100%);
    padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
  }

  .gallery-modal.open .gallery-modal-panel {
    transform: translateY(0);
  }

  .gallery-modal-pull-bar {
    display: block;
    width: 44px;
    height: 5px;
    background: rgba(255, 255, 255, 0.28);
    border-radius: 99px;
    margin: 10px auto 4px;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 12px 14px 24px;
  }

  .gallery-card-badge {
    font-size: 0.65rem;
    padding: 1px 5px;
  }
}

/* ==========================================================================
   EXTRA-NARROW SMARTPHONES (iPhone SE, Small Android <= 380px)
   ========================================================================== */
@media (max-width: 380px) {
  .mobile-bottom-bar {
    height: 48px;
    padding: 2px 6px;
    gap: 4px;
  }

  .mobile-bar-btn.index-btn,
  .mobile-bar-btn.gallery-btn {
    height: 36px;
    padding: 4px 7px;
    font-size: 0.72rem;
    gap: 3px;
  }

  .mobile-bar-btn.nav-btn,
  .mobile-bar-btn.whatsapp-btn {
    width: 35px;
    height: 35px;
  }

  .mobile-bar-btn.nav-btn svg,
  .mobile-bar-btn.whatsapp-btn svg {
    width: 17px;
    height: 17px;
  }

  .mobile-bar-btn.icon-only {
    width: 34px;
    height: 34px;
  }
}

/* ==========================================================================
   SMARTPHONE LANDSCAPE ORIENTATION (Phones rotated sideways)
   ========================================================================== */
@media (max-height: 520px) and (orientation: landscape) {
  .top-bar {
    height: 42px;
    padding: 0 10px;
  }

  .brand-title-center {
    font-size: 0.95rem;
    letter-spacing: 1.5px;
  }

  .brand-subtitle-center {
    display: none;
  }

  .bottom-bar {
    padding: 2px 6px;
  }

  .mobile-bottom-bar {
    height: 40px;
  }

  .mobile-bar-btn.index-btn,
  .mobile-page-pill {
    height: 32px;
    padding: 2px 8px;
    font-size: 0.72rem;
  }

  .mobile-bar-btn.nav-btn,
  .mobile-bar-btn.icon-only {
    width: 32px;
    height: 32px;
  }

  .btn-quick-index {
    bottom: 66px;
    left: 12px;
    width: 44px;
    height: 44px;
    padding: 0;
    justify-content: center;
  }

  .btn-quick-index-text {
    display: none;
  }

  .btn-quick-index-count {
    position: absolute;
    top: -5px;
    right: -5px;
    padding: 2px 4px;
    font-size: 0.6rem;
  }

  .hero-header {
    margin-bottom: 4px;
  }

  .hero-title {
    font-size: 1.25rem;
  }

  .hero-desc {
    display: none;
  }

  .book-3d-scene {
    height: min(180px, 46vh);
    width: calc(min(180px, 46vh) * 0.75);
    margin: 4px 0 8px;
  }

  .btn-open-book {
    padding: 8px 18px;
    font-size: 0.9rem;
  }

  .hero-meta {
    display: none;
  }
}