/* =====================================================
   Indian Masala Chai Recipe Guidebook
   Aesthetic: Warm, earthy Indian-inspired with saffron,
   terracotta, gold accents on cream paper texture
   ===================================================== */

:root {
  /* Primary Colors - Warm Indian Palette */
  --saffron: #D4652F;
  --saffron-light: #E8874E;
  --terracotta: #B54C2A;
  --terracotta-dark: #8B3A20;
  --gold: #C9A227;
  --gold-light: #E5C24D;

  /* Neutrals */
  --cream: #F7F3E9;
  --cream-dark: #EDE6D6;
  --paper: #FFFEF9;
  --paper-aged: #F5F1E4;
  --brown-dark: #4A3728;
  --brown-medium: #6B5344;
  --brown-light: #8B7355;

  /* Accent Colors */
  --green-leaf: #4A7C59;
  --green-dark: #2D5A3D;
  --maroon: #722F37;

  /* Book Structure */
  --book-spine: #1E3A5F;
  --book-spine-dark: #152A45;
  --book-cover-border: #162D47;

  /* Typography */
  --font-display: 'Caveat', cursive;
  /* Handwritten for everything */
  --font-body: 'Caveat', cursive;
  /* Handwritten for everything */
  --font-hindi: 'Noto Serif Devanagari', serif;

  /* Shadows */
  --shadow-soft: 0 4px 20px rgba(74, 55, 40, 0.15);
  --shadow-medium: 0 8px 40px rgba(74, 55, 40, 0.2);
  --shadow-page: 0 0 30px rgba(0, 0, 0, 0.3);
}

/* Reset & Base */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  overflow: hidden;
  touch-action: pan-x pan-y;
}

body {
  font-family: var(--font-body);
  /* Whitish Canvas Background */
  background: #F9F9F9;
  background-image:
    repeating-linear-gradient(90deg,
      transparent,
      transparent 50px,
      rgba(0, 0, 0, 0.03) 50px,
      rgba(0, 0, 0, 0.03) 51px),
    repeating-linear-gradient(0deg,
      transparent,
      transparent 50px,
      rgba(0, 0, 0, 0.03) 50px,
      rgba(0, 0, 0, 0.03) 51px);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
  position: relative;
}

@media (max-width: 768px) {
  body {
    padding: 5px;
    overflow-x: hidden;
  }
}

/* Mobile Scroll Wrapper */
.mobile-scroll-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: visible;
}

@media (max-width: 768px) {
  .mobile-scroll-wrapper {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start;
  }
}

.mobile-scroll-inner {
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.6s ease;
  transform-style: preserve-3d;
  min-width: min-content;
}

@media (max-width: 768px) {
  .mobile-scroll-inner.closed {
    justify-content: center;
  }

  .mobile-scroll-inner:not(.closed) {
    padding: 0 20px;
  }
}

/* Book Container - this holds the perspective */
.book-container {
  perspective: 2000px;
  perspective-origin: 50% 50%;
  transition: transform 0.6s ease;
  flex-shrink: 0;
}

/* When book is open, shift right so the two-page spread is centered */
/* The flipped page extends to the LEFT of the spine, so we shift container RIGHT */
.book-container.open {
  transform: translateX(240px);
}

.book-container.closed-end {
  transform: translateX(480px);
}

@media (max-width: 768px) {
  .book-container.open {
    transform: translateX(180px);
  }

  .book-container.closed-end {
    transform: translateX(360px);
  }
}

/* Book - the spine is at the LEFT edge of this element */
.book {
  position: relative;
  width: 480px;
  height: 660px;
  transform-style: preserve-3d;
}

/* Individual Page - all pages are positioned at the spine (left edge of .book) */
.page {
  position: absolute;
  top: 0;
  left: 0;
  width: 480px;
  height: 660px;
  transform-style: preserve-3d;
  transform-origin: 0 50%;
  /* Left edge, vertical center */
  transition: transform 0.8s cubic-bezier(0.645, 0.045, 0.355, 1.000);
  cursor: pointer;
}

/* Mobile-specific GPU acceleration and rendering optimization */
@media (max-width: 768px) {
  .page {
    -webkit-transform-style: preserve-3d;
    transform-style: preserve-3d;
  }

  .page-content {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
  }
}

/* When page is flipped, it rotates -180deg around its left edge (the spine) */
.page.flipped {
  transform: rotateY(-180deg);
}

/* Page Sides - front and back of each sheet */
.front,
.back {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 0 8px 8px 0;
  overflow: hidden;
}

