/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans KR', sans-serif;
  color: #333;
  background: #f5f7fa;
  min-height: 100vh;
  line-height: 1.6;
}

/* ── Design Tokens ── */
:root {
  --brand: #1A3A6B;
  --brand-dark: #0f2647;
  --brand-light: #E8EEF7;
  --brand-mid: #2d5aa0;
  --cta: #E8A020;
  --cta-hover: #d4901a;
  --text: #333333;
  --text-sub: #666666;
  --text-muted: #999999;
  --bg: #FFFFFF;
  --bg-page: #f5f7fa;
  --success: #22c55e;
  --danger: #ef4444;
  --border: #e5e7eb;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.06);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Icon System ── */
.icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  fill: currentColor;
  display: inline-block;
  vertical-align: middle;
}
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 24px; height: 24px; }

/* ── Animations ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 4px 16px rgba(26,58,107,0.4); }
  50% { box-shadow: 0 4px 24px rgba(26,58,107,0.6), 0 0 0 8px rgba(26,58,107,0.1); }
}
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(3deg); }
}
@keyframes floatReverse {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-16px) rotate(-3deg); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes barGrow {
  from { width: 0%; }
}

.animate-fadeInUp { animation: fadeInUp 0.5s var(--ease) both; }
.animate-fadeIn { animation: fadeIn 0.4s var(--ease) both; }

/* ── Screen system ── */
.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; animation: fadeIn 0.35s var(--ease); }
.container {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

/* ══════════════════════════════════════
   LANDING SCREEN
   ══════════════════════════════════════ */
#screen-landing {
  background: linear-gradient(170deg, #ffffff 0%, #f0f4fa 50%, #e8eef7 100%);
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
/* Decorative floating shapes */
#screen-landing::before {
  content: '';
  position: absolute;
  top: 10%;
  left: -8%;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(26,58,107,0.04);
  animation: float 8s ease-in-out infinite;
}
#screen-landing::after {
  content: '';
  position: absolute;
  bottom: 15%;
  right: -5%;
  width: 150px;
  height: 150px;
  border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
  background: rgba(232,160,32,0.08);
  animation: floatReverse 10s ease-in-out infinite;
}
#screen-landing .container {
  min-height: 100vh;
  justify-content: center;
  align-items: center;
  text-align: center;
  position: relative;
  z-index: 1;
}
.landing-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
.logo-area { margin-bottom: 44px; }
.logo-img {
  width: 240px;
  height: auto;
  display: block;
  margin: 0 auto;
}
.logo-text {
  font-size: 30px;
  font-weight: 800;
  color: var(--brand);
  letter-spacing: 3px;
}
.logo-text.small {
  font-size: 18px;
  color: var(--brand);
  margin-bottom: 8px;
}
.headline {
  font-size: 27px;
  font-weight: 700;
  color: var(--brand-dark);
  line-height: 1.45;
  margin-bottom: 14px;
}
.sub-headline {
  font-size: 15px;
  color: var(--text-sub);
  margin-bottom: 40px;
  letter-spacing: 0.3px;
}
.trust-badge {
  margin-top: 28px;
  font-size: 13px;
  color: var(--text-sub);
  background: rgba(26,58,107,0.06);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 10px 24px;
  border-radius: 24px;
  border: 1px solid rgba(26,58,107,0.08);
}
.trust-badge span { font-weight: 700; color: var(--brand); }
.landing-footer {
  padding: 24px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.landing-footer p {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.landing-footer .icon { fill: var(--text-muted); opacity: 0.6; }

/* ══════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════ */
.btn-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  padding: 16px 32px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.btn-cta:active { transform: scale(0.97); }
.btn-cta .icon { transition: transform 0.3s var(--ease); }
.btn-cta:hover .icon { transform: translateX(3px); }

.btn-primary {
  background: linear-gradient(135deg, var(--cta) 0%, #d4901a 100%);
  color: #fff;
  box-shadow: 0 4px 16px rgba(232,160,32,0.35);
}
.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(232,160,32,0.45);
  transform: translateY(-1px);
}
.btn-primary:active { transform: scale(0.97) translateY(0); }
.btn-chat-cta {
  background: var(--brand);
  color: #fff;
  margin-top: 10px;
  box-shadow: var(--shadow-sm);
}
.btn-chat-cta:hover {
  background: var(--brand-dark);
  box-shadow: var(--shadow-md);
}
.btn-share {
  background: #fff;
  color: var(--brand);
  border: 2px solid var(--brand-light);
  margin-top: 10px;
}
.btn-share:hover {
  border-color: var(--brand);
  background: var(--brand-light);
}
.btn-kakao {
  background: #FEE500;
  color: #191919;
  margin-top: 10px;
  box-shadow: var(--shadow-sm);
}
.btn-kakao:hover {
  background: #f5dc00;
  box-shadow: var(--shadow-md);
}
.btn-outline {
  background: #fff;
  color: #444;
  border: 2px solid #ddd;
  margin-top: 10px;
}
.btn-outline:hover {
  border-color: #bbb;
  background: #f9f9f9;
}
.btn-phone {
  background: var(--cta);
  color: #fff;
  margin-top: 10px;
  box-shadow: 0 4px 16px rgba(232,160,32,0.3);
}
.btn-phone:hover {
  background: #d4901a;
  box-shadow: 0 6px 20px rgba(232,160,32,0.4);
  transform: translateY(-1px);
}
.btn-phone:active { transform: scale(0.97) translateY(0); }
.cta-note {
  text-align: center;
  color: #888;
  font-size: 13px;
  margin-top: 6px;
  line-height: 1.5;
}
.btn-back {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--brand);
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-back:hover { background: var(--brand-light); }
.btn-retry {
  background: none;
  border: none;
  color: var(--text-sub);
  font-size: 14px;
  cursor: pointer;
  margin-top: 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.btn-retry:hover {
  color: var(--brand);
  background: var(--brand-light);
}

/* ══════════════════════════════════════
   SCREEN HEADER
   ══════════════════════════════════════ */
.screen-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  padding-top: 12px;
}
.screen-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--brand);
}

