/* ============================================
   CSS Variables & Base Styles
   ============================================ */
:root {
  color-scheme: light;
  --bg: #f6efe5;
  --ink: #3a2e28;
  --accent: #be8c63;
  --accent-dark: #835737;
  --paper: #fffdf8;
  --shadow: rgba(0, 0, 0, 0.15);
  
  /* Additional color variables */
  --text-secondary: #5c473c;
  --text-tertiary: #7a6456;
  --text-light: #5d4a40;
  --border-light: rgba(190, 140, 99, 0.25);
  --border-lighter: rgba(190, 140, 99, 0.2);
  --bg-overlay: rgba(255, 255, 255, 0.5);
  --bg-gradient-start: #fefbf7;
  --bg-gradient-mid: #ecdfcf;
  --bg-gradient-end: #ddc8af;
  --cover-start: #42210b;
  --cover-end: #7d4b21;
  --cover-back-start: #2d1707;
  --cover-back-end: #513115;
  --spine-start: #d6c1a5;
  --spine-end: #a2845d;
  --paper-line: rgba(222, 212, 198, 0.45);
  
  /* Spacing scale */
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  
  /* Layout */
  --border-radius-sm: 12px;
  --border-radius-md: 16px;
  --border-radius-lg: 24px;
  --border-radius-full: 999px;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 300ms ease;
  --transition-slow: 800ms ease;
  --transition-cover: 1200ms ease;
  
  /* Focus outline */
  --focus-outline: 2px solid var(--accent-dark);
  --focus-outline-offset: 2px;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  min-height: 100%;
  background-color: var(--bg-gradient-end); /* Fallback color matching gradient end */
  position: relative;
  /* Background extends into safe areas and overscroll areas on iOS */
}

html::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: radial-gradient(ellipse 150% 300% at 50% 0%, var(--bg-gradient-start) 0%, var(--bg-gradient-mid) 50%, var(--bg-gradient-end) 100%);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  z-index: -1;
  pointer-events: none;
}

body {
  margin: 0;
  min-height: 100dvh;
  background-color: transparent; /* Let html background show through */
  font-family: "Spectral", serif;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: clamp(1rem, 3vw, 2rem) clamp(1.2rem, 4vw, 3rem);
  padding-top: max(clamp(1rem, 3vw, 2rem), env(safe-area-inset-top));
  padding-right: max(clamp(1.2rem, 4vw, 3rem), env(safe-area-inset-right));
  padding-bottom: max(clamp(1rem, 3vw, 2rem), env(safe-area-inset-bottom));
  padding-left: max(clamp(1.2rem, 4vw, 3rem), env(safe-area-inset-left));
  gap: var(--space-md);
  overflow-x: hidden;
}

/* ============================================
   Header Section
   ============================================ */
header {
  text-align: center;
  margin-bottom: var(--space-md);
  max-width: min(900px, 90vw);
  width: 100%;
}

header h1 {
  font-family: "Playfair Display", serif;
  font-size: clamp(2.5rem, 4vw, 3.5rem);
  margin: 0 0 var(--space-xs) 0;
}

header .credentials {
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
  margin-bottom: var(--space-md);
  font-size: clamp(1.2rem, 2vw, 1.4rem);
  font-weight: 500;
  max-width: 100%;
  color: var(--ink);
}

.bio {
  max-width: min(750px, 82vw);
  margin: 0 auto;
  padding: var(--space-md) clamp(var(--space-md), 3vw, var(--space-lg));
  background: var(--bg-overlay);
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-light);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.bio-section {
  margin-bottom: var(--space-sm);
}

.bio-section:last-child {
  margin-bottom: 0;
}

.bio-section.contact {
  margin-top: var(--space-md);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border-lighter);
}

.bio-line {
  margin: 0 0 var(--space-xs) 0;
  font-size: clamp(0.8rem, 1.3vw, 0.9rem);
  line-height: 1.6;
  color: var(--text-secondary);
  text-align: left;
}

