/* Question and scoreboard UI */
.scoreboard {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 20px auto 1rem auto;
  max-width: 400px;
  width: 100%;
}

.team-scoreboard {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  margin: 20px auto 1rem auto;
  max-width: 400px;
  width: 100%;
  gap: 0.5rem;
}

.team-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  color: var(--btn-font-color);
  transition: transform 0.2s;
}

.team-card.active {
  outline: 3px solid var(--btn-font-color);
  transform: scale(1.05);
}

.team-card.inactive {
  transform: scale(0.85);
}

.team-name {
  font-weight: bold;
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
  text-align: center;
}

.team-score {
  font-size: 1.25rem;
  font-weight: bold;
}

.team-scoreboard .progress-wrapper {
  grid-column: 1 / 3;
  justify-self: center;
}

.score-correct {
  color: var(--correct-color);
  font-weight: bold;
  font-size: 2rem;
}

.score-wrong {
  color: var(--wrong-color);
  font-weight: bold;
  font-size: 2rem;
}

.progress-wrapper {
  position: relative;
  width: 320px;
  margin-top: 10px;
}

.score-progress {
  width: 100%;
  height: 2rem;
  accent-color: var(--btn-color);
  background: rgb(129 127 127);
  border-radius: 15px;
  position: relative;
  overflow: hidden;
  transition: all 0.8s ease-out;
}

.score-progress::-webkit-progress-bar {
  background: rgb(129 127 127);
  border-radius: 4px;
}

.score-progress::-webkit-progress-value {
  background: linear-gradient(45deg, var(--btn-color), rgba(255,255,255,0.3), var(--btn-color));
  border-radius: 4px;
  animation: progressShine 2s ease-in-out infinite;
}

.score-progress::-moz-progress-bar {
  background: linear-gradient(45deg, var(--btn-color), rgba(255,255,255,0.3), var(--btn-color));
  border-radius: 4px;
  animation: progressShine 2s ease-in-out infinite;
}

@keyframes progressShine {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

.progress-text {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--btn-font-color);
  pointer-events: none;
  line-height: 1;
}

.question {
  font-size: calc(var(--base-font) * 1.25);
  margin-bottom: 0.375rem;
  text-align: center;
  font-weight: bold;
}

.answers {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  margin: 0 auto;
  width: 100%;
  max-width: 480px;
}

.answer-btn {
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 12px;
  background: var(--btn-color);
  color: var(--btn-font-color);
  font-size: var(--base-font);
  font-weight: bold;
  cursor: pointer;
  width: 100%;
  min-width: 0;
  min-height: 48px;
}

.answer-btn.correct {
  background: var(--correct-color);
}

.answer-btn.wrong {
  background: var(--wrong-color);
}

/* Answer button animations */
.answer-btn {
  transition: all 0.3s ease, opacity 0.3s ease;
  position: relative;
  overflow: hidden;
}

.answer-btn.reveal {
  animation: answerReveal 0.4s ease-out;
}

@keyframes answerReveal {
  0% { 
    transform: rotateY(90deg); 
    opacity: 0.8;
  }
  100% { 
    transform: rotateY(0deg); 
    opacity: 1;
  }
}

.answer-btn.correct {
  box-shadow: 0 0 20px rgba(76, 175, 80, 0.6);
  animation: correctGlow 0.6s ease-out;
}

@keyframes correctGlow {
  0% { box-shadow: 0 0 0 rgba(76, 175, 80, 0); }
  50% { box-shadow: 0 0 25px rgba(76, 175, 80, 0.8); }
  100% { box-shadow: 0 0 20px rgba(76, 175, 80, 0.6); }
}


.answer-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Answer button entrance animation */
.answer-btn.entrance {
  opacity: 0;
  transform: translateY(20px);
  animation: answerEntrance 0.5s ease-out forwards;
}

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

.feedback {
  font-size: 1.5rem;
  font-weight: bold;
  text-align: center;
  margin: 1rem 0;
}

.feedback.correct {
  color: #4CAF50;
}

.feedback.wrong {
  color: #F44336;
}

/* Feedback animations */
.feedback-bounce {
  animation: feedbackBounce 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

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

.screen-shake {
  animation: screenShake 0.3s ease-in-out;
}

@keyframes screenShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  75% { transform: translateX(2px); }
}

.pulse-effect {
  position: relative;
}

