/* home.css - Updated to match enhanced quiz styling with background images */

/* Import modern font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ─── Enhanced CSS Variables ────────────────────────────────────────────── */
:root {
  --primary-color: #FF6FA5;
  --primary-dark: #E55A8F;
  --primary-light: #FFB6D3;
  --secondary-color: #8FDCEE;
  --background-primary: #FFE9EF;
  --background-secondary: #FFF0F5;
  --text-primary: #1a1a1a;
  --text-secondary: #666;
  --white: #ffffff;
  --shadow-soft: 0 4px 20px rgba(255, 111, 165, 0.15);
  --shadow-strong: 0 8px 32px rgba(255, 111, 165, 0.25);
  --border-radius: clamp(12px, 2vw, 20px);
  --spacing-xs: 8px;
  --spacing-sm: 12px;
  --spacing-md: 20px;
  --spacing-lg: 32px;
  --spacing-xl: 48px;
}

/* ─── Reset & Global Styles ────────────────────────────────────────────── */
* {
  box-sizing: border-box;
}

*,
*::before,
*::after {
  border-radius: var(--border-radius) !important;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 400;
  /* Remove background - depend on background.css */
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text-primary);
  line-height: 1.6;
  display: flex;
  justify-content: center;
  align-items: start;
}

/* Remove background pattern - depend on background.css */

@keyframes fadeIn { 
  from { opacity: 0; transform: translateY(30px) scale(0.95); } 
  to { opacity: 1; transform: translateY(0) scale(1); } 
}

/* ─── Wrapper & Main Container ─────────────────────────────────────────── */
.wrapper {
  width: 90%;
  max-width: 1040px;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 60px;
  text-align: center;
  padding: var(--spacing-md);
}

.main-container {
  background: linear-gradient(145deg, var(--white) 0%, var(--background-secondary) 100%);
  padding: clamp(24px, 5vw, 40px);
  border: 3px solid var(--primary-color);
  box-shadow: 
    var(--shadow-strong),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  width: 100%;
  max-width: 100%;
  margin-bottom: 40px;
  position: relative;
  backdrop-filter: blur(10px);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  animation: slideInUp 0.6s ease-out;
}

.room-nav-link {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #ff6fa5;
  border-radius: 24px;
  color: #d9558a;
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
}
.room-nav-link:hover { background: #fff0f6; }
.room-nav-link:focus-visible { outline: 3px solid #895bb8; outline-offset: 3px; }
.avatar-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: clamp(24px, 4vw, 44px);
  align-items: center;
  margin-bottom: 28px;
  text-align: left;
}

.avatar-hero-copy {
  min-width: 0;
}

.avatar-kicker {
  margin: 0 0 10px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #d85a92;
}

.avatar-hero h1 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1.05;
  color: var(--text-primary);
}

.avatar-summary {
  margin: 0 0 18px;
  color: var(--text-secondary);
  font-size: 0.98rem;
}

.avatar-slot-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.avatar-slot-pills span {
  padding: 8px 12px;
  border: 1px solid rgba(255, 111, 165, 0.35);
  background: rgba(255, 255, 255, 0.85);
  color: #b84d7b;
  font-size: 0.82rem;
  font-weight: 600;
}

.avatar-stage-card {
  min-width: 0;
  padding: 18px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.96) 0%, rgba(255, 236, 243, 0.98) 100%);
  border: 2px solid rgba(255, 111, 165, 0.28);
  box-shadow: 0 20px 44px rgba(255, 111, 165, 0.15);
}

.avatar-stage-frame {
  padding: 14px;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.35)),
    linear-gradient(180deg, #ffe3ed 0%, #fff7fa 100%);
  border: 1px solid rgba(255, 111, 165, 0.22);
}

