/* ========================================
   Otutor Magic Quiz - Short Answer Style
   ======================================== */

:root {
  --primary: #6C63FF;
  --primary-light: #8B85FF;
  --primary-dark: #5A52E0;
  --success: #10B981;
  --success-dark: #059669;
  --success-bg: #D1FAE5;
  --error: #EF4444;
  --error-dark: #DC2626;
  --error-bg: #FEE2E2;
  --skip: #F59E0B;
  --skip-dark: #D97706;
  --skip-bg: #FEF3C7;
  --bg-main: #F0F4FF;
  --bg-card: #FFFFFF;
  --text-main: #1E293B;
  --text-muted: #64748B;
  --border: #E2E8F0;
  --shadow: 0 4px 20px rgba(108, 99, 255, 0.12);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
  --radius: 16px;
  --radius-sm: 10px;
}

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

body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 20px;
  color: var(--text-main);
}

/* App Container */
.app-container {
  width: 100%;
  max-width: 480px;
  position: relative;
}

/* Brand Logo */
.brand-logo {
  text-align: center;
  margin-bottom: 20px;
}

.brand-logo img {
  height: 50px;
  object-fit: contain;
}

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

/* ========== LOGIN SCREEN ========== */
.login-screen {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 40px 28px;
  box-shadow: var(--shadow);
  text-align: center;
  animation: slideUp 0.5s ease;
}

.login-screen h2 {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 28px;
  color: var(--text-main);
}

.input-group {
  text-align: left;
  margin-bottom: 20px;
}

.input-group label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-wrapper {
  display: flex;
  align-items: center;
  background: var(--bg-main);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.3s;
}

.input-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.15);
}

.input-field {
  flex: 1;
  border: none;
  background: transparent;
  padding: 14px 16px;
  font-size: 16px;
  font-family: 'Nunito', sans-serif;
  color: var(--text-main);
  outline: none;
}

.input-field::placeholder {
  color: #94A3B8;
}

.mic-btn {
  background: none;
  border: none;
  padding: 12px 14px;
  color: var(--primary);
  cursor: pointer;
  transition: color 0.2s, transform 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mic-btn:hover {
  color: var(--primary-dark);
  transform: scale(1.1);
}

.mic-btn.listening {
  color: var(--error);
  animation: pulse 1s infinite;
}

/* Gradient Button */
.btn-gradient {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 16px 32px;
  font-size: 17px;
  font-weight: 700;
  font-family: 'Nunito', sans-serif;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 15px rgba(108, 99, 255, 0.35);
  width: 100%;
  display: block;
}

.btn-gradient:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(108, 99, 255, 0.45);
}

.btn-gradient:active {
  transform: translateY(0);
}

.start-btn {
  margin-top: 24px;
}

/* ========== QUIZ SCREEN ========== */
#quizScreen {
  animation: slideUp 0.5s ease;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding: 0 4px;
}

