/* ==========================================================================
   AUTHENTIC PAPER TEXTURE & STABLE MOBILE DESIGN SYSTEM
   ========================================================================== */

/* Design Tokens */
:root {
  --bg-room: #161211;
  --paper-ivory: #F7F3E9;
  --paper-cream: #FAF7F0;
  --paper-blush: #EFE7DB;
  --ink-charcoal: #26211E;
  --ink-muted: #5C524C;
  --burgundy-deep: #661821;
  --gold-foil: #B8860B;
  --gold-accent: #FFD700;
  
  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-journal: 'EB Garamond', Georgia, serif;
  --font-script: 'Alex Brush', cursive;
  --font-sans: 'Plus Jakarta Sans', -apple-system, sans-serif;
  
  --sheet-radius: 4px;
}

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

html, body {
  width: 100%;
  height: 100dvh;
  background-color: var(--bg-room);
  color: var(--ink-charcoal);
  font-family: var(--font-journal);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
}

/* Dust & Particle Canvas Background */
#dust-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100dvh;
  z-index: 1;
  pointer-events: none !important;
}

/* Envelope Gate Overlay */
.envelope-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100dvh;
  z-index: 10000;
  background: rgba(16, 12, 11, 0.96);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.envelope-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.wax-seal-card {
  width: 100%;
  max-width: 380px;
  background: var(--paper-ivory);
  padding: 36px 20px;
  border-radius: var(--sheet-radius);
  text-align: center;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.7), inset 0 0 50px rgba(220, 200, 180, 0.4);
  border: 1px solid rgba(184, 134, 11, 0.35);
  position: relative;
  z-index: 10001;
}

.wax-stamp {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8B1A2B, var(--burgundy-deep));
  margin: 0 auto 14px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-accent);
  font-size: 1.8rem;
  box-shadow: 0 4px 18px rgba(102, 24, 33, 0.7), inset 0 2px 4px rgba(255, 255, 255, 0.3);
  cursor: pointer;
  touch-action: manipulation;
  z-index: 10002;
}

.envelope-title {
  font-size: 1.75rem;
  color: var(--ink-charcoal);
  margin-bottom: 6px;
}

.envelope-subtitle {
  font-size: 1rem;
  color: var(--ink-muted);
  font-style: italic;
  margin-bottom: 20px;
}

.mobile-paper-btn {
  background: var(--ink-charcoal);
  color: var(--paper-ivory);
  border: 1px solid var(--gold-foil);
  padding: 12px 24px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer !important;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border-radius: 2px;
  transition: all 0.25s ease;
  width: 100%;
  justify-content: center;
  position: relative !important;
  z-index: 99999 !important;
  touch-action: manipulation !important;
  pointer-events: auto !important;
  min-height: 48px;
  -webkit-tap-highlight-color: rgba(212, 175, 55, 0.4);
}

.mobile-paper-btn:active {
  background: var(--burgundy-deep);
  transform: scale(0.98);
}

/* Horizontal Scroll Container (PURE 2D - NO 3D TRANSFORM MATRIX BUGS) */
.perspective-stage {
  width: 100vw;
  height: 100dvh;
}

.journal-container {
  width: 100vw;
  height: 100dvh;
  display: flex;
  flex-direction: row;
  overflow-x: scroll;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.journal-page {
  flex: 0 0 100vw;
  width: 100vw;
  height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 10px;
  position: relative;
}

/* Locked Page 14 */
.journal-page.page-locked {
  display: none !important;
}

/* Authentic Paper Sheet Card - Strict 2D Alignment */
.paper-sheet {
  width: 100%;
  max-width: 440px;
  height: 100%;
  max-height: calc(100dvh - 24px);
  background: var(--paper-ivory);
  background-image: 
    radial-gradient(circle at 50% 50%, rgba(250, 247, 240, 0.9), rgba(235, 225, 210, 0.5));
  box-shadow: 
    0 12px 35px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(184, 134, 11, 0.25),
    inset 0 0 60px rgba(220, 200, 180, 0.4);
  border-radius: var(--sheet-radius);
  padding: 18px 16px 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  will-change: opacity;
}

/* SVG Grain Texture Overlay */
.paper-texture-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none !important;
  filter: url(#paper-texture-filter);
  opacity: 0.12;
  z-index: 1;
}

.watermark {
  position: absolute;
  top: 14px;
  right: 16px;
  font-family: var(--font-serif);
  font-size: 2.5rem;
  color: rgba(184, 134, 11, 0.12);
  font-weight: 700;
  pointer-events: none !important;
  z-index: 1;
}

.sheet-top {
  border-bottom: 1px solid rgba(184, 134, 11, 0.25);
  padding-bottom: 6px;
  margin-bottom: 8px;
  position: relative;
  z-index: 2;
  flex-shrink: 0;
}

.sheet-tag {
  font-family: var(--font-sans);
  font-size: 0.68rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--gold-foil);
}

