/* Immersive Story Viewer */
.story-viewer-fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #1a1a1a;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.5s ease;
  overflow: hidden;
}

.story-viewer-fullscreen.active {
  opacity: 1;
  visibility: visible;
}

/* Controls visibility transitions */
.story-viewer-fullscreen .story-floating-header,
.story-viewer-fullscreen .story-floating-nav,
.story-viewer-fullscreen .page-indicators-floating {
  transition: all 0.4s ease;
  opacity: 1;
}

/* Hide controls when controls-hidden class is added */
.story-viewer-fullscreen.controls-hidden .story-floating-header,
.story-viewer-fullscreen.controls-hidden .story-floating-nav,
.story-viewer-fullscreen.controls-hidden .page-indicators-floating {
  opacity: 0;
}

.story-viewer-fullscreen.controls-hidden .story-floating-header {
  transform: translateY(-100%);
}

.story-viewer-fullscreen.controls-hidden .story-floating-nav {
  transform: translateX(-50%) translateY(100%);
}

/* Always show controls on feedback page - except navigation */
.story-viewer-fullscreen.on-feedback-page .story-floating-header {
  opacity: 1 !important;
  transform: translateY(0) !important;
}

/* Hide ALL navigation during feedback for clean experience */
.story-viewer-fullscreen.on-feedback-page .story-floating-nav,
.story-viewer-fullscreen.on-feedback-page .page-indicators-floating {
  display: none !important;
}

/* Floating Header */
.story-floating-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-6) var(--space-8);
  background: linear-gradient(180deg, rgba(26, 26, 26, 0.9) 0%, transparent 100%);
  backdrop-filter: blur(12px);
  z-index: 1001;
}

.story-title {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: 600;
  color: white;
  margin: 0;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.story-close-btn {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-full);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-2xl);
  line-height: 1;
  padding: 0;
  padding-bottom: 2px; /* Slight adjustment for × character */
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
}

.story-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

/* Fullscreen Content */
.story-fullscreen-content {
  width: 100%;
  height: 100%;
  position: relative;
}

.story-pages-fullscreen {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.story-page {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  opacity: 0;
  transform: translateX(30px);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.story-page.active {
  opacity: 1;
  transform: translateX(0);
}

.page-image {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f5f1eb 0%, #e8e0d5 100%);
  overflow: hidden;
  position: relative;
}

.story-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.6);
  font-size: var(--text-sm);
}

/* Premium mobile image placeholder */
@media (max-width: 480px) {
  .image-placeholder {
    position: absolute;
    inset: 0;
    background: #1a1a1a;
    overflow: hidden;
  }
  
  .image-placeholder::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
      90deg,
      transparent 0%,
      rgba(255, 255, 255, 0.08) 50%,
      transparent 100%
    );
    animation: shimmer 2s ease-in-out infinite;
  }
  
  /* Ensure content stays on top */
  .image-placeholder .placeholder-icon,
  .image-placeholder p {
    position: relative;
    z-index: 1;
  }
}

.placeholder-icon {
  font-size: var(--text-4xl);
  margin-bottom: var(--space-2);
}

.page-text {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--space-10);
  background: linear-gradient(180deg, 
    var(--color-cream) 0%, 
    var(--color-linen) 50%, 
    var(--color-cream) 100%);
  min-height: 100%;
  position: relative;
  overflow: hidden;
}

.story-text {
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 3.5vw, 2.25rem);
  line-height: 1.6;
  color: var(--color-charcoal);
  margin: 0 auto;
  text-align: left;
  font-weight: 400;
  letter-spacing: 0.02em;
  word-spacing: 0.05em;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  max-width: 42em;
}

/* Age-specific story text styling */
.story-pages-fullscreen[data-age-group="tiny_tales"] .story-text {
  font-size: clamp(1.5rem, 3.5vw, 2.25rem);
  line-height: 1.7;
  max-width: 38em;
  letter-spacing: 0.03em;
  word-spacing: 0.08em;
}

.story-pages-fullscreen[data-age-group="big_kid_tales"] .story-text {
  font-size: clamp(1.2rem, 2.8vw, 1.8rem);
  line-height: 1.5;
  max-width: 48em;
  letter-spacing: 0.01em;
  word-spacing: 0.03em;
  margin-bottom: var(--space-6);
}
  width: 100%;
  animation: gentleFadeIn 0.8s ease-out;
}