.avatar-stage {
  position: relative;
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
  min-height: 360px;
  overflow: hidden;
  border: 2px solid rgba(255, 111, 165, 0.18);
  background: linear-gradient(180deg, #fff6f9 0%, #fff 100%);
}

.avatar-stage-room {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(143, 220, 238, 0.32), transparent 30%),
    radial-gradient(circle at 85% 18%, rgba(255, 182, 211, 0.5), transparent 22%),
    linear-gradient(180deg, #fff2f6 0%, #ffe7ef 62%, #f8d4dc 62%, #f6d3c2 100%);
}

.avatar-stage-floor {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 34%;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.14) 0 2px, transparent 2px 52px),
    linear-gradient(180deg, #f6cfbb 0%, #ebb598 100%);
}

.avatar-stage-glow {
  position: absolute;
  left: 50%;
  bottom: 64px;
  width: 170px;
  height: 42px;
  transform: translateX(-50%);
  background: rgba(255, 111, 165, 0.18);
  filter: blur(16px);
}

.avatar-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 2;
  pointer-events: none;
}

.avatar-layer-background {
  z-index: 1;
}

.avatar-layer-room {
  z-index: 2;
}

.avatar-layer-body {
  z-index: 3;
}

.avatar-layer-outfit {
  z-index: 4;
}

.avatar-layer-hair {
  z-index: 5;
}

.avatar-layer-accessories {
  z-index: 6;
}

.avatar-placeholder {
  position: absolute;
  left: 50%;
  top: 18px;
  width: min(78%, 250px);
  padding: 12px 14px;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.92);
  border: 1px dashed rgba(255, 111, 165, 0.45);
  box-shadow: 0 16px 34px rgba(255, 111, 165, 0.12);
  text-align: center;
  color: var(--text-secondary);
  z-index: 7;
}

.avatar-placeholder strong,
.avatar-placeholder span {
  display: block;
}

.avatar-placeholder strong {
  margin-bottom: 6px;
  color: var(--text-primary);
}

.avatar-placeholder span {
  font-size: 0.85rem;
  line-height: 1.4;
}

.avatar-stage-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.avatar-stage-meta > div {
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 111, 165, 0.18);
}

.avatar-meta-label {
  margin: 0 0 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #bd6a90;
}

.avatar-meta-value {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-primary);
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.hidden { display: none !important; }

/* ─── Enhanced Navbar ──────────────────────────────────────────────────── */
.navbar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 var(--spacing-md);
  margin-bottom: var(--spacing-md);
  position: relative;
}

.navbar-left { 
  display: flex; 
  align-items: center; 
  gap: var(--spacing-sm);
}

.logo {
  height: 50px;
  width: auto;
  object-fit: contain;
  transition: all 0.3s ease;
}

.logo:hover {
  transform: scale(1.05);
}

.navbar-left h1 { 
  font-size: clamp(1.4rem, 4vw, 1.8rem);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.login-btn {
  background: linear-gradient(135deg, #7289da 0%, #5b6eae 100%);
  color: var(--white);
  padding: var(--spacing-sm) var(--spacing-md);
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}

.login-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.2);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  z-index: -1;
}

.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-strong);
}

.login-btn:hover::before {
  width: 300px;
  height: 300px;
}

.profile-pic {
  width: 40px;
  height: 40px;
  cursor: pointer;
  border: 2px solid var(--white);
  box-shadow: var(--shadow-soft);
  object-fit: cover;
  transition: all 0.3s ease;
}

.profile-pic:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-strong);
}

/* Supporter blue border */
.profile-pic.supporter {
  border: 3px solid #4A90E2;
  box-shadow: 0 0 8px rgba(74, 144, 226, 0.4);
}

.profile-pic.supporter:hover {
  transform: scale(1.1);
  box-shadow: 0 0 12px rgba(74, 144, 226, 0.6);
}

