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

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: #38bdf8;
  letter-spacing: -0.5px;
}

header p {
  color: #94a3b8;
  margin-top: 0.25rem;
  font-size: 0.9rem;
}

#quiz-container {
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ── Progress bar ── */
.progress-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.progress-track {
  flex: 1;
  height: 6px;
  background: #1e293b;
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: #38bdf8;
  border-radius: 99px;
  transition: width 0.35s ease;
}

.progress-label {
  font-size: 0.8rem;
  color: #64748b;
  white-space: nowrap;
}

/* ── Question card ── */
.question-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 1.75rem 1.5rem;
}

.q-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: #38bdf8;
  margin-bottom: 0.65rem;
}

.q-text {
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 1.3rem;
  line-height: 1.55;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  border: 1px solid #334155;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
  font-size: 0.97rem;
}

.option:hover { border-color: #38bdf8; background: #0f2840; }

.option input[type="radio"] {
  accent-color: #38bdf8;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.option.selected  { border-color: #38bdf8; background: #0c2a40; }
.option.correct   { border-color: #22c55e; background: #052e16; color: #86efac; }
.option.wrong     { border-color: #ef4444; background: #2d0a0a; color: #fca5a5; }
.option.reveal-correct { border-color: #22c55e; background: #052e16; color: #86efac; }

/* ── Buttons ── */
.btn {
  display: block;
  width: 100%;
  padding: 0.85rem;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.btn-primary { background: #38bdf8; color: #0f172a; }
.btn-primary:hover:not(:disabled) { background: #7dd3fc; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Error ── */
.error-msg {
  display: none;
  color: #fca5a5;
  text-align: center;
  font-size: 0.88rem;
  padding: 0.7rem 1rem;
  background: #2d0a0a;
  border-radius: 8px;
  border: 1px solid #ef4444;
}

/* ── Results page ── */
.result-header {
  text-align: center;
  padding: 1.5rem;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
}

.result-header .score {
  font-size: 3rem;
  font-weight: 800;
  color: #38bdf8;
  line-height: 1;
}

.result-header .score-label {
  color: #94a3b8;
  margin-top: 0.4rem;
  font-size: 1rem;
}

.result-header .back-msg {
  margin-top: 0.75rem;
  font-size: 0.82rem;
  color: #64748b;
}

.result-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-left: 4px solid #334155;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
}

.result-card--correct { border-left-color: #22c55e; }
.result-card--wrong   { border-left-color: #ef4444; }

.result-card .q-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.09em; margin-bottom: 0.4rem; }
.result-card--correct .q-label { color: #22c55e; }
.result-card--wrong   .q-label { color: #ef4444; }

.result-card .q-text  { font-size: 0.97rem; font-weight: 500; margin-bottom: 0.9rem; line-height: 1.5; }

.result-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.88rem;
  padding: 0.4rem 0;
}

.result-row .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-correct { background: #22c55e; }
.dot-wrong   { background: #ef4444; }

.result-row .answer-text { flex: 1; }
.result-row .tag {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tag-correct { background: #052e16; color: #22c55e; }
.tag-wrong   { background: #2d0a0a; color: #ef4444; }

.source-link {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: #38bdf8;
  text-decoration: none;
}

.source-link:hover { text-decoration: underline; }

.source-link--wrong {
  color: #fbbf24;
  font-weight: 600;
  padding: 0.3rem 0.6rem;
  background: #2a1500;
  border: 1px solid #b45309;
  border-radius: 6px;
}

.source-link--wrong:hover { background: #3a2000; }

/* ── Loader ── */
.loader {
  color: #64748b;
  text-align: center;
  padding: 2rem;
  font-size: 0.95rem;
}

/* ── Dev panel ── */
#dev-panel {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  background: #1a1000;
  border: 1px solid #b45309;
  border-radius: 10px;
  font-size: 0.8rem;
  font-family: monospace;
  z-index: 9999;
  min-width: 220px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

#dev-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: #b45309;
  border-radius: 9px 9px 0 0;
  cursor: pointer;
  user-select: none;
  color: #fef3c7;
  font-weight: 700;
  letter-spacing: 0.05em;
  font-size: 0.72rem;
  text-transform: uppercase;
}

#dev-panel-body {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#dev-date-display {
  font-size: 1rem;
  font-weight: 700;
  color: #fbbf24;
  text-align: center;
  padding: 0.3rem 0;
}

.dev-row {
  display: flex;
  gap: 0.4rem;
}

.dev-btn {
  flex: 1;
  padding: 0.35rem 0.5rem;
  border: 1px solid #b45309;
  border-radius: 6px;
  background: #2a1500;
  color: #fbbf24;
  cursor: pointer;
  font-size: 0.78rem;
  font-family: monospace;
  font-weight: 600;
  transition: background 0.1s;
  white-space: nowrap;
}

.dev-btn:hover { background: #3a2000; }
.dev-btn:active { background: #b45309; color: #fff; }
.dev-btn.danger { border-color: #ef4444; color: #fca5a5; }
.dev-btn.danger:hover { background: #2d0a0a; }

#dev-date-input {
  flex: 1;
  padding: 0.35rem 0.5rem;
  border: 1px solid #b45309;
  border-radius: 6px;
  background: #2a1500;
  color: #fbbf24;
  font-size: 0.78rem;
  font-family: monospace;
  min-width: 0;
}

#dev-state-list {
  font-size: 0.7rem;
  color: #a16207;
  line-height: 1.6;
  border-top: 1px solid #2a1500;
  padding-top: 0.5rem;
  max-height: 100px;
  overflow-y: auto;
}
