/* ===== CSS Variables ===== */
:root {
  /* Colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafb;
  --text-primary: #2d3748;
  --text-secondary: #4a5568;
  --accent-primary: #5d9ca5;
  --accent-secondary: #373f63;
  --accent-hover: #4a7f87;
  --shadow: rgba(0, 0, 0, 0.1);
  --overlay: rgba(0, 0, 0, 0.5);
  
  /* Spacing - Unified spacing system */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;
  --spacing-uniform: 1.75rem; /* Uniform spacing for header and buttons */
  
  /* Transitions - Smoothed out */
  --transition-fast: 200ms ease-out;
  --transition-normal: 350ms ease-out;
  --transition-slow: 500ms ease-out;
  --transition-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Border Radius - Standardized */
  --radius-sm: 0.375rem;
  --radius-md: 12px;
  --radius-lg: 12px;
  
  /* Standard Border */
  --border-width: 2px;
  --border-radius: 12px;
}

/* Dark Theme */
[data-theme="dark"] {
  --bg-primary: #1a202c;
  --bg-secondary: #2d3748;
  --text-primary: #f7fafc;
  --text-secondary: #e2e8f0;
  --accent-primary: #81c3cc;
  --accent-secondary: #9ca3d4;
  --shadow: rgba(0, 0, 0, 0.3);
}

/* High Contrast Theme - FIXED FOR BLACK TEXT/BORDERS */
[data-theme="high-contrast"] {
  --bg-primary: #ffffff;
  --bg-secondary: #ffffff;
  --text-primary: #111111;
  --text-secondary: #111111;
  --accent-primary: #5d9ca5;
  --accent-secondary: #111111;
  --shadow: none;
}

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

*,
*::before,
*::after {
  border: none;
  outline: none;
}

html {
  height: 100%;
  background-color: #e0e0e0;
}

/* ===== Aurora Northern Lights Background ===== */
.aurora-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(180deg, 
    rgba(237, 252, 253, 0.2) 0%, 
    rgba(224, 247, 250, 0.15) 100%
  );
}

.aurora-layer {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0.25;
  mix-blend-mode: normal;
  filter: blur(80px);
}

/* Soft, organic blob-like aurora layers */
.aurora-layer-1 {
  background: 
    radial-gradient(ellipse 800px 600px at 20% 30%, rgba(93, 156, 165, 0.3) 0%, transparent 60%),
    radial-gradient(ellipse 600px 500px at 70% 50%, rgba(93, 156, 165, 0.2) 0%, transparent 55%);
  animation: aurora-float-1 40s ease-in-out infinite;
}

.aurora-layer-2 {
  background: 
    radial-gradient(ellipse 700px 550px at 60% 40%, rgba(129, 195, 204, 0.25) 0%, transparent 58%),
    radial-gradient(ellipse 500px 450px at 30% 70%, rgba(129, 195, 204, 0.18) 0%, transparent 52%);
  animation: aurora-float-2 45s ease-in-out infinite;
  animation-delay: -10s;
}

.aurora-layer-3 {
  background: 
    radial-gradient(ellipse 650px 500px at 50% 35%, rgba(156, 163, 212, 0.2) 0%, transparent 55%),
    radial-gradient(ellipse 550px 480px at 80% 65%, rgba(156, 163, 212, 0.15) 0%, transparent 50%);
  animation: aurora-float-3 50s ease-in-out infinite;
  animation-delay: -20s;
}

.aurora-layer-4 {
  background: 
    radial-gradient(ellipse 900px 700px at 40% 60%, rgba(224, 247, 250, 0.25) 0%, transparent 62%),
    radial-gradient(ellipse 600px 520px at 85% 40%, rgba(224, 247, 250, 0.18) 0%, transparent 54%);
  animation: aurora-float-4 38s ease-in-out infinite;
  animation-delay: -30s;
}

.aurora-shimmer {
  position: absolute;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(ellipse 1000px 800px at 50% 50%, rgba(255, 255, 255, 0.04) 0%, transparent 65%);
  animation: aurora-pulse 15s ease-in-out infinite;
  filter: blur(100px);
}

/* Gentle, slow floating animations - like clouds */
@keyframes aurora-float-1 {
  0%, 100% {
    transform: translate(0%, 0%) scale(1);
  }
  25% {
    transform: translate(3%, -2%) scale(1.05);
  }
  50% {
    transform: translate(-2%, 3%) scale(0.98);
  }
  75% {
    transform: translate(2%, -1%) scale(1.02);
  }
}

@keyframes aurora-float-2 {
  0%, 100% {
    transform: translate(0%, 0%) scale(1);
  }
  30% {
    transform: translate(-3%, 2%) scale(1.03);
  }
  60% {
    transform: translate(2%, -2%) scale(0.97);
  }
}

@keyframes aurora-float-3 {
  0%, 100% {
    transform: translate(0%, 0%) scale(1);
  }
  35% {
    transform: translate(2%, 3%) scale(1.04);
  }
  70% {
    transform: translate(-1%, -2%) scale(0.99);
  }
}

@keyframes aurora-float-4 {
  0%, 100% {
    transform: translate(0%, 0%) scale(1);
  }
  40% {
    transform: translate(-2%, -3%) scale(1.02);
  }
  80% {
    transform: translate(3%, 1%) scale(0.98);
  }
}

@keyframes aurora-pulse {
  0%, 100% { 
    opacity: 0.2;
    transform: scale(1);
  }
  50% { 
    opacity: 0.35;
    transform: scale(1.05);
  }
}

body {
  font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(
    135deg,
    rgba(93, 156, 165, 0.4) 0%,
    rgba(237, 252, 253, 0.3) 50%,
    rgba(224, 247, 250, 0.4) 100%
  );
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  height: auto; /* Add this line */
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  position: relative;
  overflow-y: auto; /* Add this line */
}

[data-theme="high-contrast"] body {
  background-color: #333333;
}