/* Mobile-specific fix for backface-visibility bug */
@media (max-width: 768px) {
  /*
   * On mobile Safari/Chrome, backface-visibility: hidden sometimes fails.
   * Fix: Position the .back slightly in front of .front in 3D space using translateZ.
   * When the page is flipped (rotated -180deg), the .back will properly cover the .front.
   */

  .page {
    -webkit-transform-style: preserve-3d;
    transform-style: preserve-3d;
    /* Force GPU layer to reduce flickering */
    will-change: transform;
  }

  .front,
  .back {
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    /* Force GPU compositing layer for smoother animations */
    will-change: transform;
    /* Smooth transition for any z-index or stacking changes */
    transition: opacity 0s;
  }

  /*
   * Keep translateZ constant - don't change based on state
   * The .back is always slightly in front in 3D space
   * backface-visibility handles hiding the back of each face
   */
  .front {
    -webkit-transform: translateZ(0.5px);
    transform: translateZ(0.5px);
  }

  .back {
    -webkit-transform: rotateY(180deg) translateZ(1px);
    transform: rotateY(180deg) translateZ(1px);
  }

  /*
   * Hide non-visible faces completely.
   * No transitions - instant hide/show based on state.
   */
  .page:not(.flipped) .back {
    visibility: hidden;
  }

  .page.flipped .front {
    visibility: hidden;
  }

  /*
   * During flip animation, both faces need to be visible
   * so the 3D rotation can show the correct face.
   * The currently flipping page has z-index: 1000 so it's always on top.
   */
  .page.flipping .front,
  .page.flipping .back {
    visibility: visible;
  }

  /*
   * For pages that are already flipped (sitting on the left),
   * push their .back face significantly backward to prevent bleeding through
   * the currently flipping page. Also lower their z-index.
   */
  .page.flipped:not(.flipping) {
    z-index: 1 !important;
  }

  .page.flipped:not(.flipping) .back {
    -webkit-transform: rotateY(180deg) translateZ(-10px);
    transform: rotateY(180deg) translateZ(-10px);
  }

  /*
   * The currently flipping page must be absolutely on top of everything.
   * Keep the same translateZ values as non-flipping pages to avoid right-side flicker.
   */
  .page.flipping {
    z-index: 1000 !important;
  }

  /* Optimize cover page for smoother mobile animation */
  .cover-front {
    /* Force GPU layer for the complex cover */
    will-change: transform;
  }

  /* Simplify watercolor grid rendering on mobile for smoother flip */
  .cover-front .watercolor-grid,
  .cover-front .watercolor-grid::before,
  .cover-front .watercolor-grid::after {
    will-change: transform;
  }

  /* During flip animation, simplify cover rendering for performance */
  .page.flipping .cover-front .watercolor-grid::before {
    filter: none;
  }

  /*
   * Fix cover page animation speed - ensure it inherits the same transition
   * The cover might be missing the transition due to specificity issues
   */
  #page1 {
    transition: transform 0.8s cubic-bezier(0.645, 0.045, 0.355, 1.000) !important;
    -webkit-transition: -webkit-transform 0.8s cubic-bezier(0.645, 0.045, 0.355, 1.000) !important;
  }

  /*
   * CRITICAL FIX: Disable all drop-shadow filters during flip animation
   * These filters cause rendering issues and flickering on mobile during 3D transforms
   */
  .page.flipping .sticker-img,
  .page.flipping .ingredient-icon,
  .page.flipping .spice-icon,
  .page.flipping .step-illustration,
  .page.flipping .step-sticker-img,
  .page.flipping .decor-img,
  .page.flipping .cell-icon-img,
  .page.flipping .title-icon,
  .page.flipping .credits-sticker-container,
  .page.flipping .credits-heart-img,
  .page.flipping .deco-butterfly,
  .page.flipping .deco-leaf {
    filter: none !important;
    -webkit-filter: none !important;
  }

  /*
   * Force all pages to use GPU compositing during flip
   * This prevents the flickering at the center/spine of the book
   */
  .page.flipping {
    -webkit-transform-style: preserve-3d;
    transform-style: preserve-3d;
    -webkit-perspective: 1000px;
    perspective: 1000px;
  }

  .page.flipping .front,
  .page.flipping .back {
    -webkit-transform-style: preserve-3d;
    transform-style: preserve-3d;
  }
}


/* Back side is pre-rotated 180deg so when the page flips, it faces the viewer */
.back {
  transform: rotateY(180deg);
  border-radius: 8px 0 0 8px;
}

.front {
  background: var(--paper);
  background-image:
    linear-gradient(90deg, rgba(0, 0, 0, 0.1) 0px, transparent 2px),
    linear-gradient(rgba(0, 0, 0, 0.1) 0px, transparent 2px),
    linear-gradient(to right, rgba(139, 115, 85, 0.05) 0%, transparent 3%);
  background-size: 40px 40px, 40px 40px, 100% 100%;
  box-shadow:
    inset -3px 0 10px rgba(0, 0, 0, 0.05),
    var(--shadow-page);
  border-left: 3px solid var(--book-spine);
}

.back {
  background: var(--paper);
  background-image:
    linear-gradient(90deg, rgba(0, 0, 0, 0.1) 0px, transparent 2px),
    linear-gradient(rgba(0, 0, 0, 0.1) 0px, transparent 2px),
    linear-gradient(to left, rgba(139, 115, 85, 0.05) 0%, transparent 3%);
  background-size: 40px 40px, 40px 40px, 100% 100%;
  /* transform is set above - rotateY(180deg) */
  box-shadow:
    inset 3px 0 10px rgba(0, 0, 0, 0.05),
    var(--shadow-page);
  border-right: 3px solid var(--book-spine);
}

/* =====================================================
   COVER DESIGN - Watercolor Checkered Style
   ===================================================== */

.cover-front {
  background: #F5F1E4;
  border: none;
  border-radius: 0 8px 8px 0;
  position: relative;
  overflow: hidden;
}

/* Mobile-specific fix: Ensure cover-front properly hides when flipped */
@media (max-width: 768px) {
  .cover-front {
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
  }
}

/* Hide the old cover-pattern div - we use watercolor-grid instead */
.cover-pattern {
  display: none;
}

/* Watercolor grid - hand-painted checkered pattern */
.watercolor-grid {
  position: absolute;
  inset: 0;
  z-index: 0;
  /* Base layer */
  background: #F5F1E8;
}

