/* Choosi Quest - Modern Kids Adventure App Styles */
:root {
  /* Color Scheme - Light Mode */
  --primary: #0570b8;  /* Blue-Teal */
  --primary-dark: #048799;
  --secondary: #1499b1; /* Coral Pink */
  --secondary-dark: #386bad;
  --accent: #dd8fd7; /* Yellow */
  --bg-light: #ffffff; /* White Background */
  --bg-lighter: #f8f9fa; /* Light Gray Background */
  --card-bg: #ffffff; /* White Card Background */
  --text-dark: #333333;
  --text-medium: #555555;
  --text-light: #ffffff;
  --border-light: #eeeeee;
  --shadow-color: rgba(0, 0, 0, 0.08);
  
  /* Fonts */
  --font-main: 'Quicksand', sans-serif;
  --font-heading: 'Quicksand', sans-serif;
  
  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2.5rem;
  
  /* Border Radius */
  --radius-sm: 0.5rem;
  --radius-md: 1rem;
  --radius-lg: 1.5rem;
  
  /* Animations */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background: var(--bg-light);
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-md);
  overflow-x: hidden;
  position: relative;
}

/* Remove background animation */
body::before {
  display: none;
}

/* Stars background - remove */
.stars-background {
  display: none;
}

/* Container Styling */
.container {
  background: var(--bg-light);
  padding: var(--space-lg);
  width: 100%;
  max-width: 700px;
  margin: 0 auto;
  position: relative;
  display: flex;
  flex-direction: column;
  animation: container-intro 0.6s ease-out;
}

@keyframes container-intro {
  0% { transform: scale(0.98); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Title Container with Hamburger Menu */
.title-container {
  display: flex;
  align-items: center;
  margin-bottom: var(--space-lg);
  position: relative;
}

.hamburger-btn {
  background: transparent;
  border: none;
  color: var(--primary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: var(--space-sm);
  margin-right: var(--space-md);
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}

.hamburger-btn:hover {
  transform: scale(1.1);
}

/* Typography */
h1 {
  font-family: var(--font-heading);
  color: var(--primary);
  font-size: 2.5rem;
  text-align: center;
  position: relative;
  margin: var(--space-lg) 0;
  font-weight: 700;
}

.app-title {
  margin-bottom: var(--space-xl);
}

p.story-text {
  font-size: 1.25rem;
  line-height: 1.7;
  margin-bottom: var(--space-lg);
  color: var(--text-medium);
  text-shadow: none;
  animation: fade-in 0.5s ease-out;
  font-weight: 500;
}

@keyframes fade-in {
  0% { opacity: 0; transform: translateY(5px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Form Elements */
form {
  width: 100%;
}

.form-group {
  margin-bottom: var(--space-lg);
  animation: slide-up 0.4s ease-out;
  animation-fill-mode: both;
}

.form-group:nth-child(2) { animation-delay: 0.1s; }
.form-group:nth-child(3) { animation-delay: 0.2s; }

@keyframes slide-up {
  0% { opacity: 0; transform: translateY(20px); }
  100% { opacity: 1; transform: translateY(0); }
}

label {
  display: block;
  font-size: 1.1rem;
  margin-bottom: var(--space-sm);
  color: var(--primary);
  font-weight: 600;
}

input[type="text"] {
  width: 100%;
  padding: var(--space-md);
  border-radius: var(--radius-md);
  border: 2px solid var(--border-light);
  background-color: var(--bg-light);
  color: var(--text-dark);
  font-size: 1.1rem;
  font-family: var(--font-main);
  transition: all var(--transition-fast);
  height: 48px; /* Fixed height for alignment */
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.1);
  background-color: var(--bg-light);
}

input[type="text"]::placeholder {
  color: #c0c0c0;
}

.radio-group {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-sm);
}

.radio-option {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  cursor: pointer;
}

.radio-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.radio-custom {
  display: inline-block;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border-light);
  background: var(--bg-light);
  position: relative;
  transition: all var(--transition-fast);
}

.radio-option input[type="radio"]:checked + .radio-custom::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
  animation: radio-pop 0.3s ease;
}

@keyframes radio-pop {
  0% { transform: translate(-50%, -50%) scale(0); }
  50% { transform: translate(-50%, -50%) scale(1.2); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

.radio-option input[type="radio"]:checked + .radio-custom {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(5, 163, 184, 0.1);
}

.radio-label {
  font-size: 1.1rem;
  color: var(--text-dark);
}

.small-text {
  font-size: 0.9rem;
  color: var(--text-medium);
  margin-top: var(--space-xs);
  font-style: italic;
}

/* Buttons */
.btn {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: 1.2rem;
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 10px var(--shadow-color);
  outline: none;
  font-weight: 600;
  min-height: 54px; /* Ensure consistent height */
}

.btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0));
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}

.btn:hover::before {
  transform: translateX(100%);
}

.btn-primary {
  background: linear-gradient(to right, var(--primary), var(--primary-dark));
  color: white;
}

.btn-primary:hover {
  background: linear-gradient(to right, var(--primary-dark), var(--primary));
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(5, 163, 184, 0.2);
}

.btn-primary:active {
  transform: translateY(1px);
  box-shadow: 0 2px 5px rgba(5, 163, 184, 0.2);
}

.btn-secondary {
  background: linear-gradient(to right, var(--secondary), var(--secondary-dark));
  color: white;
}

.btn-secondary:hover {
  background: linear-gradient(to right, var(--secondary-dark), var(--secondary));
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(255, 107, 107, 0.2);
}

.btn-secondary:active {
  transform: translateY(1px);
  box-shadow: 0 2px 5px rgba(255, 107, 107, 0.2);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--border-light);
  color: var(--primary);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(5, 163, 184, 0.05);
}