.bio-line:last-child {
  margin-bottom: 0;
}

.bio-line strong {
  color: var(--ink);
  font-weight: 600;
}

.bio-line a {
  color: var(--accent-dark);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px dotted var(--accent);
  transition: color 150ms ease, border-bottom-color 150ms ease;
}

.bio-line a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent-dark);
}

.bio-line a:focus {
  outline: var(--focus-outline);
  outline-offset: var(--focus-outline-offset);
  border-radius: 2px;
}

/* ============================================
   Scroll Indicator (Floating Arrow)
   ============================================ */
.scroll-indicator {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: var(--space-sm) 0 var(--space-md) 0;
  opacity: 1;
  transition: opacity 600ms ease, transform 600ms ease;
  pointer-events: auto;
  z-index: 10;
  flex-shrink: 0;
  background: none;
  border: none;
  padding: var(--space-sm);
  cursor: pointer;
  border-radius: 50%;
}

.scroll-indicator:focus {
  outline: var(--focus-outline);
  outline-offset: var(--focus-outline-offset);
}

.scroll-indicator:hover {
  transform: translateY(2px);
}

.scroll-indicator:active {
  transform: translateY(4px);
}

.scroll-indicator.hidden {
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  cursor: default;
}

.scroll-indicator svg {
  width: 40px;
  height: 40px;
  color: var(--accent-dark);
  filter: drop-shadow(0 3px 10px rgba(0, 0, 0, 0.25));
  animation: float-arrow 2s ease-in-out infinite;
}

@keyframes float-arrow {
  0%, 100% {
    transform: translateY(0);
    opacity: 0.8;
  }
  50% {
    transform: translateY(12px);
    opacity: 1;
  }
}

/* ============================================
   Notebook Container
   ============================================ */
.notebook-stage {
  width: min(900px, 90vw);
  aspect-ratio: 3 / 2.3;
  perspective: 1800px;
  position: relative;
  max-height: 90vh;
  margin-top: var(--space-md);
}

.notebook {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  border-radius: var(--border-radius-lg);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.25),
    inset 0 0 20px rgba(255, 255, 255, 0.3);
  transition: transform 1200ms ease;
  transform: rotateX(12deg);
}

.notebook.open {
  transform: rotateX(0deg);
}

/* ============================================
   Notebook Cover & Spine
   ============================================ */
.cover {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #42210b, #7d4b21);
  border-radius: var(--border-radius-lg);
  box-shadow: 0 20px 30px rgba(0, 0, 0, 0.3);
}

.cover.front {
  transform-origin: left;
  transform: rotateY(0deg);
  transition: transform 1200ms ease;
  z-index: 5;
}

.cover.front::after {
  content: "Dr. Nandlal Jotwani · Sindhi Verse";
  position: absolute;
  left: 11%;
  right: 40%;
  top: 26%;
  padding: 0.7rem 1.1rem;
  border-radius: 14px;
  background: radial-gradient(circle at top left, #f7efe2 0%, #e2c9a0 55%, #c39a6a 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.5),
    inset 0 0 8px rgba(120, 72, 32, 0.45),
    0 10px 18px rgba(0, 0, 0, 0.35);
  color: #4a2a13;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: "Playfair Display", serif;
  font-size: 0.9rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}

.notebook.label-hidden .cover.front::after {
  display: none;
}

.notebook.open .cover.front {
  transform: rotateY(-150deg);
}

.cover.back {
  background: linear-gradient(135deg, #2d1707, #513115);
}

.spine {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 14px;
  left: calc(50% - 7px);
  background: linear-gradient(180deg, #d6c1a5, #a2845d);
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.4);
  z-index: 1;
}

/* ============================================
   Pages Container
   ============================================ */
.pages {
  position: absolute;
  inset: 4% 4%;
  background: var(--paper);
  border-radius: var(--border-radius-md);
  overflow: visible;
  perspective: 2200px;
  transform-style: preserve-3d;
  z-index: 2;
}

.page {
  position: absolute;
  inset: 0;
  padding: clamp(1.2rem, 3vw, 2rem);
  background: repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0),
      rgba(255, 255, 255, 0) 28px,
      rgba(222, 212, 198, 0.45) 28px,
      rgba(222, 212, 198, 0.45) 29px
    ),
    var(--paper);
  border-radius: var(--border-radius-sm);
  box-shadow:
    inset 0 0 3px rgba(0, 0, 0, 0.08),
    0 0 0 1px rgba(0, 0, 0, 0.03);
  transform-origin: left;
  transform-style: preserve-3d;
  transition: transform 800ms ease, box-shadow 800ms ease;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  overflow: hidden;
}