/* SVG-based watercolor grid for organic painted look */
.watercolor-grid::before {
  content: '';
  position: absolute;
  inset: 0;
  /* Create organic watercolor squares using SVG */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='480' height='660'%3E%3Cdefs%3E%3Cfilter id='watercolor' x='-20%25' y='-20%25' width='140%25' height='140%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.04' numOctaves='3' result='noise'/%3E%3CfeDisplacementMap in='SourceGraphic' in2='noise' scale='6' xChannelSelector='R' yChannelSelector='G'/%3E%3C/filter%3E%3C/defs%3E%3Cg filter='url(%23watercolor)'%3E%3C!-- Row 1 --%3E%3Crect x='0' y='0' width='60' height='60' fill='%231E5F8A'/%3E%3Crect x='60' y='0' width='60' height='60' fill='%23D4652F'/%3E%3Crect x='120' y='0' width='60' height='60' fill='%232B4A7C'/%3E%3Crect x='180' y='0' width='60' height='60' fill='%23E8874E'/%3E%3Crect x='240' y='0' width='60' height='60' fill='%23F5F1E8'/%3E%3Crect x='300' y='0' width='60' height='60' fill='%231A4A6E'/%3E%3Crect x='360' y='0' width='60' height='60' fill='%23D4652F'/%3E%3Crect x='420' y='0' width='60' height='60' fill='%233366A3'/%3E%3C!-- Row 2 --%3E%3Crect x='0' y='60' width='60' height='60' fill='%23D4652F'/%3E%3Crect x='60' y='60' width='60' height='60' fill='%232B4A7C'/%3E%3Crect x='120' y='60' width='60' height='60' fill='%23F5F1E8'/%3E%3Crect x='180' y='60' width='60' height='60' fill='%231E5F8A'/%3E%3Crect x='240' y='60' width='60' height='60' fill='%23E8874E'/%3E%3Crect x='300' y='60' width='60' height='60' fill='%23D4652F'/%3E%3Crect x='360' y='60' width='60' height='60' fill='%231A4A6E'/%3E%3Crect x='420' y='60' width='60' height='60' fill='%23F5F1E8'/%3E%3C!-- Row 3 --%3E%3Crect x='0' y='120' width='60' height='60' fill='%232B4A7C'/%3E%3Crect x='60' y='120' width='60' height='60' fill='%23F5F1E8'/%3E%3Crect x='120' y='120' width='60' height='60' fill='%23E8874E'/%3E%3Crect x='180' y='120' width='60' height='60' fill='%231A4A6E'/%3E%3Crect x='240' y='120' width='60' height='60' fill='%23D4652F'/%3E%3Crect x='300' y='120' width='60' height='60' fill='%233366A3'/%3E%3Crect x='360' y='120' width='60' height='60' fill='%23F5F1E8'/%3E%3Crect x='420' y='120' width='60' height='60' fill='%231E5F8A'/%3E%3C!-- Row 4 --%3E%3Crect x='0' y='180' width='60' height='60' fill='%23E8874E'/%3E%3Crect x='60' y='180' width='60' height='60' fill='%231E5F8A'/%3E%3Crect x='120' y='180' width='60' height='60' fill='%232B4A7C'/%3E%3Crect x='180' y='180' width='60' height='60' fill='%23F5F1E8'/%3E%3Crect x='240' y='180' width='60' height='60' fill='%23F5F1E8'/%3E%3Crect x='300' y='180' width='60' height='60' fill='%23F5F1E8'/%3E%3Crect x='360' y='180' width='60' height='60' fill='%23D4652F'/%3E%3Crect x='420' y='180' width='60' height='60' fill='%232B4A7C'/%3E%3C!-- Row 5 --%3E%3Crect x='0' y='240' width='60' height='60' fill='%231A4A6E'/%3E%3Crect x='60' y='240' width='60' height='60' fill='%23D4652F'/%3E%3Crect x='120' y='240' width='60' height='60' fill='%23F5F1E8'/%3E%3Crect x='180' y='240' width='60' height='60' fill='%23F5F1E8'/%3E%3Crect x='240' y='240' width='60' height='60' fill='%23F5F1E8'/%3E%3Crect x='300' y='240' width='60' height='60' fill='%23F5F1E8'/%3E%3Crect x='360' y='240' width='60' height='60' fill='%231E5F8A'/%3E%3Crect x='420' y='240' width='60' height='60' fill='%23E8874E'/%3E%3C!-- Row 6 --%3E%3Crect x='0' y='300' width='60' height='60' fill='%23D4652F'/%3E%3Crect x='60' y='300' width='60' height='60' fill='%232B4A7C'/%3E%3Crect x='120' y='300' width='60' height='60' fill='%23E8874E'/%3E%3Crect x='180' y='300' width='60' height='60' fill='%23F5F1E8'/%3E%3Crect x='240' y='300' width='60' height='60' fill='%23F5F1E8'/%3E%3Crect x='300' y='300' width='60' height='60' fill='%23F5F1E8'/%3E%3Crect x='360' y='300' width='60' height='60' fill='%232B4A7C'/%3E%3Crect x='420' y='300' width='60' height='60' fill='%231A4A6E'/%3E%3C!-- Row 7 --%3E%3Crect x='0' y='360' width='60' height='60' fill='%233366A3'/%3E%3Crect x='60' y='360' width='60' height='60' fill='%23E8874E'/%3E%3Crect x='120' y='360' width='60' height='60' fill='%231A4A6E'/%3E%3Crect x='180' y='360' width='60' height='60' fill='%23F5F1E8'/%3E%3Crect x='240' y='360' width='60' height='60' fill='%23F5F1E8'/%3E%3Crect x='300' y='360' width='60' height='60' fill='%23D4652F'/%3E%3Crect x='360' y='360' width='60' height='60' fill='%23E8874E'/%3E%3Crect x='420' y='360' width='60' height='60' fill='%231E5F8A'/%3E%3C!-- Row 8 --%3E%3Crect x='0' y='420' width='60' height='60' fill='%23F5F1E8'/%3E%3Crect x='60' y='420' width='60' height='60' fill='%231E5F8A'/%3E%3Crect x='120' y='420' width='60' height='60' fill='%23D4652F'/%3E%3Crect x='180' y='420' width='60' height='60' fill='%233366A3'/%3E%3Crect x='240' y='420' width='60' height='60' fill='%23E8874E'/%3E%3Crect x='300' y='420' width='60' height='60' fill='%232B4A7C'/%3E%3Crect x='360' y='420' width='60' height='60' fill='%231A4A6E'/%3E%3Crect x='420' y='420' width='60' height='60' fill='%23D4652F'/%3E%3C!-- Row 9 --%3E%3Crect x='0' y='480' width='60' height='60' fill='%231E5F8A'/%3E%3Crect x='60' y='480' width='60' height='60' fill='%23F5F1E8'/%3E%3Crect x='120' y='480' width='60' height='60' fill='%232B4A7C'/%3E%3Crect x='180' y='480' width='60' height='60' fill='%23E8874E'/%3E%3Crect x='240' y='480' width='60' height='60' fill='%231A4A6E'/%3E%3Crect x='300' y='480' width='60' height='60' fill='%23F5F1E8'/%3E%3Crect x='360' y='480' width='60' height='60' fill='%23D4652F'/%3E%3Crect x='420' y='480' width='60' height='60' fill='%233366A3'/%3E%3C!-- Row 10 --%3E%3Crect x='0' y='540' width='60' height='60' fill='%232B4A7C'/%3E%3Crect x='60' y='540' width='60' height='60' fill='%23D4652F'/%3E%3Crect x='120' y='540' width='60' height='60' fill='%231A4A6E'/%3E%3Crect x='180' y='540' width='60' height='60' fill='%23F5F1E8'/%3E%3Crect x='240' y='540' width='60' height='60' fill='%233366A3'/%3E%3Crect x='300' y='540' width='60' height='60' fill='%23E8874E'/%3E%3Crect x='360' y='540' width='60' height='60' fill='%231E5F8A'/%3E%3Crect x='420' y='540' width='60' height='60' fill='%23F5F1E8'/%3E%3C!-- Row 11 --%3E%3Crect x='0' y='600' width='60' height='60' fill='%23E8874E'/%3E%3Crect x='60' y='600' width='60' height='60' fill='%231E5F8A'/%3E%3Crect x='120' y='600' width='60' height='60' fill='%23F5F1E8'/%3E%3Crect x='180' y='600' width='60' height='60' fill='%232B4A7C'/%3E%3Crect x='240' y='600' width='60' height='60' fill='%23D4652F'/%3E%3Crect x='300' y='600' width='60' height='60' fill='%231A4A6E'/%3E%3Crect x='360' y='600' width='60' height='60' fill='%23F5F1E8'/%3E%3Crect x='420' y='600' width='60' height='60' fill='%232B4A7C'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover;
}