.btn-block {
  display: block;
  width: 100%;
}

/* Choice Buttons */
.choices-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--bg-light);
  box-shadow: 0 -5px 15px var(--shadow-color);
  padding: var(--space-lg);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  z-index: 1000;
  transform: translateY(100%);
  transition: transform var(--transition-normal);
}

.choices-container.active {
  transform: translateY(0);
}

.choices-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

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

.choices-toggle {
  position: fixed;
  left: 0; /* Snap to left */
  right: 0; /* Snap to right */
  width: 100%; /* Full width */
  padding: var(--space-lg); /* Generous padding for a larger button feel */
  height: auto; /* Auto height based on padding and content */
  min-height: 5em;
  border-radius: 0; /* Remove pill shape for full width */
  background: linear-gradient(to right, var(--secondary), var(--secondary-dark)); /* Gradient */
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem; /* Adjusted font size */
  font-weight: bold;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 -3px 10px rgba(0, 0, 0, 0.15); /* Shadow for bottom button */
  z-index: 998;
  border: none;
  transition: all var(--transition-normal);
}

/* Desktop positioning - 100px from bottom */
@media (min-width: 769px) {
  .choices-toggle {
    bottom: 100px; /* Position higher on desktop */
  }
}

/* Mobile positioning - at bottom */
@media (max-width: 768px) {
  .choices-toggle {
    bottom: 0; /* Snap to bottom on mobile */
    padding: calc(var(--space-lg) * 1.5); /* 50% taller on mobile */
    font-size: 1.3rem;
  }
}

/* Small mobile adjustments */
@media (max-width: 480px) {
  .choices-toggle {
    padding: calc(var(--space-md) * 1.5); /* Adjusted padding but still 50% taller than normal */
    font-size: 1.1rem;
  }
}

.choices-toggle:hover {
  background: linear-gradient(to right, var(--secondary-dark), var(--secondary)); /* Shift gradient on hover */
  box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.2);
}

.choices-toggle:active {
  transform: translateY(1px); /* Slight press effect */
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.15);
}

/* Mobile adjustments for the new toggle button */
@media (max-width: 768px) {
  .choices-toggle {
    /* min-width: 160px; */
    /* height: 60px; */
    padding: var(--space-md); /* Adjust padding for mobile */
    font-size: 1.3rem;
    /* border-radius: 30px; */
  }
}

@media (max-width: 480px) {
  .choices-toggle {
    /* min-width: 140px; */
    /* height: 50px; */
    padding: var(--space-sm) var(--space-md); /* Further adjust padding */
    font-size: 1.1rem;
    /* border-radius: 25px; */
  }
}

.choice-button {
  width: 100%;
  text-align: left;
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  border: none;
  background: rgba(5, 163, 184, 0.05);
  border: 2px solid rgba(5, 163, 184, 0.1);
  color: var(--text-dark);
  font-family: var(--font-main);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
  font-weight: 500;
}