.pulse-effect::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--btn-color);
  opacity: 0.3;
  transform: translate(-50%, -50%) scale(0);
  animation: pulseRing 0.8s ease-out;
}

/* Green burst for correct answers */
.feedback.correct.pulse-effect::after {
  background: #4CAF50;
}

/* Red burst for wrong answers */
.feedback.wrong.pulse-effect::after {
  background: #F44336;
}

@keyframes pulseRing {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0.3;
  }
  100% {
    transform: translate(-50%, -50%) scale(3);
    opacity: 0;
  }
}

/* Fun fact enhancements */
.fun-fact {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  padding: 1rem;
  margin: 1rem auto 0;
  max-width: 500px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.5s ease-out;
  font-size: calc(var(--base-font) * 0.9);
  text-align: center;
}

.fun-fact.slide-up {
  transform: translateY(0);
  opacity: 1;
}

.fun-fact-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-weight: bold;
  font-size: calc(var(--base-font) * 1.1);
}

.lightbulb-icon {
  font-size: 1.2rem;
  transition: all 0.3s ease;
  filter: grayscale(1);
}

.lightbulb-icon.light-up {
  filter: grayscale(0);
  text-shadow: 0 0 8px rgba(255, 255, 0, 0.6);
  animation: lightBulbGlow 0.6s ease-out;
}

@keyframes lightBulbGlow {
  0% { 
    transform: scale(1);
    text-shadow: 0 0 0 rgba(255, 255, 0, 0);
  }
  50% { 
    transform: scale(1.1);
    text-shadow: 0 0 12px rgba(255, 255, 0, 0.8);
  }
  100% { 
    transform: scale(1);
    text-shadow: 0 0 8px rgba(255, 255, 0, 0.6);
  }
}