.page-title, .anim-title {
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink-charcoal);
  margin-bottom: 8px;
  opacity: 0;
  transform: translateY(18px);
  will-change: transform, opacity;
  position: relative;
  z-index: 2;
  flex-shrink: 0;
}

.page-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  font-size: 1.1rem;
  line-height: 1.55;
  color: var(--ink-charcoal);
  overflow-y: auto;
  position: relative;
  z-index: 5;
}

.journal-line, .anim-line {
  color: var(--ink-charcoal);
  opacity: 0;
  transform: translateY(18px);
  will-change: transform, opacity;
}

.subtle-italic {
  color: var(--ink-muted);
  font-style: italic;
}

.font-serif { font-family: var(--font-serif); }
.font-journal { font-family: var(--font-journal); }
.font-script { font-family: var(--font-script); }

.script-accent {
  font-size: 2.2rem;
  color: var(--burgundy-deep);
  line-height: 1;
  margin: 2px 0;
}

.ornament {
  text-align: center;
  color: var(--gold-foil);
  font-size: 0.8rem;
  letter-spacing: 4px;
  opacity: 0.75;
}

.quote-card {
  background: var(--paper-blush);
  border-left: 3px solid var(--burgundy-deep);
  padding: 10px 12px;
  font-size: 1.15rem;
  border-radius: 0 3px 3px 0;
}

.chips-flex {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 2px 0;
}

.chip {
  background: rgba(184, 134, 11, 0.08);
  border: 1px solid rgba(184, 134, 11, 0.2);
  padding: 5px 10px;
  font-size: 1rem;
  color: var(--ink-muted);
  border-radius: 2px;
}

.journal-bullets {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.star {
  color: var(--gold-foil);
  margin-right: 6px;
  font-size: 0.75rem;
}

.grand-quote {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--burgundy-deep);
  padding-left: 10px;
  border-left: 2px solid var(--gold-foil);
}

.paper-box {
  background: var(--paper-cream);
  border: 1px solid rgba(184, 134, 11, 0.3);
  padding: 12px;
  border-radius: 2px;
  font-size: 1.1rem;
}

.highlight-burgundy {
  color: var(--burgundy-deep);
  font-weight: 600;
}

.reasons-mobile {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reasons-mobile li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 1.05rem;
}

.num {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--gold-foil);
}

.stamp-box {
  font-family: var(--font-serif);
  font-size: 2rem;
  color: rgba(102, 24, 33, 0.25);
  letter-spacing: 3px;
  text-transform: uppercase;
  text-align: center;
  margin: 4px 0;
}

.grand-truth {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--burgundy-deep);
  background: var(--paper-blush);
  border: 1px solid rgba(184, 134, 11, 0.3);
  padding: 12px;
  text-align: center;
  border-radius: 2px;
}

.highlight-phrase {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--burgundy-deep);
}

.highlight-honest {
  color: var(--burgundy-deep);
  font-weight: 600;
}

.text-center { text-align: center; }
.text-burgundy { color: var(--burgundy-deep); }

/* PAGE 5 PLOT TWIST CARD */
.plot-twist-sheet {
  background: #1B1514 !important;
  color: #FFFFFF !important;
  border: 1px solid var(--gold-foil) !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9), inset 0 0 80px rgba(184, 134, 11, 0.2) !important;
  padding: 16px 14px 12px 14px !important;
}

.tag-twist {
  color: var(--gold-accent) !important;
}

.twist-body {
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 4px !important;
  text-align: center !important;
  padding: 0 !important;
}

.twist-line {
  display: block !important;
  position: relative !important;
  color: #FFFFFF !important;
  font-size: 1.1rem;
  line-height: 1.35 !important;
  margin: 2px 0 !important;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transform: translateY(18px);
}

.twist-no {
  font-size: 2rem !important;
  color: var(--gold-accent) !important;
  font-weight: 700 !important;
  margin: 4px 0 !important;
  text-shadow: 0 0 15px rgba(255, 215, 0, 0.6) !important;
}

.twist-highlight-box {
  width: 100%;
  background: rgba(184, 134, 11, 0.18);
  border: 1px dashed var(--gold-accent);
  padding: 8px 6px;
  margin: 4px 0;
  border-radius: 4px;
  text-align: center;
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.2);
  opacity: 0;
  transform: translateY(18px);
}

.twist-you {
  font-size: 1.2rem;
  color: #FFFFFF;
  display: block;
}