/* ─── Enhanced Profile Dropdown ────────────────────────────────────────── */
.user-menu {
  position: absolute;
  top: 60px;
  right: 0;
  background: linear-gradient(145deg, var(--white) 0%, var(--background-secondary) 100%);
  border: 2px solid var(--primary-light);
  box-shadow: var(--shadow-strong);
  display: flex;
  flex-direction: column;
  min-width: 150px;
  z-index: 100;
  backdrop-filter: blur(10px);
  animation: dropdownAppear 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes dropdownAppear {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.user-menu.hidden { display: none; }

.user-menu .menu-item {
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.user-menu .menu-item:hover {
  background: var(--primary-light);
  color: var(--white);
  transform: translateX(2px);
}

/* ─── Enhanced Tabs ────────────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  gap: var(--spacing-sm);
  justify-content: center;
  margin: var(--spacing-md) 0;
  flex-wrap: nowrap;
}

.tab-bar button {
  background: linear-gradient(135deg, var(--white) 0%, #f8f9ff 100%);
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
  padding: var(--spacing-sm) var(--spacing-md);
  cursor: pointer;
  font-size: clamp(0.9rem, 2.5vw, 1rem);
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tab-bar button::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: var(--primary-color);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  z-index: -1;
}

.tab-bar button:hover,
.tab-bar button.active {
  color: var(--white);
  transform: translateY(-2px);
  box-shadow: var(--shadow-strong);
}

.tab-bar button:hover::before,
.tab-bar button.active::before {
  width: 300px;
  height: 300px;
}

/* ─── Enhanced Sections ────────────────────────────────────────────────── */
.section-content { 
  width: 100%; 
  padding: var(--spacing-md) 0; 
}

.featured { 
  border-bottom: 2px solid var(--primary-light);
  padding-bottom: var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

.featured h2 { 
  font-size: clamp(1.2rem, 3vw, 1.4rem);
  font-weight: 700;
  margin-bottom: var(--spacing-sm);
  color: var(--text-primary);
}

.featured p { 
  font-size: clamp(0.9rem, 2.5vw, 1rem);
  line-height: 1.6;
  color: var(--text-secondary);
}

.featured a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s ease;
  position: relative;
}

.featured a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary-color);
  transition: width 0.3s ease;
}

.featured a:hover {
  color: var(--primary-dark);
}

.featured a:hover::after {
  width: 100%;
}

/* ─── Enhanced Quiz Section Header ─────────────────────────────────────── */
#quizzes-section {
  text-align: center;
}

#quizzes-section h2 {
  font-size: clamp(1.4rem, 4vw, 1.6rem);
  color: var(--text-primary);
  margin-bottom: var(--spacing-xs);
  font-weight: 700;
}

.quiz-subtitle {
  color: var(--text-secondary);
  font-size: clamp(0.9rem, 2.5vw, 1rem);
  margin-bottom: var(--spacing-lg);
  font-style: italic;
  font-weight: 500;
}

/* ─── Enhanced Quiz Cards with Background Images ───────────────────────── */
.quiz-grid,
#results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--spacing-lg);
  padding: 0 var(--spacing-sm);
}

.quiz-card {
  aspect-ratio: 1 / 1;
  border: 3px solid var(--primary-color);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
  /* Background image will be set via JavaScript */
}

.quiz-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, rgba(255, 111, 165, 0.1), transparent);
  transform: rotate(45deg);
  transition: all 0.6s ease;
  opacity: 0;
  z-index: 1;
}

.quiz-card:hover::before {
  opacity: 1;
  animation: shimmer 1.5s ease-in-out;
}

@keyframes shimmer {
  0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
  100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.quiz-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--shadow-strong);
  border-color: var(--primary-light);
}

.quiz-card.completed {
  opacity: 0.8;
  filter: grayscale(30%);
}

