/* ===== Reset & Base ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #1565c0;
  --primary-dark: #0d47a1;
  --primary-light: #bbdefb;
  --accent: #e53935;
  --green: #2e7d32;
  --red: #c62828;
  --orange: #ef6c00;
  --bg: #f0f4f8;
  --card: #ffffff;
  --text: #1a202c;
  --text-light: #64748b;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --font: 'Noto Sans SC', system-ui, -apple-system, sans-serif;
  --transition: 250ms cubic-bezier(0.16, 1, 0.3, 1);
}

html, body { height: 100%; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ===== Top Bar ===== */
.top-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff; padding: 0 20px; height: 52px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.top-bar-logo { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; font-weight: 600; }
.logo-icon { font-size: 1.2rem; }
.top-bar-info { font-size: 0.8rem; opacity: 0.85; }

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

/* ===== App Container ===== */
.app {
  position: relative; z-index: 5;
  min-height: 100dvh; padding: 72px 20px 40px;
  display: flex; align-items: flex-start; justify-content: center;
}

.screen {
  max-width: 640px; width: 100%;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.screen.hidden {
  opacity: 0; pointer-events: none;
  transform: translateY(16px);
}
.screen:not(.hidden) {
  opacity: 1; pointer-events: auto;
  transform: translateY(0);
}

/* ===== Card Base ===== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
  width: 100%;
}

/* ===== Welcome Screen ===== */
.welcome-card { text-align: center; }
.welcome-icon { font-size: 3.5rem; line-height: 1; margin-bottom: 0.5rem; }
.welcome-title {
  font-size: 1.5rem; font-weight: 800; color: var(--primary-dark);
  margin-bottom: 0.5rem; letter-spacing: -0.02em;
}
.welcome-desc {
  font-size: 0.9rem; color: var(--text-light); line-height: 1.7;
  margin-bottom: 1.5rem;
}

.dimension-preview {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 8px; margin-bottom: 1.5rem;
}
.dim-tag {
  padding: 6px 14px; border-radius: 99px;
  font-size: 0.8rem; font-weight: 600;
  background: var(--primary-light); color: var(--primary-dark);
}

/* ===== Form ===== */
.student-form { width: 100%; }
.form-row { display: flex; gap: 0.75rem; margin-bottom: 1rem; }
.form-group { flex: 1; display: flex; flex-direction: column; gap: 4px; text-align: left; }
.form-group label { font-size: 0.8rem; font-weight: 600; color: var(--text-light); }
.form-input {
  width: 100%; padding: 10px 14px;
  border: 2px solid #e2e8f0; border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 0.9rem;
  outline: none; transition: border-color var(--transition);
}
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(21,101,192,0.12);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 12px 28px; border: none; border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 0.95rem; font-weight: 700;
  cursor: pointer; transition: all var(--transition);
}
.btn:active { transform: scale(0.96); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; box-shadow: 0 3px 10px rgba(21,101,192,0.3);
}
.btn-primary:hover {
  box-shadow: 0 5px 16px rgba(21,101,192,0.4);
  transform: translateY(-1px);
}
.btn-outline {
  background: transparent; color: var(--primary);
  border: 2px solid var(--primary);
}
.btn-outline:hover {
  background: var(--primary); color: #fff;
}
.btn-outline:disabled {
  opacity: 0.35; cursor: not-allowed; pointer-events: none;
}
.btn-full { width: 100%; }
.btn-lg { padding: 14px 36px; font-size: 1.05rem; border-radius: var(--radius-sm); }