/* Watercolor texture overlay - paint bleed and paper grain */
.watercolor-grid::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    /* Organic paint texture spots */
    radial-gradient(ellipse 40px 35px at 90px 45px, rgba(255, 255, 255, 0.2) 0%, transparent 70%),
    radial-gradient(ellipse 35px 40px at 350px 95px, rgba(255, 255, 255, 0.15) 0%, transparent 70%),
    radial-gradient(ellipse 45px 35px at 45px 200px, rgba(0, 0, 0, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse 30px 45px at 420px 320px, rgba(255, 255, 255, 0.12) 0%, transparent 65%),
    radial-gradient(ellipse 40px 30px at 150px 550px, rgba(255, 255, 255, 0.18) 0%, transparent 70%),
    radial-gradient(ellipse 35px 40px at 380px 480px, rgba(0, 0, 0, 0.06) 0%, transparent 60%),
    /* Paper texture grain */
    url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
}

.cover-grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(11, 1fr);
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Watercolor/Gouache Effect Adjustments */
.grid-cell {
  position: relative;
  width: 100%;
  height: 100%;

  /* Gouache is opaque, so we limit blending with background */
  /* mix-blend-mode: multiply; -> Removed */

  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;

  /* Paint Texture Composition:
     1. Base Gradient (variable direction) for "stroke" body
     2. Radial gradient for uneven pigment loading
  */
  background-image:
    linear-gradient(var(--brush-angle, 180deg), rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.1) 20%, rgba(0, 0, 0, 0.05) 50%, rgba(255, 255, 255, 0) 100%),
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.1) 0%, rgba(0, 0, 0, 0.1) 80%);

  /* Subtle ridge perception */
  box-shadow:
    inset 0 0 3px rgba(0, 0, 0, 0.1),
    1px 1px 1px rgba(0, 0, 0, 0.05);
}

/* Canvas/Paper Grain Overlay */
.grid-cell::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.5'/%3E%3C/svg%3E");
  opacity: 0.15;
  /* Subtle grain */
  mix-blend-mode: overlay;
  pointer-events: none;
  z-index: 2;
}

/* "Dry Brush" Streaks Overlay via ::after */
.grid-cell::after {
  content: '';
  position: absolute;
  /* Extend outside to cover rotation */
  top: -50%;
  left: -50%;
  right: -50%;
  bottom: -50%;

  /* Streaky pattern */
  background-image:
    repeating-linear-gradient(90deg,
      transparent 0px,
      transparent 2px,
      rgba(0, 0, 0, 0.06) 3px,
      transparent 5px);

  transform: rotate(var(--brush-angle, 0deg));
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: 1;
}

/* Updating Color Classes for Vibrant Watercolor feel (Reference Style) */
/* Using more saturated, deeper tones */
.cell-color-1 {
  background-color: #D35400;
}

/* Deep Pumpkin/Rust (Vibrant Terracotta) */
.cell-color-2 {
  background-color: #E67E22;
}

/* Carousel Orange (Vibrant Saffron) */
.cell-color-3 {
  background-color: #1A5276;
}

/* Dark Blue (Vibrant Navy) */
.cell-color-4 {
  background-color: #FDF2E9;
}

/* Very Light Cream (opaque) */
.cell-color-5 {
  background-color: #F1C40F;
}

/* Vibrant Gold */

/* Hand Painted Icons in Cells */
.cell-icon {
  font-size: 2rem;
  /* Reduced blending to keep icons visible and popped */
  transform: rotate(var(--rotation, 0deg)) scale(var(--scale, 1));
  filter: contrast(1.1) sepia(0.2);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cell-icon-img {
  width: 90%;
  height: 90%;
  object-fit: contain;
  /* Add a subtle drop shadow to the cutout image */
  filter: drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.2));
}

/* Adjustments for specific icons to look better painted */
.cell-icon.icon-light {
  mix-blend-mode: hard-light;
  opacity: 0.9;
}

/* Border Overlay removed as requested */
/* .cover-front::before {
  content: '';
  position: absolute;
  inset: 15px;
  border: 3px solid var(--gold-light);
  border-radius: 4px;
  pointer-events: none;
  z-index: 10;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.1);
} */


/* Specific Positions - mimicking the grid (approx 60px blocks) */
/* Columns approx: 0, 60, 120, 180, 240, 300, 360, 420 */
/* Rows approx: 0, 60, 120... */