.quiz-card.completed::after {
  content: '✓ Completed';
  position: absolute;
  top: var(--spacing-xs);
  right: var(--spacing-xs);
  background: linear-gradient(135deg, #4CAF50, #45a049);
  color: white;
  padding: 4px var(--spacing-xs);
  font-size: 0.75rem;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
  z-index: 3;
}

/* Quiz card overlay for text readability */
.quiz-card-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  background: linear-gradient(
    135deg,
    rgba(0, 0, 0, 0.4) 0%,
    rgba(0, 0, 0, 0.2) 50%,
    rgba(0, 0, 0, 0.4) 100%
  );
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: all 0.3s ease;
  padding: var(--spacing-sm);
}

.quiz-card:hover .quiz-card-overlay {
  background: linear-gradient(
    135deg,
    rgba(255, 111, 165, 0.7) 0%,
    rgba(255, 111, 165, 0.5) 50%,
    rgba(255, 111, 165, 0.7) 100%
  );
}

.quiz-card .quiz-title {
  margin: 0;
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  font-weight: 700;
  color: var(--white);
  line-height: 1.2;
  transition: all 0.3s ease;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
  text-align: center;
  word-break: break-word;
  hyphens: auto;
}

.quiz-card:hover .quiz-title {
  transform: scale(1.05);
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

/* Remove old quiz-icon styles since we're using background images */
.quiz-icon {
  display: none;
}

/* ─── Results Cards (background image style like quiz cards) ───────────────────────── */
.result-card {
  aspect-ratio: 1 / 1;
  background: linear-gradient(145deg, var(--white) 0%, var(--background-secondary) 100%);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border: 3px solid var(--primary-color);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
  overflow: hidden;
}

/* Shimmer effect for result cards */
.result-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, rgba(255, 111, 165, 0.1), transparent);
  transform: rotate(45deg);
  transition: all 0.6s ease;
  opacity: 0;
  z-index: 1;
}

.result-card:hover::before {
  opacity: 1;
  animation: shimmer 1.5s ease-in-out;
}

.result-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--shadow-strong);
  border-color: var(--primary-light);
}

/* Result card overlay for text readability */
.result-card-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.8) 0%,
    rgba(0, 0, 0, 0.6) 50%,
    transparent 100%
  );
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 2;
  transition: all 0.3s ease;
  padding: var(--spacing-sm);
  min-height: 60px;
}

.result-card:hover .result-card-overlay {
  background: linear-gradient(
    to top,
    rgba(255, 111, 165, 0.9) 0%,
    rgba(255, 111, 165, 0.7) 50%,
    transparent 100%
  );
}

.result-card .quiz-title {
  margin: 0;
  font-size: clamp(0.9rem, 2.5vw, 1.1rem);
  font-weight: 700;
  color: var(--white);
  line-height: 1.2;
  transition: all 0.3s ease;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
  text-align: center;
  word-break: break-word;
  hyphens: auto;
  z-index: 3;
  position: relative;
}

.result-card:hover .quiz-title {
  transform: scale(1.05);
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

/* Hide the old result icon since we're using background images */
.result-icon {
  display: none;
}

/* Result overlay badge (for the result key) */
.result-overlay {
  position: absolute;
  top: var(--spacing-xs);
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
  color: var(--white);
  padding: 4px var(--spacing-xs);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-soft);
  z-index: 3;
  border-radius: 8px;
}

/* Mobile optimizations for result cards */
@media (max-width: 768px) {
  /* Remove background-attachment difference - let it be same as desktop */
  
  .result-card .quiz-title {
    font-size: clamp(0.8rem, 2vw, 1rem);
  }
  
  .result-overlay {
    font-size: 0.75rem;
    padding: 3px 6px;
  }
  
  /* Force main container to use light backgrounds on mobile */
  .main-container {
    background: linear-gradient(145deg, #ffffff 0%, #FFF0F5 100%) !important;
    backdrop-filter: blur(10px);
  }
  
  .user-menu {
    background: linear-gradient(145deg, #ffffff 0%, #FFF0F5 100%) !important;
    backdrop-filter: blur(10px);
  }
  
  /* Don't override quiz card backgrounds - they have background images set by JS */
  /* Quiz cards should keep their background images intact */
  .quiz-card {
    backdrop-filter: none !important; /* Remove blur filter that can interfere with background images on mobile */
  }
  
  /* Don't override result card backgrounds - they have background images set by JS */
  /* Result cards should render exactly the same as desktop */
  .result-card {
    backdrop-filter: none !important; /* Remove blur filter that can interfere with background images on mobile */
  }
}

/* ─── Enhanced Chat Link ───────────────────────────────────────────────── */
.chat-link {
  display: inline-block;
  margin: var(--spacing-md) auto;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
  color: var(--white);
  padding: var(--spacing-sm) var(--spacing-md);
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 600;
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}

.chat-link::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.3);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  z-index: -1;
}