/* ══════════════════════════════════════
   GRADE SELECTION
   ══════════════════════════════════════ */
#screen-grade, #screen-info, #screen-quiz, #screen-result {
  background: var(--bg-page);
}
.grade-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 28px;
  background: var(--brand-light);
  border-radius: var(--radius-md);
  padding: 4px;
}
.tab-btn {
  flex: 1;
  padding: 11px 8px;
  border: none;
  border-radius: 10px;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-sub);
  cursor: pointer;
  transition: all var(--transition);
}
.tab-btn.active {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 2px 8px rgba(26,58,107,0.25);
}
.grade-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.grade-btn {
  padding: 22px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}
.grade-btn:hover {
  border-color: var(--brand);
  background: var(--brand-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.grade-btn:active { transform: translateY(0); }

/* ══════════════════════════════════════
   INFO SCREEN
   ══════════════════════════════════════ */
.info-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 0;
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.04);
}
.info-grade {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  background: var(--brand);
  padding: 16px 24px;
}
.info-list { list-style: none; padding: 4px 24px; }
.info-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid #f0f2f5;
  font-size: 15px;
}
.info-list li:last-child { border-bottom: none; }
.info-list li strong {
  color: var(--text-sub);
  display: flex;
  align-items: center;
  gap: 8px;
}
.info-list li strong .icon { color: var(--brand); }
.info-list li span { font-weight: 600; color: var(--text); }
.info-notice {
  margin: 0 24px 20px;
  padding: 14px 16px;
  background: var(--brand-light);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-sub);
  line-height: 1.7;
  border-left: 3px solid var(--brand);
}
.info-notice p + p { margin-top: 4px; }

/* ══════════════════════════════════════
   QUIZ SCREEN
   ══════════════════════════════════════ */
