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

/* Enhanced viewport handling for mobile */
html {
  height: 100%;
  overflow-x: hidden;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  line-height: 1.6;
  color: #fff;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  min-height: 100vh;
  min-height: 100dvh; /* Dynamic viewport height for mobile */
  overflow-x: hidden;
  position: relative;
  /* Safe area support for modern phones */
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* Prevent zoom on input focus for iOS Safari */
@media screen and (max-width: 767px) {
  input,
  select,
  textarea {
    font-size: 16px !important;
  }
}

/* Enhanced touch-friendly interactions */
.btn,
.floating-btn,
.suggestion-item,
.score-item {
  -webkit-tap-highlight-color: rgba(233, 175, 81, 0.3);
  touch-action: manipulation;
  user-select: none;
  /* Minimum touch target size */
  min-height: 44px;
  min-width: 44px;
}

/* Beautiful game-like background effects */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
      circle at 20% 80%,
      rgba(233, 175, 81, 0.15) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 20%,
      rgba(233, 175, 81, 0.08) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 40% 40%,
      rgba(102, 126, 234, 0.12) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 60% 70%,
      rgba(233, 175, 81, 0.05) 0%,
      transparent 40%
    );
  animation: backgroundShift 20s ease-in-out infinite;
  z-index: -1;
}

@keyframes backgroundShift {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.8;
  }
}

/* Additional floating particles effect */
body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(
      2px 2px at 20px 30px,
      rgba(233, 175, 81, 0.3),
      transparent
    ),
    radial-gradient(2px 2px at 40px 70px, rgba(233, 175, 81, 0.2), transparent),
    radial-gradient(1px 1px at 90px 40px, rgba(233, 175, 81, 0.4), transparent),
    radial-gradient(1px 1px at 130px 80px, rgba(233, 175, 81, 0.3), transparent),
    radial-gradient(2px 2px at 160px 30px, rgba(233, 175, 81, 0.2), transparent);
  background-repeat: repeat;
  background-size: 200px 100px;
  animation: sparkle 15s linear infinite;
  z-index: -1;
  pointer-events: none;
}

@keyframes sparkle {
  0% {
    transform: translateY(0px) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(-100vh) rotate(360deg);
    opacity: 0;
  }
}

/* Container - Enhanced responsive */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  z-index: 1;
  /* Safe area support */
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
  padding-top: max(1rem, env(safe-area-inset-top));
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
}

/* Screen Management - Enhanced */
.screen {
  display: none;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  animation: fadeIn 1s ease-in-out;
  position: relative;
  overflow: hidden;
}

.screen.active {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

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

/* Game Header - Reduced margins */
.game-header {
  text-align: center;
  margin-bottom: 1.5rem;
  width: 100%;
}

.logo {
  margin-bottom: 1rem;
}

.logo h1 {
  font-size: 3.5rem;
  font-weight: 800;
  background: linear-gradient(45deg, #667eea, #764ba2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.3rem;
}

.tagline {
  font-size: 1.2rem;
  color: #666;
  font-weight: 500;
}

/* Setup Form - Game theme styling */
.setup-card {
  background: rgba(20, 25, 45, 0.9);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 20px rgba(233, 175, 81, 0.1);
  width: 100%;
  max-width: 600px;
  animation: slideUp 0.8s ease-out;
  border: 1px solid rgba(233, 175, 81, 0.3);
  backdrop-filter: blur(10px);
}

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

.card-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.card-header h2 {
  color: #e9af51;
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.card-header p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 1rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.form-group {
  margin-bottom: 0;
}

.form-group label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.form-group label i {
  color: #e9af51;
  font-size: 0.9rem;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 2px solid rgba(233, 175, 81, 0.3);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  font-family: inherit;
  backdrop-filter: blur(5px);
}

.form-group input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #e9af51;
  box-shadow: 0 0 0 3px rgba(233, 175, 81, 0.2);
}

/* Character count styles */
.char-count {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 0.5rem;
  text-align: right;
  font-weight: 500;
}

.char-count-warning {
  color: #ff6b6b;
}

.char-count-ok {
  color: #51cf66;
}

.form-group select option {
  background: rgba(20, 25, 45, 0.95);
  color: #fff;
}

/* Progress Container - Simplified */
.progress-container {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  margin-bottom: 1.5rem;
  border: 1px solid rgba(102, 126, 234, 0.1);
}

.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
}

#round-display {
  color: #333;
  font-weight: 700;
  font-size: 1.1rem;
}

.progress-text {
  color: #666;
  font-size: 0.85rem;
}

/* Game Logo Container */
.game-logo-container {
  text-align: center;
  margin-bottom: 2rem;
}

.game-logo-container h1 {
  font-size: 3.5rem;
  font-weight: 800;
  color: #667eea;
  margin: 0;
}