/* ===== App Container ===== */
.app-container {
  border: 2px solid rgba(93, 156, 165, 0.4);
  border-radius: var(--border-radius);
  background: rgba(255, 255, 255, 0.98); /* Solid white background */
  backdrop-filter: none; /* Remove blur */
  -webkit-backdrop-filter: none; /* Remove blur */
  box-shadow: 
    0 8px 32px 0 rgba(93, 156, 165, 0.25),
    0 20px 60px 0 rgba(93, 156, 165, 0.15),
    0 2px 8px 0 rgba(255, 255, 255, 0.8) inset,
    0 0 0 1px rgba(255, 255, 255, 0.1) inset;
  box-sizing: border-box;
  overflow: visible;
  padding: 40px;
  padding-top: 30px;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
}

[data-theme="dark"] .app-container {
  background: rgba(26, 32, 44, 0.85);
  border-color: rgba(129, 195, 204, 0.3);
  box-shadow: 
    0 8px 32px 0 rgba(0, 0, 0, 0.4),
    0 2px 8px 0 rgba(129, 195, 204, 0.1) inset,
    0 0 0 1px rgba(129, 195, 204, 0.2) inset;
}

[data-theme="high-contrast"] .app-container {
  background: white;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 2px solid #333333;
  box-shadow: none;
}

/* ===== Skip Navigation ===== */
.skip-nav {
  position: absolute;
  left: -9999px;
  top: -9999px;
  width: 0;
  height: 0;
  font-size: 0;
  line-height: 0;
  overflow: hidden;
  border: none;
  margin: 0;
  padding: 0;
  background: transparent;
  color: transparent;
}

.skip-nav:focus {
  position: absolute;
  left: 10px;
  top: 10px;
  width: auto;
  height: auto;
  padding: var(--spacing-xs) var(--spacing-sm);
  background: var(--accent-primary);
  color: white;
  text-decoration: none;
  border-radius: var(--border-radius);
  z-index: 10000;
  font-size: 1rem;
  line-height: normal;
}

/* ===== Header ===== */
header {
  background: rgba(255, 255, 255, 0.98); /* Solid white background */
  backdrop-filter: none; /* Remove blur */
  -webkit-backdrop-filter: none; /* Remove blur */
  padding: var(--spacing-lg) var(--spacing-md);
  text-align: center;
  position: relative;
  z-index: 2;
  border-radius: var(--border-radius);
  border: 2px solid rgba(93, 156, 165, 0.2);
  box-shadow: 
    0 4px 16px 0 rgba(93, 156, 165, 0.1),
    0 1px 2px 0 rgba(255, 255, 255, 0.8) inset;
  margin: 0 auto var(--spacing-uniform);
  max-width: 800px;
  width: 100%;
  transition: all var(--transition-normal);
}

[data-theme="dark"] header {
  background: rgba(45, 55, 72, 0.4);
  border-color: rgba(129, 195, 204, 0.2);
  box-shadow: 
    0 4px 16px 0 rgba(0, 0, 0, 0.2),
    0 1px 2px 0 rgba(129, 195, 204, 0.1) inset;
}

[data-theme="high-contrast"] header {
  background: white;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 2px solid #333333;
  box-shadow: none;
}

/* Top navigation bar */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-lg);
  width: 100%;
}

/* Back to NarcTrauma Link */
.back-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: var(--spacing-xs) var(--spacing-sm);
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.9) 0%,
    rgba(245, 253, 254, 0.9) 100%
  );
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(93, 156, 165, 0.4);
  border-radius: var(--border-radius);
  transition: all var(--transition-fast);
  min-height: 44px;
  min-width: fit-content;
  box-shadow: 
    0 2px 8px rgba(93, 156, 165, 0.1),
    0 1px 2px 0 rgba(255, 255, 255, 0.9) inset;
}

.back-link:hover {
  background: linear-gradient(
    135deg,
    rgba(93, 156, 165, 0.9) 0%,
    rgba(93, 156, 165, 0.8) 100%
  );
  color: white;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(93, 156, 165, 0.3);
}

/* HIGH CONTRAST FIX - Back Link */
[data-theme="high-contrast"] .back-link {
  color: #111111;
  background: white;
  border: 2px solid #333333;
}

[data-theme="high-contrast"] .back-link:hover {
  background: #f0f0f0;
  color: #111111;
}

/* Theme toggle button */
.icon-btn {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.9) 0%,
    rgba(245, 253, 254, 0.9) 100%
  );
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(93, 156, 165, 0.4);
  border-radius: var(--border-radius);
  padding: var(--spacing-xs) var(--spacing-sm);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  white-space: nowrap;
  min-height: 44px;
  min-width: fit-content;
  color: var(--text-primary);
  box-shadow: 
    0 2px 8px rgba(93, 156, 165, 0.1),
    0 1px 2px 0 rgba(255, 255, 255, 0.9) inset;
}

.icon-btn:hover {
  background: linear-gradient(
    135deg,
    rgba(93, 156, 165, 0.9) 0%,
    rgba(93, 156, 165, 0.8) 100%
  );
  color: white;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(93, 156, 165, 0.3);
}

/* HIGH CONTRAST FIX - Theme Toggle Button */
[data-theme="high-contrast"] .icon-btn {
  color: #111111;
  background: white;
  border: 2px solid #333333;
}

[data-theme="high-contrast"] .icon-btn:hover {
  background: #f0f0f0;
  color: #111111;
}

/* Theme label with prefix */
.theme-label {
  font-size: 0.875rem;
  font-weight: 500;
  margin: 0;
}

.theme-label::before {
  content: "Theme: ";
  font-weight: 500;
  opacity: 0.9;
}

/* Logo Container */
.logo-link {
  display: inline-block;
  text-decoration: none;
  position: relative;
  max-width: 100%; /* Prevent overflow */
  margin: 0 auto;
}

.logo-container {
  width: 360px;
  height: 240px;
  margin: 0 auto var(--spacing-sm);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition-normal);
}