.chat-link:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-strong);
}

.chat-link:hover::before {
  width: 300px;
  height: 300px;
}

/* ─── Enhanced Social Footer ───────────────────────────────────────────── */
.social-footer {
  display: flex;
  justify-content: center;
  gap: var(--spacing-md);
  margin: var(--spacing-md) 0 40px;
  flex-wrap: wrap;
}

.social-link {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: transparent;
  border: none;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.social-link::before {
  display: none;
}

.social-link:hover,
.social-link:focus-visible { 
  transform: translateY(-4px) scale(1.12);
}

.social-link img {
  width: 70%;
  height: 70%;
  object-fit: contain;
  transition: all 0.3s ease;
}

/* ─── Enhanced Responsive Design ───────────────────────────────────────── */
@media (max-width: 768px) {
  .wrapper {
    width: min(94%, 560px);
    padding: var(--spacing-sm);
    justify-content: flex-start;
    padding-top: var(--spacing-xl);
  }

  .main-container {
    padding: var(--spacing-md);
  }

  .avatar-hero {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .avatar-slot-pills {
    justify-content: center;
  }

  .avatar-stage-meta {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  :root {
    --spacing-xs: 6px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
  }

  .tab-bar {
    gap: 6px;
  }

  .tab-bar button { 
    font-size: 0.85rem; 
    padding: 8px 6px;
    min-width: 0;
  }
  
  .quiz-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--spacing-md);
    padding: 0 5px;
  }
  
  .quiz-card-overlay {
    padding: var(--spacing-xs);
  }
  
  .quiz-card .quiz-title {
    font-size: 0.9rem;
    font-weight: 600;
  }
  
  #quizzes-section h2 {
    font-size: 1.4rem;
  }
  
  .quiz-subtitle {
    font-size: 0.9rem;
  }
  
  .result-icon { 
    width: 80px; 
    height: 80px; 
  }
  
  .navbar-left h1 { 
    font-size: 1.4rem; 
  }
  
  .logo { 
    height: 40px; 
  }
  
  .profile-pic { 
    width: 32px; 
    height: 32px; 
  }
  
  .profile-pic.supporter {
    border: 2px solid #4A90E2;
    box-shadow: 0 0 6px rgba(74, 144, 226, 0.4);
  }
  
  .featured h2 { 
    font-size: 1.2rem; 
  }
  
  .featured p { 
    font-size: 0.9rem; 
  }

  .social-link { 
    width: 44px; 
    height: 44px; 
  }
  
  /* Ensure all containers have proper backgrounds on small mobile screens */
  .main-container {
    background: linear-gradient(145deg, #ffffff 0%, #FFF0F5 100%) !important;
  }
  
  .user-menu {
    background: linear-gradient(145deg, #ffffff 0%, #FFF0F5 100%) !important;
  }
  
  .tab-bar button {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9ff 100%) !important;
  }
  
  .creator-story {
    background: linear-gradient(145deg, #f8f4ff 0%, #f0e8ff 100%) !important;
  }
  
  .support-section {
    background: linear-gradient(145deg, #fff5f7 0%, #ffe9ef 100%) !important;
  }
  
  /* Remove backdrop filter on quiz cards for small mobile screens too */
  .quiz-card {
    backdrop-filter: none !important;
  }
}

/* ─── Accessibility & Performance ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  /* Exception: Keep background animation on mobile even with reduced motion */
  body {
    animation: bgMove 60s linear infinite !important;
  }
}


/* Focus states for accessibility */
button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Loading states */
.loading {
  opacity: 0.7;
  pointer-events: none;
  position: relative;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--primary-light);
  border-top: 2px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* ─── Creator Story Styles ───────────────────────────────────────────── */
.creator-story {
  background: linear-gradient(145deg, #f8f4ff 0%, #f0e8ff 100%);
  border: 2px solid #b8a3ff;
  border-radius: var(--border-radius);
  padding: var(--spacing-lg);
  margin: var(--spacing-lg) 0;
  text-align: left;
  box-shadow: var(--shadow-soft);
}

.creator-story h3 {
  color: #6b46c1;
  margin-bottom: var(--spacing-md);
  font-size: 1.3rem;
  font-weight: 700;
  text-align: center;
}

.creator-story p {
  color: var(--text-primary);
  margin-bottom: var(--spacing-md);
  line-height: 1.7;
  font-size: 1rem;
}

.creator-story .signature {
  text-align: center;
  font-style: italic;
  color: #6b46c1;
  font-weight: 500;
  margin-bottom: 0;
  margin-top: var(--spacing-lg);
}

/* ─── Support Section Styles ───────────────────────────────────────────── */
.support-section {
  background: linear-gradient(145deg, #fff5f7 0%, #ffe9ef 100%);
  border: 2px solid var(--primary-light);
  border-radius: var(--border-radius);
  padding: var(--spacing-lg);
  margin: var(--spacing-lg) 0;
  text-align: center;
  box-shadow: var(--shadow-soft);
}

.support-section h3 {
  color: var(--primary-color);
  margin-bottom: var(--spacing-md);
  font-size: 1.3rem;
  font-weight: 700;
}

.support-section p {
  color: var(--text-secondary);
  margin-bottom: var(--spacing-md);
  line-height: 1.6;
}

.subscribe-cta-btn {
  background: linear-gradient(135deg, #4A90E2 0%, #6BB6FF 100%);
  color: white;
  border: none;
  padding: var(--spacing-sm) var(--spacing-lg);
  border-radius: var(--border-radius);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-soft);
  margin: var(--spacing-md) 0;
  position: relative;
  overflow: hidden;
}

.subscribe-cta-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.2);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  z-index: 0;
}

.subscribe-cta-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(74, 144, 226, 0.4);
}

.subscribe-cta-btn:hover::before {
  width: 200px;
  height: 200px;
}

.subscribe-cta-btn span {
  position: relative;
  z-index: 1;
}

.support-note {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: var(--spacing-md);
  margin-bottom: 0;
}

/* Mobile responsiveness for creator story and support section */
@media (max-width: 768px) {
  .creator-story {
    padding: var(--spacing-md);
    margin: var(--spacing-md) 0;
  }
  
  .creator-story h3 {
    font-size: 1.1rem;
  }
  
  .creator-story p {
    font-size: 0.95rem;
  }

  .support-section {
    padding: var(--spacing-md);
    margin: var(--spacing-md) 0;
  }
  
  .support-section h3 {
    font-size: 1.1rem;
  }
  
  .subscribe-cta-btn {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.9rem;
  }
}
/* The public prototype uses a text wordmark so the displayed name stays editable. */
.navbar .site-wordmark { font-size: 36px; font-weight: 800; letter-spacing: -2px; text-decoration: none; color: #26212b; line-height: 1.2; }
.navbar .site-wordmark span { color: #ed659a; }
.prototype-note { margin: 20px auto 6px; color: #726570; text-align: center; font-size: 14px; line-height: 1.6; }
html[data-public-prototype] .prototype-note { display: block; }