/* Enhanced answer button depth */
.answer-btn {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.answer-btn:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Question dimming */
.question.dimmed {
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

/* Next button enhancements */
.next-btn-slide {
  transform: translateX(30px);
  opacity: 0;
  transition: all 0.4s ease-out;
}

.next-btn-slide.slide-in {
  transform: translateX(0);
  opacity: 1;
}

.next-btn-pulse {
  animation: nextButtonPulse 2s infinite;
}

@keyframes nextButtonPulse {
  0% { 
    box-shadow: 0 0 0 0 rgba(var(--btn-color-rgb, 177, 44, 44), 0.7);
  }
  70% { 
    box-shadow: 0 0 0 10px rgba(var(--btn-color-rgb, 177, 44, 44), 0);
  }
  100% { 
    box-shadow: 0 0 0 0 rgba(var(--btn-color-rgb, 177, 44, 44), 0);
  }
}

#next-btn:hover::after {
  content: ' →';
  transition: all 0.2s ease;
}

/* Progress bar highlight */
.progress-highlight {
  animation: progressGlow 0.6s ease-out;
}

@keyframes progressGlow {
  0% { 
    box-shadow: 0 4px 15px rgba(66, 135, 245, 0.3);
  }
  50% { 
    box-shadow: 0 4px 20px rgba(66, 135, 245, 0.6);
  }
  100% { 
    box-shadow: 0 4px 15px rgba(66, 135, 245, 0.3);
  }
}

/* Score animations */
.score-correct.celebration,
.score-wrong.celebration {
  animation: scoreCelebration 0.6s ease-out;
}

@keyframes scoreCelebration {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.team-score.celebration {
  animation: teamScoreCelebration 0.8s ease-out;
}

@keyframes teamScoreCelebration {
  0% { 
    transform: scale(1);
    text-shadow: none;
  }
  50% { 
    transform: scale(1.2);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
  }
  100% { 
    transform: scale(1);
    text-shadow: none;
  }
}

/* Team card breathing animation */
.team-card.active.breathing {
  animation: teamBreathing 2s ease-in-out infinite;
}

@keyframes teamBreathing {
  0%, 100% { transform: scale(1.05); }
  50% { transform: scale(1.08); }
}

/* Team switch transition */
.team-card.switching {
  transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Question transition animations */
.question-container {
  transition: all 0.4s ease-out;
}

.question-container.fade-out {
  opacity: 0;
  transform: translateY(-20px);
}

.question-container.fade-in {
  opacity: 1;
  transform: translateY(0);
}

.question-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100px;
  opacity: 0;
  transition: opacity 0.2s ease-in;
}

.question-loading.show {
  opacity: 1;
}

.loading-spinner {
  width: 30px;
  height: 30px;
  border: 3px solid rgba(var(--btn-color-rgb, 177, 44, 44), 0.3);
  border-top-color: var(--btn-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Touch device enhancements */
.touch-device .answer-btn,
.touch-device .pill-btn,
.touch-device .team-card {
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.touch-active {
  transform: scale(0.96) !important;
  opacity: 0.8 !important;
  transition: all 0.1s ease !important;
}

/* Ripple animation for touch feedback */
@keyframes ripple {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 0;
  }
}

/* Mobile performance optimizations */
.touch-device * {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Reduce motion for performance on request */
@media (prefers-reduced-motion: reduce) {
  .touch-device *,
  .touch-device *::before,
  .touch-device *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Improve mobile viewport handling */
.touch-device {
  height: 100vh;
  height: calc(var(--vh, 1vh) * 100);
  overflow-x: hidden;
}

/* Mobile touch optimizations */
@media (hover: none) and (pointer: coarse) {
  /* Mobile/touch device specific styles */
  .answer-btn,
  .pill-btn,
  .nav-btn {
    min-height: 44px;
    min-width: 44px;
    padding: 0.75rem 1rem;
    margin: 0.5rem 0.25rem;
    position: relative;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  
  /* Enhanced font weight for better readability */
  .answer-btn {
    font-weight: 700;
  }
  
  /* Touch ripple effect */
  .answer-btn::before,
  .pill-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
    pointer-events: none;
  }
  
  /* Touch pressed state */
  .answer-btn:active::before,
  .pill-btn:active::before {
    width: 200px;
    height: 200px;
  }
  
  .answer-btn:active,
  .pill-btn:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }
  
  /* Enhanced mobile spacing */
  .answers {
    gap: 0.75rem;
    padding: 0 1rem;
  }
  
  .team-card {
    min-height: 60px;
    padding: 0.75rem;
    margin: 0.5rem;
  }
  
  /* Mobile progress bar */
  .progress-wrapper {
    width: 100%;
    max-width: none;
    margin: 1rem 0;
  }
  
  .score-progress {
    height: 2.5rem;
  }
  
  /* Mobile question text */
  .question {
    font-size: calc(var(--base-font) * 1.1);
    line-height: 1.4;
    padding: 0 1rem;
  }
  
  /* Mobile feedback */
  .feedback {
    font-size: 4.5rem;
    margin: 1.5rem 0;
  }
  
  /* Mobile fun fact */
  .fun-fact {
    margin: 1.5rem auto 0;
    padding: 1.25rem;
    font-size: calc(var(--base-font) * 0.85);
    max-width: calc(100% - 2rem);
  }
  
  /* Mobile navigation */
  .nav-btn {
    padding: 0.5rem;
    margin: 0 0.25rem;
  }
  
  .nav-btn .icon {
    font-size: 1.5rem;
  }
}

/* Progressive enhancement for mobile viewport */
@media (max-width: 480px) {
  /* Small mobile optimizations */
  .answer-btn {
    font-size: 1rem;
    font-weight: bold;
    padding: 1rem;
    border-radius: 12px;
  }
  
  .team-scoreboard {
    gap: 0.75rem;
    margin: 1rem auto;
  }
  
  .fun-fact {
    border-radius: 8px;
    margin: 1rem auto 0;
    max-width: calc(100% - 1rem);
  }
  
  .question {
    margin-bottom: 1rem;
  }
}

@media (max-width: 500px) {
  .icon {
    font-size: 3rem;
  }
  .team-scoreboard {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
  }
  .team-scoreboard .progress-wrapper {
    width: 100%;
  }
}

/* Tablet optimizations */
@media (min-width: 768px) and (max-width: 1024px) {
  .fun-fact {
    margin: 1.5rem auto 0;
    max-width: 600px;
    padding: 1.5rem;
    font-size: calc(var(--base-font) * 1);
  }
  
  .fun-fact-header {
    font-size: calc(var(--base-font) * 1.2);
  }
}

/* Enhanced Final Score Screen */
.final-score-container {
  max-width: 600px;
  margin: 1rem auto;
  padding: 0 1rem;
  animation: fadeInUp 0.8s ease-out;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 120px);
}

.score-card {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.score-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
  animation: shimmer 2s ease-in-out infinite;
}

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

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

.score-title {
  font-size: 1.75rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
  background: linear-gradient(45deg, var(--btn-color), #FF6B6B);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.score-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  align-items: center;
}

.score-circle {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 0 auto;
}

.circle-background,
.circle-progress {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 6px solid;
}

.circle-background {
  border-color: rgba(255, 255, 255, 0.2);
}

.circle-progress {
  border-color: transparent;
  border-top-color: var(--correct-color);
  border-right-color: var(--correct-color);
  transform: rotate(-90deg);
  transition: transform 1.5s ease-out;
}

.score-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.score-percentage {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--correct-color);
  margin: 0;
}

.score-label {
  font-size: 0.9rem;
  opacity: 0.8;
  margin: 0;
}

.score-breakdown {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.score-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  animation: slideInRight 0.6s ease-out;
}

.score-item.correct {
  border-left: 4px solid var(--correct-color);
}

.score-item.wrong {
  border-left: 4px solid var(--wrong-color);
}

.score-item-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}

.score-item-icon {
  font-size: 1.2rem;
}

.score-item-value {
  font-size: 1.2rem;
  font-weight: bold;
  animation: countUp 1s ease-out;
}

.performance-section {
  margin: 1rem 0;
  flex: 1;
}

.performance-title {
  text-align: center;
  font-size: 1.2rem;
  margin-bottom: 1rem;
  opacity: 0.9;
}

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

.performance-card {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.performance-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.performance-icon {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}

.performance-value {
  font-size: 1.25rem;
  font-weight: bold;
  margin-bottom: 0.25rem;
}

.performance-label {
  font-size: 0.9rem;
  opacity: 0.8;
}

.emotional-feedback {
  text-align: center;
  margin: 1rem 0;
  animation: bounceIn 1s ease-out 0.5s both;
}

.feedback-emoji {
  font-size: 3rem;
  margin-bottom: 0.5rem;
  animation: float 3s ease-in-out infinite;
}

.feedback-message {
  font-size: 1.2rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.feedback-encouragement {
  font-size: 1rem;
  opacity: 0.8;
  font-style: italic;
}

.achievement-section {
  margin: 1rem 0;
}

.achievement-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.achievement-badge {
  background: linear-gradient(45deg, #FFD700, #FFA500);
  color: #333;
  padding: 0.375rem 0.75rem;
  border-radius: 20px;
  font-weight: bold;
  font-size: 0.8rem;
  box-shadow: 0 2px 10px rgba(255, 215, 0, 0.3);
  animation: badgeGlow 2s ease-in-out infinite alternate;
}

@keyframes badgeGlow {
  0% { box-shadow: 0 2px 10px rgba(255, 215, 0, 0.3); }
  100% { box-shadow: 0 4px 20px rgba(255, 215, 0, 0.6); }
}

.streak-visualization {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0.5rem 0;
}

.streak-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--correct-color);
  opacity: 0.3;
  transition: all 0.3s ease;
}

.streak-dot.active {
  opacity: 1;
  transform: scale(1.2);
  box-shadow: 0 0 10px var(--correct-color);
}

.action-panel {
  margin-top: auto;
  text-align: center;
  flex-shrink: 0;
  padding-top: 1rem;
}

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

.action-button {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 10px;
  background: var(--btn-color);
  color: var(--btn-font-color);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  animation: slideInUp 0.6s ease-out;
}

.action-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.action-button::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 ease;
}

.action-button:hover::before {
  left: 100%;
}

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

.confetti-piece {
  position: absolute;
  width: 8px;
  height: 8px;
  background: #FFD700;
  animation: confettiFall 3s linear infinite;
}

@keyframes confettiFall {
  0% {
    transform: translateY(-100vh) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

/* Animation keyframes */
@keyframes fadeInUp {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

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

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

/* Mobile and small screen optimizations */
@media (max-height: 700px) {
  .final-score-container {
    margin: 0.5rem auto;
    min-height: calc(100vh - 80px);
  }
  
  .score-card {
    padding: 1rem;
    margin-bottom: 0.5rem;
  }
  
  .score-header {
    margin-bottom: 1rem;
  }
  
  .score-title {
    font-size: 1.5rem;
  }
  
  .score-summary {
    gap: 1rem;
    margin-bottom: 1rem;
  }
  
  .score-circle {
    width: 80px;
    height: 80px;
  }
  
  .performance-section {
    margin: 0.5rem 0;
  }
  
  .performance-title {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
  }
  
  .performance-card {
    padding: 0.75rem;
  }
  
  .emotional-feedback {
    margin: 0.75rem 0;
  }
  
  .feedback-emoji {
    font-size: 2.5rem;
    margin-bottom: 0.25rem;
  }
  
  .achievement-section {
    margin: 0.75rem 0;
  }
  
  .action-panel {
    padding-top: 0.5rem;
  }
  
  .action-button {
    padding: 0.625rem 1.25rem;
    font-size: 0.9rem;
  }
}

/* Landscape mobile optimization */
@media (max-height: 600px) and (orientation: landscape) {
  .feedback {
    font-size: 3rem;
    margin: 0.5rem 0;
  }
  
  .fun-fact {
    margin: 0.5rem auto 0;
    padding: 0.75rem;
    font-size: calc(var(--base-font) * 0.8);
  }
  
  .question {
    font-size: calc(var(--base-font) * 1);
    margin-bottom: 0.5rem;
  }
  
  .answers {
    gap: 0.5rem;
  }
  
  .final-score-container {
    margin: 0.25rem auto;
    min-height: calc(100vh - 60px);
  }
  
  .score-card {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
  }
  
  .score-summary {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
  }
  
  .score-circle {
    width: 70px;
    height: 70px;
  }
  
  .performance-section {
    margin: 0.5rem 0;
  }
  
  .emotional-feedback {
    margin: 0.5rem 0;
  }
  
  .feedback-emoji {
    font-size: 2rem;
    margin-bottom: 0;
  }
  
  .achievement-section {
    margin: 0.5rem 0;
  }
}

/* Settings panel */
.settings-panel {
  position: fixed;
  top: 0;
  right: -340px;
  width: 340px;
  max-width: 100%;
  height: 100%;
  background: var(--bg-color, #fff);
  padding: 1rem 1rem 2rem;
  overflow-y: auto;
  box-shadow: -4px 0 12px rgb(0 0 0 / 0.15);
  transition: right 0.35s ease;
  font-size: 16px !important;
  z-index: 2000;
}

.settings-panel * {
  font-size: inherit !important;
}

body.show-settings .settings-panel {
  right: 0;
}

.settings-panel h2 {
  font-size: 1.25rem;
  text-align: center;
  margin: 0 0 1rem;
}
.settings-section{
  border: 2px solid #c3b8ac;
  border-radius: 14px;
  background: #faf7f2;
  margin: 0.5rem 0;
  padding: 1em 1em 0.7em 1em;
  box-shadow: 0 2px 8px rgb(120 90 70 / 0.05);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: stretch;
}


.settings-section h3 {
  font-size: 1rem;
  margin: 0 0 0.5rem;
  text-align: center;
}

.swatch-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgb(0 0 0 / 0.25);
  cursor: pointer;
  opacity: 0.8;
}

.swatch.selected {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--saved-btn, #d15353);
}

.settings-panel .selected {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--saved-btn, #d15353);
}

.close-panel-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 3rem;
  font-weight: bold;
  cursor: pointer;
}

.slider-wrapper {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  box-sizing: border-box;
}

.slider-wrapper input[type="range"] {
  width: 100%;
  min-width: 0;
}

.slider-wrapper span {
  margin: 0;
  padding: 0;
  min-width: 34px;
  text-align: right;
  font-weight: 600;
  white-space: nowrap;
}

.question-image {
  max-width: 100%;
  margin-bottom: 1rem;
  display: block;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgb(255 255 255 / 0.9);
  font-size: 2rem;
  z-index: 3000;
}

.toast {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--btn-color);
  color: var(--btn-font-color);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s;
  z-index: 4000;
}

.toast.show {
  opacity: 1;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgb(0 0 0 / 0.5);
  z-index: 5000;
}

.team-modal {
  background: #fff;
  padding: 1rem;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 6px solid var(--btn-color);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Timeout Splash Screen */
.timeout-splash-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.5s ease-in-out;
}

.splash-content {
  text-align: center;
  color: white;
  max-width: 500px;
  padding: 2rem;
}

.splash-spinner {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 2rem;
}

.splash-content h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

.splash-content p {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  opacity: 0.9;
}

.splash-subtitle {
  font-size: 0.9rem !important;
  opacity: 0.7 !important;
  font-style: italic;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