.cover-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  /* Hand-painted look: Warmer, varied background */
  background-color: #F8E8D0;
  /* Warmer Biscuit/Cream base */
  background-image:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.4) 0%, rgba(0, 0, 0, 0) 80%),
    url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.08'/%3E%3C/svg%3E");

  padding: 40px 50px;

  /* Imperfect hand-painted shape */
  border-radius: 2% 4% 3% 5% / 4% 3% 5% 2%;

  /* Softer, more diffuse shadow to blend */
  box-shadow:
    0 2px 15px rgba(139, 69, 19, 0.15),
    /* Warm brown shadow */
    inset 0 0 40px rgba(210, 180, 140, 0.3);
  /* Inner darkening */

  text-align: center;
  z-index: 10;
}

.cover-title {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 700;
  color: #8B3A20;
  line-height: 1.15;
  text-shadow: 1px 1px 0px rgba(255, 255, 255, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.chai-title-row {
  display: inline-block;
  position: relative;
  /* Ensure the container only wraps the text width */
}

.title-icon {
  position: absolute;
  left: 100%;
  top: 50%;
  height: 70px;
  width: auto;
  margin-left: -5px;
  /* Pull closer to text */
  filter: drop-shadow(2px 2px 3px rgba(0, 0, 0, 0.2));
  transform: translateY(-65%);
  /* Shift upwards to align visually with text baseline */
  white-space: nowrap;
}

/* Cover Decorations - Butterflies and Botanicals */
.cover-decorations {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

.cover-decorations span {
  position: absolute;
  font-size: 1.8rem;
  filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.2));
  transition: transform 0.3s ease;
}

.pos-1 {
  top: 30px;
  left: 30px;
  transform: translate(-50%, -50%) rotate(-15deg);
}

/* Top Left */
.pos-2 {
  top: 30px;
  right: 90px;
  transform: translate(50%, -50%) rotate(10deg);
}

/* Top Right-ish */
.pos-3 {
  top: 150px;
  left: 90px;
  transform: translate(-50%, -50%) rotate(5deg);
}

.pos-4 {
  top: 90px;
  right: 30px;
  transform: translate(50%, -50%) rotate(-8deg);
}

.pos-5 {
  bottom: 150px;
  left: 30px;
  transform: translate(-50%, -50%) rotate(-20deg);
}

.pos-6 {
  bottom: 210px;
  right: 90px;
  transform: translate(50%, -50%) rotate(15deg) scale(0.8);
}

.pos-7 {
  bottom: 30px;
  left: 90px;
  transform: translate(-50%, -50%) rotate(5deg);
}

.pos-8 {
  bottom: 30px;
  right: 30px;
  transform: translate(50%, -50%) rotate(-10deg);
}

/* Center-ish scattered */
.pos-9 {
  top: 50%;
  left: 30px;
  transform: translate(-50%, -50%) rotate(12deg);
}

.pos-10 {
  top: 50%;
  right: 30px;
  transform: translate(50%, -50%) rotate(-5deg);
}

.pos-11 {
  top: 180px;
  left: 50%;
  transform: translate(-50%, -50%) rotate(45deg) scale(0.6);
}

/* Above Title */
/* Above Title */
.pos-12 {
  bottom: 180px;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-15deg);
}

/* Butterfly decorations */
.deco-butterfly {
  position: absolute;
  font-size: 1.6rem;
  filter: drop-shadow(1px 2px 2px rgba(0, 0, 0, 0.25));
  transition: transform 0.4s ease;
}

.deco-butterfly:hover {
  transform: scale(1.2) rotate(10deg);
}

.deco-butterfly.top-left-1 {
  top: 45px;
  left: 80px;
  font-size: 1.5rem;
  transform: rotate(-20deg);
}

.deco-butterfly.top-right-1 {
  top: 55px;
  right: 100px;
  font-size: 1.4rem;
  transform: rotate(25deg) scaleX(-1);
}

.deco-butterfly.mid-left {
  top: 45%;
  left: 25px;
  font-size: 1.7rem;
  transform: rotate(-10deg);
}

.deco-butterfly.mid-right {
  top: 40%;
  right: 20px;
  font-size: 1.5rem;
  transform: rotate(15deg) scaleX(-1);
}

.deco-butterfly.bottom-left-1 {
  bottom: 120px;
  left: 60px;
  font-size: 1.4rem;
  transform: rotate(5deg);
}

.deco-butterfly.bottom-right-1 {
  bottom: 100px;
  right: 70px;
  font-size: 1.6rem;
  transform: rotate(-15deg) scaleX(-1);
}

.deco-butterfly.bottom-mid {
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%) rotate(5deg);
  font-size: 1.3rem;
}

/* Botanical/Leaf decorations */
.deco-leaf {
  position: absolute;
  font-size: 1.5rem;
  filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.2));
  transition: transform 0.3s ease;
}

.deco-leaf.top-left {
  top: 100px;
  left: 30px;
  font-size: 1.4rem;
  transform: rotate(-45deg);
}

.deco-leaf.top-right {
  top: 110px;
  right: 35px;
  font-size: 1.4rem;
  transform: rotate(45deg) scaleX(-1);
}

.deco-leaf.bottom-left {
  bottom: 60px;
  left: 140px;
  font-size: 1.3rem;
  transform: rotate(30deg);
}

.deco-leaf.bottom-right {
  bottom: 55px;
  right: 130px;
  font-size: 1.3rem;
  transform: rotate(-30deg) scaleX(-1);
}

.deco-leaf.mid-bottom-left {
  bottom: 150px;
  left: 25px;
  font-size: 1.2rem;
  transform: rotate(-20deg);
}

.deco-leaf.mid-bottom-right {
  bottom: 140px;
  right: 30px;
  font-size: 1.2rem;
  transform: rotate(20deg) scaleX(-1);
}

/* Cover Back (Inside Cover) */
.cover-back {
  background: var(--book-spine);
}

.cover-back .inner-page {
  margin: 8px;
  height: calc(100% - 16px);
  background: var(--paper);
  border-radius: 4px;
}


.cover-back-end {
  background: var(--book-spine);
  border-radius: 8px 0 0 8px;
}

.cover-back-end .inner-page {
  margin: 8px;
  height: calc(100% - 16px);
  background: var(--book-spine);
  border-radius: 4px;
}