/* Immersive Game Content - Enhanced */
.game-content {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1rem;
  min-height: calc(100vh - 120px);
  min-height: calc(100dvh - 120px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.5rem;
  position: relative;
  z-index: 1;
  /* Safe area support */
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
}

/* Fixed Question Counter - Enhanced positioning */
.question-counter-fixed {
  position: fixed;
  top: max(1rem, env(safe-area-inset-top) + 0.5rem);
  left: max(1rem, env(safe-area-inset-left) + 0.5rem);
  z-index: 100;
  background: rgba(20, 25, 45, 0.9);
  padding: 0.6rem 1rem;
  border-radius: 20px;
  border: 2px solid rgba(233, 175, 81, 0.4);
  backdrop-filter: blur(15px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), 0 0 15px rgba(233, 175, 81, 0.2);
}

.question-counter-fixed span {
  color: #e9af51;
  font-weight: 700;
  font-size: 1rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Conversation container removed - elements flow directly in game-content */

/* Question Bubble - Immersive Game Style */
.question-bubble {
  background: linear-gradient(135deg, #e9af51, #d4941a);
  color: white;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.5;
  padding: 1.5rem 2rem;
  border-radius: 25px 25px 25px 8px;
  position: relative;
  box-shadow: 0 8px 25px rgba(233, 175, 81, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  max-width: 85%;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.question-bubble::before {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 20px;
  width: 16px;
  height: 16px;
  background: linear-gradient(135deg, #e9af51, #d4941a);
  transform: rotate(45deg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

/* Answer Bubble - Immersive Game Style */
.answer-bubble {
  background: linear-gradient(135deg, #48dbfb, #0abde3, #48dbfb);
  color: white;
  font-size: 1.1rem;
  font-weight: 500;
  line-height: 1.5;
  padding: 1.5rem 2rem;
  border-radius: 25px 25px 8px 25px;
  position: relative;
  box-shadow: 0 8px 25px rgba(72, 219, 251, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  max-width: 85%;
  margin-left: auto;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background-size: 200% 100%;
}

.answer-bubble::before {
  content: "";
  position: absolute;
  bottom: -8px;
  right: 20px;
  width: 16px;
  height: 16px;
  background: linear-gradient(135deg, #48dbfb, #0abde3);
  transform: rotate(45deg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}

/* Share Button Container */
.share-button-container {
  position: absolute;
  top: 1rem;
  right: 1rem;
}

/* Character Question - Game Style */
.character-question {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  animation: slideInLeft 0.8s ease-out;
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.character-avatar {
  font-size: 3rem;
  flex-shrink: 0;
  animation: characterBounce 3s ease-in-out infinite;
  background: rgba(233, 175, 81, 0.1);
  border-radius: 50%;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(233, 175, 81, 0.3);
  box-shadow: 0 4px 15px rgba(233, 175, 81, 0.2);
}

@keyframes characterBounce {
  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

.character-info {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.character-name {
  color: #e9af51;
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* User Answer Section - Enhanced */
.user-answer {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  animation: slideInRight 0.8s ease-out;
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: rgba(20, 25, 45, 0.6);
  border-radius: 20px;
  border: 1px solid rgba(72, 219, 251, 0.2);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

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

.user-avatar {
  font-size: 2.5rem;
  flex-shrink: 0;
  order: 2;
  animation: characterBounce 3s ease-in-out infinite;
}

.user-info {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  order: 1;
}

.user-name {
  color: #48dbfb;
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  text-align: right;
}

/* Answer Input Section - No Container Style */
.answer-input {
  margin-bottom: 2rem;
  position: relative;
}

.user-input-container {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  animation: slideInRight 0.5s ease-out;
}

.user-avatar {
  font-size: 2.5rem;
  flex-shrink: 0;
  animation: characterBounce 3s ease-in-out infinite;
  order: 1;
  background: rgba(72, 219, 251, 0.1);
  border-radius: 50%;
  width: 70px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(72, 219, 251, 0.3);
  box-shadow: 0 4px 15px rgba(72, 219, 251, 0.2);
}

.user-info {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  order: 2;
}

.user-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.user-name {
  color: #48dbfb;
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
}

.user-header .btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

#user-answer {
  width: 85%;
  min-height: 120px;
  padding: 1.5rem;
  border: 2px solid rgba(233, 175, 81, 0.3);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-size: 1rem;
  resize: vertical;
  transition: all 0.3s ease;
  font-family: inherit;
  position: relative;
  backdrop-filter: blur(10px);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.2);
}

#user-answer::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

#user-answer:focus {
  outline: none;
  border-color: #e9af51;
  box-shadow: 0 0 0 3px rgba(233, 175, 81, 0.2);
}

/* Floating Navigation - Enhanced positioning */
.floating-nav {
  position: fixed;
  bottom: max(2rem, env(safe-area-inset-bottom) + 1rem);
  left: 0;
  right: 0;
  z-index: 100;
  pointer-events: none;
  /* Safe area support */
  padding-left: max(2rem, env(safe-area-inset-left) + 1rem);
  padding-right: max(2rem, env(safe-area-inset-right) + 1rem);
}

.floating-btn {
  pointer-events: all;
  border-radius: 50px;
  padding: 1rem 1.5rem;
  font-weight: 600;
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4), 0 0 20px rgba(233, 175, 81, 0.2);
  backdrop-filter: blur(15px);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  /* Enhanced touch targets */
  min-height: 48px;
  min-width: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.floating-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;
}

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

.floating-left {
  position: absolute;
  left: 2rem;
  bottom: 0;
}

.floating-right {
  position: absolute;
  right: 2rem;
  bottom: 0;
  display: flex;
  gap: 1rem;
  align-items: center;
}

/* AI Suggestions - Moved above Next button */
.ai-suggestions {
  margin-bottom: 1.5rem;
}

/* AI Suggestions - Reduced margins */
.suggestions-container {
  margin-top: 1rem;
  padding: 1.2rem;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 10px;
  border: 1px solid #e1e5e9;
  animation: slideDown 0.5s ease-out;
}

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

.suggestions-container.hidden {
  display: none;
}

.suggestions-container h4 {
  color: #333;
  margin-bottom: 0.8rem;
  font-size: 1rem;
  font-weight: 600;
}

.suggestions-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.suggestion-item {
  padding: 0.8rem;
  background: white;
  border-radius: 8px;
  color: #333;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid transparent;
  font-size: 0.9rem;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.suggestion-item:hover {
  background: #f8f9fa;
  border-color: #48dbfb;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* Buttons - Remove gradients */
.btn {
  padding: 0.8rem 1.5rem;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-decoration: none;
  font-family: inherit;
  text-align: center;
}

.btn-primary {
  background: linear-gradient(135deg, #e9af51, #d4941a, #e9af51);
  color: #fff;
  box-shadow: 0 6px 25px rgba(233, 175, 81, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);

  animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
  0%,
  100% {
    background-position: 200% 0;
  }
  50% {
    background-position: -200% 0;
  }
}

.btn-primary:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 10px 35px rgba(233, 175, 81, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  background: linear-gradient(135deg, #f0bc5e, #e9af51, #f0bc5e);
  background-size: 200% 100%;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  border: 2px solid rgba(233, 175, 81, 0.4);
  backdrop-filter: blur(15px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
  background: rgba(233, 175, 81, 0.15);
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 25px rgba(233, 175, 81, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  border-color: #e9af51;
  color: #e9af51;
}

.btn-magic {
  background: #a55eea;
  color: white;
  border: none;
  box-shadow: 0 4px 15px rgba(165, 94, 234, 0.3);
}

.btn-magic:hover {
  box-shadow: 0 6px 20px rgba(165, 94, 234, 0.4);
}

.btn-outline {
  background: rgba(233, 175, 81, 0.05);
  color: #e9af51;
  border: 2px solid #e9af51;
  backdrop-filter: blur(15px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(233, 175, 81, 0.1);
}

.btn-outline:hover {
  background: rgba(233, 175, 81, 0.2);
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 25px rgba(233, 175, 81, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  color: #fff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

/* Removed share button styles */

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Action Buttons */
.action-buttons {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Results Screen - Simplified */
.results-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.results-header h2 {
  color: #e9af51;
  font-size: 2.5rem;
  font-weight: 800;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.score-section {
  text-align: center;
  margin-bottom: 2rem;
  padding: 2rem;
  background: rgba(20, 25, 45, 0.9);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 20px rgba(233, 175, 81, 0.1);
  animation: slideUp 0.8s ease-out;
  border: 1px solid rgba(233, 175, 81, 0.3);
  backdrop-filter: blur(10px);
}

.score-badge {
  font-size: 4rem;
  animation: badgePulse 3s ease-in-out infinite;
  margin-bottom: 0.8rem;
}

@keyframes badgePulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

#score-title {
  color: #e9af51;
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

#score-description {
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.1rem;
  line-height: 1.5;
}

.answers-review {
  width: 100%;
  margin-bottom: 1.5rem;
}

.answers-review h3 {
  color: #e9af51;
  font-size: 1.6rem;
  margin-bottom: 1rem;
  text-align: center;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.answers-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.answer-item {
  background: rgba(20, 25, 45, 0.9);
  border-radius: 10px;
  padding: 1.2rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
  border: 1px solid rgba(233, 175, 81, 0.3);
  backdrop-filter: blur(10px);
}

.answer-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.answer-character {
  color: #e9af51;
  font-weight: 700;
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
}

.answer-question {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
  margin-bottom: 0.6rem;
  font-style: italic;
}

.answer-text {
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
  font-size: 1rem;
  line-height: 1.4;
}

/* Loading Animation */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(102, 126, 234, 0.3);
  border-radius: 50%;
  border-top-color: #667eea;
  animation: spin 1s ease-in-out infinite;
}

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

/* Utility Classes */
.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

.mb-1 {
  margin-bottom: 0.5rem;
}
.mb-2 {
  margin-bottom: 1rem;
}
.mb-3 {
  margin-bottom: 1.5rem;
}
.mb-4 {
  margin-bottom: 2rem;
}

/* COMPREHENSIVE RESPONSIVE DESIGN - ENHANCED */

/* Extra Small Mobile Devices: 320px - 480px */
@media (max-width: 480px) {
  /* Base Layout */
  .container {
    padding: 0.5rem;
    min-height: 100vh;
    min-height: 100dvh;
    padding-left: max(0.5rem, env(safe-area-inset-left));
    padding-right: max(0.5rem, env(safe-area-inset-right));
    padding-top: max(0.5rem, env(safe-area-inset-top));
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
  }

  /* Header & Logo */
  .logo h1 {
    font-size: 2.2rem;
    line-height: 1.2;
  }

  .tagline {
    font-size: 0.9rem;
  }

  /* Setup Form */
  .setup-card {
    padding: 1.2rem;
    margin: 0.5rem;
    width: calc(100% - 1rem);
  }

  .card-header h2 {
    font-size: 1.6rem;
  }

  .card-header p {
    font-size: 0.9rem;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 0.8rem;
  }

  .form-group input,
  .form-group select {
    padding: 0.7rem 0.8rem;
    font-size: 0.9rem;
    min-height: 48px; /* Touch target */
  }

  /* Game Content */
  .game-content {
    padding: 0.8rem 0.3rem;
    gap: 1.5rem;
    min-height: calc(100vh - 140px);
    min-height: calc(100dvh - 140px);
    padding-left: max(0.3rem, env(safe-area-inset-left));
    padding-right: max(0.3rem, env(safe-area-inset-right));
  }

  .question-counter-fixed {
    top: max(0.5rem, env(safe-area-inset-top) + 0.3rem);
    left: max(0.5rem, env(safe-area-inset-left) + 0.3rem);
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
  }

  .question-counter-fixed span {
    font-size: 0.9rem;
  }

  /* Characters */
  .character-question {
    gap: 1rem;
    flex-direction: column;
    text-align: center;
  }

  .character-avatar {
    font-size: 2.5rem;
    width: 70px;
    height: 70px;
    margin: 0 auto;
  }

  .character-name {
    font-size: 1rem;
  }

  .question-bubble {
    font-size: 0.9rem;
    padding: 1rem 1.2rem;
    max-width: 100%;
    border-radius: 20px 20px 20px 8px;
  }

  /* User Answer */
  .user-answer {
    padding: 1rem;
    gap: 1rem;
    flex-direction: column-reverse;
    text-align: center;
  }

  .user-avatar {
    font-size: 2rem;
    width: 60px;
    height: 60px;
    margin: 0 auto;
    order: 1;
  }

  .user-info {
    order: 2;
  }

  .answer-bubble {
    font-size: 0.95rem;
    padding: 1rem 1.2rem;
    max-width: 100%;
    margin: 0 auto;
    border-radius: 20px 20px 8px 20px;
  }

  /* Answer Input */
  .answer-input {
    margin-bottom: 140px; /* Space for floating buttons */
  }

  .user-input-container {
    flex-direction: column;
    gap: 0.8rem;
    align-items: center;
  }

  .user-input-container .user-avatar {
    order: 1;
  }

  .user-info {
    order: 2;
    width: 100%;
  }

  .user-header {
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
  }

  #user-answer {
    min-height: 100px;
    padding: 1rem;
    font-size: 0.95rem;
    width: 100%;
  }

  /* Floating Navigation */
  .floating-nav {
    bottom: max(1rem, env(safe-area-inset-bottom) + 0.5rem);
    left: 0;
    right: 0;
    padding-left: max(0.5rem, env(safe-area-inset-left) + 0.3rem);
    padding-right: max(0.5rem, env(safe-area-inset-right) + 0.3rem);
  }

  .floating-left {
    left: 0;
    bottom: 0;
  }

  .floating-right {
    right: 0;
    bottom: 0;
    flex-direction: row;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
    width: 100%;
  }

  .floating-btn {
    padding: 0.8rem 1rem;
    font-size: 0.85rem;
    border-radius: 25px;
    flex: 1;
    max-width: 120px;
    min-height: 48px;
    min-width: 48px;
  }

  /* Buttons */
  .btn {
    padding: 0.7rem 1rem;
    font-size: 0.9rem;
    border-radius: 8px;
    min-height: 48px;
    min-width: 48px;
  }

  .action-buttons {
    flex-direction: column;
    gap: 0.8rem;
  }

  /* Results */
  .results-header h2 {
    font-size: 1.8rem;
  }

  .score-section {
    padding: 1.5rem;
  }

  .score-badge {
    font-size: 3rem;
  }

  #score-title {
    font-size: 1.4rem;
  }

  #score-description {
    font-size: 1rem;
  }

  .answers-review h3 {
    font-size: 1.4rem;
  }

  .answer-item {
    padding: 1rem;
  }
}

/* Small Mobile Devices: 481px - 767px */
@media (min-width: 481px) and (max-width: 767px) {
  .container {
    padding: 0.8rem;
    padding-left: max(0.8rem, env(safe-area-inset-left));
    padding-right: max(0.8rem, env(safe-area-inset-right));
    padding-top: max(0.8rem, env(safe-area-inset-top));
    padding-bottom: max(0.8rem, env(safe-area-inset-bottom));
  }

  .logo h1 {
    font-size: 2.6rem;
  }

  .setup-card {
    padding: 1.5rem;
    width: calc(100% - 1rem);
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .game-content {
    padding: 1rem 0.5rem;
    gap: 2rem;
    padding-left: max(0.5rem, env(safe-area-inset-left));
    padding-right: max(0.5rem, env(safe-area-inset-right));
  }

  .character-question {
    padding: 1.2rem;
    gap: 1.2rem;
  }

  .character-avatar {
    font-size: 2.8rem;
    width: 75px;
    height: 75px;
  }

  .user-avatar {
    font-size: 2.3rem;
    width: 65px;
    height: 65px;
  }

  .question-bubble,
  .answer-bubble {
    font-size: 0.95rem;
    padding: 1.2rem 1.5rem;
    max-width: 90%;
  }

  .user-input-container {
    flex-direction: row;
    gap: 1rem;
  }

  .floating-right {
    flex-direction: column;
    gap: 0.8rem;
    align-items: flex-end;
  }

  .floating-btn {
    padding: 0.8rem 1.2rem;
    font-size: 0.9rem;
    min-height: 48px;
    min-width: 48px;
  }

  .results-header h2 {
    font-size: 2rem;
  }

  .score-badge {
    font-size: 3.3rem;
  }
}

/* Tablet Portrait: 768px - 1024px */
@media (min-width: 768px) and (max-width: 1024px) {
  .container {
    padding: 1rem;
    max-width: 900px;
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
    padding-top: max(1rem, env(safe-area-inset-top));
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
  }

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

  .setup-card {
    padding: 2rem;
    max-width: 700px;
  }

  .form-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1.2rem;
  }

  .game-content {
    padding: 1.5rem 1rem;
    gap: 2.5rem;
    max-width: 850px;
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }

  .character-question {
    gap: 1.5rem;
  }

  .character-avatar {
    font-size: 3.2rem;
    width: 85px;
    height: 85px;
  }

  .user-avatar {
    font-size: 2.8rem;
    width: 75px;
    height: 75px;
  }

  .question-bubble,
  .answer-bubble {
    font-size: 1.1rem;
    padding: 1.4rem 1.8rem;
    max-width: 85%;
  }

  .user-input-container {
    gap: 1.2rem;
  }

  #user-answer {
    min-height: 120px;
    padding: 1.3rem;
  }

  .floating-btn {
    padding: 0.9rem 1.4rem;
    font-size: 1rem;
    min-height: 48px;
    min-width: 48px;
  }

  .question-counter-fixed {
    top: max(1.2rem, env(safe-area-inset-top) + 0.8rem);
    left: max(1rem, env(safe-area-inset-left) + 0.5rem);
    padding: 0.7rem 1.2rem;
  }

  .results-header h2 {
    font-size: 2.3rem;
  }

  .score-badge {
    font-size: 3.8rem;
  }
}

/* Desktop Small: 1025px - 1440px */
@media (min-width: 1025px) and (max-width: 1440px) {
  .container {
    max-width: 1000px;
    padding: 1.5rem;
    padding-left: max(1.5rem, env(safe-area-inset-left));
    padding-right: max(1.5rem, env(safe-area-inset-right));
    padding-top: max(1.5rem, env(safe-area-inset-top));
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
  }

  .logo h1 {
    font-size: 3.5rem;
  }

  .setup-card {
    max-width: 650px;
    padding: 2.5rem;
  }

  .game-content {
    max-width: 900px;
    padding: 2rem 1.5rem;
    padding-left: max(1.5rem, env(safe-area-inset-left));
    padding-right: max(1.5rem, env(safe-area-inset-right));
  }

  .user-answer {
    padding: 2rem;
  }

  .floating-btn {
    padding: 1rem 1.6rem;
    font-size: 1.1rem;
    min-height: 48px;
    min-width: 48px;
  }
}

/* Desktop Large: 1441px+ */
@media (min-width: 1441px) {
  .container {
    max-width: 1200px;
    padding: 2rem;
    padding-left: max(2rem, env(safe-area-inset-left));
    padding-right: max(2rem, env(safe-area-inset-right));
    padding-top: max(2rem, env(safe-area-inset-top));
    padding-bottom: max(2rem, env(safe-area-inset-bottom));
  }

  .logo h1 {
    font-size: 4rem;
  }

  .setup-card {
    max-width: 700px;
    padding: 3rem;
  }

  .game-content {
    max-width: 1000px;
    padding: 2.5rem 2rem;
    gap: 3.5rem;
    padding-left: max(2rem, env(safe-area-inset-left));
    padding-right: max(2rem, env(safe-area-inset-right));
  }

  .character-question {
    padding: 2.5rem;
  }

  .question-bubble,
  .answer-bubble {
    font-size: 1.3rem;
    padding: 1.8rem 2.2rem;
  }

  .character-avatar {
    font-size: 3.8rem;
    width: 95px;
    height: 95px;
  }

  .user-avatar {
    font-size: 3.2rem;
    width: 85px;
    height: 85px;
  }

  #user-answer {
    min-height: 140px;
    padding: 1.8rem;
    font-size: 1.1rem;
  }
}

/* Additional responsive enhancements for specific components */

/* Very small screens (320px and below) */
@media (max-width: 320px) {
  .container {
    padding: 0.3rem;
    padding-left: max(0.3rem, env(safe-area-inset-left));
    padding-right: max(0.3rem, env(safe-area-inset-right));
    padding-top: max(0.3rem, env(safe-area-inset-top));
    padding-bottom: max(0.3rem, env(safe-area-inset-bottom));
  }

  .setup-card {
    padding: 1rem;
    margin: 0.3rem;
    width: calc(100% - 0.6rem);
  }

  .card-header h2 {
    font-size: 1.4rem;
  }

  .logo h1 {
    font-size: 2rem;
  }

  .game-content {
    padding: 0.5rem 0.2rem;
    gap: 1.2rem;
    padding-left: max(0.2rem, env(safe-area-inset-left));
    padding-right: max(0.2rem, env(safe-area-inset-right));
  }

  .character-avatar,
  .user-avatar {
    font-size: 2rem;
    width: 55px;
    height: 55px;
  }

  .question-bubble,
  .answer-bubble {
    font-size: 0.9rem;
    padding: 0.9rem 1rem;
  }

  .floating-btn {
    padding: 0.6rem 0.8rem;
    font-size: 0.8rem;
    max-width: 100px;
    min-height: 44px;
    min-width: 44px;
  }

  #user-answer {
    min-height: 80px;
    padding: 0.8rem;
    font-size: 0.9rem;
  }
}

/* Landscape mobile orientation - Enhanced */
@media (max-width: 767px) and (orientation: landscape) {
  .game-content {
    padding: 0.5rem 0.3rem;
    gap: 1rem;
    min-height: calc(100vh - 100px);
    min-height: calc(100dvh - 100px);
    padding-left: max(0.3rem, env(safe-area-inset-left));
    padding-right: max(0.3rem, env(safe-area-inset-right));
  }

  .user-answer {
    padding: 0.8rem;
  }

  .question-counter-fixed {
    top: max(0.3rem, env(safe-area-inset-top) + 0.2rem);
    left: max(0.3rem, env(safe-area-inset-left) + 0.2rem);
    padding: 0.3rem 0.6rem;
  }

  .floating-nav {
    bottom: max(0.5rem, env(safe-area-inset-bottom) + 0.3rem);
    padding-left: max(0.5rem, env(safe-area-inset-left) + 0.3rem);
    padding-right: max(0.5rem, env(safe-area-inset-right) + 0.3rem);
  }

  .answer-input {
    margin-bottom: 80px;
  }

  .character-question {
    flex-direction: row;
    text-align: left;
  }

  .character-avatar {
    margin: 0;
  }

  .user-answer {
    flex-direction: row;
  }

  .user-avatar {
    margin: 0;
  }

  /* Optimize for landscape */
  .setup-card {
    padding: 1rem;
    margin: 0.5rem;
  }

  .form-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
  }

  .btn {
    padding: 0.6rem 1rem;
    min-height: 44px;
  }
}

/* High DPI / Retina displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .character-avatar,
  .user-avatar,
  .sweet-popup-icon {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* Dark mode support for devices that prefer it */
@media (prefers-color-scheme: dark) {
  /* Our theme is already dark, so we maintain consistency */
  body {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  }
}

/* Enhanced touch targets for all interactive elements */
@media (max-width: 767px) {
  .btn,
  .floating-btn,
  .suggestion-item,
  .score-item,
  input[type="button"],
  input[type="submit"],
  select,
  textarea {
    min-height: 44px;
    min-width: 44px;
  }

  /* Ensure proper spacing for touch targets */
  .floating-nav {
    gap: 0.5rem;
  }

  .action-buttons {
    gap: 0.8rem;
  }

  /* Improve form usability */
  .form-group input,
  .form-group select {
    min-height: 48px;
  }

  /* Better textarea handling */
  #user-answer {
    min-height: 100px;
    resize: none; /* Prevent resize on mobile */
  }
}

/* Specific fixes for iOS Safari */
@supports (-webkit-touch-callout: none) {
  body {
    /* Prevent elastic scrolling on iOS */
    -webkit-overflow-scrolling: touch;
  }

  .floating-nav {
    /* Ensure buttons stay visible on iOS */
    position: fixed;
    bottom: max(2rem, env(safe-area-inset-bottom) + 1rem);
  }

  .question-counter-fixed {
    /* Ensure counter stays visible on iOS */
    position: fixed;
    top: max(1rem, env(safe-area-inset-top) + 0.5rem);
  }
}

/* Fix for Android Chrome */
@media screen and (max-width: 767px) {
  .floating-nav {
    /* Prevent bottom bar overlap on Android */
    bottom: max(2rem, env(safe-area-inset-bottom) + 1rem);
  }

  .game-content {
    /* Ensure content doesn't get hidden behind Android navigation */
    padding-bottom: max(2rem, env(safe-area-inset-bottom) + 1rem);
  }
}

/* Final mobile-specific fixes */
@media (max-width: 767px) {
  /* Fix textarea width issue */
  #user-answer {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Ensure buttons don't overlap */
  .floating-right {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .floating-btn {
    flex-shrink: 0;
  }

  /* Better spacing for very small screens */
  @media (max-width: 360px) {
    .floating-nav {
      padding-left: 0.3rem;
      padding-right: 0.3rem;
    }

    .floating-btn {
      padding: 0.6rem 0.8rem;
      font-size: 0.8rem;
      min-width: 40px;
      min-height: 40px;
    }

    .question-counter-fixed {
      padding: 0.3rem 0.6rem;
      font-size: 0.8rem;
    }
  }

  /* Fix for landscape mode on small screens */
  @media (max-width: 767px) and (orientation: landscape) and (max-height: 500px) {
    .game-content {
      padding: 0.3rem 0.2rem;
      gap: 0.8rem;
      min-height: calc(100vh - 80px);
      min-height: calc(100dvh - 80px);
    }

    .character-question {
      flex-direction: row;
      gap: 0.8rem;
    }

    .character-avatar {
      font-size: 2rem;
      width: 50px;
      height: 50px;
    }

    .user-avatar {
      font-size: 1.8rem;
      width: 45px;
      height: 45px;
    }

    .question-bubble,
    .answer-bubble {
      font-size: 0.85rem;
      padding: 0.8rem 1rem;
    }

    .floating-nav {
      bottom: 0.3rem;
      padding-left: 0.3rem;
      padding-right: 0.3rem;
    }

    .answer-input {
      margin-bottom: 60px;
    }
  }
}

/* Ensure proper touch targets on all devices */
@media (hover: none) and (pointer: coarse) {
  .btn,
  .floating-btn,
  input[type="button"],
  input[type="submit"],
  select,
  .suggestion-item {
    min-height: 44px;
    min-width: 44px;
  }
}

/* Fix for iOS Safari specific issues */
@supports (-webkit-touch-callout: none) {
  /* Prevent zoom on input focus */
  input,
  select,
  textarea {
    font-size: 16px !important;
  }

  /* Fix for iOS safe area */
  .floating-nav {
    padding-bottom: env(safe-area-inset-bottom);
  }

  .question-counter-fixed {
    padding-top: env(safe-area-inset-top);
  }
}

/* Fix for Android Chrome specific issues */
@media screen and (max-width: 767px) {
  /* Prevent address bar from affecting layout */
  body {
    min-height: 100vh;
    min-height: 100dvh;
  }

  /* Ensure buttons are always visible */
  .floating-nav {
    position: fixed !important;
    bottom: max(1rem, env(safe-area-inset-bottom) + 0.5rem) !important;
  }
}

/* Score Popup - Perfect UI */
.score-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    135deg,
    rgba(26, 26, 46, 0.95) 0%,
    rgba(22, 33, 62, 0.95) 50%,
    rgba(15, 52, 96, 0.95) 100%
  );
  backdrop-filter: blur(20px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  animation: popupBackdropIn 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes popupBackdropIn {
  0% {
    opacity: 0;
    backdrop-filter: blur(0px);
  }
  100% {
    opacity: 1;
    backdrop-filter: blur(20px);
  }
}

.score-popup-content {
  background: linear-gradient(
    145deg,
    rgba(20, 25, 45, 0.98) 0%,
    rgba(26, 26, 46, 0.95) 50%,
    rgba(20, 25, 45, 0.98) 100%
  );
  border-radius: 24px;
  padding: 3rem 2.5rem;
  max-width: 500px;
  width: 95%;
  text-align: center;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4), 0 0 40px rgba(233, 175, 81, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(233, 175, 81, 0.3);
  backdrop-filter: blur(20px);
  animation: popupContentIn 0.8s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
  overflow: hidden;
}

/* Perfect popup entrance animation */
@keyframes popupContentIn {
  0% {
    opacity: 0;
    transform: translateY(60px) scale(0.8);
    filter: blur(10px);
  }
  60% {
    transform: translateY(-10px) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0px);
  }
}

/* Add subtle glow effect */
.score-popup-content::before {
  content: "";
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 24px;
  z-index: -1;
  animation: glowPulse 3s ease-in-out infinite;
}

@keyframes glowPulse {
  0%,
  100% {
    opacity: 0.6;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.02);
  }
}

.score-popup-content h2 {
  color: #e9af51;
  font-size: 2.2rem;
  margin-bottom: 2rem;
  font-weight: 800;
  text-shadow: 0 2px 8px rgba(233, 175, 81, 0.3);
  animation: titleGlow 0.8s ease-out 0.3s both;
}

@keyframes titleGlow {
  0% {
    opacity: 0;
    transform: translateY(20px);
    text-shadow: 0 2px 8px rgba(233, 175, 81, 0);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
    text-shadow: 0 2px 8px rgba(233, 175, 81, 0.3);
  }
}

.score-display {
  margin-bottom: 2.5rem;
  animation: scoreDisplayIn 1s ease-out 0.5s both;
}

@keyframes scoreDisplayIn {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  70% {
    transform: scale(1.1);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.score-number {
  font-size: 4rem;
  font-weight: 900;
  background: linear-gradient(135deg, #e9af51, #f0bc5e, #e9af51);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1rem;
  text-shadow: 0 4px 12px rgba(233, 175, 81, 0.4);
  animation: scoreNumberPulse 2s ease-in-out infinite;
  position: relative;
}

@keyframes scoreNumberPulse {
  0%,
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.05);
    filter: brightness(1.2);
  }
}

.score-number::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 120%;
  height: 120%;
  background: radial-gradient(
    circle,
    rgba(233, 175, 81, 0.2) 0%,
    transparent 70%
  );
  border-radius: 50%;
  z-index: -1;
  animation: scoreGlow 2s ease-in-out infinite;
}

@keyframes scoreGlow {
  0%,
  100% {
    opacity: 0.3;
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    opacity: 0.6;
    transform: translate(-50%, -50%) scale(1.1);
  }
}

.score-text {
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.1rem;
  font-weight: 500;
}

.score-category {
  margin-top: 2rem;
  padding: 1.5rem;
  background: linear-gradient(
    135deg,
    rgba(233, 175, 81, 0.15) 0%,
    rgba(233, 175, 81, 0.08) 50%,
    rgba(233, 175, 81, 0.15) 100%
  );
  border-radius: 16px;
  border: 1px solid rgba(233, 175, 81, 0.2);
  animation: categorySlideIn 1s ease-out 0.7s both;
}

@keyframes categorySlideIn {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.category-emoji {
  font-size: 2.5rem;
  margin-bottom: 0.8rem;
  animation: emojiFloat 3s ease-in-out infinite;
}

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

.category-name {
  font-size: 1.3rem;
  font-weight: 700;
  color: #e9af51;
  margin-bottom: 0.8rem;
  text-shadow: 0 2px 4px rgba(233, 175, 81, 0.3);
}

.category-description {
  color: rgba(255, 255, 255, 0.8);
  font-size: 1rem;
  line-height: 1.5;
  font-weight: 400;
}

.score-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 2.5rem;
  animation: buttonsSlideIn 1s ease-out 1s both;
}

@keyframes buttonsSlideIn {
  0% {
    opacity: 0;
    transform: translateY(40px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.score-buttons .btn {
  width: 100%;
  max-width: none;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* Enhanced button hover effects for popup */
.score-buttons .btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 25px rgba(233, 175, 81, 0.4);
}

/* API Score Display Styles - Perfect UI */
.api-score-section {
  margin-top: 2rem;
  padding: 1.8rem;
  background: linear-gradient(
    145deg,
    rgba(233, 175, 81, 0.2) 0%,
    rgba(233, 175, 81, 0.1) 50%,
    rgba(233, 175, 81, 0.2) 100%
  );
  border-radius: 20px;
  color: white;
  border: 1px solid rgba(233, 175, 81, 0.3);
  backdrop-filter: blur(15px);
  animation: apiSectionSlideIn 1.2s ease-out 0.9s both;
  position: relative;
  overflow: hidden;
}

/* Add subtle animated background */
.api-score-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(233, 175, 81, 0.1),
    transparent
  );
  animation: shimmerEffect 3s ease-in-out infinite;
}

@keyframes shimmerEffect {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

@keyframes apiSectionSlideIn {
  0% {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.api-score-section h3 {
  margin-bottom: 1.5rem;
  font-size: 1.4rem;
  font-weight: 700;
  text-align: center;
  color: #e9af51;
  text-shadow: 0 2px 8px rgba(233, 175, 81, 0.3);
  position: relative;
  z-index: 1;
}

.api-score-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
  position: relative;
  z-index: 1;
}

.score-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: rgba(20, 25, 45, 0.6);
  border-radius: 12px;
  border: 1px solid rgba(233, 175, 81, 0.2);
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  animation: scoreItemFadeIn 0.6s ease-out calc(var(--item-index) * 0.1s) both;
}

.score-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(233, 175, 81, 0.2);
  border-color: rgba(233, 175, 81, 0.4);
}

@keyframes scoreItemFadeIn {
  0% {
    opacity: 0;
    transform: translateX(-20px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

.score-label {
  font-weight: 600;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.9);
}

.score-value {
  font-weight: 800;
  font-size: 1.2rem;
  color: #e9af51;
  text-shadow: 0 2px 4px rgba(233, 175, 81, 0.3);
}

.api-feedback {
  text-align: center;
  padding: 1.2rem;
  background: rgba(20, 25, 45, 0.6);
  border-radius: 12px;
  border: 1px solid rgba(233, 175, 81, 0.2);
  backdrop-filter: blur(10px);
  position: relative;
  z-index: 1;
  animation: feedbackFadeIn 0.8s ease-out 1.2s both;
}

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

.api-feedback p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.6;
  font-style: italic;
  color: rgba(255, 255, 255, 0.9);
}

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

/* Perfect Popup Mobile Responsiveness */
@media (max-width: 768px) {
  .score-popup-content {
    padding: 2.5rem 2rem;
    max-width: 95%;
    margin: 1rem;
  }

  .score-popup-content h2 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
  }

  .score-number {
    font-size: 3.5rem;
  }

  .category-emoji {
    font-size: 2.2rem;
  }

  .category-name {
    font-size: 1.2rem;
  }

  .api-score-section {
    padding: 1.5rem;
  }

  .api-score-section h3 {
    font-size: 1.2rem;
  }

  .api-score-details {
    grid-template-columns: 1fr;
    gap: 0.8rem;
  }

  .score-item {
    padding: 0.8rem;
  }

  .score-value {
    font-size: 1.1rem;
  }

  .score-buttons {
    flex-direction: column;
    gap: 0.8rem;
  }
}

@media (max-width: 480px) {
  .score-popup-content {
    padding: 2rem 1.5rem;
    border-radius: 20px;
  }

  .score-popup-content h2 {
    font-size: 1.6rem;
  }

  .score-number {
    font-size: 3rem;
  }

  .category-emoji {
    font-size: 2rem;
  }

  .category-name {
    font-size: 1.1rem;
  }

  .category-description {
    font-size: 0.9rem;
  }

  .api-score-section {
    padding: 1.2rem;
  }

  .api-score-section h3 {
    font-size: 1.1rem;
  }

  .score-item {
    padding: 0.7rem;
    flex-direction: column;
    gap: 0.3rem;
    text-align: center;
  }

  .score-label,
  .score-value {
    font-size: 0.95rem;
  }

  .api-feedback p {
    font-size: 0.9rem;
  }
}

/* Score Details Enhancement */
.score-details {
  animation: detailsSlideIn 0.8s ease-out 0.6s both;
}

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

.score-breakdown {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.95rem;
  font-weight: 500;
}

/* Sweet Custom Popup Styles */
.sweet-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    135deg,
    rgba(26, 26, 46, 0.95) 0%,
    rgba(22, 33, 62, 0.95) 50%,
    rgba(15, 52, 96, 0.95) 100%
  );
  backdrop-filter: blur(20px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  animation: sweetPopupBackdropIn 0.4s ease-out;
}

@keyframes sweetPopupBackdropIn {
  0% {
    opacity: 0;
    backdrop-filter: blur(0px);
  }
  100% {
    opacity: 1;
    backdrop-filter: blur(20px);
  }
}

.sweet-popup-content {
  background: linear-gradient(
    145deg,
    rgba(20, 25, 45, 0.98) 0%,
    rgba(26, 26, 46, 0.95) 50%,
    rgba(20, 25, 45, 0.98) 100%
  );
  border-radius: 20px;
  padding: 2.5rem 2rem;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), 0 0 30px rgba(233, 175, 81, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(233, 175, 81, 0.3);
  backdrop-filter: blur(15px);
  animation: sweetPopupContentIn 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
  overflow: hidden;
}

@keyframes sweetPopupContentIn {
  0% {
    opacity: 0;
    transform: translateY(40px) scale(0.9);
    filter: blur(5px);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0px);
  }
}

.sweet-popup-content::before {
  content: "";
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(
    45deg,
    rgba(233, 175, 81, 0.2),
    rgba(233, 175, 81, 0.05),
    rgba(233, 175, 81, 0.2)
  );
  border-radius: 20px;
  z-index: -1;
  animation: sweetGlow 2s ease-in-out infinite;
}

@keyframes sweetGlow {
  0%,
  100% {
    opacity: 0.4;
  }
  50% {
    opacity: 0.8;
  }
}

.sweet-popup-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  animation: iconPulse 1.5s ease-in-out infinite;
  text-align: center;
  display: block;
}

@keyframes iconPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

.sweet-popup h3 {
  color: #e9af51;
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 1rem;
  text-shadow: 0 2px 8px rgba(233, 175, 81, 0.3);
  text-align: center;
}

.sweet-popup p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 1rem;
  line-height: 1.5;
  margin-bottom: 2rem;
  text-align: center;
}

.sweet-popup-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.sweet-popup-buttons .btn {
  min-width: 100px;
  font-size: 0.95rem;
  padding: 0.7rem 1.2rem;
  text-align: center;
  justify-content: center;
  align-items: center;
}

/* Sweet popup variants */
.sweet-popup.warning .sweet-popup-icon {
  color: #ffa726;
}

.sweet-popup.error .sweet-popup-icon {
  color: #ef5350;
}

.sweet-popup.success .sweet-popup-icon {
  color: #66bb6a;
}

.sweet-popup.info .sweet-popup-icon {
  color: #42a5f5;
}

/* Comprehensive popup responsiveness */
@media (max-width: 480px) {
  .sweet-popup-content {
    padding: 1.5rem 1rem;
    margin: 0.5rem;
    max-width: 95%;
    border-radius: 16px;
  }

  .sweet-popup h3 {
    font-size: 1.3rem;
    margin-bottom: 0.8rem;
  }

  .sweet-popup p {
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
  }

  .sweet-popup-icon {
    font-size: 2.2rem;
    margin-bottom: 0.8rem;
  }

  .sweet-popup-buttons {
    flex-direction: column;
    gap: 0.8rem;
  }

  .sweet-popup-buttons .btn {
    width: 100%;
    padding: 0.8rem;
    font-size: 0.9rem;
    text-align: center;
    justify-content: center;
    align-items: center;
  }

  /* Score popup mobile optimization */
  .score-popup-content {
    padding: 2rem 1.2rem;
    margin: 0.5rem;
    max-width: 95%;
  }

  .score-popup-content h2 {
    font-size: 1.6rem;
    margin-bottom: 1.5rem;
  }

  .score-number {
    font-size: 3rem;
  }

  .category-emoji {
    font-size: 2rem;
  }

  .category-name {
    font-size: 1.1rem;
  }

  .category-description {
    font-size: 0.9rem;
  }

  .api-score-section {
    padding: 1rem;
    margin-top: 1.5rem;
  }

  .api-score-section h3 {
    font-size: 1.1rem;
  }

  .api-score-details {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }

  .score-item {
    padding: 0.6rem;
    flex-direction: column;
    gap: 0.2rem;
    text-align: center;
  }

  .score-label,
  .score-value {
    font-size: 0.9rem;
  }

  .api-feedback {
    padding: 0.8rem;
  }

  .api-feedback p {
    font-size: 0.85rem;
  }

  .score-buttons {
    flex-direction: column;
    gap: 0.8rem;
    margin-top: 2rem;
  }

  .score-buttons .btn {
    width: 100%;
    padding: 0.8rem;
    font-size: 0.9rem;
  }
}

@media (min-width: 481px) and (max-width: 767px) {
  .sweet-popup-content {
    padding: 2rem 1.5rem;
    max-width: 90%;
  }

  .score-popup-content {
    padding: 2.5rem 2rem;
    max-width: 90%;
  }

  .score-popup-content h2 {
    font-size: 1.8rem;
  }

  .score-number {
    font-size: 3.5rem;
  }

  .api-score-details {
    grid-template-columns: 1fr;
    gap: 0.8rem;
  }
}

@media (min-width: 768px) and (max-width: 1024px) {
  .sweet-popup-content {
    padding: 2.5rem 2rem;
    max-width: 600px;
  }

  .score-popup-content {
    padding: 3rem 2.5rem;
    max-width: 600px;
  }

  .api-score-details {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
}

/* Loading message styles */
#loading-message {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 1rem 2rem;
  border-radius: 8px;
  z-index: 1000;
  display: none;
  font-weight: 500;
}

/* AI Analysis Section Styles */
.ai-analysis-section {
  margin-top: 2rem;
  padding: 1.5rem;
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-radius: 16px;
  color: white;
  animation: slideInUp 0.8s ease-out;
}

.ai-analysis-section h3 {
  margin-bottom: 1.5rem;
  font-size: 1.4rem;
  font-weight: 700;
  text-align: center;
  color: white;
}

.ai-analysis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.ai-score-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.ai-score-label {
  font-weight: 600;
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.9);
}

.ai-score-value {
  font-weight: 800;
  font-size: 1.2rem;
  color: #ffd700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.ai-feedback-summary {
  text-align: center;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.ai-feedback-summary p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.6;
  font-style: italic;
  color: rgba(255, 255, 255, 0.95);
}

/* Responsive design for AI analysis */
@media (max-width: 768px) {
  .ai-analysis-grid {
    grid-template-columns: 1fr;
    gap: 0.8rem;
  }

  .ai-analysis-section {
    padding: 1rem;
    margin-top: 1.5rem;
  }

  .ai-analysis-section h3 {
    font-size: 1.2rem;
  }

  .ai-score-item {
    padding: 0.8rem;
  }

  .ai-score-label {
    font-size: 0.9rem;
  }

  .ai-score-value {
    font-size: 1.1rem;
  }
}

/* Score Breakdown Styles */
.score-breakdown-section {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 2rem;
  margin: 2rem 0;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.score-breakdown-section h3 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #667eea;
  margin-bottom: 1.5rem;
  text-align: center;
}

.score-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.breakdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: rgba(102, 126, 234, 0.1);
  border-radius: 12px;
  border: 1px solid rgba(102, 126, 234, 0.2);
}

.breakdown-label {
  font-weight: 600;
  color: #333;
  font-size: 0.95rem;
}

.breakdown-value {
  font-weight: 700;
  color: #667eea;
  font-size: 1.1rem;
}

.individual-scores {
  margin-top: 1.5rem;
}

.individual-scores h4 {
  font-size: 1.2rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 1rem;
  text-align: center;
}

.scores-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
}

.score-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  background: rgba(72, 219, 251, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(72, 219, 251, 0.2);
}

.question-number {
  font-weight: 600;
  color: #333;
  font-size: 0.9rem;
}

.question-score {
  font-weight: 700;
  color: #48dbfb;
  font-size: 1rem;
}

/* Score Details in Popup */
.score-details {
  margin: 1rem 0;
  padding: 1rem;
  background: rgba(102, 126, 234, 0.1);
  border-radius: 12px;
  border: 1px solid rgba(102, 126, 234, 0.2);
}

.score-breakdown {
  text-align: center;
  font-size: 0.95rem;
  color: #666;
}

/* Responsive adjustments for score breakdown */
@media (max-width: 768px) {
  .score-breakdown-section {
    padding: 1.5rem;
    margin: 1.5rem 0;
  }

  .score-breakdown-section h3 {
    font-size: 1.3rem;
  }

  .score-breakdown-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .breakdown-item {
    padding: 0.75rem;
  }

  .breakdown-label {
    font-size: 0.9rem;
  }

  .breakdown-value {
    font-size: 1rem;
  }

  .scores-list {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.5rem;
  }

  .score-item {
    padding: 0.5rem;
  }

  .question-number {
    font-size: 0.85rem;
  }

  .question-score {
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .score-breakdown-section {
    padding: 1rem;
    margin: 1rem 0;
  }

  .score-breakdown-section h3 {
    font-size: 1.2rem;
  }

  .individual-scores h4 {
    font-size: 1.1rem;
  }

  .scores-list {
    grid-template-columns: repeat(2, 1fr);
  }
}