.choice-button:hover {
  transform: translateY(-3px);
  background: rgba(5, 163, 184, 0.08);
  border-color: var(--primary);
  box-shadow: 0 5px 15px rgba(5, 163, 184, 0.1);
}

.choice-button:active {
  transform: translateY(1px);
}

.choice-button::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--primary);
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.choice-button:hover::before {
  opacity: 1;
}

.choice-button .choice-number {
  background: var(--primary);
  color: white;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  margin-right: var(--space-sm);
  font-weight: bold;
}

/* Story Image */
.story-image-container {
  position: relative;
  width: 100%;
  margin-bottom: var(--space-lg);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 10px 30px var(--shadow-color);
  aspect-ratio: 4/3;
  display: flex;
  flex-direction: column; /* Allow button/placeholder to stack */
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(5, 163, 184, 0.05), rgba(5, 163, 184, 0.1));
  flex-shrink: 0;
  max-height: 40vh; /* Limit height on all devices */
  border: 1px solid var(--border-light);
}

/* Styles for when no image is present */
.story-image-container.no-image {
  aspect-ratio: unset; /* Remove fixed aspect ratio */
  min-height: auto; /* Allow shrinking */
  height: auto; /* Allow shrinking */
  max-height: none; /* Remove max height when no image */
  background: transparent; /* No placeholder background */
  border: none; /* No border when collapsed */
  box-shadow: none; /* No shadow when collapsed */
  padding: var(--space-sm) 0; /* Some padding around the button */
  margin-bottom: var(--space-sm); /* Less margin when collapsed */
}

.story-image-container.no-image .generate-image-btn {
  margin: 0; /* Remove default margin if only element */
  /* The button already uses btn-secondary, so colors are handled */
}

.story-image-container .image-placeholder,
.story-image-container .generate-image-btn {
  margin-top: var(--space-sm);
}

.generate-image-btn {
  padding: var(--space-sm) var(--space-md);
  font-size: 0.9rem;
  /* background: var(--secondary); Using btn-secondary class for this */
  /* color: white; */
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

/* .generate-image-btn:hover {
    background: var(--secondary-dark);
} */

.image-loading-spinner {
  display: flex; /* Changed from none by default, JS will handle visibility */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  text-align: center;
  color: var(--text-medium);
}

.image-loading-spinner .loading-spinner {
  width: 40px; /* Smaller spinner for image loading */
  height: 40px;
  border-width: 3px;
  margin-bottom: var(--space-sm);
}

.story-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform var(--transition-slow);
  position: absolute;
  top: 0;
  left: 0;
}

.story-image:hover {
  transform: scale(1.02);
}

.image-placeholder {
  background: linear-gradient(135deg, rgba(5, 163, 184, 0.05), rgba(5, 163, 184, 0.1));
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-medium);
  font-style: italic;
}

/* Hamburger Menu Drawer */
.menu-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100%;
  background: var(--card-bg);
  z-index: 2000;
  transform: translateX(-100%);
  transition: transform var(--transition-normal);
  box-shadow: 5px 0 25px var(--shadow-color);
  overflow-y: auto;
  border-right: 1px solid var(--border-light);
}

.menu-drawer.active {
  transform: translateX(0);
}

.menu-close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  background: transparent;
  border: none;
  color: var(--text-dark);
  font-size: 1.5rem;
  cursor: pointer;
}

.menu-content {
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.menu-content h3 {
  color: var(--primary);
  margin-bottom: var(--space-lg);
  font-family: var(--font-heading);
  padding-top: var(--space-md);
  font-weight: 700;
}

.menu-items {
  list-style: none;
  margin-bottom: var(--space-lg);
  flex-grow: 1;
}

.menu-item {
  padding: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  color: var(--text-dark);
  text-decoration: none;
  font-size: 1.1rem;
  transition: all var(--transition-fast);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-sm);
  cursor: pointer;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  font-family: var(--font-main);
  font-weight: 500;
}

.menu-item:hover {
  background: rgba(5, 163, 184, 0.05);
  color: var(--primary);
}

.menu-item i {
  width: 24px;
  text-align: center;
  color: var(--primary);
}

.menu-footer {
  margin-top: auto;
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-light);
  font-size: 0.9rem;
  color: var(--text-medium);
}

.menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(3px);
  z-index: 1999;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

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