.page::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--border-radius-sm);
  box-shadow: 5px 0 20px rgba(0, 0, 0, 0.08);
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease;
}

.page.active::after {
  opacity: 1;
}

/* ============================================
   Page Content
   ============================================ */
.page-content {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: clamp(0.3rem, 1vw, 0.9rem);
  scrollbar-gutter: stable both-edges;
  position: relative;
}

.page-content.has-more-content-bottom {
  mask-image: linear-gradient(
    to bottom,
    black 0%,
    black calc(100% - 50px),
    transparent 100%
  );
  -webkit-mask-image: linear-gradient(
    to bottom,
    black 0%,
    black calc(100% - 50px),
    transparent 100%
  );
}

.page-content.has-more-content-top {
  mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    black 50px,
    black 100%
  );
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    black 50px,
    black 100%
  );
}

.page-content.has-more-content-top.has-more-content-bottom {
  mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    black 50px,
    black calc(100% - 50px),
    transparent 100%
  );
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    black 50px,
    black calc(100% - 50px),
    transparent 100%
  );
}

.page-content::-webkit-scrollbar {
  width: 6px;
}

.page-content::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: var(--border-radius-full);
}

.page-content::-webkit-scrollbar-thumb {
  background: rgba(58, 46, 40, 0.35);
  border-radius: var(--border-radius-full);
}

/* ============================================
   Poem Typography
   ============================================ */
.page h2 {
  font-family: "Aref Ruqaa Ink", "Lateef", serif;
  margin: 0;
  font-size: 1.4rem;
  letter-spacing: 0.05em;
}

.page header .title-translation {
  font-family: "Spectral", serif;
  font-size: 1rem;
  font-weight: 400;
  font-style: italic;
  color: var(--text-secondary);
  margin: 0.4rem 0 0 0;
  letter-spacing: 0.02em;
}

.poem-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: clamp(1rem, 3vw, 2.5rem);
  align-items: start;
}

.page.translation-visible .poem-body {
  align-items: start;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3rem);
  max-width: 100%;
}

.page:not(.translation-visible) .poem-body {
  margin-left: clamp(2rem, 6vw, 4rem);
}

/* Stanza grid for aligned display */
.stanza-grid {
  display: none;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(1rem, 2.5vw, 2rem);
  width: 100%;
}

.page.translation-visible .stanza-grid {
  display: grid;
  grid-column: 1 / -1;
  width: 100%;
}

.page.translation-visible .poem-body > .original {
  display: none;
}

.stanza-row {
  display: contents;
}