.story-progress-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.progress-bar-floating {
  width: 120px;
  height: 3px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: white;
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
  width: 25%;
}

.page-counter-floating {
  font-size: var(--text-sm);
  color: white;
  font-weight: 500;
  min-width: 40px;
  text-align: center;
}

/* Page Indicators - Removed (not needed for mobile scroll or desktop) */

/* Story End Marker */
.story-end-marker {
  text-align: center;
  margin-top: var(--space-8);
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  color: var(--color-sage);
  font-style: italic;
  opacity: 0;
  animation: fadeInUp 1s ease 0.5s forwards;
}

/* Feedback Page Styles - Desktop Only */
@media (min-width: 481px) {
  .feedback-page {
    grid-template-columns: 1fr !important;
    background: linear-gradient(180deg, 
      #0f172a 0%, 
      #1e293b 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-8);
  }
  
  .feedback-card {
    background: rgba(253, 251, 247, 0.92);
    backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-2xl);
    padding: var(--space-12) var(--space-8);
    box-shadow: 
      0 20px 50px -12px rgba(0, 0, 0, 0.25),
      0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    text-align: center;
    position: relative;
    overflow: hidden;
  }
  
  .feedback-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(234, 179, 8, 0.1) 0%, transparent 70%);
    opacity: 0.5;
    animation: gentleFloat 20s ease-in-out infinite;
  }
  
  /* Desktop feedback buttons - high visibility */
  .feedback-page .feedback-actions .btn-primary {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8) !important;
    border: none !important;
    color: white !important;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    min-width: 200px;
  }
  
  .feedback-page .feedback-actions .btn-primary:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af) !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.5);
  }
  
  .feedback-page .feedback-actions .btn-secondary {
    background: rgba(255, 255, 255, 0.9) !important;
    border: 1px solid rgba(255, 255, 255, 0.8) !important;
    color: #1f2937 !important;
    font-weight: 600;
    backdrop-filter: blur(12px);
    min-width: 200px;
  }
  
  .feedback-page .feedback-actions .btn-secondary:hover {
    background: rgba(255, 255, 255, 1) !important;
    border-color: rgba(255, 255, 255, 1) !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  }
}

.feedback-content {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.feedback-title {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  color: #1f2937;
  margin-bottom: var(--space-8);
  position: relative;
  z-index: 1;
  text-shadow: none;
}

/* Star Rating */
.star-rating {
  display: flex;
  justify-content: center;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
  position: relative;
  z-index: 1;
  padding: var(--space-4) 0;
}

.star-btn {
  background: none;
  border: none;
  padding: var(--space-2);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  border-radius: var(--radius-lg);
  min-height: 56px;
  min-width: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.star-btn:hover {
  transform: scale(1.1) translateY(-1px);
}

.star-btn:active {
  transform: scale(1.1);
  transition: transform 0.1s ease;
}

.star-btn.filled .star {
  fill: #eab308;
  stroke: #eab308;
  filter: drop-shadow(0 2px 4px rgba(234, 179, 8, 0.3));
  animation: none;
}

.star {
  width: 48px;
  height: 48px;
  color: #d4d4d8;
  stroke: #d4d4d8;
  stroke-width: 1.5;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  filter: none;
}

.star-btn:hover .star {
  color: #f59e0b;
  stroke: #f59e0b;
  filter: drop-shadow(0 2px 4px rgba(245, 158, 11, 0.2));
  transform: none;
}

/* Sparkle container for multiple sparkles */
.star-sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
  display: none; /* Hide sparkles for cleaner look */
}

/* Sparkle animation for filled stars */
.star-btn.filled .star-sparkles::after,
.star-btn.filled .star-sparkles::before {
  content: '';
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--color-gold-warm);
  border-radius: 50%;
  pointer-events: none;
}

.star-btn.filled .star-sparkles::after {
  top: 8px;
  right: 12px;
  animation: sparkleFloat 1.5s ease-out;
  box-shadow: 0 0 6px var(--color-gold-warm);
}

.star-btn.filled .star-sparkles::before {
  top: 12px;
  left: 8px;
  animation: sparkleFloat 1.5s ease-out 0.3s;
  box-shadow: 0 0 6px var(--color-coral-mid);
}