/* Animations Library */
.animate-fade-in {
  animation: fade-in 0.5s ease-out;
}

.animate-bounce {
  animation: bounce 1s ease infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.animate-pulse {
  animation: pulse 2s ease infinite;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* Menu Controls */
.menu-controls {
  position: fixed;
  top: var(--space-md);
  right: var(--space-md);
  z-index: 100;
  display: flex;
  gap: var(--space-sm);
}

.menu-btn {
  background: var(--card-bg);
  backdrop-filter: blur(5px);
  border: none;
  color: var(--primary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 3px 10px var(--shadow-color);
  border: 1px solid var(--border-light);
}

.menu-btn:hover {
  background: var(--primary);
  color: var(--text-light);
}

/* Character Profile Sidebar */
.character-profile {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: 300px;
  background: var(--card-bg);
  padding: var(--space-lg);
  transform: translateX(-100%);
  transition: transform var(--transition-normal);
  z-index: 1000;
  box-shadow: 0 0 20px var(--shadow-color);
  overflow-y: auto;
  border-right: 1px solid var(--border-light);
}

.character-profile.active {
  transform: translateX(0);
}

.profile-close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  background: transparent;
  border: none;
  color: var(--text-dark);
  font-size: 1.5rem;
  cursor: pointer;
}

.profile-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--primary);
  margin: 0 auto var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: white;
  box-shadow: 0 5px 15px rgba(5, 163, 184, 0.2);
}

.profile-name {
  font-family: var(--font-heading);
  color: var(--primary);
  font-size: 1.5rem;
  text-align: center;
  margin-bottom: var(--space-md);
  font-weight: 700;
}

.profile-stats {
  margin-bottom: var(--space-lg);
}

.profile-stat {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-xs);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--border-light);
  color: var(--text-dark);
}

.profile-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
  z-index: 999;
}

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

/* Inventory System */
.inventory-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.inventory-item {
  aspect-ratio: 1;
  background: rgba(5, 163, 184, 0.05);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  position: relative;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid var(--border-light);
}

.inventory-item:hover {
  background: rgba(5, 163, 184, 0.1);
}

.inventory-item.has-item {
  border: 1px solid var(--primary);
}

.item-count {
  position: absolute;
  bottom: 2px;
  right: 2px;
  background: var(--primary);
  color: white;
  font-size: 0.7rem;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Item Details Modal */
.item-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: var(--card-bg);
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px var(--shadow-color);
  width: 90%;
  max-width: 400px;
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition-normal);
  border: 1px solid var(--border-light);
}

.item-modal.active {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.modal-close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  background: transparent;
  border: none;
  color: var(--text-dark);
  font-size: 1.2rem;
  cursor: pointer;
}

.modal-title {
  color: var(--primary);
  margin-bottom: var(--space-md);
  padding-right: var(--space-xl);
  font-weight: 700;
}

.modal-description {
  margin-bottom: var(--space-lg);
  color: var(--text-medium);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
  z-index: 1050;
}

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

/* Accessibility */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Loading State */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

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

.loading-spinner {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 4px solid transparent;
  border-top-color: var(--primary);
  border-right-color: var(--accent);
  border-bottom-color: var(--secondary);
  animation: spin 1.5s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Achievements Popup */
.achievement-popup {
  position: fixed;
  bottom: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  box-shadow: 0 5px 15px rgba(5, 163, 184, 0.2);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  transition: bottom var(--transition-normal);
  z-index: 900;
  color: var(--text-light);
}

.achievement-popup.show {
  bottom: var(--space-lg);
}

.achievement-icon {
  background: var(--text-light);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--primary);
}

.achievement-details {
  flex: 1;
}

.achievement-title {
  font-weight: bold;
  margin-bottom: 2px;
}

.achievement-desc {
  font-size: 0.9rem;
  opacity: 0.8;
}