.stanza-cell {
  padding: 0;
  margin: 0;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

.stanza-cell.original {
  font-family: "Aref Ruqaa Ink", "Lateef", serif;
  font-size: clamp(0.75rem, 1.5vw, 1rem);
  line-height: 1.5;
  text-align: right;
}

.stanza-cell.original br {
  line-height: 0.7;
  margin-bottom: 0.4em;
  height: 0.7em;
  display: block;
}

.stanza-cell.translation {
  font-style: italic;
  color: var(--text-secondary);
  font-size: clamp(0.75rem, 1.5vw, 1rem);
  line-height: 1.5;
  text-align: left;
}

.stanza-cell.translation br {
  line-height: 0.7;
  margin-bottom: 0.4em;
  height: 0.7em;
  display: block;
}

.original {
  font-family: "Aref Ruqaa Ink", "Lateef", serif;
  font-size: clamp(1.15rem, 2.5vw, 1.9rem);
  line-height: 1.8;
  text-align: left;
  padding: 0;
  margin: 0;
}

.original br {
  line-height: 0.4;
  display: block;
  margin-bottom: 0.2em;
}

/* ============================================
   Page Footer
   ============================================ */
.page footer {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  font-size: 0.9rem;
  color: var(--text-tertiary);
  flex-shrink: 0;
  padding-top: 0.2rem;
  background: linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.7),
    rgba(255, 255, 255, 0)
  );
}

.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.scroll-hint {
  font-size: 0.75rem;
  color: rgba(90, 70, 60, 0.85); /* Keep specific opacity */
  text-align: center;
  opacity: 0.85;
}

.toggle-translation {
  border: none;
  background: var(--accent);
  color: #fffdf8;
  border-radius: var(--border-radius-full);
  padding: 0.35rem 0.9rem;
  font-size: 0.9rem;
  cursor: pointer;
  font-family: inherit;
  transition: transform 150ms ease, box-shadow 150ms ease;
  min-height: 44px; /* Better touch target */
}

/* Hide floating button on desktop */
body > .toggle-translation {
  display: none;
}

.toggle-translation:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.toggle-translation:active {
  transform: translateY(0);
}

.toggle-translation:focus {
  outline: var(--focus-outline);
  outline-offset: var(--focus-outline-offset);
}

.page-count {
  font-variant-numeric: tabular-nums;
}

/* ============================================
   Navigation
   ============================================ */
.page-navigation {
  position: absolute;
  inset: auto 0 -4.5rem;
  display: flex;
  justify-content: center;
  gap: var(--space-lg);
}

.nav-btn {
  width: 54px;
  height: 54px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  border: none;
  background: #fffdf8;
  box-shadow:
    0 10px 25px rgba(0, 0, 0, 0.2),
    inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  font-size: 1.6rem;
  color: var(--accent-dark);
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.nav-btn:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.25),
    inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.nav-btn:not(:disabled):active {
  transform: translateY(0);
}

.nav-btn:focus:not(:disabled) {
  outline: var(--focus-outline);
  outline-offset: var(--focus-outline-offset);
}