/* Extra sparkles for high ratings - 4th and 5th stars */
.star-btn:nth-child(4).filled .star-sparkles span:nth-child(1),
.star-btn:nth-child(5).filled .star-sparkles span:nth-child(1) {
  position: absolute;
  top: 4px;
  left: 50%;
  width: 3px;
  height: 3px;
  background: var(--color-gold-bright);
  border-radius: 50%;
  animation: sparkleRadiate 1.2s ease-out;
}

.star-btn:nth-child(5).filled .star-sparkles span:nth-child(2) {
  position: absolute;
  bottom: 4px;
  right: 8px;
  width: 3px;
  height: 3px;
  background: var(--color-coral-deep);
  border-radius: 50%;
  animation: sparkleRadiate 1.4s ease-out 0.2s;
}

/* Ripple effect on click */
.star-btn::after {
  content: '';
  position: absolute;
  inset: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(234, 179, 8, 0.2);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.star-btn.ripple::after {
  animation: rippleEffect 0.6s ease-out;
}

/* Tooltip for star rating */
.star-btn[data-tooltip] {
  position: relative;
}

.star-btn[data-tooltip]::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: #1f2937;
  color: white;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  animation: none;
}

.star-btn[data-tooltip]:hover::before {
  opacity: 1;
  transform: translateX(-50%) translateY(-12px);
}

.feedback-message {
  font-family: var(--font-body);
  font-size: var(--text-lg);
  color: #6b7280;
  margin-bottom: var(--space-8);
  transition: all 0.3s ease;
  position: relative;
  z-index: 1;
}

.feedback-message.rated {
  color: #374151;
  font-weight: 600;
}

/* Feedback Actions */
.feedback-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-6);
  position: relative;
  z-index: 1;
}

.feedback-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-4);
  padding-top: var(--space-6);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  width: 100%;
}

.cta-text {
  font-size: var(--text-base);
  color: #6b7280;
  margin: 0;
}

/* Button improvements for feedback */
.feedback-actions .btn {
  min-width: 200px;
  position: relative;
  overflow: visible;
  font-size: var(--text-base); /* Ensure consistent button text size */
}

.feedback-page .feedback-actions .btn-secondary {
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: white;
  font-weight: 600; /* Match base .btn font weight for consistent text appearance */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.feedback-page .feedback-actions .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.35);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

/* Special styling for Create New Story button */
.feedback-page .feedback-actions #createNewBtn {
  background: transparent;
  border: 1.5px solid #9ca3af;
  color: #4b5563;
}

.feedback-page .feedback-actions #createNewBtn:hover {
  background: rgba(107, 114, 128, 0.08);
  border-color: #6b7280;
  color: #374151;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.feedback-page .feedback-actions #createNewBtn .btn-icon {
  filter: none;
  color: inherit;
}