.quiz-header { margin-bottom: 20px; padding-top: 16px; }
.progress-bar {
  height: 8px;
  background: var(--brand-light);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand) 0%, var(--brand-mid) 100%);
  border-radius: 4px;
  transition: width 0.4s var(--ease);
  width: 0%;
  position: relative;
}
.progress-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  background-size: 200% 100%;
  animation: shimmer 2s infinite linear;
}
.progress-text {
  font-size: 13px;
  color: var(--text-sub);
  text-align: right;
  font-weight: 500;
}
.quiz-body {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: var(--shadow-md);
  flex: 1;
  min-height: 300px;
  border: 1px solid rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
}
.question-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.question-label {
  font-size: 13px;
  color: var(--brand);
  font-weight: 600;
  padding: 5px 12px;
  background: var(--brand-light);
  border-radius: 6px;
  display: inline-block;
}
.btn-tts {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--brand-light);
  color: var(--brand);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s var(--ease);
  flex-shrink: 0;
}
.btn-tts:hover { background: #c8d6ed; }
.btn-tts:active { transform: scale(0.92); }
.btn-tts.playing {
  background: var(--brand);
  color: #fff;
}
.tts-icon { display: block; }
.tts-wave { display: none; }
.btn-tts.playing .tts-icon { display: none; }
.btn-tts.playing .tts-wave { display: flex; }

.tts-wave {
  align-items: center;
  gap: 2px;
  height: 16px;
}
.tts-wave span {
  display: block;
  width: 3px;
  background: #fff;
  border-radius: 2px;
  animation: ttsWave 0.8s ease-in-out infinite;
}
.tts-wave span:nth-child(1) { height: 6px; animation-delay: 0s; }
.tts-wave span:nth-child(2) { height: 12px; animation-delay: 0.15s; }
.tts-wave span:nth-child(3) { height: 8px; animation-delay: 0.3s; }
.tts-wave span:nth-child(4) { height: 14px; animation-delay: 0.45s; }

@keyframes ttsWave {
  0%, 100% { transform: scaleY(0.4); }
  50% { transform: scaleY(1); }
}
.question-text {
  font-size: 17px;
  font-weight: 500;
  line-height: 1.75;
  margin-bottom: 24px;
  color: var(--text);
  word-break: keep-all;
  animation: fadeInUp 0.35s var(--ease);
}
.choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.choice-btn {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 12px;
  line-height: 1.5;
  animation: fadeInUp 0.35s var(--ease) both;
}
.choice-btn:nth-child(1) { animation-delay: 0s; }
.choice-btn:nth-child(2) { animation-delay: 0.04s; }
.choice-btn:nth-child(3) { animation-delay: 0.08s; }
.choice-btn:nth-child(4) { animation-delay: 0.12s; }
.choice-btn:nth-child(5) { animation-delay: 0.16s; }
.choice-btn:hover {
  border-color: var(--brand);
  background: #f8faff;
  transform: translateX(2px);
}
.choice-btn.selected {
  border-color: var(--brand);
  background: var(--brand-light);
  font-weight: 600;
}
.choice-num {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #f0f2f5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-sub);
  flex-shrink: 0;
  transition: all var(--transition);
}
.choice-btn.selected .choice-num {
  background: var(--brand);
  color: #fff;
}
.choice-btn.selected .choice-num .icon { display: block; }

.quiz-nav {
  display: flex;
  margin-top: 20px;
  padding-bottom: 20px;
}
.quiz-branding {
  text-align: center;
  margin-top: auto;
  padding-top: 24px;
  font-size: 12px;
  color: #adb5bd;
  letter-spacing: 0.5px;
}
.btn-nav {
  padding: 12px 20px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-sub);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow-sm);
}
.btn-nav:hover { border-color: var(--brand); color: var(--brand); }
.btn-nav:disabled { opacity: 0; pointer-events: none; }

/* ══════════════════════════════════════
   RESULT SCREEN
   ══════════════════════════════════════ */