/* Hide the logo hover text completely */
.logo-hover-text {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Remove hover effects from logo container */
.logo-container:hover {
  transform: none !important; /* Remove scale effect */
}

.logo-link:hover .logo-container {
  transform: none !important; /* Remove scale effect on link hover */
}

.logo {
  max-width: 100%;
  height: auto;
  max-height: 100%;
  display: block;
  border-radius: var(--border-radius);
  transition: opacity var(--transition-normal);
  object-fit: contain; /* Ensures image scales properly */
}

/* Title */
header h1 {
  font-family: 'Forum', serif;
  font-size: 2.67rem;
  font-weight: 400;
  color: var(--accent-secondary);
  letter-spacing: 0.05em;
}

/* HIGH CONTRAST FIX - Title */
[data-theme="high-contrast"] header h1 {
  color: #111111;
}

/* ===== Main Content ===== */
main {
  padding: 0;
  max-width: 800px;
  margin: 0 auto;
  flex: 1;
  width: 100%;
  background-color: transparent;
}

.button-container {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-uniform); /* Uniform spacing between buttons */
  padding: 0;
  margin: 0;
}

.button-group {
  width: 100%;
  margin: 0;
  padding: 0;
}

/* ===== Main Buttons ===== */
.main-btn {
  font-family: 'Forum', serif;
  width: 100%;
  padding: var(--spacing-md) var(--spacing-lg);
  background-color: var(--accent-primary);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  font-size: 1.2rem;
  font-weight: 400;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
  min-height: 56px;
  margin: 0;
}

.main-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.main-btn:hover::before {
  left: 100%;
}

.main-btn:hover {
  background-color: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px var(--shadow);
}

.main-btn.active {
  background-color: var(--accent-secondary);
}

.arrow {
  transition: transform 400ms var(--transition-smooth);
  font-size: 0.8em;
  display: inline-block;
  transform-origin: center;
}

.main-btn.active .arrow {
  transform: rotate(180deg);
}

.sub-buttons {
  margin-top: var(--spacing-md);
  display: grid !important;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-10px);
  transition: 
    max-height 600ms var(--transition-smooth),
    opacity 400ms var(--transition-smooth),
    transform 400ms var(--transition-smooth),
    margin 400ms var(--transition-smooth);
  padding: 0;
  visibility: hidden;
  background: transparent;
}
.sub-buttons.show {
  display: grid !important;
  max-height: 300px;
  opacity: 1;
  transform: translateY(0);
  padding: 3px;
  visibility: visible;
  background: rgba(255, 255, 255, 0.95); /* Solid white background */
  backdrop-filter: none; /* Remove blur effect */
  -webkit-backdrop-filter: none; /* Remove blur effect */
  border-radius: 8px;
  border: 1px solid rgba(93, 156, 165, 0.15); /* Subtle border for definition */
}

/* Dark Theme - Sub-buttons container background */
[data-theme="dark"] .sub-buttons.show {
  background: rgba(45, 55, 72, 0.98); /* Nearly opaque dark background */
  backdrop-filter: none; /* Remove blur */
  -webkit-backdrop-filter: none; /* Remove blur */
  border: 1px solid rgba(129, 195, 204, 0.3);
}

.sub-btn {
  padding: var(--spacing-sm) var(--spacing-md);
  background-color: white; /* White background for sub-buttons */
  backdrop-filter: none;
  color: var(--accent-secondary);
  border: var(--border-width) solid var(--accent-primary);
  border-radius: var(--border-radius);
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  position: relative;
  overflow: hidden;
  min-height: 48px;
  box-sizing: border-box;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05); /* Subtle shadow for depth */
}

/* HIGH CONTRAST FIX - Sub Buttons */
[data-theme="high-contrast"] .sub-btn {
  background: white;
  color: #111111;
  border: 2px solid #333333;
}

[data-theme="high-contrast"] .sub-btn:hover {
  background: #f0f0f0;
  color: #111111;
  transform: translateY(-3px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-icon {
  font-size: 1.2em;
  flex-shrink: 0;
  color: var(--accent-secondary);
}

/* HIGH CONTRAST FIX - Button Icons */
[data-theme="high-contrast"] .btn-icon {
  color: #111111;
}

.btn-text {
  flex: 1;
  white-space: nowrap;
  color: var(--accent-secondary);
}

/* HIGH CONTRAST FIX - Button Text */
[data-theme="high-contrast"] .btn-text {
  color: #111111;
}

/* Dark Theme - Make sub-buttons teal with white text */
[data-theme="dark"] .sub-btn {
  background: #81c3cc;
  color: white;
  border-color: #81c3cc;
}

[data-theme="dark"] .sub-btn:hover {
  background: #6ba8b1;
  color: white;
  border-color: #6ba8b1;
}

[data-theme="dark"] .btn-icon,
[data-theme="dark"] .btn-text {
  color: white;
}

/* Dark Theme - Top Navigation Buttons */
[data-theme="dark"] .back-link {
  background: #81c3cc;
  color: white;
  border-color: #81c3cc;
}

[data-theme="dark"] .back-link:hover {
  background: #6ba8b1;
  color: white;
  border-color: #6ba8b1;
}

[data-theme="dark"] .icon-btn {
  background: #81c3cc;
  color: white;
  border-color: #81c3cc;
}

[data-theme="dark"] .icon-btn:hover {
  background: #6ba8b1;
  color: white;
  border-color: #6ba8b1;
}

.sub-btn:hover {
  background-color: var(--accent-primary);
  color: white;
  border-color: var(--accent-secondary);
  transform: translateY(-3px);
  box-shadow: 0 8px 16px rgba(93, 156, 165, 0.3);
}

.sub-btn:hover .btn-icon,
.sub-btn:hover .btn-text {
  color: white;
}

/* HIGH CONTRAST - Keep text dark on hover */
[data-theme="high-contrast"] .sub-btn:hover .btn-icon,
[data-theme="high-contrast"] .sub-btn:hover .btn-text {
  color: #111111;
}

/* Staggered animation for sub-buttons */
.sub-buttons.show .sub-btn {
  opacity: 0;
  transform: translateY(-5px);
  animation: fadeInButton 300ms ease-out forwards;
}

.sub-buttons.show .sub-btn:nth-child(1) { animation-delay: 50ms; }
.sub-buttons.show .sub-btn:nth-child(2) { animation-delay: 100ms; }
.sub-buttons.show .sub-btn:nth-child(3) { animation-delay: 150ms; }

@keyframes fadeInButton {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Welcome Overlay ===== */
.welcome-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    135deg,
    rgba(93, 156, 165, 0.4) 0%,
    rgba(237, 252, 253, 0.3) 50%,
    rgba(224, 247, 250, 0.4) 100%
  );
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  animation: fadeInSmooth 400ms ease-out forwards;
  overflow-y: auto;
  padding: var(--spacing-md);
  box-sizing: border-box;
}

.welcome-overlay.hidden {
  display: none;
}

.welcome-content {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.92) 0%,
    rgba(245, 253, 254, 0.92) 50%,
    rgba(237, 252, 253, 0.92) 100%
  );
  backdrop-filter: blur(25px) saturate(150%);
  -webkit-backdrop-filter: blur(25px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 
    0 8px 32px 0 rgba(93, 156, 165, 0.25),
    0 2px 12px 0 rgba(255, 255, 255, 0.8) inset,
    0 0 0 1px rgba(255, 255, 255, 0.4) inset;
  padding: var(--spacing-xl);
  border-radius: var(--border-radius);
  max-width: 500px;
  width: 90%;
  text-align: center;
  animation: slideInSmooth 400ms ease-out;
  max-height: 90vh;
  overflow-y: auto;
  margin: auto;
}