/* ===== Quiz Screen ===== */
.quiz-card { padding: 2rem; }
.quiz-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
}
.quiz-student-info { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.quiz-progress-text { font-size: 0.85rem; font-weight: 600; color: var(--text-light); }
.quiz-progress-text span { color: var(--primary); font-size: 1rem; }

/* Progress bar */
.progress-bar {
  width: 100%; height: 6px; background: #e2e8f0;
  border-radius: 3px; margin-bottom: 1.5rem; overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--primary), #42a5f5);
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Question */
.question-box {
  background: #f8fafc; border: 1px solid #e8ecf0;
  border-radius: var(--radius-sm); padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.question-number {
  font-size: 0.75rem; font-weight: 600; color: var(--primary);
  text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.75rem;
}
.question-text {
  font-size: 1.1rem; font-weight: 600; line-height: 1.6; color: var(--text);
}

/* Options */
.options { display: flex; flex-direction: column; gap: 10px; margin-bottom: 1rem; }
.option-btn {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 14px 16px;
  border: 2px solid #e2e8f0; border-radius: var(--radius-sm);
  background: #fff; font-family: var(--font); font-size: 0.95rem;
  text-align: left; cursor: pointer;
  transition: all var(--transition);
}
.option-btn:hover { border-color: var(--primary); background: #f5f9ff; }
.option-btn.selected { border-color: var(--primary); background: var(--primary-light); }
.option-btn.correct { border-color: var(--green); background: #e8f5e9; }
.option-btn.wrong { border-color: var(--red); background: #ffebee; }
.option-letter {
  width: 32px; height: 32px; border-radius: 50%;
  background: #f0f4f8; display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 700; color: var(--text-light); flex-shrink: 0;
}
.option-btn.selected .option-letter { background: var(--primary); color: #fff; }
.option-btn.correct .option-letter { background: var(--green); color: #fff; }
.option-btn.wrong .option-letter { background: var(--red); color: #fff; }
.option-text { flex: 1; }

/* Feedback */
.feedback {
  text-align: center; font-size: 0.9rem; font-weight: 700;
  padding: 10px; border-radius: var(--radius-sm);
  margin-bottom: 1rem; min-height: 42px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.feedback.correct { color: var(--green); background: #e8f5e9; }
.feedback.wrong { color: var(--red); background: #ffebee; }
.feedback.empty { opacity: 0; }

/* Quiz actions */
.quiz-actions {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}

/* ===== Result Screen ===== */
.result-card { padding: 2rem; }
.result-header { text-align: center; margin-bottom: 1.5rem; }
.result-icon { font-size: 3rem; line-height: 1; margin-bottom: 0.5rem; }
.result-title {
  font-size: 1.5rem; font-weight: 800; color: var(--primary-dark);
  margin-bottom: 0.25rem;
}
.result-subtitle { font-size: 0.9rem; color: var(--text-light); }

/* Score summary */
.score-summary {
  display: flex; align-items: center; justify-content: center;
  gap: 2rem; margin-bottom: 2rem; padding: 1.5rem;
  background: #f8fafc; border-radius: var(--radius-sm);
}
.score-total { text-align: center; }
.score-number {
  font-size: 3rem; font-weight: 800; color: var(--primary); line-height: 1;
}
.score-suffix { font-size: 1rem; color: var(--text-light); }
.score-details { display: flex; gap: 1.5rem; }
.score-detail { text-align: center; }
.detail-num { font-size: 1.5rem; font-weight: 800; display: block; }
.detail-num.green { color: var(--green); }
.detail-num.red { color: var(--red); }
.detail-label { font-size: 0.75rem; color: var(--text-light); }

/* Radar Chart */
.radar-section {
  margin-bottom: 2rem; padding: 1.5rem;
  background: #f8fafc; border-radius: var(--radius-sm);
}
.section-title {
  font-size: 1.1rem; font-weight: 700; color: var(--text);
  margin-bottom: 1rem; text-align: center;
}
.radar-container {
  display: flex; justify-content: center;
  margin-bottom: 1rem;
}
.radar-container canvas {
  max-width: 100%; height: auto;
}
.radar-legend {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 8px;
}
.legend-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.8rem; font-weight: 600; color: var(--text);
}
.legend-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.legend-score { color: var(--text-light); font-weight: 400; }

/* Recommendations */
.recommend-section {
  margin-bottom: 1.5rem; padding: 1.5rem;
  background: #f8fafc; border-radius: var(--radius-sm);
}
.recommend-list { display: flex; flex-direction: column; gap: 12px; }
.recommend-item {
  padding: 14px 16px; background: #fff; border-radius: var(--radius-sm);
  border-left: 4px solid var(--primary);
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.recommend-item.weak {
  border-left-color: var(--accent);
}
.recommend-item-title {
  font-size: 0.9rem; font-weight: 700; color: var(--text);
  margin-bottom: 4px;
}
.recommend-item-desc {
  font-size: 0.8rem; color: var(--text-light); line-height: 1.5;
  margin-bottom: 6px;
}
.recommend-item-link {
  font-size: 0.8rem; color: var(--primary); font-weight: 600;
  text-decoration: none;
}
.recommend-item-link:hover { text-decoration: underline; }

/* Result actions */
.result-actions {
  display: flex; flex-direction: column; gap: 10px;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 99px; }

/* ===== Responsive ===== */
@media (max-width: 520px) {
  .card { padding: 1.5rem; border-radius: 12px; }
  .quiz-card, .result-card { padding: 1.5rem; }
  .form-row { flex-direction: column; }
  .welcome-title { font-size: 1.25rem; }
  .question-text { font-size: 1rem; }
  .option-btn { padding: 12px 14px; font-size: 0.9rem; }
  .score-number { font-size: 2.5rem; }
  .score-summary { flex-direction: column; gap: 1rem; }
  .top-bar { padding: 0 12px; }
  .top-bar-logo { font-size: 0.8rem; }
}

@media (min-width: 768px) {
  .card { padding: 3rem; }
}