/* =====================================================
   PAGE CONTENT STYLES
   ===================================================== */

.page-content {
  padding: 45px 40px;
  height: 100%;
  display: flex;
  flex-direction: column;
}

@media (max-width: 768px) {
  .page-content {
    -webkit-overflow-scrolling: touch;
  }

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

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

  .page-content::-webkit-scrollbar-thumb {
    background: rgba(139, 115, 85, 0.3);
    border-radius: 2px;
  }

  .page-content::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 115, 85, 0.5);
  }
}

/* Page Header & Title */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 25px;
  border-bottom: 2px solid var(--terracotta);
  padding-bottom: 10px;
}

.page-title {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 600;
  color: var(--terracotta-dark);
  text-decoration: underline;
  text-decoration-color: var(--saffron);
  text-underline-offset: 5px;
}

.decor-icon {
  font-size: 2.5rem;
  opacity: 0.8;
}

.decor-img {
  height: 80px;
  width: auto;
  filter: drop-shadow(2px 2px 2px rgba(0, 0, 0, 0.1));
  opacity: 0.9;
}

.page-number {
  position: absolute;
  bottom: 24px;
  font-family: var(--font-body);
  font-size: 1.1rem;
  color: var(--brown-light);
  font-style: italic;
}

.front .page-number {
  right: 28px;
}

.back .page-number {
  left: 28px;
}

/* =====================================================
   INGREDIENTS PAGE
   ===================================================== */

.ingredient-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  padding-top: 10px;
}

.ingredient-item {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 22px;
  /* background: rgba(247, 243, 233, 0.7); removed for sticker look */
  border-radius: 10px;
  transition: transform 0.2s ease;
}

.ingredient-item:hover {
  transform: translateX(5px);
}

.ingredient-item.right {
  flex-direction: row-reverse;
}

.ingredient-item.right:hover {
  transform: translateX(-5px);
}

.ingredient-icon {
  font-size: 2.8rem;
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  /* background: white; removed */
  /* border: 4px solid white; removed */
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.15));
  transform: rotate(-3deg);
}

.ingredient-item:nth-child(even) .ingredient-icon {
  transform: rotate(2deg);
}

.ingredient-info {
  flex: 1;
}

.ingredient-item.right .ingredient-info {
  text-align: right;
}

.ingredient-name {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 600;
  color: var(--brown-dark);
}

.ingredient-desc {
  font-family: var(--font-body);
  font-size: 1.15rem;
  color: var(--brown-medium);
  font-style: italic;
}

/* =====================================================
   SPICE GRID
   ===================================================== */

.spice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  flex: 1;
  padding-top: 18px;
}

.spice-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 22px 16px;
  /* background: linear-gradient(135deg, rgba(212, 101, 47, 0.08) 0%, rgba(201, 162, 39, 0.05) 100%); removed for scrapbook look */
  /* border-radius: 10px; removed */
  /* border: 1px solid rgba(212, 101, 47, 0.15); removed */
  text-align: center;
  transition: all 0.2s ease;
}

.spice-item:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 15px rgba(212, 101, 47, 0.15);
}

.spice-item:last-child {
  grid-column: 1 / -1;
}

.spice-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  color: var(--terracotta);
  /* Sticker Layout */
  width: 100px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  /* No background - images have their own white backing */
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.15));
  transform: rotate(3deg);
}

.spice-icon .sticker-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  pointer-events: none;
}

.sticker-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.spice-item:nth-child(even) .spice-icon {
  transform: rotate(-3deg);
}

/* Pepper Sticker - Add white rounded rectangular background */
.spice-item:nth-child(3) .spice-icon {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.spice-item:nth-child(3) .sticker-img {
  clip-path: none;
  border-radius: 0;
  padding: 8px;
}

/* Cinnamon Sticker - Add white rounded rectangular background */
.spice-item:nth-child(4) .spice-icon {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.spice-item:nth-child(4) .sticker-img {
  clip-path: none;
  border-radius: 0;
  padding: 8px;
}

.spice-name {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--brown-dark);
  margin-bottom: 4px;
}

.spice-note {
  font-family: var(--font-body);
  font-size: 1.05rem;
  color: var(--brown-medium);
  font-style: italic;
}

/* =====================================================
   STEP PAGES
   ===================================================== */

.step-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 22px;
}

.step-illustration {
  width: 170px;
  height: 170px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5.5rem;
  margin-bottom: 28px;
  /* Sticker Style */
  background: white;
  border: 5px solid white;
  border-radius: 12px;
  /* Slight round rect like sticker */
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
  transform: rotate(-2deg);
  /* removal of radial gradient */
  animation: gentle-pulse 3s ease-in-out infinite;
}

.step-sticker-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.step-illustration:hover {
  transform: rotate(-2deg) scale(1.05);
  /* keep rotation on hover */
}

@keyframes gentle-pulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }
}

.tea-step .tea-leaves {
  font-size: 2.8rem;
  letter-spacing: 7px;
  animation: tea-float 2s ease-in-out infinite;
}

@keyframes tea-float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

.step-instructions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 28px;
}

.step-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 10px 0;
  /* reduced padding, removed box */
  /* background: rgba(247, 243, 233, 0.7); removed */
  /* border-radius: 8px; removed */
  /* border-left: 4px solid var(--saffron); removed */
}

.step-num {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--saffron);
  min-width: 32px;
}

.step-text {
  font-family: var(--font-body);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--brown-dark);
  line-height: 1.4;
}

.step-note {
  text-align: center;
  padding: 18px 28px;
  /* background: linear-gradient(...); removed */
  /* border-radius: 25px; removed */
  font-family: var(--font-body);
  font-size: 1.4rem;
  /* Larger for handwritten feel */
  color: var(--brown-dark);
  /* Darker for readability */
  font-weight: 600;
}

/* =====================================================
   PRO TIPS
   ===================================================== */

.pro-tips-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 35px;
  padding-top: 15px;
}