.welcome-content h2 {
  color: var(--accent-secondary);
  margin-bottom: var(--spacing-md);
  font-size: 1.75rem;
  line-height: 1.2;
}

.welcome-content ul {
  list-style: none;
  text-align: left;
  margin: var(--spacing-md) 0;
}

.welcome-content li {
  margin: var(--spacing-sm) 0;
  padding-left: var(--spacing-md);
  position: relative;
}

.welcome-content li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--accent-primary);
}

/* Password Input Section */
.passcode-section {
  margin: var(--spacing-md) 0;
}

.passcode-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.passcode-input {
  width: 100%;
  padding: var(--spacing-sm);
  padding-right: calc(var(--spacing-xl) + var(--spacing-xs));
  border: var(--border-width) solid rgba(93, 156, 165, 0.5);
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-family: inherit;
  text-align: center;
  transition: all var(--transition-fast);
  background-color: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text-primary);
  min-height: 44px;
}

.passcode-input:focus {
  outline: none;
  border-color: var(--accent-secondary);
  box-shadow: 0 0 0 3px rgba(93, 156, 165, 0.2);
  background-color: rgba(255, 255, 255, 0.9);
}

.password-toggle {
  position: absolute;
  right: var(--spacing-xs);
  background: none;
  border: none;
  padding: var(--spacing-xs);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 1.25rem;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  border-radius: var(--border-radius);
}

/* ===== Fix Bubble Wand Video - Proper Aspect Ratio ===== */
/* Video container with aspect ratio box */
.video-container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
  background: #f8fafb; /* Light background instead of black */
  border-radius: 8px;
}

/* Video positioned absolutely to fill container */
#bubbleVideo,
.video-container video {
  position: absolute !important;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important; /* Fills container, crops if needed */
  background: transparent;
  display: block;
}

/* Alternative for exact fit without cropping */
@media (max-width: 768px) {
  .video-container {
    padding-bottom: 75%; /* Adjust for mobile aspect ratio if needed */
  }
}

/* Remove wrapper padding */
.video-wrapper {
  padding: 0;
  margin: 0;
  width: 100%;
  background: transparent;
}

/* Video Controls - Horizontal button style */
.video-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm); /* Add gap between buttons */
  padding: var(--spacing-md) 0;
  background-color: transparent;
  opacity: 1;
  position: static;
  margin-top: var(--spacing-sm);
}

/* Horizontal play/pause button */
.play-pause-btn,
.fullscreen-btn {
  padding: var(--spacing-sm) var(--spacing-lg);
  background-color: var(--accent-primary);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  font-family: 'Forum', serif;
  font-size: 1rem;
  min-height: 44px;
  min-width: 120px;
}

.play-pause-btn:hover,
.fullscreen-btn:hover {
  background-color: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.play-pause-btn:active,
.fullscreen-btn:active {
  transform: scale(0.98);
}

.play-pause-btn .play-icon,
.play-pause-btn .pause-icon,
.fullscreen-btn .fullscreen-icon,
.fullscreen-btn .exit-fullscreen-icon {
  width: 20px;
  height: 20px;
  fill: white;
  flex-shrink: 0;
}

.play-pause-btn .btn-label,
.fullscreen-btn .btn-label {
  color: white;
  font-size: 1rem;
}

/* Toggle visibility based on playing state */
.play-pause-btn.playing .play-icon,
.play-pause-btn.playing .btn-label.play-label {
  display: none;
}

.play-pause-btn:not(.playing) .pause-icon,
.play-pause-btn:not(.playing) .btn-label.pause-label {
  display: none;
}

/* Toggle visibility for fullscreen button */
.fullscreen-btn.is-fullscreen .fullscreen-icon,
.fullscreen-btn.is-fullscreen .btn-label.fullscreen-label {
  display: none;
}

.fullscreen-btn:not(.is-fullscreen) .exit-fullscreen-icon,
.fullscreen-btn:not(.is-fullscreen) .btn-label.exit-label {
  display: none;
}

/* Instruction text for breathing exercises */
.instruction-text {
  font-size: 1.2rem;
  text-align: center;
  color: var(--text-primary);
  line-height: 1.8;
  opacity: 0;
  animation: textFadeIn 2s ease-in forwards;
  animation-delay: 1s;
}

@keyframes textFadeIn {
  to { opacity: 1; }
}

/* Dark theme adjustments for video */
[data-theme="dark"] .video-container {
  background-color: var(--bg-secondary);
}

[data-theme="dark"] .play-pause-btn {
  background-color: var(--accent-primary);
}

[data-theme="dark"] .play-pause-btn:hover {
  background-color: var(--accent-hover);
}

/* High contrast adjustments */
[data-theme="high-contrast"] .play-pause-btn {
  border: 2px solid white;
}

.enter-btn {
  font-family: 'Forum', serif;
  background: rgba(93, 156, 165, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: white;
  border: var(--border-width) solid rgba(255, 255, 255, 0.3);
  padding: var(--spacing-sm) var(--spacing-lg);
  border-radius: var(--border-radius);
  font-size: 1.1rem;
  font-weight: 400;
  cursor: pointer;
  transition: all var(--transition-normal);
  margin-top: var(--spacing-sm);
  min-height: 44px;
  box-shadow: 0 4px 15px 0 rgba(31, 38, 135, 0.2);
}

.enter-btn:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px 0 rgba(31, 38, 135, 0.3);
}

.enter-btn:disabled {
  background: rgba(74, 85, 104, 0.5);
  cursor: not-allowed;
  opacity: 0.7;
}

/* ===== Modal Styles ===== */
.modal-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.4); /* Lighter overlay for better glass effect */
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  transition: opacity 350ms ease-out;
  padding: var(--spacing-md);
}