.twist-name {
  font-size: 2.5rem;
  color: var(--gold-accent);
  line-height: 1;
  margin: 0;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.twist-transition {
  font-size: 1rem;
  color: #F7F3E9;
  font-style: italic;
  margin-top: 2px;
  opacity: 0;
  transform: translateY(18px);
}

/* Page 13 Choices */
.disclaimer-mobile {
  font-size: 0.95rem;
  color: var(--ink-muted);
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 8px;
}

.question-card {
  background: var(--paper-cream);
  border: 1px solid var(--gold-foil);
  padding: 12px;
  margin-bottom: 10px;
}

.q-main {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ink-charcoal);
  margin-bottom: 2px;
}

.q-sub {
  font-size: 0.9rem;
  color: var(--ink-muted);
}

.mobile-choice-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.choice-btn {
  width: 100%;
  min-height: 48px;
  background: var(--paper-ivory);
  border: 1px solid rgba(184, 134, 11, 0.35);
  padding: 10px 12px;
  border-radius: 2px;
  cursor: pointer !important;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  transition: all 0.25s ease;
  position: relative !important;
  z-index: 99999 !important;
  touch-action: manipulation !important;
  pointer-events: auto !important;
  -webkit-tap-highlight-color: rgba(212, 175, 55, 0.4);
}

.glow-pulse {
  animation: pulseGold 2.5s infinite alternate;
}

@keyframes pulseGold {
  0% { box-shadow: 0 0 0 0 rgba(184, 134, 11, 0.4); }
  100% { box-shadow: 0 0 12px 3px rgba(212, 175, 55, 0.5); }
}

.icon { font-size: 1.4rem; }

.btn-info strong {
  display: block;
  font-size: 1.05rem;
  color: var(--ink-charcoal);
}

.btn-info span {
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.choice-btn:not(:disabled):active,
.choice-btn:not(:disabled):hover {
  background: var(--burgundy-deep);
  border-color: var(--gold-accent);
}

.choice-btn:not(:disabled):active .btn-info strong,
.choice-btn:not(:disabled):active .btn-info span,
.choice-btn:not(:disabled):hover .btn-info strong,
.choice-btn:not(:disabled):hover .btn-info span {
  color: #FFF;
}

.choice-btn:disabled {
  cursor: not-allowed !important;
  opacity: 0.65;
}

.choice-btn.selected {
  background: var(--burgundy-deep) !important;
  border-color: var(--gold-accent) !important;
  opacity: 1 !important;
  box-shadow: 0 0 15px rgba(212, 175, 55, 0.6) !important;
}

.choice-btn.selected .btn-info strong,
.choice-btn.selected .btn-info span {
  color: #FFF !important;
}

/* Page 14 Final Promise */
.thanks-stack {
  font-size: 1.05rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mobile-promise-box {
  background: var(--paper-blush);
  border: 1px solid var(--gold-foil);
  padding: 12px;
  margin: 10px 0;
  border-radius: 2px;
}

.promise-header {
  font-size: 0.7rem;
  letter-spacing: 1.5px;
  color: var(--gold-foil);
  margin-bottom: 2px;
}

.promise-text {
  font-size: 1.1rem;
  color: var(--ink-charcoal);
  line-height: 1.35;
}

.burgundy-text {
  color: var(--burgundy-deep);
  font-weight: 600;
  font-style: normal;
}

.signature {
  font-size: 1.8rem;
  color: var(--gold-foil);
}

/* FOOTER BUTTON CONTAINER & FULL-WIDTH ACTION BUTTONS */
.sheet-bottom {
  border-top: 1px solid rgba(184, 134, 11, 0.25);
  padding-top: 10px;
  margin-top: auto;
  flex-shrink: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  position: relative !important;
  z-index: 99998 !important;
}

.next-chapter-btn {
  width: 100%;
  min-height: 48px;
  background: var(--paper-cream);
  color: var(--ink-charcoal);
  border: 1px solid var(--gold-foil);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer !important;
  padding: 12px 18px;
  border-radius: 3px;
  position: relative !important;
  z-index: 99999 !important;
  touch-action: manipulation !important;
  pointer-events: auto !important;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: rgba(212, 175, 55, 0.4);
}

.next-chapter-btn:active {
  background: var(--burgundy-deep);
  color: #FFFFFF;
  border-color: var(--gold-accent);
  transform: scale(0.98);
}

.twist-btn {
  background: #2A211F !important;
  color: var(--gold-accent) !important;
  border-color: var(--gold-accent) !important;
}

.btn-sm {
  padding: 10px 16px;
  font-size: 0.78rem;
}

/* Desktop Scaling */
@media (min-width: 768px) {
  .journal-page {
    padding: 24px;
  }
  .paper-sheet {
    max-width: 580px;
    max-height: 640px;
    padding: 32px 28px;
  }
  .page-title {
    font-size: 2.2rem;
  }
  .page-body {
    font-size: 1.2rem;
    gap: 12px;
  }
}