.instruction {
  margin-top: 4.5rem;
  text-align: center;
  font-size: 0.95rem;
  color: var(--text-light);
  max-width: min(700px, 85vw);
  line-height: 1.6;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 700px),
       (max-width: 1000px) and (max-height: 500px) and (orientation: landscape) {
  body {
    padding: var(--space-sm) var(--space-md);
    gap: var(--space-sm);
  }

  header {
    max-width: 95vw;
    margin-bottom: var(--space-sm);
  }

  header h1 {
    font-size: 2.2rem;
    margin-bottom: var(--space-xs);
  }

  header .credentials {
    margin-bottom: var(--space-sm);
  }

  .bio {
    padding: var(--space-md) var(--space-sm);
    max-width: 95vw;
  }

  .bio-section {
    margin-bottom: var(--space-sm);
  }

  .bio-section.contact {
    margin-top: var(--space-md);
    padding-top: var(--space-sm);
  }

  .bio-line {
    font-size: 0.8rem;
    line-height: 1.5;
    margin-bottom: var(--space-xs);
  }

  .scroll-indicator {
    margin: var(--space-sm) 0;
  }

  .scroll-indicator svg {
    width: 36px;
    height: 36px;
  }

  .notebook-stage {
    width: min(95vw, 100vw);
    aspect-ratio: unset;
    max-height: none;
    min-height: unset;
    height: auto;
    perspective: none;
    margin-top: var(--space-md);
    margin-bottom: var(--space-2xl);
  }

  .notebook {
    transform: none !important;
    transform-style: flat;
    height: auto;
    min-height: auto;
  }

  .notebook.open {
    transform: none !important;
  }

  .cover.front {
    transform: none !important;
    display: none;
  }

  .cover.back {
    display: none;
  }

  .spine {
    display: none;
  }

  .pages {
    perspective: none;
    transform-style: flat;
    inset: 0;
    position: relative;
    height: auto;
    min-height: auto;
    padding: 0;
    border-radius: var(--border-radius-md);
  }

  .page {
    backface-visibility: visible !important;
    transform-style: flat;
    transform: none !important;
    position: absolute;
    opacity: 0;
    pointer-events: none;
    transition: opacity 300ms ease;
    height: auto;
    min-height: auto;
    width: 100%;
  }

  .page.active {
    opacity: 1 !important;
    pointer-events: auto;
    z-index: 10;
    position: relative;
  }

  .page.flipped {
    display: none;
  }

  .poem-body {
    grid-template-columns: 1fr !important;
    margin-left: 0 !important;
  }

  .page.translation-visible .poem-body {
    grid-template-columns: 1fr 1fr !important;
    gap: var(--space-md);
  }

  .page.translation-visible .stanza-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: var(--space-sm);
    grid-column: 1 / -1 !important;
    width: 100% !important;
  }

  .stanza-cell.original {
    font-size: clamp(0.95rem, 2.5vw, 1.15rem);
    line-height: 1.5;
  }

  .stanza-cell.translation {
    font-size: clamp(0.95rem, 2.5vw, 1.15rem);
    line-height: 1.5;
  }

  .page-content {
    overflow-y: visible;
    -webkit-overflow-scrolling: auto;
    height: auto;
    min-height: auto;
  }

  .page-navigation {
    position: relative;
    inset: auto;
    margin-top: var(--space-md);
  }

  .nav-btn {
    width: 48px;
    height: 48px;
    font-size: 1.4rem;
  }

  .scroll-hint {
    display: none;
  }

  /* Floating translation button on mobile */
  body > .toggle-translation {
    display: block !important;
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    border-radius: var(--border-radius-full);
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    min-height: 44px;
    /* Smooth pop-in / pop-out animation */
    transition: opacity var(--transition-normal), transform var(--transition-normal);
  }

  .page footer {
    padding-bottom: 4rem;
  }

  .page footer .footer-top {
    justify-content: center;
  }

  .page footer .toggle-translation {
    display: none;
  }

  .instruction {
    margin-top: var(--space-md);
    font-size: 0.85rem;
    padding: 0 var(--space-md);
  }

  /* Hidden state for the floating translation button on mobile */
  body > .toggle-translation.translation-toggle-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
  }
}

/* ============================================
   Landscape Orientation
   ============================================ */