/* Mobile specific adjustments */
@media (max-width: 768px) {
  body {
    padding: 0;
    overflow: auto; /* Allow scrolling on body */
    position: static; /* Remove fixed position */
    height: auto; /* Auto height instead of 100% */
  }
  
  html {
    overflow: auto; /* Allow scrolling on html */
  }
  
  .container {
    padding: var(--space-md);
    max-width: 100%;
    width: 100%;
    margin: 0;
    height: auto; /* Auto height instead of 100vh */
    min-height: 100vh; /* Ensure it still fills the viewport */
    overflow-y: auto; /* Allow scrolling inside container */
  }
  
  .app-title {
    font-size: 2rem;
    margin-top: var(--space-lg);
    margin-bottom: var(--space-lg);
    text-align: center;
  }
  
  .story-text {
    font-size: 1.1rem;
    margin-bottom: var(--space-md);
    flex-shrink: 1; /* Allow text to shrink if needed */
    overflow-y: auto; /* Allow scrolling within text if it's too long */
  }
  
  .choice-button {
    padding: var(--space-md);
    font-size: 1rem;
  }
  
  /* Make story image smaller on mobile to fit more content */
  .story-image-container {
    margin-bottom: var(--space-md);
    flex-shrink: 0; /* Prevent image from shrinking */
    max-height: 30vh; /* Limit height to 30% of viewport */
  }
  
  /* Ensure choices container doesn't overflow */
  .choices-container {
    padding: var(--space-md);
    margin-bottom: 0;
  }
  
  .menu-controls {
    top: var(--space-sm);
    right: var(--space-sm);
  }
  
  .menu-drawer {
    width: 260px;
  }
  
  .achievement-popup {
    width: 90%;
    max-width: 300px;
  }
  
  .title-container {
    margin-bottom: var(--space-md);
    flex-shrink: 0; /* Prevent title from shrinking */
  }
  
  .hamburger-btn {
    font-size: 1.3rem;
  }
  
  .app-title.animate-pulse {
    animation: pulse 2s ease infinite;
    min-height: auto;
    margin-bottom: var(--space-md);
  }
  
  @keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.03); }
    100% { transform: scale(1); }
  }
  
  /* Ensure the form has enough space at the bottom */
  form {
    margin-bottom: var(--space-xl);
  }
  
  /* Button padding and bottom margin */
  .btn-block {
    margin-bottom: var(--space-lg);
    padding-bottom: calc(var(--space-md) + 5px); /* Extra padding for touch */
  }
  
  /* Add more bottom padding to container */
  .container {
    padding-bottom: calc(var(--space-lg) + var(--space-lg));
  }
  
  /* Ensure app info doesn't get cut off */
  .app-info {
    margin-top: auto;
    padding-top: var(--space-md);
    padding-bottom: var(--space-md);
  }
}

/* For very small devices */
@media (max-width: 480px) {
  body {
    padding: 0;
    -webkit-overflow-scrolling: touch; /* Enable smooth scrolling on iOS */
    overscroll-behavior-y: contain; /* Prevent page overscroll but allow refresh */
  }
  
  .container {
    padding: var(--space-sm);
    height: auto;
    min-height: 100vh;
  }
  
  h1 {
    font-size: 1.5rem;
  }
  
  /* Audio controls - REMOVED
  .audio-controls {
    bottom: calc(var(--space-sm) + 50px);
    transform: scale(0.9);
    transform-origin: bottom left;
  }
  */
}

/* Print Styles */
@media print {
  body {
    background: white;
    color: #000;
  }
  
  .container {
    box-shadow: none;
    margin: 0;
    padding: 0;
  }
  
  .menu-controls,
  .audio-controls,
  .hamburger-btn,
  .choice-button {
    display: none;
  }
}

/* Theme Selection Styling */
.theme-selection {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-sm);
  flex-wrap: wrap;
}

.theme-option {
  flex: 1;
  min-width: 100px;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: var(--space-sm);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.theme-option input[type="radio"] {
  position: absolute;
  opacity: 0;
}

.theme-option.active {
  border-color: var(--primary);
  background: rgba(5, 163, 184, 0.05);
  box-shadow: 0 3px 10px rgba(5, 163, 184, 0.1);
}

.theme-icon {
  font-size: 1.5rem;
  color: var(--primary);
  margin-bottom: var(--space-xs);
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-medium);
}

.theme-option.active .theme-label {
  color: var(--primary);
}

.theme-option:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(5, 163, 184, 0.1);
}