.pro-tip-item {
  display: flex;
  gap: 15px;
  padding: 18px;
  background: linear-gradient(135deg, rgba(74, 124, 89, 0.08) 0%, rgba(201, 162, 39, 0.05) 100%);
  border-radius: 12px;
  border: 1px solid rgba(74, 124, 89, 0.15);
}

.pro-tip-icon {
  font-size: 2.5rem;
  min-width: 55px;
  text-align: center;
}

.pro-tip-text {
  flex: 1;
}

.pro-tip-title {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 600;
  color: var(--green-dark);
  margin-bottom: 8px;
}

.pro-tip-description {
  font-family: var(--font-body);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--brown-dark);
  line-height: 1.35;
}

/* =====================================================
   CREDITS PAGE
   ===================================================== */

.credits-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
}

.credits-decor {
  font-size: 2.8rem;
  opacity: 0.6;
  position: absolute;
}

.credits-decor.top {
  top: 45px;
  left: 50%;
  transform: translateX(-50%);
}

.credits-decor.bottom {
  bottom: 70px;
  right: 55px;
}

.credits-main {
  margin-bottom: 45px;
}

.credits-text {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
  color: var(--brown-medium);
  margin-bottom: 14px;
}

.credits-handle {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
  color: var(--saffron);
  text-decoration: none;
  border-bottom: 2px solid var(--saffron);
  padding-bottom: 4px;
  transition: all 0.2s ease;
}

.credits-handle:hover {
  color: var(--terracotta);
  border-bottom-color: var(--terracotta);
}

.credits-sticker-container {
  width: 200px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  /* Sticker Style */
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  transform: rotate(-2deg);
  transition: transform 0.3s ease;
}

.credits-sticker-container:hover {
  transform: rotate(0deg) scale(1.05);
}

.credits-sticker-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  padding: 6px;
}

/* Credits Heart Image */
.credits-heart-img {
  width: 60px;
  /* Slightly bigger than typical text emoji */
  height: auto;
  display: block;
  margin: 0 auto;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.1));
}

@keyframes steam {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-5px);
  }
}

/* Page 5 base styles - let JavaScript handle z-index dynamically */
#page5 {
  display: block;
  visibility: visible;
  opacity: 1;
}

/* =====================================================
   END PAGE - STATIC BACKBOARD
   ===================================================== */

/* Static backboard - NOT a flippable page */
.static-backboard {
  position: absolute;
  top: 0;
  left: 0;
  width: 480px;
  height: 660px;
  z-index: 0 !important;
  pointer-events: none !important;
  cursor: default !important;
  /* NO transform-style, NO transitions - completely static */
}

.static-backboard .front {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--paper);
  background-image:
    linear-gradient(90deg, rgba(0, 0, 0, 0.1) 0px, transparent 2px),
    linear-gradient(rgba(0, 0, 0, 0.1) 0px, transparent 2px),
    linear-gradient(to right, rgba(139, 115, 85, 0.05) 0%, transparent 3%);
  background-size: 40px 40px, 40px 40px, 100% 100%;
  border-radius: 0 8px 8px 0;
  box-shadow:
    inset -3px 0 10px rgba(0, 0, 0, 0.05),
    var(--shadow-page);
  border-left: 3px solid var(--book-spine);
}

.end-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.end-text {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--brown-light);
  font-style: italic;
  margin-bottom: 28px;
}

.end-decoration {
  font-size: 2.3rem;
  letter-spacing: 14px;
  opacity: 0.7;
}

/* =====================================================
   NAVIGATION
   ===================================================== */

.nav-controls {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 20px;
  z-index: 100;
}

.nav-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid var(--terracotta);
  background: var(--cream);
  color: var(--terracotta);
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-soft);
}

.nav-btn:hover:not(:disabled) {
  background: var(--terracotta);
  color: var(--cream);
  transform: scale(1.1);
}

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

.nav-arrow {
  font-weight: bold;
}

/* Scroll Hint */
.scroll-hint {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--brown-light);
  background: var(--cream);
  padding: 8px 16px;
  border-radius: 20px;
  box-shadow: var(--shadow-soft);
  opacity: 0.8;
}

.scroll-hint.hidden {
  display: none;
}

/* =====================================================
   RESPONSIVE DESIGN
   ===================================================== */

@media (max-width: 1000px) {
  body {
    padding: 10px;
  }

  .book {
    width: 400px;
    height: 550px;
  }

  .page,
  .static-backboard {
    width: 400px;
    height: 550px;
  }

  .book-container.open {
    transform: translateX(200px);
  }

  .cover-title {
    font-size: 2.6rem;
  }

  .title-icon {
    height: 60px;
  }

  .cover-center {
    padding: 35px 45px;
  }

  .page-content {
    padding: 35px 30px;
  }

  .page-title {
    font-size: 2.1rem;
  }

  .decor-img {
    height: 65px;
  }

  .ingredient-name {
    font-size: 1.5rem;
  }

  .ingredient-icon {
    width: 75px;
    height: 75px;
  }

  .step-illustration {
    width: 140px;
    height: 140px;
    font-size: 4.5rem;
  }

  .nav-controls {
    bottom: 20px;
  }

  .nav-btn {
    width: 55px;
    height: 55px;
  }
}