.result-header {
  text-align: center;
  padding-top: 28px;
  margin-bottom: 24px;
}
.result-title {
  font-size: 18px;
  color: var(--text);
  font-weight: 500;
  margin-top: 4px;
}
.result-level-card {
  text-align: center;
  padding: 36px 24px;
  border-radius: var(--radius-xl);
  margin-bottom: 20px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
  animation: scaleIn 0.5s var(--ease);
}
.result-level-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.4) 0%, transparent 60%);
  pointer-events: none;
}
.level-badge {
  display: inline-block;
  font-size: 52px;
  font-weight: 900;
  margin-bottom: 8px;
  position: relative;
}
.level-score { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.level-desc { font-size: 14px; color: var(--text-sub); }

/* Level colors */
.level-S { background: linear-gradient(135deg, #fef3c7 0%, #fde68a 50%, #fbbf24 100%); }
.level-S .level-badge { color: #92400e; }
.level-Aplus { background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 50%, #93c5fd 100%); }
.level-Aplus .level-badge { color: #1d4ed8; }
.level-A { background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 50%, #86efac 100%); }
.level-A .level-badge { color: #15803d; }
.level-Bplus { background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 50%, #7dd3fc 100%); }
.level-Bplus .level-badge { color: #0369a1; }
.level-B { background: linear-gradient(135deg, #ffedd5 0%, #fed7aa 50%, #fdba74 100%); }
.level-B .level-badge { color: #c2410c; }
.level-C { background: linear-gradient(135deg, #fee2e2 0%, #fecaca 50%, #fca5a5 100%); }
.level-C .level-badge { color: #dc2626; }

.result-section {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(0,0,0,0.04);
  animation: fadeInUp 0.5s var(--ease) both;
}
.result-section:nth-child(3) { animation-delay: 0.1s; }
.result-section:nth-child(4) { animation-delay: 0.2s; }
.result-section h3 {
  font-size: 16px;
  color: var(--brand);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.result-section h3 .icon { color: var(--brand); }
.section-sub { font-size: 13px; color: var(--text-sub); margin-bottom: 16px; }

/* Subject chart */
.subject-bar { margin-bottom: 14px; }
.subject-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 6px;
}
.subject-bar-label span:first-child { font-weight: 600; color: var(--text); }
.subject-bar-label span:last-child { color: var(--text-sub); font-weight: 500; }
.subject-bar-track {
  height: 10px;
  background: #f0f2f5;
  border-radius: 5px;
  overflow: hidden;
}
.subject-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.8s var(--ease);
  animation: barGrow 0.8s var(--ease);
}
.subject-bar-fill.good { background: linear-gradient(90deg, #22c55e, #4ade80); }
.subject-bar-fill.warn { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.subject-bar-fill.bad { background: linear-gradient(90deg, #ef4444, #f87171); }
.subject-bar.weak .subject-bar-label span:first-child { color: var(--danger); }

.recommendation {
  font-size: 14px;
  color: var(--text);
  line-height: 1.8;
  padding: 16px;
  background: var(--brand-light);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--brand);
}

.result-cta {
  text-align: center;
  margin-top: 12px;
  margin-bottom: 16px;
}
.result-cta .cta-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--brand);
  margin-bottom: 16px;
}
.result-footer { text-align: center; padding-bottom: 80px; }

/* ══════════════════════════════════════
   CHAT WIDGET
   ══════════════════════════════════════ */
#chat-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-mid) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(26,58,107,0.4);
  z-index: 1000;
  transition: transform 0.25s var(--ease);
  animation: pulse 3s ease-in-out infinite;
}
#chat-bubble:hover {
  transform: scale(1.08);
  animation: none;
}
.chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}

#chat-window {
  position: fixed;
  bottom: 92px;
  right: 24px;
  width: 360px;
  height: 480px;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 280px;
  min-height: 300px;
  max-width: 600px;
  max-height: 80vh;
  animation: scaleIn 0.25s var(--ease);
  border: 1px solid rgba(0,0,0,0.06);
}

/* Resize handle */
.chat-resize-handle {
  position: absolute;
  top: 0;
  left: 0;
  width: 20px;
  height: 20px;
  cursor: nw-resize;
  z-index: 10;
}
.chat-resize-handle::before {
  content: '';
  position: absolute;
  top: 5px;
  left: 5px;
  width: 7px;
  height: 7px;
  border-top: 2px solid rgba(255,255,255,0.4);
  border-left: 2px solid rgba(255,255,255,0.4);
}
#chat-window.resizing {
  transition: none !important;
  user-select: none;
}
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-mid) 100%);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
}
.chat-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.chat-close {
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.chat-close:hover { background: rgba(255,255,255,0.2); }
#chat-name-form {
  padding: 28px 20px;
  text-align: center;
}
#chat-name-form .chat-user-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--brand-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: var(--brand);
}
#chat-name-form p {
  font-size: 14px;
  color: var(--text-sub);
  margin-bottom: 16px;
}
#chat-name-input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 12px;
  outline: none;
  transition: border-color 0.2s;
}
#chat-name-input:focus { border-color: var(--brand); }
.btn-chat-start {
  width: 100%;
  padding: 12px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-chat-start:hover { background: var(--brand-dark); }
#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  min-height: 0;
}
.chat-msg {
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  animation: fadeInUp 0.25s var(--ease);
}
.chat-msg.user { align-items: flex-end; }
.chat-msg.admin { align-items: flex-start; }
.chat-msg.bot { align-items: flex-start; }
.chat-msg-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
}
.chat-msg.user .chat-msg-bubble {
  background: var(--brand);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-msg.admin .chat-msg-bubble {
  background: #f0f2f5;
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.chat-msg.bot .chat-msg-bubble {
  background: var(--brand-light);
  color: var(--brand-dark);
  border: 1px solid #c8d6ed;
  border-bottom-left-radius: 4px;
}

/* Typing indicator */
.typing-dots {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 18px !important;
}
.typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand);
  opacity: 0.4;
  animation: typingBounce 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

.chat-msg-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* Quick question buttons */
.chat-quick-questions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
  border-top: 1px solid #f0f2f5;
  background: #fafbfc;
}
.chat-quick-questions button {
  padding: 7px 14px;
  border: 1px solid var(--brand-light);
  border-radius: 20px;
  background: #fff;
  color: var(--brand);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.chat-quick-questions button:hover,
.chat-quick-questions button:active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  transform: translateY(-1px);
}

#chat-input-area {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #f0f2f5;
  background: #fafbfc;
}
#chat-input {
  flex: 1;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
#chat-input:focus { border-color: var(--brand); }
.btn-chat-send {
  padding: 10px 14px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-chat-send:hover { background: var(--brand-dark); }

/* ══════════════════════════════════════
   TOAST
   ══════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--brand-dark);
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transition: all 0.3s var(--ease);
  z-index: 2000;
  pointer-events: none;
  box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ══════════════════════════════════════
   ADMIN PAGE
   ══════════════════════════════════════ */
.admin-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px;
}
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding: 16px 24px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-mid) 100%);
  border-radius: var(--radius-md);
  color: #fff;
  box-shadow: var(--shadow-md);
}
.admin-header h1 { font-size: 18px; font-weight: 700; }
.admin-header a {
  color: rgba(255,255,255,0.8);
  font-size: 13px;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  transition: background 0.2s;
}
.admin-header a:hover { background: rgba(255,255,255,0.1); }
.admin-login-card {
  max-width: 360px;
  margin: 80px auto;
  padding: 36px;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  text-align: center;
  border: 1px solid rgba(0,0,0,0.04);
}
.admin-login-card h2 { color: var(--brand); margin-bottom: 24px; font-size: 20px; }
.admin-login-card input {
  width: 100%;
  padding: 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  margin-bottom: 12px;
  outline: none;
  text-align: center;
  transition: border-color 0.2s;
}
.admin-login-card input:focus { border-color: var(--brand); }
.admin-login-card button {
  width: 100%;
  padding: 14px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.admin-login-card button:hover { background: var(--brand-dark); }
.admin-login-error {
  color: var(--danger);
  font-size: 13px;
  margin-bottom: 12px;
  padding: 8px;
  background: #fef2f2;
  border-radius: 6px;
}
.admin-body {
  display: flex;
  gap: 16px;
  height: calc(100vh - 120px);
}
.admin-chat-list {
  width: 280px;
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  overflow-y: auto;
  flex-shrink: 0;
  border: 1px solid rgba(0,0,0,0.04);
}
.admin-chat-item {
  padding: 14px 16px;
  border-bottom: 1px solid #f0f2f5;
  cursor: pointer;
  transition: all 0.15s;
}
.admin-chat-item:hover, .admin-chat-item.active { background: var(--brand-light); }
.admin-chat-item .name { font-weight: 600; font-size: 14px; }
.admin-chat-item .time { font-size: 12px; color: var(--text-muted); }
.admin-chat-item .preview {
  font-size: 13px;
  color: var(--text-sub);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-chat-item .unread-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--danger);
  display: inline-block;
  margin-left: 6px;
}
.admin-chat-panel {
  flex: 1;
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(0,0,0,0.04);
}
.admin-chat-panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid #f0f2f5;
  font-weight: 700;
  color: var(--brand);
}
.admin-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}
.admin-chat-messages .chat-msg { margin-bottom: 12px; }
.admin-reply-area {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid #f0f2f5;
  background: #fafbfc;
}
.admin-reply-area input {
  flex: 1;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.admin-reply-area input:focus { border-color: var(--brand); }
.admin-reply-area button {
  padding: 12px 20px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.admin-reply-area button:hover { background: var(--brand-dark); }
.admin-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #ccc;
  font-size: 15px;
}

/* ══════════════════════════════════════
   ADMIN TABS & STATS DASHBOARD
   ══════════════════════════════════════ */
.admin-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.admin-tabs {
  display: flex;
  gap: 2px;
  background: rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 3px;
}
.admin-tab {
  padding: 7px 16px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: rgba(255,255,255,0.7);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.admin-tab:hover { color: #fff; background: rgba(255,255,255,0.1); }
.admin-tab.active { background: rgba(255,255,255,0.2); color: #fff; }
.admin-tab-content { display: none; }
.admin-tab-content.active { display: block; }

/* Stats Loading */
.stats-loading {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
  font-size: 15px;
}

/* Summary Cards */
.stats-summary-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.stats-card {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 24px 20px;
  text-align: center;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(0,0,0,0.04);
}
.stats-card-label {
  font-size: 13px;
  color: var(--text-sub);
  margin-bottom: 8px;
  font-weight: 500;
}
.stats-card-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--brand);
}

/* Charts Row */
.stats-charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

/* Stats Section Card */
.stats-section {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(0,0,0,0.04);
  margin-bottom: 20px;
}
.stats-section h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f0f2f5;
}

/* Bar Chart */
.stats-bar-item { margin-bottom: 12px; }
.stats-bar-item:last-child { margin-bottom: 0; }
.stats-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 5px;
}
.stats-bar-label span:first-child { font-weight: 600; color: var(--text); }
.stats-bar-label span:last-child { color: var(--text-sub); font-weight: 500; }
.stats-bar-track {
  height: 10px;
  background: #f0f2f5;
  border-radius: 5px;
  overflow: hidden;
}
.stats-bar-fill {
  height: 100%;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--brand) 0%, var(--brand-mid) 100%);
  transition: width 0.6s var(--ease);
}
.stats-bar-fill.weak {
  background: linear-gradient(90deg, #ef4444, #f87171);
}

/* Daily Chart */
.daily-chart {
  display: flex;
  gap: 4px;
  align-items: flex-end;
  height: 180px;
  padding: 8px 0;
  overflow-x: auto;
}
.daily-col {
  flex: 1;
  min-width: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.daily-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-sub);
}
.daily-bar-wrap {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.daily-bar {
  width: 60%;
  max-width: 28px;
  min-height: 3px;
  background: linear-gradient(180deg, var(--brand), #60a5fa);
  border-radius: 4px 4px 0 0;
  transition: height 0.3s;
}
.daily-col.today .daily-bar {
  background: linear-gradient(180deg, #f59e0b, #fbbf24);
}
.daily-col.today .daily-label,
.daily-col.today .daily-day {
  font-weight: 700;
  color: var(--brand);
}
.daily-label {
  font-size: 10px;
  color: var(--text-sub);
}
.daily-day {
  font-size: 10px;
  color: #adb5bd;
}

/* Stats Table */
.stats-table-wrap { overflow-x: auto; }
.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.stats-table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-sub);
  font-weight: 600;
  border-bottom: 2px solid #f0f2f5;
  white-space: nowrap;
}
.stats-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f0f2f5;
  color: var(--text);
}
.stats-table tbody tr { cursor: pointer; transition: background 0.15s; }
.stats-table tbody tr:hover { background: var(--brand-light); }

