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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f0f2f5;
  color: #1a1a2e;
  min-height: 100vh;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

header {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  color: white;
  padding: 20px 0;
  margin-bottom: 30px;
}

header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header h1 { font-size: 1.5rem; }

header nav a {
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  margin-left: 20px;
  font-size: 0.95rem;
}
header nav a:hover { color: white; }

.card {
  background: white;
  border-radius: 12px;
  padding: 30px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

h2 { margin-bottom: 20px; color: #1a1a2e; }
h3 { margin-bottom: 12px; }

input[type="text"], input[type="file"], select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s;
}
input:focus { outline: none; border-color: #4361ee; }

.btn {
  display: inline-block;
  padding: 12px 28px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.2s;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: #4361ee;
  color: white;
}
.btn-primary:hover { box-shadow: 0 4px 12px rgba(67,97,238,0.4); }

.btn-success {
  background: #2ec4b6;
  color: white;
}

.btn-danger {
  background: #e63946;
  color: white;
}

.btn-secondary {
  background: #6c757d;
  color: white;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Timer */
.timer-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: white;
  padding: 12px 20px;
  border-bottom: 2px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}
.timer-bar .time { font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.timer-bar .time.warning { color: #e63946; }

.progress-bar {
  height: 4px;
  background: #e0e0e0;
  border-radius: 2px;
  margin-top: 8px;
}
.progress-bar .fill {
  height: 100%;
  background: #4361ee;
  border-radius: 2px;
  transition: width 0.3s;
}

/* Questions */
.question-card {
  background: white;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.question-card .q-number {
  font-weight: 700;
  color: #4361ee;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.question-card .q-text {
  font-size: 1.05rem;
  margin-bottom: 16px;
  line-height: 1.5;
}

.choices { display: flex; flex-direction: column; gap: 8px; }

.choice-label {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border: 2px solid #e8e8e8;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.choice-label:hover { border-color: #4361ee; background: #f8f9ff; }
.choice-label input { display: none; }
.choice-label input:checked + .choice-text { font-weight: 600; }
.choice-label:has(input:checked) {
  border-color: #4361ee;
  background: #eef0ff;
}

.choice-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  margin-right: 12px;
  flex-shrink: 0;
}

.choice-label:has(input:checked) .choice-letter {
  background: #4361ee;
  color: white;
}

/* Review mode */
.question-card.correct { border-left: 4px solid #2ec4b6; }
.question-card.incorrect { border-left: 4px solid #e63946; }
.question-card.unanswered { border-left: 4px solid #ffc107; }

.choice-label.correct-answer {
  border-color: #2ec4b6;
  background: #e8f8f5;
}
.choice-label.wrong-answer {
  border-color: #e63946;
  background: #fdecea;
}

/* Question navigator */
.question-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 16px 0;
}

.question-nav .q-dot {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  border: 2px solid #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  background: white;
  transition: all 0.15s;
}
.question-nav .q-dot:hover { border-color: #4361ee; }
.question-nav .q-dot.answered { background: #4361ee; color: white; border-color: #4361ee; }
.question-nav .q-dot.current { border-color: #1a1a2e; border-width: 3px; }

/* Scores */
.score-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.score-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.score-card .score-value {
  font-size: 2rem;
  font-weight: 800;
  color: #4361ee;
}

.score-card .score-label {
  font-size: 0.85rem;
  color: #666;
  margin-top: 4px;
}

.score-card .score-pct {
  font-size: 1.1rem;
  color: #888;
  margin-top: 4px;
}

/* Section selector */
.section-list { display: flex; flex-direction: column; gap: 12px; }

.section-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 2px solid transparent;
}

.section-item .info h3 { margin-bottom: 4px; }
.section-item .info span { font-size: 0.85rem; color: #666; }

/* Table */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}
th, td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid #eee;
}
th { font-weight: 600; font-size: 0.85rem; color: #666; text-transform: uppercase; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
}
.badge-green { background: #d4edda; color: #155724; }
.badge-yellow { background: #fff3cd; color: #856404; }
.badge-red { background: #f8d7da; color: #721c24; }

.text-center { text-align: center; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

.alert {
  padding: 14px 20px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-weight: 500;
}
.alert-success { background: #d4edda; color: #155724; }
.alert-error { background: #f8d7da; color: #721c24; }
.alert-info { background: #d1ecf1; color: #0c5460; }

@media (max-width: 600px) {
  .container { padding: 12px; }
  .card { padding: 20px; }
  header .container { flex-direction: column; gap: 10px; }
  .score-summary { grid-template-columns: 1fr 1fr; }
}