.modal-container.show {
  display: flex;
  opacity: 1;
}

.modal {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.85) 0%,
    rgba(237, 252, 253, 0.85) 50%,
    rgba(224, 247, 250, 0.85) 100%
  );
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 
    0 8px 32px 0 rgba(93, 156, 165, 0.2),
    0 2px 12px 0 rgba(255, 255, 255, 0.8) inset,
    0 0 0 1px rgba(255, 255, 255, 0.4) inset;
  border-radius: var(--border-radius);
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow: hidden;
  position: relative;
  animation: modalSlideInSmooth 400ms ease-out;
}

.modal-header {
  padding: var(--spacing-md);
  border-bottom: 1px solid rgba(93, 156, 165, 0.15);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.95) 0%,
    rgba(237, 252, 253, 0.9) 100%
  );
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.modal-title {
  font-family: 'Forum', serif;
  font-size: 1.5rem;
  color: var(--accent-secondary);
  font-weight: 400;
}

.modal-close {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.9) 0%,
    rgba(245, 253, 254, 0.9) 100%
  );
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  font-size: 1.5rem;
  cursor: pointer;
  padding: var(--spacing-xs);
  color: var(--text-secondary);
  transition: transform 200ms ease-out;
  border-radius: var(--border-radius);
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 
    0 2px 8px rgba(93, 156, 165, 0.1),
    0 1px 2px 0 rgba(255, 255, 255, 0.9) inset;
}

.modal-close:hover {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.95) 0%,
    rgba(237, 252, 253, 0.95) 100%
  );
  color: var(--accent-primary);
  transform: rotate(90deg);
}

.modal-body {
  padding: var(--spacing-lg);
  overflow-y: auto;
  max-height: calc(90vh - 80px);
  background: rgba(255, 255, 255, 0.98); /* Solid white */
  backdrop-filter: none; /* Remove blur */
  -webkit-backdrop-filter: none; /* Remove blur */
}

/* ===== Exercise Content ===== */
.exercise-content {
  max-width: 600px;
  margin: 0 auto;
  padding: var(--spacing-md);
}

.exercise-step {
  background: rgba(255, 255, 255, 0.98); /* Solid white */
  backdrop-filter: none; /* Remove blur */
  -webkit-backdrop-filter: none; /* Remove blur */
  border: 1px solid rgba(93, 156, 165, 0.2);
  border-radius: var(--border-radius);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
  position: relative;
  opacity: 0;
  animation: fadeInUp 0.6s var(--transition-smooth) forwards;
  box-shadow: 
    0 4px 16px rgba(93, 156, 165, 0.08),
    0 1px 2px 0 rgba(255, 255, 255, 0.9) inset;
}

.step-number {
  position: absolute;
  top: -15px;
  left: var(--spacing-lg);
  background-color: var(--accent-primary);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: bold;
  font-family: 'Forum', serif;
  border: var(--border-width) solid white;
}

.step-icon {
  font-size: 3.25rem !important;
  margin: var(--spacing-sm) 0;
  display: block;
  text-align: center;
}

/* ===== Step Cards (5-4-3-2-1 and Distraction) ===== */
.step-cards-container {
  position: relative;
  min-height: 300px;
  margin-bottom: var(--spacing-sm); /* Reduced from var(--spacing-lg) - helps bring buttons closer */
  margin-top: 0;
  padding: 0;
}

.step-card {
  display: none;
  background: rgba(255, 255, 255, 0.98); /* Solid white */
  backdrop-filter: none; /* Remove blur */
  -webkit-backdrop-filter: none; /* Remove blur */
  border: 1px solid rgba(93, 156, 165, 0.2);
  box-shadow: 
    0 8px 32px 0 rgba(93, 156, 165, 0.15),
    0 1px 3px 0 rgba(255, 255, 255, 0.9) inset;
  border-radius: var(--border-radius);
  padding: var(--spacing-xl);
  padding-top: calc(var(--spacing-xl) + 10px); /* Extra space for number badge */
  text-align: center;
  position: relative;
  animation: cardSlideIn 0.4s ease-out;
  margin: 0; /* No margins on the card itself */
}

.step-card.active {
  display: block;
}

.step-card h3 {
  font-family: 'Forum', serif;
  color: var(--accent-secondary);
  font-size: 1.5rem;
  margin-top: var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

.step-card .step-number {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--accent-primary);
  color: white;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: bold;
  font-family: 'Forum', serif;
  border: var(--border-width) solid white;
  box-shadow: 0 4px 12px rgba(93, 156, 165, 0.3);
  z-index: 1;
}

/* Challenge prompt styling */
.challenge-prompt {
  font-size: 1.1rem;
  font-weight: bold;
  margin: var(--spacing-sm) 0;
  line-height: 1.5;
  color: var(--text-primary);
}

/* Step hint styling */
.step-hint {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: var(--spacing-md);
  padding-top: var(--spacing-md);
  border-top: 1px solid rgba(93, 156, 165, 0.2);
}

/* Exercise intro */
.exercise-intro {
  text-align: center;
  margin-bottom: var(--spacing-lg); /* Standard spacing like Distraction */
  font-size: 1.1rem;
  color: var(--text-secondary);
  padding: 0; /* No extra padding */
}

