/* Employee Quiz Builder — vanilla CSS, no framework, no external requests. */
* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0; padding: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 1rem; line-height: 1.5; color: #1a1a1a; background: #f6f7f9;
}
.app { max-width: 560px; margin: 0 auto; padding: 16px; min-height: 100vh; }
h1 { font-size: 1.5rem; margin: 0; line-height: 1.25; }
h2 { font-size: 1.25rem; margin: 1.25rem 0 0.5rem; }
p { margin: 0.5rem 0; }
button { font-size: 1rem; font-family: inherit; cursor: pointer; }
a { color: #0b5fff; overflow-wrap: anywhere; }

.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.subtitle { color: #555; margin-top: 4px; }
.chip {
  display: inline-block; padding: 8px 12px; border-radius: 999px;
  font-size: 0.875rem; font-weight: 600; white-space: nowrap;
  background: #e5e7eb; color: #374151; min-height: 36px;
}
.chip-live { background: #dcfce7; color: #166534; }
.chip-offline { background: #fef3c7; color: #92400e; }
.chip-waking { background: #e5e7eb; color: #374151; }

.screen[hidden] { display: none; }
label { display: block; font-weight: 600; margin: 12px 0 4px; }
input[type="text"], select {
  width: 100%; min-height: 48px; padding: 10px 12px;
  font-size: 1rem; font-family: inherit;
  border: 1px solid #9ca3af; border-radius: 8px; background: #fff; color: #1a1a1a;
}
input[type="text"]:focus, select:focus, button:focus-visible, a:focus-visible {
  outline: 3px solid #0b5fff; outline-offset: 2px;
}
.btn {
  display: block; width: 100%; min-height: 48px; padding: 12px 16px;
  border: none; border-radius: 8px; font-weight: 700; margin-top: 12px;
}
.btn-primary { background: #0b5fff; color: #fff; }
.btn-primary:hover { background: #0848c2; }
.btn-secondary { background: #e5e7eb; color: #1a1a1a; }
.btn-secondary:hover { background: #d1d5db; }
.hint { color: #555; font-size: 0.9375rem; }
.notice {
  margin-top: 16px; padding: 12px; border-radius: 8px;
  background: #fef3c7; border: 1px solid #f59e0b; color: #78350f;
}
.notice .btn { margin-top: 8px; }

.sample-cards { display: grid; gap: 12px; margin-top: 8px; }
.sample-card {
  background: #fff; border: 1px solid #d1d5db; border-radius: 10px;
  padding: 16px; text-align: left; width: 100%;
}
.sample-card:hover { border-color: #0b5fff; }
.sample-card strong { display: block; font-size: 1.0625rem; }
.sample-card span { color: #555; font-size: 0.9375rem; }

/* Loading */
.loader { display: flex; gap: 8px; justify-content: center; margin: 48px 0 16px; }
.loader span {
  width: 14px; height: 14px; border-radius: 50%; background: #0b5fff;
  animation: bounce 1.2s infinite ease-in-out;
}
.loader span:nth-child(2) { animation-delay: 0.15s; }
.loader span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce { 0%, 80%, 100% { transform: translateY(0); opacity: 0.5; } 40% { transform: translateY(-12px); opacity: 1; } }
.loading-note { text-align: center; font-weight: 600; }

/* Quiz header */
.quiz-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 8px; }
.streak { font-size: 1.125rem; font-weight: 700; min-height: 48px; display: inline-flex; align-items: center; }
.streak.bump { animation: bump 0.3s ease; }
@keyframes bump { 0% { transform: scale(1); } 50% { transform: scale(1.25); } 100% { transform: scale(1); } }
.badge {
  padding: 6px 10px; border-radius: 999px; font-size: 0.8125rem; font-weight: 700;
}
.badge-grounded { background: #dcfce7; color: #166534; }
.badge-partial { background: #fef3c7; color: #92400e; }
.badge-ungrounded { background: #fee2e2; color: #991b1b; }

.progress-wrap { margin-top: 12px; }
.progress-bar, .timer-bar {
  height: 10px; background: #e5e7eb; border-radius: 999px; overflow: hidden;
}
.progress-fill { height: 100%; width: 0; background: #0b5fff; border-radius: 999px; transition: width 0.3s ease; }
.progress-text, .timer-text { font-size: 0.9375rem; color: #555; margin: 4px 0 0; }
.timer-wrap { margin-top: 8px; }
.timer-fill { height: 100%; width: 100%; background: #22c55e; border-radius: 999px; transition: width 0.1s linear; }
.timer-fill.low { background: #dc2626; animation: pulse 1s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

.question-card {
  background: #fff; border: 1px solid #d1d5db; border-radius: 12px;
  padding: 16px; margin-top: 16px;
}
.question-card.slide-out { transform: translateX(-24px); opacity: 0; transition: transform 0.25s ease, opacity 0.25s ease; }
.question-card.slide-in { animation: slideIn 0.25s ease; }
@keyframes slideIn { from { transform: translateX(24px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.difficulty { text-transform: capitalize; color: #555; font-size: 0.875rem; font-weight: 600; margin: 0; }
#question-text { font-size: 1.1875rem; margin: 4px 0 12px; line-height: 1.4; }

.options { display: grid; gap: 10px; }
.option-btn {
  display: flex; gap: 10px; align-items: flex-start; text-align: left;
  width: 100%; min-height: 48px; padding: 12px 14px;
  background: #fff; border: 2px solid #9ca3af; border-radius: 10px; color: #1a1a1a;
}
.option-btn:hover:not(:disabled) { border-color: #0b5fff; }
.option-btn:disabled { cursor: default; opacity: 1; }
.option-key { font-weight: 800; flex-shrink: 0; }
.option-btn.correct { background: #dcfce7; border-color: #16a34a; animation: greenPulse 0.5s ease; }
.option-btn.wrong { background: #fee2e2; border-color: #dc2626; animation: shake 0.4s ease; }
.option-btn.dim { opacity: 0.6; }
@keyframes greenPulse { 0% { transform: scale(1); } 50% { transform: scale(1.02); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

.feedback { font-weight: 700; margin-top: 12px; min-height: 1.5rem; }
.feedback.correct { color: #166534; }
.feedback.wrong { color: #991b1b; }
.points-float {
  display: inline-block; color: #166534; font-weight: 800;
  animation: floatUp 1s ease forwards;
}
@keyframes floatUp { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-18px); opacity: 0; } }
.explanation {
  margin-top: 12px; padding: 12px; background: #f6f7f9;
  border-left: 4px solid #0b5fff; border-radius: 0 8px 8px 0;
}
.source-line { font-size: 0.9375rem; color: #555; }
.source-line .flag { color: #991b1b; font-weight: 600; }

/* Results */
.score-line { font-size: 2.5rem; font-weight: 800; margin: 8px 0; }
.score-label { font-size: 1rem; font-weight: 400; color: #555; }
.grade-line { font-size: 1.375rem; font-weight: 800; }
.correct-line, .best-line { font-size: 1.0625rem; }
.results-actions { display: grid; gap: 0; margin-top: 16px; }
.confetti-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 50; }

/* Review */
.review-list { display: grid; gap: 12px; margin: 12px 0; }
.review-item { background: #fff; border: 1px solid #d1d5db; border-radius: 10px; padding: 14px; }
.review-item h3 { font-size: 1.0625rem; margin: 0 0 8px; }
.review-item p { margin: 4px 0; }
.review-correct { color: #166534; font-weight: 600; }
.review-wrong { color: #991b1b; font-weight: 600; }
.review-item .badge { margin-left: 6px; }

.footer { margin-top: 32px; border-top: 1px solid #d1d5db; padding-top: 12px; }
.footer p { color: #555; font-size: 0.875rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