.btn-icon {
  font-size: 1.2em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Read Again button with curved arrow */
.btn-read-again {
  background: linear-gradient(135deg, #1a5490, #2d7bc7);
  backdrop-filter: none;
  border: none;
  color: white;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.btn-read-again:hover {
  background: linear-gradient(135deg, #2d7bc7, #4a90e2);
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.btn-read-again .arrow-icon {
  width: 20px;
  height: 20px;
  transition: transform 0.3s ease;
}

.btn-read-again:hover .arrow-icon {
  transform: rotate(-180deg);
}

/* Confetti container */
.confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--confetti-color, #eab308);
  animation: confettiFall var(--fall-duration, 3s) linear forwards,
            confettiSway 0.5s ease-in-out infinite;
  animation-delay: var(--fall-delay, 0s);
}

/* Add animation for text */
@keyframes gentleFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Premium animations for mobile */
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(1.05);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Tablet Responsive - Keep existing page turner */
@media (max-width: 768px) and (min-width: 481px) {
  .story-page {
    grid-template-columns: 1fr;
  }
  
  .page-image {
    height: 40vh;
  }
  
  .page-text {
    padding: var(--space-6) var(--space-8);
  }
  
  .story-text {
    font-size: clamp(1.25rem, 4vw, 1.75rem);
    line-height: 1.5;
    max-width: 100%;
  }
  
  .feedback-card {
    padding: var(--space-8) var(--space-6);
  }
  
  .feedback-title {
    font-size: var(--text-2xl);
  }
  
  .star {
    width: 40px;
    height: 40px;
  }
}

/* Touch Gesture Styles */
.story-pages-fullscreen.touch-active {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.story-pages-fullscreen.swiping {
  transition: none;
}

/* Swipe hint indicators */
.story-pages-fullscreen.swipe-left-hint::before,
.story-pages-fullscreen.swipe-right-hint::before {
  content: '';
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1003;
  opacity: 0;
  animation: swipeHintPulse 0.6s ease-out;
  pointer-events: none;
  backdrop-filter: blur(8px);
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.story-pages-fullscreen.swipe-left-hint::before {
  left: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23374151' stroke-width='2'%3E%3Cpath d='M19 12H5M12 19l-7-7 7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 24px 24px;
}

.story-pages-fullscreen.swipe-right-hint::before {
  right: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23374151' stroke-width='2'%3E%3Cpath d='M5 12h14M12 5l7 7-7 7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 24px 24px;
}

/* Swipe progress feedback */
.story-pages-fullscreen.swiping .story-page.active {
  transform: translateX(calc(var(--swipe-direction, 0) * var(--swipe-progress, 0) * 20px));
  opacity: calc(1 - var(--swipe-progress, 0) * 0.3);
  transition: none;
}

/* Swipe hint pulse animation */
@keyframes swipeHintPulse {
  0% {
    opacity: 0;
    transform: translateY(-50%) scale(0.8);
  }
  50% {
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
  }
  100% {
    opacity: 0.8;
    transform: translateY(-50%) scale(1);
  }
}

/* Enhanced page transitions for mobile swipe */
@media (max-width: 768px) {
  .story-page {
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  }
  
  .story-pages-fullscreen.swiping .story-page {
    transition: none;
  }
}

/* Mobile Premium Storybook Experience */
@media (max-width: 480px) {
  /* Enable scrolling for mobile */
  .story-pages-fullscreen {
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    padding-bottom: 0;
    height: 100%;
  }
  
  /* Convert pages to vertical scroll */
  .story-page {
    position: relative;
    opacity: 1;
    transform: none;
    display: flex;
    flex-direction: column;
    height: auto;
    width: 100%;
    margin-bottom: 0;
    transition: none;
    background: var(--color-cream);
  }
  
  /* Full-width cinematic images */
  .page-image {
    width: 100%;
    height: 70vh;
    position: relative;
    overflow: hidden;
    order: 1;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f1eb 0%, #e8e0d5 100%);
  }
  
  .story-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    opacity: 0;
    transition: opacity 0.6s ease;
  }
  
  .story-image.loaded {
    opacity: 1 !important;
    animation: fadeInScale 0.6s ease-out;
  }
  
  /* Premium page curl effect */
  .page-image::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 120px;
    background: 
      radial-gradient(ellipse at top, transparent 65%, var(--color-cream) 100%),
      linear-gradient(to bottom, transparent 0%, var(--color-cream) 95%);
    pointer-events: none;
    z-index: 2;
  }
  
  /* Text as premium book pages */
  .page-text {
    order: 2;
    padding: var(--space-10) var(--space-6);
    background: var(--color-cream);
    position: relative;
    min-height: 50vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
  }
  
  .story-text {
    font-size: 1.125rem;
    line-height: 1.8;
    letter-spacing: 0.02em;
    color: var(--color-charcoal);
    max-width: 100%;
    position: relative;
    animation: none; /* Remove animation for mobile */
  }
  
  /* Drop cap for first page */
  .story-page:first-of-type .story-text::first-letter {
    float: left;
    font-size: 4rem;
    line-height: 3.5rem;
    padding: 0 0.5rem 0 0;
    margin-top: -0.25rem;
    font-weight: 600;
    color: var(--color-sage);
    font-family: var(--font-heading);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
  }
  
  /* Premium story dividers */
  .story-page:not(:last-child) .page-text::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    right: 20%;
    height: 1px;
    background: linear-gradient(
      to right,
      transparent,
      var(--color-sage) 20%,
      var(--color-sage) 80%,
      transparent
    );
    opacity: 0.3;
  }
  
  /* Hide navigation controls on mobile */
  .story-floating-nav {
    display: none;
  }
  
  /* Keep header visible but simplified and compact for mobile only */
  .story-floating-header {
    position: sticky;
    top: 0;
    background: rgba(253, 251, 247, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    z-index: 1002;
    transform: none;
    padding: var(--space-3) var(--space-4); /* Reduced from var(--space-6) var(--space-8) for mobile */
  }
  
  /* Compact mobile header elements */
  .story-floating-header .story-title {
    font-size: var(--text-lg); /* Reduced from var(--text-2xl) for mobile */
    color: var(--color-charcoal); /* Change to dark text on light background for mobile */
    text-shadow: none; /* Remove shadow for light background on mobile */
  }
  
  /* Compact mobile close button */
  .story-floating-header .story-close-btn {
    width: 48px; /* Slightly reduced from 56px for compactness on mobile */
    height: 48px; /* Slightly reduced from 56px for compactness on mobile */
    font-size: var(--text-2xl); /* Reduced from var(--text-3xl) for mobile */
    background: rgba(255, 255, 255, 0.9); /* More opaque for light background on mobile */
    color: var(--color-charcoal); /* Dark text instead of white for mobile */
    border: 1px solid rgba(0, 0, 0, 0.1); /* Add subtle border for definition on mobile */
  }
  
  /* Never hide controls on mobile via the old controls-hidden mechanism */
  .story-viewer-fullscreen.controls-hidden .story-floating-header {
    opacity: 1;
    transform: none;
  }
  
  /* Mobile scroll-based header auto-hide */
  .story-floating-header.scroll-hidden {
    transform: translateY(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  /* Ensure smooth transitions */
  .story-floating-header {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  /* Feedback page styling */
  .feedback-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: var(--color-cream);
    padding: var(--space-4);
    grid-template-columns: 1fr;
  }
  
  /* The End decoration - enhanced for mobile */
  .feedback-page::before {
    content: 'The End';
    position: absolute;
    top: var(--space-8);
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-style: italic;
    color: var(--color-sage);
    opacity: 0.6;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  }
  
  /* Enhanced mobile feedback page styling */
  .feedback-page::after {
    content: '';
    position: absolute;
    top: 0;
    left: 20%;
    right: 20%;
    height: 1px;
    background: linear-gradient(
      to right,
      transparent,
      var(--color-sage) 20%,
      var(--color-sage) 80%,
      transparent
    );
    opacity: 0.3;
  }
  
  .feedback-card {
    background: rgba(253, 251, 247, 0.92);
    backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-2xl);
    padding: var(--space-8) var(--space-6);
    margin: 0 var(--space-4);
    box-shadow: 
      0 20px 40px rgba(0, 0, 0, 0.15),
      0 0 0 1px rgba(255, 255, 255, 0.2) inset;
    text-align: center;
    position: relative;
    overflow: hidden;
  }
  
  /* Add subtle animated background for premium feel */
  .feedback-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(156, 163, 175, 0.08) 0%, transparent 70%);
    opacity: 0.6;
    animation: gentleFloat 25s ease-in-out infinite;
    pointer-events: none;
  }
  
  /* Ensure feedback content appears above animated background */
  .feedback-content,
  .feedback-title,
  .star-rating,
  .feedback-message,
  .feedback-actions {
    position: relative;
    z-index: 1;
  }
  
  /* Enhanced mobile feedback styling */
  .feedback-title {
    color: var(--color-charcoal);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  }
  
  .feedback-message {
    color: #6b7280;
    font-weight: 400;
  }
  
  .feedback-message.rated {
    color: #374151;
    font-weight: 600;
  }
  
  .feedback-actions .btn {
    min-width: 160px;
    min-height: 48px; /* Ensure minimum touch target height */
    font-size: var(--text-base);
    padding: var(--space-3) var(--space-4); /* Ensure adequate padding for touch */
  }
  
  /* Optimized star rating for mobile */
  .star-rating {
    gap: var(--space-2); /* Reduced gap for better mobile fit */
    padding: var(--space-6) var(--space-2); /* Add side padding to ensure proper spacing */
  }
  
  .star-btn {
    min-height: 60px; /* Exceeds 44px minimum touch target */
    min-width: 60px; /* Exceeds 44px minimum touch target */
    padding: var(--space-2); /* Optimized padding for mobile */
    border-radius: var(--radius-md); /* Slightly smaller radius for mobile */
  }
  
  .star {
    width: 36px; /* Slightly smaller for better mobile fit */
    height: 36px;
  }
}