/* Progress dots */
.step-progress {
  display: flex;
  justify-content: center;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-lg); /* Standard spacing before cards */
  margin-top: 0; /* No extra top margin */
}

.progress-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: rgba(93, 156, 165, 0.3);
  cursor: pointer;
  transition: all var(--transition-normal);
}

.progress-dot:hover {
  transform: scale(1.2);
  background-color: rgba(93, 156, 165, 0.5);
}

.progress-dot.active {
  background-color: var(--accent-primary);
  transform: scale(1.3);
}

/* Control Panel */
.control-panel {
  display: flex;
  justify-content: center;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  margin-top: var(--spacing-sm);
  padding: var(--spacing-md);
  background: rgba(255, 255, 255, 0.98); /* Solid white */
  backdrop-filter: none; /* Remove blur */
  -webkit-backdrop-filter: none; /* Remove blur */
  border: 1px solid rgba(93, 156, 165, 0.2);
  border-radius: var(--border-radius);
  position: relative;
  z-index: 10;
  box-shadow: 
    0 4px 16px 0 rgba(93, 156, 165, 0.1),
    0 1px 2px 0 rgba(255, 255, 255, 0.8) inset;
}

.control-btn {
  padding: var(--spacing-sm) var(--spacing-lg);
  background-color: var(--accent-primary);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  font-family: 'Forum', serif;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  transition: all var(--transition-normal);
  min-width: 120px;
  justify-content: center;
  position: relative;
  z-index: 11;
  pointer-events: auto !important;
}

.control-btn:hover:not(:disabled) {
  background-color: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(93, 156, 165, 0.3);
}

.control-btn:disabled {
  background-color: rgba(93, 156, 165, 0.3);
  cursor: not-allowed;
  opacity: 0.6;
  pointer-events: none;
}

/* Next steps panel */
.next-steps-panel {
  background: rgba(255, 255, 255, 0.98); /* Solid white */
  backdrop-filter: none; /* Remove blur */
  -webkit-backdrop-filter: none; /* Remove blur */
  border: 1px solid rgba(93, 156, 165, 0.2);
  border-radius: var(--border-radius);
  padding: var(--spacing-lg);
  margin-top: var(--spacing-lg); /* Standard spacing from control panel */
  box-shadow: 
    0 4px 16px 0 rgba(93, 156, 165, 0.1),
    0 1px 2px 0 rgba(255, 255, 255, 0.6) inset;
}

/* Completion card styling */
.completion-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--spacing-md);
  background-color: #4ade80;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  font-weight: bold;
  animation: checkmarkPop 0.5s ease-out;
}

/* Request Password button styling */
.request-password-link {
  color: var(--accent-primary);
  text-decoration: none;
  font-size: 0.9rem;
  padding: var(--spacing-xs) var(--spacing-sm);
  border: var(--border-width) solid var(--accent-primary);
  border-radius: var(--border-radius);
  transition: all var(--transition-fast);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: white;
  font-weight: 500;
  cursor: pointer;
}

.request-password-link:hover {
  background-color: var(--accent-primary);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(93, 156, 165, 0.2);
}

/* Welcome footer layout */
.welcome-footer {
  margin-top: var(--spacing-md);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  align-items: center;
}

/* Skip intro checkbox */
.skip-intro {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  color: var(--text-secondary);
  font-size: 0.9rem;
  cursor: pointer;
  margin-bottom: var(--spacing-xs);
}

.skip-intro input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  margin: 0;
}

/* Loading spinner */
.video-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: var(--text-primary);
  z-index: 2;
  background: rgba(248, 250, 251, 0.9);
  backdrop-filter: blur(10px);
  padding: 2rem;
  border-radius: 8px;
  border: 1px solid rgba(93, 156, 165, 0.2);
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(93, 156, 165, 0.3);
  border-top-color: #5d9ca5;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Hide loaded class spinner */
.video-container.loaded .video-loading {
  display: none !important;
}

/* Logo fallback */
.logo-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
}

.logo-icon {
  font-size: 3rem;
}

/* Error message */
.error-message {
  display: block;
  color: #e57373;
  font-size: 0.875rem;
  text-align: center;
  min-height: 1.2rem;
}

.mobile-break {
  display: none;
}