/* Responsive adjustments for setup page */
@media (max-width: 600px) {
  .form-row {
    flex-direction: column;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
  }
  
  .theme-selection {
    gap: var(--space-sm);
  }
  
  .theme-option {
    padding: var(--space-xs);
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  
  .theme-icon {
    font-size: 1.2rem;
    margin-bottom: 2px;
    height: 1.5rem;
  }
  
  .theme-label {
    font-size: 0.8rem;
  }
}

/* Mobile-specific enhancements */
body.mobile-device .app-title {
  margin-top: var(--space-sm);
  margin-bottom: var(--space-md);
  font-size: 2rem;
  padding: var(--space-xs) 0;
  min-height: auto;
  height: auto;
}

body.mobile-device .container {
  display: flex;
  flex-direction: column;
  height: auto;
  min-height: 95vh; /* Increase to ensure no cutoff */
  max-height: 95vh;
  justify-content: flex-start;
  padding-bottom: var(--space-xl); /* Extra padding at bottom */
}

body.mobile-device form {
  flex: 1;
  display: flex;
  flex-direction: column;
}

body.mobile-device .btn-block {
  margin-top: auto;
  position: relative;
  padding: var(--space-md);
  font-size: 1.1rem;
  margin-bottom: var(--space-xl); /* More bottom margin */
  height: 54px; /* Restore original height */
}

body.mobile-device .app-info {
  margin-top: var(--space-md);
  padding-bottom: var(--space-xl); /* Extra bottom padding */
}

body.mobile-device .form-group:last-of-type {
  margin-bottom: var(--space-xl);
}

body.mobile-device .theme-selection {
  margin-bottom: var(--space-md);
}

/* Mobile spacer for button positioning */
.mobile-spacer {
  display: none;
}

body.mobile-device .mobile-spacer {
  display: block;
  flex: 1;
  min-height: 40px; /* Increased height for better spacing */
}

/* Make sure mobile devices have adequate space */
@media (max-width: 480px) {
  body.mobile-device .mobile-spacer {
    min-height: 50px; /* Even more space on smaller devices */
  }
  
  body.mobile-device .btn-block {
    margin-bottom: var(--space-xl);
    height: 54px; /* Maintain height on small devices */
  }
  
  body.mobile-device .container {
    margin-bottom: var(--space-xl);
    overflow-y: auto;
    padding-bottom: calc(var(--space-xl) * 1.5); /* Extra bottom padding */
  }
  
  body.mobile-device .app-info {
    margin-bottom: var(--space-xl);
  }
  
  /* Prevent overflow on the bottom */
  body.mobile-device {
    padding-bottom: var(--space-xl);
  }
}

/* Inline fields for better mobile layout */
.inline-field {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.inline-field label {
  margin-bottom: 0;
  white-space: nowrap;
  font-size: 1rem;
  min-width: 80px; /* Ensures alignment */
}

.inline-field input[type="text"] {
  flex: 1;
}

.inline-field .radio-group {
  margin-top: 0;
  display: flex;
  align-items: center;
}

/* Responsive adjustments for setup page */
@media (max-width: 600px) {
  .form-row {
    gap: var(--space-xs);
    margin-bottom: var(--space-md);
  }
  
  .inline-field {
    flex: 1;
    min-width: 0;
    gap: var(--space-xs);
  }
  
  .inline-field label {
    font-size: 0.9rem;
    min-width: 60px;
  }
  
  .inline-field input[type="text"] {
    padding: var(--space-sm);
    height: 42px;
    font-size: 1rem;
  }
  
  .radio-option {
    padding: 0 var(--space-xs);
  }
  
  .radio-label {
    font-size: 0.9rem;
  }
  
  .radio-custom {
    width: 20px;
    height: 20px;
  }
}

/* Setup form container */
.setup-form-container {
  background: transparent;
  padding: 0;
  margin-top: 0;
  margin-bottom: var(--space-lg);
}

/* Input row styling */
.input-row {
  margin-bottom: var(--space-md);
}

.input-row label {
  display: block;
  font-weight: 600;
  margin-bottom: var(--space-xs);
  color: var(--primary);
}

.input-row input[type="text"] {
  width: 100%;
  padding: var(--space-md);
  height: 48px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  font-size: 1.1rem;
  background: #fafafa;
}

.input-row input[type="text"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(5, 112, 184, 0.1);
  outline: none;
}

/* Radio group styling */
.radio-group {
  display: flex;
  gap: var(--space-md);
}

.radio-option {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) 0;
}

/* Theme selection styling */
.theme-selection {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.theme-option {
  flex: 1;
  min-width: 80px;
  max-width: 120px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: var(--space-sm);
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: #fafafa;
}

.theme-option.active {
  border-color: var(--primary);
  background: rgba(5, 112, 184, 0.05);
}

.theme-icon {
  font-size: 1.5rem;
  color: var(--primary);
  margin-bottom: var(--space-xs);
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-label {
  font-size: 0.9rem;
  font-weight: 600;
}

/* Button styling */
.btn-block {
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  font-size: 1.2rem;
  height: 54px;
  margin-top: var(--space-lg);
  margin-bottom: var(--space-md);
  border-radius: 30px;
  background: linear-gradient(to right, var(--primary), var(--primary-dark));
}

.btn-block:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(5, 112, 184, 0.2);
}

/* App info */
.app-info {
  text-align: center;
  margin-top: auto;
  padding: var(--space-lg) 0;
  color: var(--text-medium);
}

.version {
  font-size: 0.8rem;
  margin-top: var(--space-xs);
  opacity: 0.7;
}

/* Mobile specific adjustments */
@media (max-width: 768px) {
  .container {
    padding: var(--space-md);
    max-height: none;
    height: auto;
    margin: var(--space-sm);
    width: calc(100% - var(--space-sm) * 2);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
  }
  
  .app-title {
    font-size: 2rem;
    margin-top: var(--space-sm);
    margin-bottom: var(--space-md);
    height: auto;
  }
  
  .input-row {
    margin-bottom: var(--space-sm);
  }
  
  .input-row label {
    font-size: 1rem;
  }
  
  .input-row input[type="text"] {
    padding: var(--space-sm);
    height: 42px;
    font-size: 1rem;
  }
  
  .radio-group {
    gap: var(--space-sm);
  }
  
  .radio-option {
    padding: var(--space-xs);
  }
  
  .theme-selection {
    gap: var(--space-xs);
  }
  
  .theme-option {
    min-width: 70px;
    padding: var(--space-xs);
  }
  
  .theme-icon {
    font-size: 1.2rem;
    margin-bottom: 2px;
    height: 1.5rem;
  }
  
  .theme-label {
    font-size: 0.8rem;
  }
  
  .btn-block {
    margin-top: var(--space-md);
    height: 54px;
    padding: var(--space-sm) var(--space-md);
  }
  
  .app-info {
    margin-top: auto;
    padding: var(--space-md);
    padding-bottom: calc(var(--space-xl) + var(--space-md));
  }
  
  body {
    padding-bottom: var(--space-xl);
    max-height: 100vh;
    overflow: hidden;
  }
}

/* For very small devices */
@media (max-width: 480px) {
  .container {
    padding: var(--space-sm);
  }
  
  .setup-form-container {
    padding: var(--space-sm);
  }
  
  .app-title {
    font-size: R1.5rem;
    margin-bottom: var(--space-sm);
  }
  
  .app-info {
    padding-bottom: calc(var(--space-xl) + var(--space-xl));
  }
}

/* Page Navigation Styles */
.page-navigation {
  position: absolute;
  bottom: 0;
  left: 0;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: var(--space-sm);
  background-color: rgba(0, 0, 0, 0.7);
  padding: var(--space-sm) var(--space-md);
  z-index: 10;
  width: 100%;
  height: 30%; /* Cover ~30% of the image height */
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.3) 70%, transparent 100%);
  padding-top: 15%; /* Push controls to bottom of gradient */
}

.nav-arrow {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--primary);
  color: white;
  border-radius: 50%;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  margin-left: var(--space-sm);
}

.nav-arrow:hover {
  transform: scale(1.1);
  background-color: var(--primary-dark);
}

.nav-arrow.disabled {
  background-color: #555;
  cursor: not-allowed;
  opacity: 0.5;
  pointer-events: none;
}

.page-indicator {
  color: white;
  font-weight: bold;
  padding: 0 var(--space-sm);
  font-size: 1rem;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* Menu item header styling */
.menu-item-header {
  color: var(--primary);
  font-weight: bold;
  padding: var(--space-sm) var(--space-md);
  margin-top: var(--space-md);
  border-bottom: 1px solid var(--border-light);
  font-size: 0.9rem;
  text-transform: uppercase;
}

.menu-item.active {
  background-color: rgba(5, 112, 184, 0.1);
  color: var(--primary);
  font-weight: bold;
} 