:root {
  --nv-green: #76b900;
  --nv-green-dark: #5a9100;
  --bg: #0d1117;
  --bg-elevated: #161b22;
  --bg-card: #1b222c;
  --border: #2a323d;
  --text: #e6edf3;
  --text-dim: #9aa7b2;
  --danger: #e5484d;
  --danger-bg: rgba(229, 72, 77, 0.12);
  --success: #76b900;
  --success-bg: rgba(118, 185, 0, 0.12);
  --warning: #e8a33d;
  --warning-bg: rgba(232, 163, 61, 0.14);
  --radius: 10px;
  --shadow: 0 4px 18px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100%;
}

.hidden { display: none !important; }

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 8px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-name {
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
}

.brand-sub {
  font-size: 12px;
  color: var(--text-dim);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.timer {
  font-variant-numeric: tabular-nums;
  font-size: 18px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 8px;
  background: rgba(118, 185, 0, 0.12);
  color: var(--nv-green);
  border: 1px solid rgba(118, 185, 0, 0.35);
}

.timer.timer-warn {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(229, 72, 77, 0.4);
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* ---------- Buttons ---------- */
.btn {
  font-size: 14px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

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

.btn-primary {
  background: var(--nv-green);
  color: #06210a;
}
.btn-primary:hover:not(:disabled) {
  background: #86cc00;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover:not(:disabled) {
  border-color: var(--nv-green);
  color: var(--nv-green);
}

.btn-submit {
  background: var(--danger);
  color: #fff;
}
.btn-submit:hover:not(:disabled) {
  background: #c9393e;
}

/* ---------- Layout ---------- */
main#app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 20px 60px;
  min-height: calc(100vh - 140px);
}

.footer {
  text-align: center;
  padding: 18px;
  font-size: 12px;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
}

/* ---------- Start Screen ---------- */
.hero {
  text-align: center;
  margin-bottom: 40px;
}

.hero h1 {
  font-size: 32px;
  line-height: 1.3;
  margin-bottom: 14px;
}

.accent { color: var(--nv-green); }

.hero-sub {
  color: var(--text-dim);
  font-size: 15px;
  max-width: 640px;
  margin: 0 auto;
}

.mode-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 760px) {
  .mode-cards { grid-template-columns: 1fr; }
}

.mode-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}

.mode-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.mode-card h2 {
  margin: 0 0 10px;
  font-size: 20px;
}

.mode-card p {
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 14px;
}

.mode-features {
  list-style: none;
  padding: 0;
  margin: 0 0 22px;
  color: var(--text);
  font-size: 13.5px;
}

.mode-features li {
  padding: 5px 0 5px 22px;
  position: relative;
}

.mode-features li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--nv-green);
  font-weight: 700;
}

.mode-card .btn {
  margin-top: auto;
  width: 100%;
}

/* ---------- Quiz layout ---------- */
.quiz-layout {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 24px;
  align-items: start;
}

@media (max-width: 860px) {
  .quiz-layout { grid-template-columns: 1fr; }
}

.progress-row {
  margin-bottom: 20px;
}

.progress-label {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.progress-bar {
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--nv-green);
  transition: width 0.25s ease;
}

.question-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

.question-text {
  font-size: 17px;
  line-height: 1.55;
  margin: 0 0 22px;
  white-space: pre-line;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  background: var(--bg-elevated);
  transition: border-color 0.15s ease, background 0.15s ease;
  font-size: 14.5px;
  line-height: 1.45;
}

.option:hover {
  border-color: var(--nv-green);
}

.option.selected {
  border-color: var(--nv-green);
  background: rgba(118, 185, 0, 0.08);
}

.option-letter {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12.5px;
  color: var(--text-dim);
}

.option.selected .option-letter {
  border-color: var(--nv-green);
  color: var(--nv-green);
}

.option.correct {
  border-color: var(--success);
  background: var(--success-bg);
}
.option.correct .option-letter {
  background: var(--success);
  border-color: var(--success);
  color: #06210a;
}

.option.incorrect {
  border-color: var(--danger);
  background: var(--danger-bg);
}
.option.incorrect .option-letter {
  background: var(--danger);
  border-color: var(--danger);
  color: #2a0506;
}

.option.disabled {
  cursor: default;
}

/* ---------- Feedback (Practice mode) ---------- */
.feedback {
  margin-top: 20px;
  padding: 20px 22px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.feedback.is-correct { border-left: 4px solid var(--success); }
.feedback.is-incorrect { border-left: 4px solid var(--danger); }

.feedback-verdict {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.feedback-verdict.correct { color: var(--success); }
.feedback-verdict.incorrect { color: var(--danger); }

.feedback-section {
  margin-bottom: 12px;
}

.feedback-section h4 {
  margin: 0 0 6px;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}

.feedback-section p {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-line;
}

.feedback-tip {
  background: rgba(118, 185, 0, 0.06);
  border: 1px dashed rgba(118, 185, 0, 0.4);
  border-radius: 8px;
  padding: 12px 14px;
}

/* ---------- Nav row ---------- */
.nav-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 22px;
  flex-wrap: wrap;
}

.nav-row-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  flex-wrap: wrap;
}

/* ---------- Exam sidebar ---------- */
.quiz-side {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: sticky;
  top: 84px;
}

.quiz-side h3 {
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.nav-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.nav-cell {
  aspect-ratio: 1;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.nav-cell:hover { border-color: var(--nv-green); }

.nav-cell.answered {
  background: rgba(118, 185, 0, 0.15);
  border-color: var(--nv-green);
  color: var(--nv-green);
}

.nav-cell.correct {
  background: var(--success-bg);
  border-color: var(--success);
  color: var(--success);
}

.nav-cell.incorrect {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger);
}

.nav-cell.flagged {
  background: var(--warning-bg);
  border-color: var(--warning);
  color: var(--warning);
}

.nav-cell.current {
  outline: 2px solid var(--text);
  outline-offset: 1px;
}

.nav-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 18px;
}

.nav-legend span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot-answered { background: var(--nv-green); }
.dot-correct { background: var(--success); }
.dot-incorrect { background: var(--danger); }
.dot-flagged { background: var(--warning); }
.dot-current { background: var(--text); }
.dot-unanswered { background: var(--border); }

.quiz-side .btn-submit {
  width: 100%;
}

/* ---------- Results ---------- */
.results-summary {
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 24px;
  box-shadow: var(--shadow);
}

.score-circle {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 6px solid var(--nv-green);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 20px auto;
  font-size: 30px;
  font-weight: 800;
}

.score-detail {
  font-size: 15px;
  color: var(--text-dim);
  margin: 6px 0 20px;
}

.results-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.review-list {
  margin-top: 30px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.review-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}

.review-item-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 700;
}

.review-badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
}

.review-badge.correct {
  background: var(--success-bg);
  color: var(--success);
}
.review-badge.incorrect {
  background: var(--danger-bg);
  color: var(--danger);
}
.review-badge.unanswered {
  background: rgba(154,167,178,0.15);
  color: var(--text-dim);
}