@media (orientation: landscape) and (max-height: 600px),
       (max-height: 500px) {
  body {
    padding: var(--space-sm) var(--space-md);
    gap: var(--space-sm);
  }

  header {
    max-width: 95vw;
    margin-bottom: var(--space-xs);
  }

  header h1 {
    font-size: 1.8rem;
    margin-bottom: var(--space-xs);
  }

  header .credentials {
    margin-bottom: var(--space-xs);
    font-size: 1rem;
  }

  .bio {
    padding: var(--space-sm) var(--space-xs);
    max-width: 95vw;
    margin-bottom: var(--space-xs);
  }

  .bio-section {
    margin-bottom: var(--space-xs);
  }

  .bio-section.contact {
    margin-top: var(--space-sm);
    padding-top: var(--space-xs);
  }

  .bio-line {
    font-size: 0.75rem;
    line-height: 1.4;
    margin-bottom: 0.25rem;
  }

  .scroll-indicator {
    margin: var(--space-xs) 0;
  }

  .scroll-indicator svg {
    width: 32px;
    height: 32px;
  }

  .notebook-stage {
    width: min(95vw, 100vw);
    aspect-ratio: unset;
    max-height: none;
    min-height: unset;
    height: auto;
    perspective: none;
    margin-top: var(--space-xs);
    margin-bottom: var(--space-lg);
  }

  .notebook {
    transform: none !important;
    transform-style: flat;
    height: auto;
    min-height: auto;
    box-shadow:
      0 8px 24px rgba(0, 0, 0, 0.15),
      inset 0 0 10px rgba(255, 255, 255, 0.2);
  }

  .notebook.open {
    transform: none !important;
  }

  .cover.front {
    transform: none !important;
    display: none;
  }

  .cover.back {
    display: none;
  }

  .spine {
    display: none;
  }

  .pages {
    perspective: none;
    transform-style: flat;
    inset: 0;
    position: relative;
    height: auto;
    min-height: auto;
    padding: 0;
    border-radius: var(--border-radius-md);
  }

  .page {
    backface-visibility: visible !important;
    transform-style: flat;
    transform: none !important;
    position: absolute;
    opacity: 0;
    pointer-events: none;
    transition: opacity 300ms ease;
    padding: clamp(0.8rem, 2vw, 1.2rem);
    box-shadow:
      inset 0 0 2px rgba(0, 0, 0, 0.06),
      0 0 0 1px rgba(0, 0, 0, 0.02);
    height: auto;
    min-height: auto;
    width: 100%;
  }

  .page::after {
    box-shadow: 3px 0 10px rgba(0, 0, 0, 0.06);
  }

  .page.active {
    opacity: 1 !important;
    pointer-events: auto;
    z-index: 10;
    position: relative;
  }

  .page.flipped {
    display: none;
  }

  .page h2 {
    font-size: 1.1rem;
    margin-bottom: var(--space-xs);
  }

  .page header .title-translation {
    font-size: 0.85rem;
    margin-top: 0.2rem;
  }

  .poem-body {
    grid-template-columns: 1fr !important;
    margin-left: 0 !important;
    gap: var(--space-sm);
  }

  .page.translation-visible .poem-body {
    grid-template-columns: 1fr 1fr !important;
    gap: var(--space-sm);
  }

  .page.translation-visible .stanza-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: var(--space-xs);
    grid-column: 1 / -1 !important;
    width: 100% !important;
  }

  .original {
    font-size: clamp(0.9rem, 2vw, 1.2rem);
    line-height: 1.6;
  }

  .stanza-cell.original {
    font-size: clamp(0.8rem, 2vw, 1rem);
    line-height: 1.4;
  }

  .stanza-cell.translation {
    font-size: clamp(0.8rem, 2vw, 1rem);
    line-height: 1.4;
  }

  .page-content {
    overflow-y: visible;
    -webkit-overflow-scrolling: auto;
    height: auto;
    min-height: auto;
    gap: var(--space-sm);
  }

  .page footer {
    padding-top: 0.1rem;
    font-size: 0.8rem;
  }

  .toggle-translation {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    min-height: 44px;
  }

  /* Floating translation button on mobile landscape */
  body > .toggle-translation {
    display: block !important;
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    border-radius: var(--border-radius-full);
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    min-height: 44px;
  }

  .page footer {
    padding-bottom: 3rem;
  }

  .page footer .footer-top {
    justify-content: center;
  }

  .page footer .toggle-translation {
    display: none;
  }

  .page-navigation {
    position: relative;
    inset: auto;
    margin-top: var(--space-sm);
  }

  .nav-btn {
    width: 44px;
    height: 44px;
    font-size: 1.3rem;
  }

  .scroll-hint {
    font-size: 0.65rem;
    color: rgba(90, 70, 60, 0.95); /* Keep specific opacity */
    text-align: center;
  }

  .instruction {
    margin-top: var(--space-sm);
    font-size: 0.75rem;
    padding: 0 var(--space-sm);
  }
}