/* ===== Animations ===== */
@keyframes fadeInSmooth {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideInSmooth {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes modalSlideInSmooth {
  from {
    transform: scale(0.95);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cardSlideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes checkmarkPop {
  0% {
    transform: scale(0);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Forum', serif;
  font-weight: 400;
}

/* ===== Dark Theme Adjustments ===== */
[data-theme="dark"] .welcome-overlay {
  background: linear-gradient(
    135deg,
    rgba(26, 32, 44, 0.5) 0%,
    rgba(45, 55, 72, 0.4) 50%,
    rgba(55, 65, 82, 0.5) 100%
  );
}

[data-theme="dark"] .welcome-content {
  background: linear-gradient(
    135deg,
    rgba(26, 32, 44, 0.95) 0%,
    rgba(45, 55, 72, 0.95) 50%,
    rgba(55, 65, 82, 0.95) 100%
  );
  border: 1px solid rgba(129, 195, 204, 0.3);
  box-shadow: 
    0 8px 32px 0 rgba(0, 0, 0, 0.4),
    0 1px 2px 0 rgba(129, 195, 204, 0.1) inset;
}

[data-theme="dark"] .modal {
  background: linear-gradient(
    135deg,
    rgba(26, 32, 44, 0.92) 0%,
    rgba(45, 55, 72, 0.92) 50%,
    rgba(55, 65, 82, 0.92) 100%
  );
  border: 1px solid rgba(129, 195, 204, 0.3);
  box-shadow: 
    0 8px 32px 0 rgba(0, 0, 0, 0.4),
    0 1px 2px 0 rgba(129, 195, 204, 0.1) inset;
}

[data-theme="dark"] .modal-header {
  background: linear-gradient(
    180deg,
    rgba(45, 55, 72, 0.95) 0%,
    rgba(55, 65, 82, 0.9) 100%
  );
  border-bottom: 1px solid rgba(129, 195, 204, 0.2);
}

[data-theme="dark"] .modal-body {
  background: linear-gradient(
    180deg,
    rgba(26, 32, 44, 0.3) 0%,
    rgba(45, 55, 72, 0.2) 100%
  );
}

[data-theme="dark"] .step-card {
  background: linear-gradient(
    135deg,
    rgba(45, 55, 72, 0.95) 0%,
    rgba(55, 65, 82, 0.95) 100%
  );
  border: 1px solid rgba(129, 195, 204, 0.3);
}

[data-theme="dark"] .request-password-link {
  background-color: rgba(255, 255, 255, 0.9);
  color: var(--accent-primary);
}

[data-theme="dark"] .request-password-link:hover {
  background-color: var(--accent-primary);
  color: white;
}

[data-theme="dark"] .challenge-prompt {
  color: var(--text-primary);
}

[data-theme="dark"] .step-hint {
  color: var(--text-secondary);
  border-top-color: rgba(129, 195, 204, 0.2);
}

/* ===== High Contrast Theme Adjustments ===== */
[data-theme="high-contrast"] .main-btn {
  color: black;
  font-size: calc(1.2rem + 9px);
  font-weight: 500;
}

/* HIGH CONTRAST FIX - Keep text white on active/selected main buttons */
[data-theme="high-contrast"] .main-btn.active {
  color: white;
  background-color: #111111;
}

[data-theme="high-contrast"] .modal,
[data-theme="high-contrast"] .step-card,
[data-theme="high-contrast"] .control-panel {
  background: white;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 2px solid var(--accent-primary);
  box-shadow: none;
}
/* ===== Responsive Design ===== */
/* Tablet responsive */
@media (max-width: 1024px) and (min-width: 769px) {
  .sub-buttons,
  .sub-buttons.show {
    grid-template-columns: repeat(3, 1fr); /* Still 3 columns on tablets */
  }
}

/* Mobile responsive design */
@media (max-width: 768px) {
  /* Allow full scrolling */
  html {
    height: auto;
    min-height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
  }
  
  body {
    min-height: 100vh;
    min-height: -webkit-fill-available;
    height: auto; /* Add this */
    padding: 12px;
    padding-top: 12px !important;
    display: block; /* Change from flex to block */
    overflow-y: auto; /* Add this */
    overflow-x: hidden;
  }
  
  /* Spacing variables for mobile */
  :root {
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 0.75rem;
    --spacing-lg: 1rem;
    --spacing-xl: 1.5rem;
    --spacing-uniform: 0.75rem;
  }
  
  .app-container {
    margin-top: 0;
    margin-bottom: 20px; /* Change from auto to fixed value */
    max-height: none;
    height: auto; /* Add this */
    position: relative;
    width: 100%;
    max-width: 750px;
    padding: 20px;
    padding-top: 15px;
    border-radius: var(--border-radius);
  }
  
  header {
    background: rgba(255, 255, 255, 0.98); /* Solid white */
    backdrop-filter: none; /* Remove blur */
    -webkit-backdrop-filter: none; /* Remove blur */
    padding: 15px 12px;
    margin-bottom: 15px;
    border-radius: var(--border-radius);
    border: 2px solid #5d9ca5;
  }
  
  header h1 {
    font-size: 1.75rem;
    margin: 0;
    line-height: 1.2;
  }
  
  .top-nav {
    margin-bottom: 15px;
    gap: 10px;
  }
  
  .back-link,
  .icon-btn {
    font-size: 0.8rem;
    padding: 6px 10px;
    min-height: 36px;
  }
  
  .logo-container {
    width: 180px;
    height: 120px;
    margin: 0 auto 10px;
  }
  
  .logo {
    max-width: 100%;
    height: auto;
    max-height: 100%;
    display: block;
    object-fit: contain;
    border-radius: var(--border-radius);
  }
  
  .logo-hover-text {
    display: none;
  }
  
  .logo-icon {
    font-size: 2.5rem;
  }
  
  .button-container {
    gap: 10px;
  }
  
  .main-btn {
    padding: 12px 16px;
    font-size: 1rem;
    min-height: 44px;
  }
  
  .sub-btn {
    padding: 0.875rem !important;
    min-height: 44px;
  }
  
  .btn-icon {
    font-size: 1.2rem;
  }
  
  .btn-text {
    font-size: 0.9rem;
  }
  
  .sub-buttons {
    padding: 6px 10px;
    margin-top: 6px;
  }
  
  .play-pause-btn,
  .fullscreen-btn {
    min-width: 90px;
    font-size: 0.9rem;
    padding: var(--spacing-xs) var(--spacing-sm);
  }
  
  /* Mobile Secondary Buttons - Full Width Stacked */
  .sub-buttons {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.5rem;
    padding: 0.5rem;
    width: 100%;
  }
  
  .sub-buttons.show {
    display: flex !important;
    flex-direction: column !important;
  }
  
  .sub-buttons:not(.show) {
    display: none !important;
    height: 0;
    overflow: hidden;
    opacity: 0;
    margin: 0;
    padding: 0;
  }
  
  .sub-btn {
    width: 100% !important;
    padding: 1rem !important;
    font-size: 1rem !important;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
  }
  
  .modal {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    border-radius: 0;
    border: none;
  }
  
  /* Fix Navigation Controls on Mobile */
.control-panel {
    display: flex !important;
    justify-content: space-between !important;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.98) !important; /* Solid white */
    backdrop-filter: none !important; /* Remove blur */
    -webkit-backdrop-filter: none !important; /* Remove blur */
    border: 2px solid rgba(93, 156, 165, 0.3);
    border-radius: 12px;
    position: relative;
    z-index: 10;
    width: 100%;
    box-sizing: border-box;
  }
  
  .control-btn {
    padding: 0.75rem 1rem !important;
    background-color: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-family: 'Forum', serif;
    font-size: 0.9rem !important;
    cursor: pointer;
    display: flex !important;
align-items: center;
    gap: 0.25rem;
    transition: all 0.3s ease;
    min-width: auto !important;
    justify-content: center;
    flex: 1;
    min-height: 44px;
  }
  
  .control-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
  }
  
  .step-cards-container {
    min-height: 250px;
    margin-bottom: 1rem;
  }
  
  .step-progress {
    margin-bottom: 1rem;
  }
  
  .progress-dot {
    width: 10px;
    height: 10px;
  }
  
  .video-container {
    padding-bottom: 75%;
  }
  
  .mobile-break {
    display: block;
  }
  
  /* Fix for iOS Safari viewport issues */
  @supports (-webkit-touch-callout: none) {
    body {
      min-height: -webkit-fill-available;
      padding-top: env(safe-area-inset-top, 12px);
    }
  }
}

/* Super small screens (below 380px) */
@media (max-width: 380px) {
  body {
    padding: 6px;
  }
  
  .app-container {
    padding: 10px;
    padding-top: 8px;
  }
  
  header {
    padding: 8px 6px;
    margin-bottom: 8px;
  }
  
  .top-nav {
    margin-bottom: 8px;
    flex-wrap: wrap;
  }
  
  .logo-container {
    width: 120px;
    height: 80px;
    margin: 0 auto 6px;
  }
  
  header h1 {
    font-size: 1.3rem;
  }
  
  .button-container {
    gap: 8px;
  }
  
  .control-btn {
    padding: 0.75rem 0.5rem !important;
    font-size: 0.85rem !important;
  }
  
  .theme-label::before {
    content: "";
  }
}

/* Even smaller screens (phones in portrait) */
@media (max-width: 480px) {
  body {
    padding: 8px;
    padding-top: 8px !important;
    align-items: flex-start;
  }
  
  .app-container {
    margin-top: 0;
    padding: 12px;
    padding-top: 10px;
  }
  
  header {
    padding: 10px 8px;
    margin-bottom: 10px;
  }
  
  header h1 {
    font-size: 1.5rem;
    letter-spacing: 0.02em;
  }
  
  .top-nav {
    margin-bottom: 10px;
    gap: 8px;
  }
  
  .back-link,
  .icon-btn {
    font-size: 0.75rem;
    padding: 5px 8px;
    min-height: 32px;
  }
  
  .logo-container {
    width: 150px;
    height: 100px;
    margin: 0 auto 8px;
  }
  
  .logo-icon {
    font-size: 2rem;
  }
}

/* Fix initial state of buttons */
.main-btn:not(.active) + .sub-buttons {
  display: none !important;
  max-height: 0;
  opacity: 0;
  visibility: hidden;
}

.main-btn.active + .sub-buttons {
  display: block;
  max-height: 300px;
  opacity: 1;
  visibility: visible;
}

/* ===== MOBILE MODAL FIX ===== */
/* Add this to the END of your main.css file */

/* Fix modal scrolling and sizing on mobile */
@media (max-width: 768px) {
  
  /* Modal container - full screen on mobile */
  .modal-container {
    padding: 0 !important;
    align-items: flex-start !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  
  /* Modal - full width and height on mobile */
  .modal {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 100vh !important;
    min-height: -webkit-fill-available !important;
    max-height: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
  }
  
  /* Modal body - scrollable */
  .modal-body {
    max-height: none !important;
    overflow-y: visible !important;
    overflow-x: hidden !important;
    padding: 1rem !important;
    padding-bottom: 2rem !important;
  }
  
  /* Video container - proper mobile aspect ratio */
  .video-container {
    width: 100% !important;
    padding-bottom: 56.25% !important; /* 16:9 ratio */
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  
  .video-container video {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important; /* Changed from cover to contain */
  }
  
  /* Exercise content - full width */
  .exercise-content {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
  }
  
  /* Step cards - proper spacing */
  .step-cards-container {
    width: 100% !important;
    margin-bottom: 1rem !important;
  }
  
  .step-card {
    width: 100% !important;
    margin: 0 !important;
    padding: 1.5rem 1rem !important;
  }
  
  /* Control panel - always visible at bottom */
.control-panel {
    position: sticky !important;
    bottom: 0 !important;
    z-index: 10 !important;
    background: rgba(255, 255, 255, 0.98) !important; /* Solid white */
    backdrop-filter: none !important; /* Remove blur */
    -webkit-backdrop-filter: none !important; /* Remove blur */
    margin-top: 1rem !important;
    padding: 0.75rem !important;
    border: 1px solid rgba(93, 156, 165, 0.2);
  }
  
  /* iOS Safari specific fixes */
  @supports (-webkit-touch-callout: none) {
    .modal {
      min-height: -webkit-fill-available !important;
    }
    
    body.modal-open {
      position: fixed !important;
      width: 100% !important;
      overflow: hidden !important;
    }
  }
}

/* Smaller phones (iPhone SE, etc) */
@media (max-width: 375px) {
  .modal-body {
    padding: 0.75rem !important;
  }
  
  .step-card {
    padding: 1rem 0.75rem !important;
  }
  
  .video-controls {
    gap: 0.5rem !important;
  }
}

/* Scroll indicator for mobile when content extends below fold */
/* Smart positioning - automatically adjusts based on screen content */
.scroll-indicator {
  position: fixed;
  bottom: 20px; /* Default position */
  left: 50%;
  transform: translateX(-50%);
  background: rgba(93, 156, 165, 0.9);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  z-index: 1001;
  animation: bounce 2s infinite;
  display: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  pointer-events: none; /* Don't block clicks */
  transition: bottom 0.3s ease; /* Smooth position changes */
}

.scroll-indicator.visible {
  display: block;
}

/* When control panel is visible (in modals like Bubble Wand) */
body:has(.control-panel) .scroll-indicator {
  bottom: 90px; /* Move up to avoid control panel */
}

/* Hide when modal is open */
body:has(.modal-container.show) .scroll-indicator {
  display: none !important;
}

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

/* Hide on desktop */
@media (min-width: 769px) {
  .scroll-indicator {
    display: none !important;
  }
}

/* Extra adjustment for very small screens */
@media (max-width: 375px) {
  body:has(.control-panel) .scroll-indicator {
    bottom: 100px; /* Even more room on tiny screens */
  }
}