/* Tablet and Mobile Devices */
@media (max-width: 768px) {
  .book {
    width: 360px;
    height: 580px;
  }

  .page,
  .static-backboard {
    width: 360px;
    height: 580px;
  }

  .book-container.open {
    transform: translateX(180px);
  }

  .cover-title {
    font-size: 2.2rem;
  }

  .title-icon {
    height: 50px;
  }

  .cover-center {
    padding: 30px 35px;
  }

  .page-content {
    padding: 28px 22px;
    overflow-y: auto;
    max-height: 100%;
  }

  .page-title {
    font-size: 1.9rem;
  }

  .decor-icon {
    font-size: 2rem;
  }

  .decor-img {
    height: 60px;
  }

  .ingredient-list {
    gap: 10px;
  }

  .ingredient-item {
    padding: 8px 16px;
    gap: 15px;
  }

  .ingredient-icon {
    width: 70px;
    height: 70px;
    font-size: 2.4rem;
  }

  .ingredient-name {
    font-size: 1.4rem;
  }

  .ingredient-desc {
    font-size: 1rem;
  }

  .spice-grid {
    gap: 15px;
  }

  .spice-item {
    padding: 18px 14px;
  }

  .spice-icon {
    width: 85px;
    height: 85px;
    font-size: 2.2rem;
  }

  .spice-name {
    font-size: 1.3rem;
  }

  .spice-note {
    font-size: 0.95rem;
  }

  .step-illustration {
    width: 130px;
    height: 130px;
  }

  .step-text {
    font-size: 1.3rem;
  }

  .step-note {
    font-size: 1.2rem;
    padding: 14px 22px;
  }

  .pro-tip-item {
    padding: 14px;
    gap: 12px;
  }

  .pro-tip-icon {
    font-size: 2rem;
    min-width: 45px;
  }

  .pro-tip-title {
    font-size: 1.5rem;
  }

  .pro-tip-description {
    font-size: 1.15rem;
  }

  .credits-sticker-container {
    width: 160px;
    height: 160px;
  }

  .credits-text {
    font-size: 1.7rem;
  }

  .credits-handle {
    font-size: 1.7rem;
  }

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

/* Small Mobile Devices */
@media (max-width: 550px) {
  .book {
    width: 300px;
    height: 500px;
  }

  .page,
  .static-backboard {
    width: 300px;
    height: 500px;
  }

  .book-container.open {
    transform: translateX(150px);
  }

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

  .title-icon {
    height: 45px;
    margin-left: -8px;
  }

  .cover-center {
    padding: 25px 30px;
  }

  .page-content {
    padding: 22px 18px;
    overflow-y: auto;
    max-height: 100%;
  }

  .page-title {
    font-size: 1.6rem;
  }

  .decor-icon {
    font-size: 1.8rem;
  }

  .decor-img {
    height: 50px;
  }

  .page-header {
    margin-bottom: 18px;
  }

  .ingredient-list {
    gap: 8px;
  }

  .ingredient-item {
    padding: 6px 12px;
    gap: 12px;
  }

  .ingredient-icon {
    width: 60px;
    height: 60px;
    font-size: 2rem;
  }

  .ingredient-name {
    font-size: 1.2rem;
  }

  .ingredient-desc {
    font-size: 0.9rem;
  }

  .spice-grid {
    gap: 12px;
  }

  .spice-item {
    padding: 14px 10px;
  }

  .spice-icon {
    width: 75px;
    height: 75px;
    font-size: 2rem;
  }

  .spice-name {
    font-size: 1.15rem;
  }

  .spice-note {
    font-size: 0.85rem;
  }

  .step-content {
    padding-top: 15px;
  }

  .step-illustration {
    width: 110px;
    height: 110px;
    margin-bottom: 20px;
  }

  .step-instructions {
    gap: 14px;
    margin-bottom: 20px;
  }

  .step-num {
    font-size: 1.5rem;
    min-width: 28px;
  }

  .step-text {
    font-size: 1.15rem;
  }

  .step-note {
    font-size: 1.05rem;
    padding: 12px 18px;
  }

  .pro-tips-content {
    gap: 18px;
  }

  .pro-tip-item {
    padding: 10px;
    gap: 8px;
  }

  .pro-tip-icon {
    font-size: 1.6rem;
    min-width: 35px;
  }

  .pro-tip-title {
    font-size: 1.2rem;
    margin-bottom: 4px;
  }

  .pro-tip-description {
    font-size: 0.95rem;
  }

  .credits-sticker-container {
    width: 140px;
    height: 140px;
  }

  .credits-text {
    font-size: 1.5rem;
  }

  .credits-handle {
    font-size: 1.5rem;
  }

  .credits-heart-img {
    width: 50px;
  }

  .end-text {
    font-size: 2rem;
  }

  .nav-controls {
    bottom: 15px;
    gap: 15px;
  }

  .nav-btn {
    width: 45px;
    height: 45px;
    font-size: 1.2rem;
  }

  .scroll-hint {
    font-size: 0.75rem;
    padding: 6px 12px;
    bottom: 80px;
  }
}

/* Extra Small Devices (iPhone SE, etc.) */
@media (max-width: 380px) {
  .book {
    width: 280px;
    height: 470px;
  }

  .page,
  .static-backboard {
    width: 280px;
    height: 470px;
  }

  .book-container.open {
    transform: translateX(140px);
  }

  .cover-title {
    font-size: 1.6rem;
  }

  .title-icon {
    height: 40px;
  }

  .cover-center {
    padding: 20px 25px;
  }

  .page-content {
    padding: 20px 16px;
    overflow-y: auto;
    max-height: 100%;
  }

  .page-title {
    font-size: 1.4rem;
  }

  .decor-img {
    height: 45px;
  }

  .ingredient-icon {
    width: 55px;
    height: 55px;
  }

  .ingredient-name {
    font-size: 1.1rem;
  }

  .ingredient-desc {
    font-size: 0.85rem;
  }

  .spice-icon {
    width: 65px;
    height: 65px;
  }

  .spice-name {
    font-size: 1.05rem;
  }

  .step-illustration {
    width: 100px;
    height: 100px;
  }

  .step-text {
    font-size: 1.05rem;
  }

  .pro-tip-title {
    font-size: 1.2rem;
  }

  .pro-tip-description {
    font-size: 0.95rem;
  }

  .nav-btn {
    width: 42px;
    height: 42px;
  }
}

/* =====================================================
   ANIMATIONS & TRANSITIONS
   ===================================================== */

/* Page flip shadow effect */
.page.flipping .front {
  box-shadow:
    inset -3px 0 10px rgba(0, 0, 0, 0.1),
    -20px 0 40px rgba(0, 0, 0, 0.2);
}

/* Subtle hover effect on pages - only when book is closed */
.book-container:not(.open) .page:not(.flipped):hover {
  transform: rotateY(-3deg);
}

/* Loading state - use opacity only to avoid transform conflicts */
.book-container {
  animation: book-appear 0.8s ease-out forwards;
}

@keyframes book-appear {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}