.progress-dots {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

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

.progress-dot.active {
  background: var(--primary);
  transform: scale(1.2);
  box-shadow: 0 0 8px rgba(108, 99, 255, 0.4);
}

.progress-dot.correct {
  background: var(--success);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.progress-dot.wrong {
  background: var(--error);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

.progress-dot.skipped {
  background: var(--skip);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

.score-board {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  background: rgba(108, 99, 255, 0.1);
  padding: 6px 16px;
  border-radius: 20px;
}

/* Question Box */
.question-box {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 32px 24px;
  box-shadow: var(--shadow);
  text-align: center;
  margin-bottom: 24px;
}

.question-box h1 {
  font-size: 32px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.4;
}

/* ========== ANSWER AREA (NEW) ========== */
.answer-area {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.answer-label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.answer-input-wrapper {
  display: flex;
  align-items: center;
  background: var(--bg-main);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.answer-input-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.15);
}

.answer-input-wrapper.correct {
  border-color: var(--success);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
  background: var(--success-bg);
}

.answer-input-wrapper.wrong {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
  background: var(--error-bg);
}

.answer-input-wrapper.submitted {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.1);
}

.answer-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 16px 18px;
  font-size: 24px;
  font-weight: 800;
  font-family: 'Nunito', sans-serif;
  color: var(--text-main);
  outline: none;
  text-align: center;
  letter-spacing: 2px;
}

.answer-input::placeholder {
  color: #CBD5E1;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0;
}

.answer-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.submit-answer-btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border: none;
  padding: 14px 18px;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, opacity 0.2s;
  min-width: 56px;
}

.submit-answer-btn:hover {
  transform: scale(1.05);
}

.submit-answer-btn:active {
  transform: scale(0.95);
}

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

.answer-hint {
  text-align: center;
  font-size: 12px;
  color: #94A3B8;
  margin-top: 10px;
  font-weight: 600;
}

/* Feedback Message */
.feedback-msg {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 700;
  animation: fadeIn 0.3s ease;
}

.feedback-msg.correct {
  background: var(--success-bg);
  color: var(--success-dark);
}

.feedback-msg.wrong {
  background: var(--error-bg);
  color: var(--error-dark);
}

.feedback-icon {
  font-size: 22px;
}

/* Next Button — Always visible */
.next-btn {
  margin-top: 16px;
  padding: 18px 32px;
  font-size: 18px;
  animation: slideUp 0.4s ease;
  position: relative;
  opacity: 0.85;
}

.next-btn:hover {
  opacity: 1;
}

.next-btn:active {
  transform: translateY(0);
}

.next-btn.submitted-state {
  opacity: 1;
}

.next-btn::after {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 4px;
  background: linear-gradient(90deg, transparent, var(--primary-light), transparent);
  border-radius: 2px;
  animation: glowPulse 1.5s ease-in-out infinite;
}

/* ========== RESULT SCREEN ========== */
.result-screen {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 36px 28px;
  box-shadow: var(--shadow);
  text-align: center;
  animation: slideUp 0.5s ease;
}

.result-screen h2 {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 20px;
}

.result-summary {
  margin-bottom: 24px;
}

.final-score {
  font-size: 64px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
  margin: 16px 0 4px;
  animation: popIn 0.5s ease;
}

.stats-row {
  display: flex;
  gap: 12px;
  margin-bottom: 28px;
}

.stat-box {
  flex: 1;
  background: var(--bg-main);
  border-radius: var(--radius-sm);
  padding: 16px 8px;
  text-align: center;
}

.stat-value {
  font-size: 24px;
  font-weight: 800;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* WhatsApp Button */
.whatsapp-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #25D366;
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 16px;
  font-weight: 700;
  font-family: 'Nunito', sans-serif;
  cursor: pointer;
  margin-bottom: 24px;
  transition: background 0.2s, transform 0.2s;
}

.whatsapp-btn:hover {
  background: #1EBE5A;
  transform: translateY(-2px);
}

.whatsapp-icon {
  flex-shrink: 0;
}

/* Review List */
.review-list {
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 24px;
}

.review-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  background: var(--bg-main);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  text-align: left;
  border-left: 4px solid var(--border);
  transition: border-color 0.3s;
}

.review-item.review-correct {
  border-left-color: var(--success);
}

.review-item.review-wrong {
  border-left-color: var(--error);
}

.review-item.review-skipped {
  border-left-color: var(--skip);
}

.review-icon {
  font-size: 22px;
  flex-shrink: 0;
  margin-top: 2px;
}

.review-content {
  flex: 1;
}

.review-question {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-main);
  margin-bottom: 4px;
}

.review-answer {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
}

.review-answer span {
  font-weight: 800;
}

.review-answer .user-ans-correct {
  color: var(--success-dark);
}

.review-answer .user-ans-wrong {
  color: var(--error-dark);
}

.review-answer .user-ans-skipped {
  color: var(--skip-dark);
}

.review-answer .correct-ans {
  color: var(--success-dark);
}

/* ========== ANIMATIONS ========== */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

.shake {
  animation: shake 0.4s ease;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 500px) {
  body {
    padding: 12px;
  }
  
  .login-screen,
  .result-screen {
    padding: 28px 20px;
  }
  
  .question-box h1 {
    font-size: 26px;
  }
  
  .answer-input {
    font-size: 20px;
  }
  
  .final-score {
    font-size: 52px;
  }

  .stats-row {
    flex-wrap: wrap;
  }

  .stat-box {
    flex: 1 1 calc(50% - 6px);
  }
}