/* Level Badge */
.stats-level-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
}
.stats-level-badge.level-S { background: #fef3c7; color: #92400e; }
.stats-level-badge.level-Aplus { background: #dbeafe; color: #1d4ed8; }
.stats-level-badge.level-A { background: #dcfce7; color: #15803d; }
.stats-level-badge.level-Bplus { background: #e0f2fe; color: #0369a1; }
.stats-level-badge.level-B { background: #ffedd5; color: #c2410c; }
.stats-level-badge.level-C { background: #fee2e2; color: #dc2626; }

.stats-empty {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ══════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════ */
@media (max-width: 480px) {
  .container { padding: 16px; }
  .headline { font-size: 23px; }
  .sub-headline { font-size: 14px; }
  #chat-window { right: 8px; left: 8px; width: auto !important; height: auto !important; bottom: 84px; max-height: 70vh; }
  .chat-resize-handle { display: none; }
  .grade-group { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .grade-btn { padding: 16px 12px; font-size: 15px; }
  .quiz-body { padding: 20px 16px; }
  .question-text { font-size: 16px; }
  .choice-btn { padding: 12px 14px; font-size: 14px; }
  .admin-body { flex-direction: column; height: auto; }
  .admin-chat-list { width: 100%; max-height: 200px; }
  .stats-summary-row { grid-template-columns: 1fr; gap: 10px; }
  .stats-charts-row { grid-template-columns: 1fr; }
  .admin-tabs { gap: 1px; padding: 2px; }
  .admin-tab { padding: 5px 10px; font-size: 12px; }
}

/* ══════════════════════════════════════
   SHARED RESULT PAGE
   ══════════════════════════════════════ */
.shared-result {
  min-height: 100vh;
  background: var(--bg-page);
  padding: 24px 0;
}
.shared-result .container {
  max-width: 520px;
  margin: 0 auto;
}
.shared-result .result-header { margin-bottom: 20px; }
.shared-result .result-level-card { animation: scaleIn 0.5s var(--ease); }
.shared-result .subject-bar-fill { animation: barGrow 0.8s var(--ease) forwards; }
.shared-footer {
  text-align: center;
  padding: 24px 0 8px;
}
.shared-footer-text {
  color: var(--text-sub);
  font-size: 13px;
}
.shared-footer-sub {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 4px;
}

/* ══════════════════════════════════════
   KATEX OVERRIDES
   ══════════════════════════════════════ */
.katex { font-size: 1em !important; }
.question-text .katex { font-size: 1.1em !important; }

/* ══════════════════════════════════════
   SUBJECT SELECT (Landing)
   ══════════════════════════════════════ */
.subject-select {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
}
.btn-subject {
  padding: 28px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  background: #fff;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}
.btn-subject:hover {
  border-color: var(--brand);
  background: var(--brand-light);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.btn-subject:active {
  transform: translateY(0);
}
.btn-subject-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-subject-math .btn-subject-icon {
  background: #fef3c7;
  color: #92400e;
}
.btn-subject-english .btn-subject-icon {
  background: #dbeafe;
  color: #1d4ed8;
}
.btn-subject-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}
.btn-subject-desc {
  font-size: 12px;
  color: var(--text-sub);
  text-align: center;
  line-height: 1.4;
}

/* ══════════════════════════════════════
   ENGLISH QUIZ: Passage & Listening
   ══════════════════════════════════════ */
.passage-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 4px solid var(--brand);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text);
  white-space: pre-line;
  max-height: none;
  overflow-y: visible;
  animation: fadeInUp 0.35s var(--ease);
}
.listening-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 500;
  color: #1d4ed8;
  animation: fadeInUp 0.35s var(--ease);
}
.listening-indicator .icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* ══════════════════════════════════════
   RESPONSIVE: Subject Select
   ══════════════════════════════════════ */
@media (max-width: 480px) {
  .subject-select { gap: 12px; }
  .btn-subject { padding: 22px 12px; }
  .btn-subject-icon { width: 48px; height: 48px; }
  .btn-subject-icon svg { width: 24px; height: 24px; }
  .btn-subject-name { font-size: 15px; }
  .passage-box { max-height: none; overflow-y: visible; font-size: 13px; padding: 12px 14px; }
}

/* ══════════════════════════════════════
   SEMESTER TOGGLE & TEST COMPOSITION
   ══════════════════════════════════════ */
.semester-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
}
.semester-label {
  font-size: 0.9rem;
  color: var(--text-sub);
  font-weight: 500;
}
.semester-btns {
  display: flex;
  gap: 8px;
}
.semester-btn {
  padding: 8px 20px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-sub);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.semester-btn.active {
  border-color: var(--brand);
  background: var(--brand);
  color: white;
}
.semester-btn:hover:not(.active) {
  border-color: var(--brand-mid);
  color: var(--brand);
}
.test-composition-info {
  text-align: center;
  margin-top: 12px;
  padding: 10px 16px;
  background: var(--brand-light);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--brand);
  font-weight: 500;
}

/* ══════════════════════════════════════
   GRADE BADGE IN QUIZ
   ══════════════════════════════════════ */
.grade-badge-quiz {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  vertical-align: middle;
  margin: 0 4px;
}
.grade-badge-quiz.badge-prev {
  background: #e0f2fe;
  color: #0369a1;
}
.grade-badge-quiz.badge-current {
  background: #dcfce7;
  color: #15803d;
}
.grade-badge-quiz.badge-cat {
  background: #ede9fe;
  color: #6d28d9;
}

/* ══════════════════════════════════════
   CAT LEVEL INDICATOR
   ══════════════════════════════════════ */
.cat-level-indicator {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-sub);
  padding: 6px 14px;
  background: #ede9fe;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  animation: fadeIn 0.3s ease;
}

/* ══════════════════════════════════════
   CAT RESULT ANALYSIS
   ══════════════════════════════════════ */
.cat-result-summary {
  background: #f5f3ff;
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid #e0daf7;
}
.cat-summary-row {
  padding: 5px 0;
  font-size: 0.95rem;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cat-summary-row strong {
  color: #6d28d9;
  font-weight: 700;
}

/* ══════════════════════════════════════
   DUAL ANALYSIS (RESULT SCREEN)
   ══════════════════════════════════════ */
.analysis-score {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--brand);
  margin-bottom: 12px;
  padding: 8px 12px;
  background: var(--brand-light);
  border-radius: var(--radius-sm);
}
.prev-warning {
  padding: 10px 14px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  color: #dc2626;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 12px;
}

@media (max-width: 480px) {
  .semester-toggle { flex-direction: column; gap: 8px; }
  .semester-btn { padding: 7px 16px; font-size: 0.85rem; }
  .test-composition-info { font-size: 0.8rem; padding: 8px 12px; }
  .grade-badge-quiz { font-size: 0.7rem; padding: 1px 6px; }
  .cat-level-indicator { font-size: 0.75rem; padding: 5px 10px; }
  .cat-result-summary { padding: 12px; }
  .cat-summary-row { font-size: 0.88rem; }
}

/* ══════════════════════════════════════
   WRONG ANSWERS REVIEW
   ══════════════════════════════════════ */
.wrong-answer-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 12px;
}
.wrong-answer-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text);
}
.wrong-answer-header .badge-q {
  background: #fee2e2;
  color: #dc2626;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 600;
}
.wrong-answer-question {
  font-size: 0.93rem;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 10px;
  word-break: keep-all;
}
.wrong-answer-passage {
  background: #f8fafc;
  border-left: 3px solid var(--brand);
  padding: 10px 14px;
  margin-bottom: 10px;
  font-size: 0.85rem;
  line-height: 1.7;
  color: #475569;
  white-space: pre-line;
}
.wrong-answer-choices {
  list-style: none;
  padding: 0;
  margin: 0 0 10px 0;
}
.wrong-answer-choices li {
  padding: 6px 10px;
  margin-bottom: 4px;
  border-radius: 6px;
  font-size: 0.88rem;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.wrong-answer-choices .choice-num-review {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 1px;
}
.wrong-answer-choices .user-wrong {
  background: #fef2f2;
  border: 1px solid #fecaca;
}
.wrong-answer-choices .user-wrong .choice-num-review {
  background: #dc2626;
  color: #fff;
}
.wrong-answer-choices .correct-answer {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}
.wrong-answer-choices .correct-answer .choice-num-review {
  background: #16a34a;
  color: #fff;
}
.wrong-answer-choices .neutral {
  color: #94a3b8;
}
.wrong-answer-choices .neutral .choice-num-review {
  background: #f1f5f9;
  color: #94a3b8;
}
.explanation-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 0.85rem;
  line-height: 1.7;
  color: #1e40af;
}
.explanation-box strong {
  font-weight: 700;
}

@media (max-width: 600px) {
  .wrong-answer-card { padding: 12px; }
  .wrong-answer-question { font-size: 0.88rem; }
  .wrong-answer-choices li { font-size: 0.83rem; padding: 5px 8px; }
  .explanation-box { font-size: 0.82rem; padding: 8px 12px; }
}
