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

:root {
  --primary: #6C5CE7;
  --primary-light: #A29BFE;
  --bg: #ffffff;
  --text: #1a1a2e;
  --text-light: #6b7280;
  --border: #e5e7eb;
  --border-hover: #6C5CE7;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --error: #ef4444;
  --error-bg: #fef2f2;
  --badge-bg: #f3f4f6;
  --badge-text: #6b7280;
  --badge-selected-bg: #6C5CE7;
  --badge-selected-text: #fff;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --transition: all 0.2s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Progress Bar */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--primary);
  transition: width 0.4s ease;
  z-index: 100;
}

/* Container */
.quiz-container {
  max-width: 620px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

/* Header */
.quiz-header {
  margin-bottom: 40px;
}
.quiz-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  letter-spacing: -0.5px;
}

/* Divider */
.divider {
  height: 1px;
  background: var(--border);
  margin: 32px 0;
}

/* Form Fields */
.field-group {
  margin-bottom: 28px;
}
.field-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.field-label .required {
  color: var(--primary);
  font-size: 12px;
}

.field-input {
  width: 100%;
  padding: 12px 16px;
  font-size: 15px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  transition: var(--transition);
  outline: none;
  font-family: inherit;
}
.field-input::placeholder { color: #c4c4c4; }
.field-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.08); }

/* Question */
.question-block {
  margin-bottom: 36px;
  opacity: 0;
  transform: translateY(12px);
  animation: fadeInUp 0.4s ease forwards;
}
@keyframes fadeInUp {
  to { opacity: 1; transform: translateY(0); }
}

.question-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  line-height: 1.5;
}
.question-title .required { color: var(--primary); font-size: 12px; margin-left: 4px; }

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

.option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}
.option:hover {
  border-color: var(--border-hover);
  background: #fafafe;
}
.option.selected {
  border-color: var(--primary);
  background: #f8f7ff;
}

.option-badge {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--badge-bg);
  color: var(--badge-text);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
}
.option.selected .option-badge {
  background: var(--badge-selected-bg);
  color: var(--badge-selected-text);
}

.option-text {
  font-size: 15px;
  color: var(--text);
  flex: 1;
}

/* Results - correct/incorrect */
.option.correct {
  border-color: var(--success);
  background: var(--success-bg);
}
.option.correct .option-badge {
  background: var(--success);
  color: #fff;
}
.option.incorrect {
  border-color: var(--error);
  background: var(--error-bg);
}
.option.incorrect .option-badge {
  background: var(--error);
  color: #fff;
}

.explanation {
  margin-top: 8px;
  padding: 10px 14px;
  background: #f0f9ff;
  border-radius: 8px;
  font-size: 13px;
  color: #1e40af;
  line-height: 1.5;
  border-left: 3px solid #3b82f6;
}

/* Submit Button */
.submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 32px;
  background: var(--text);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  width: 100%;
  margin-top: 12px;
}
.submit-btn:hover { background: #2d2d4e; transform: translateY(-1px); }
.submit-btn:active { transform: translateY(0); }
.submit-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Results Page */
.results-container {
  text-align: center;
  padding: 40px 0 24px;
}

.score-circle {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  border: 4px solid;
}
.score-circle.passed { border-color: var(--success); background: var(--success-bg); }
.score-circle.failed { border-color: var(--error); background: var(--error-bg); }

.score-number {
  font-size: 36px;
  font-weight: 800;
  line-height: 1;
}
.score-circle.passed .score-number { color: var(--success); }
.score-circle.failed .score-number { color: var(--error); }

.score-label {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 4px;
}

.score-status {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}
.score-status.passed { color: var(--success); }
.score-status.failed { color: var(--error); }

.score-message {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 32px;
}

.results-title {
  font-size: 18px;
  font-weight: 700;
  text-align: left;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* Loading */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  font-size: 15px;
  color: var(--text-light);
}

/* Admin */
.admin-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px;
}

.login-box {
  max-width: 380px;
  margin: 120px auto;
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.login-box h1 {
  font-size: 22px;
  margin-bottom: 24px;
  text-align: center;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}
.stat-card {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}
.stat-value { font-size: 28px; font-weight: 800; color: var(--text); }
.stat-label { font-size: 12px; color: var(--text-light); margin-top: 4px; }

.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; padding: 12px; border-bottom: 2px solid var(--border); font-weight: 600; color: var(--text-light); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
td { padding: 12px; border-bottom: 1px solid var(--border); }
tr:hover td { background: #fafafa; }
.badge { padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-success { background: var(--success-bg); color: #065f46; }
.badge-error { background: var(--error-bg); color: #991b1b; }

/* Responsive */
@media (max-width: 640px) {
  .quiz-container { padding: 32px 16px 60px; }
  .quiz-title { font-size: 22px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
