/* ===== Biến màu chủ đạo: trắng + xanh nhạt sang trọng ===== */
:root {
  --bg: #f0f7ff;
  --bg-card: #ffffff;
  --primary: #1a73e8;
  --primary-light: #e8f0fe;
  --primary-dark: #0d47a1;
  --accent: #00acc1;
  --success: #2e7d32;
  --success-bg: #e8f5e9;
  --error: #c62828;
  --error-bg: #ffebee;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #d0e3f7;
  --shadow: 0 8px 30px rgba(26, 115, 232, 0.12);
  --radius: 16px;
  --transition: 0.25s ease;
}

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

body {
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Roboto", sans-serif;
  background: linear-gradient(160deg, #e3f2fd 0%, #f0f7ff 40%, #e8f5e9 100%);
  min-height: 100vh;
  color: var(--text);
  line-height: 1.55;
  padding: 16px;
}

.app {
  max-width: 720px;
  margin: 0 auto;
}

/* ===== Header ===== */
.header {
  text-align: center;
  margin-bottom: 24px;
  padding: 20px 16px 12px;
}

.header h1 {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--primary-dark);
  letter-spacing: -0.3px;
}

.header p {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-top: 6px;
}

.badge {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  margin-top: 10px;
}

/* ===== Progress ===== */
.progress-wrap {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  border: 1px solid var(--border);
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.progress-bar {
  height: 8px;
  background: #e3f2fd;
  border-radius: 10px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 10px;
  transition: width 0.4s ease;
  width: 0%;
}

/* ===== Card câu hỏi ===== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 24px 20px;
  margin-bottom: 20px;
  animation: fadeIn 0.35s ease;
}

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

.q-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.q-number {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  padding: 4px 12px;
  border-radius: 20px;
}

.q-type {
  font-size: 0.78rem;
  color: var(--text-muted);
  background: #f1f5f9;
  padding: 3px 10px;
  border-radius: 12px;
}

.q-text {
  font-size: 1.08rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 18px;
  line-height: 1.5;
}

.q-image {
  margin-bottom: 16px;
  text-align: center;
}

.q-image img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  display: block;
  margin: 0 auto;
}

/* ===== Options ===== */
.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: #fafcff;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  position: relative;
}

/* Chỉ hover trên máy có chuột thật, tránh dính xanh trên điện thoại */
@media (hover: hover) and (pointer: fine) {
  .option:hover:not(.disabled):not(.correct):not(.wrong) {
    border-color: var(--primary);
    background: var(--primary-light);
  }
}

.option.selected:not(.correct):not(.wrong) {
  border-color: var(--primary);
  background: var(--primary-light);
}

.option.correct {
  border-color: var(--success) !important;
  background: var(--success-bg) !important;
}

.option.wrong {
  border-color: var(--error) !important;
  background: var(--error-bg) !important;
}

.option.disabled {
  cursor: default;
  pointer-events: none;
}

.option-letter {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e3f2fd;
  color: var(--primary);
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease;
}

.option.selected:not(.correct):not(.wrong) .option-letter {
  background: var(--primary);
  color: white;
}

.option.correct .option-letter {
  background: var(--success) !important;
  color: white !important;
}

.option.wrong .option-letter {
  background: var(--error) !important;
  color: white !important;
}

.option-text {
  flex: 1;
  font-size: 0.98rem;
  padding-top: 2px;
}

/* ===== Feedback ===== */
.feedback {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 500;
  display: none;
  animation: fadeIn 0.3s ease;
}

.feedback.show {
  display: block;
}

.feedback.correct {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid #a5d6a7;
}

.feedback.wrong {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid #ef9a9a;
}

/* ===== Actions ===== */
.actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.btn {
  flex: 1;
  padding: 14px 20px;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #1565c0);
  color: white;
  box-shadow: 0 4px 14px rgba(26, 115, 232, 0.35);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(26, 115, 232, 0.45);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: white;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-secondary:hover {
  background: var(--primary-light);
}

/* ===== Kết quả ===== */
.result-card {
  text-align: center;
  padding: 32px 24px;
}

.result-icon {
  font-size: 3.2rem;
  margin-bottom: 12px;
}

.result-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 8px;
}

.result-score {
  font-size: 2.8rem;
  font-weight: 800;
  color: var(--primary);
  margin: 12px 0 4px;
}

.result-detail {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 24px;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 28px;
}

.stat-box {
  background: var(--primary-light);
  border-radius: 12px;
  padding: 14px 8px;
}

.stat-box .num {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.stat-box .label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.stat-box.good { background: var(--success-bg); }
.stat-box.good .num { color: var(--success); }
.stat-box.bad { background: var(--error-bg); }
.stat-box.bad .num { color: var(--error); }

/* ===== Footer ===== */
.footer {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 16px;
  padding-bottom: 20px;
}

/* ===== Timer nhỏ ===== */
.auto-next {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 10px;
  height: 20px;
}

/* Responsive */
@media (max-width: 480px) {
  .header h1 { font-size: 1.3rem; }
  .card { padding: 18px 14px; }
  .q-text { font-size: 1rem; }
  .stats-grid { grid-template-columns: 1fr 1fr 1fr; }
}
