:root {
  color-scheme: light;
  font-family: "Helvetica Neue", Arial, sans-serif;
  background: #f3f5f9;
  color: #1e293b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 100%);
  padding: 32px 0;
}

.quiz-container {
  width: min(720px, 92%);
  padding: 24px;
}

.quiz-card {
  background: #ffffff;
  border: 1px solid #dbe3ef;
  border-radius: 18px;
  box-shadow: 0 18px 60px rgba(15, 23, 42, 0.08);
  padding: 28px;
}

.hidden {
  display: none !important;
}

h1 {
  margin: 0 0 20px;
  font-size: 1.8rem;
  letter-spacing: -0.03em;
}

h2 {
  font-size: 1.25rem;
  margin: 0 0 24px;
  line-height: 1.6;
}

.lead {
  margin: 0 0 20px;
  color: #475569;
  line-height: 1.6;
}

.meta {
  font-size: 0.95rem;
  color: #64748b;
  margin-bottom: 16px;
}

.form {
  display: grid;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.95rem;
  color: #334155;
}

.field input {
  padding: 12px 14px;
  font-size: 1rem;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
  color: #0f172a;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
  background: #ffffff;
}

.choices {
  display: grid;
  gap: 12px;
}

.choice-button {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
  color: #0f172a;
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.choice-button:hover {
  background: #edf2ff;
}

.choice-button.selected {
  background: #e0e7ff;
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15) inset;
}

.nav-buttons {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
}

.primary-button,
.secondary-button {
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 1rem;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.primary-button {
  border: none;
  background: #4338ca;
  color: #ffffff;
}

.primary-button:not(:disabled):hover {
  transform: translateY(-1px);
  background: #3730a3;
}

.secondary-button {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
}

.secondary-button:not(:disabled):hover {
  background: #f1f5f9;
}

.primary-button:disabled,
.secondary-button:disabled {
  opacity: 0.5;
  cursor: default;
}

.submit-status {
  margin: 0 0 18px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #ecfeff;
  color: #155e75;
  font-size: 0.95rem;
}

.submit-status.error {
  background: #fef2f2;
  color: #991b1b;
}

.answer-review {
  padding-left: 20px;
  margin: 0;
  display: grid;
  gap: 14px;
}

.answer-review li {
  line-height: 1.6;
}

.answer-review .review-question {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
  color: #1e293b;
}

.answer-review .review-answer {
  display: block;
  color: #475569;
  font-size: 0.95rem;
}

.answer-review .review-answer.unanswered {
  color: #b91c1c;
}

.start-error {
  margin: 0 0 18px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #fef2f2;
  color: #991b1b;
  font-size: 0.95rem;
  line-height: 1.6;
}

.log-details {
  margin-top: 24px;
  border-top: 1px solid #e2e8f0;
  padding-top: 16px;
}

.log-details summary {
  cursor: pointer;
  font-weight: 600;
  color: #334155;
}

.exam-log {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
  font-size: 0.9rem;
}

.exam-log th,
.exam-log td {
  border: 1px solid #e2e8f0;
  padding: 8px 10px;
  text-align: left;
}

.exam-log th {
  background: #f1f5f9;
  color: #334155;
  font-weight: 600;
}

.exam-log td {
  color: #475569;
}

.exam-log td.cell-pass {
  color: #166534;
  font-weight: 600;
}

.exam-log td.cell-fail {
  color: #b91c1c;
  font-weight: 600;
}

.text-link {
  display: inline-block;
  margin-top: 18px;
  background: none;
  border: none;
  color: #64748b;
  font-size: 0.85rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}

.text-link:hover {
  color: #334155;
}

.score-board {
  margin-bottom: 20px;
  text-align: center;
}

.score-result {
  display: inline-block;
  padding: 10px 32px;
  border-radius: 999px;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.score-result.pass {
  background: #ddf7e2;
  color: #166534;
}

.score-result.fail {
  background: #ffe3e3;
  color: #b91c1c;
}

.score-detail {
  margin: 14px 0 0;
  color: #334155;
  font-size: 1rem;
}

.timer {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 100;
  padding: 10px 18px;
  border-radius: 999px;
  background: #1e293b;
  color: #ffffff;
  font-size: 1.1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.25);
}

.timer.warning {
  background: #b91c1c;
  animation: timer-pulse 1s ease-in-out infinite;
}

@keyframes timer-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

@media (max-width: 520px) {
  .quiz-card {
    padding: 20px;
  }

  .choice-button {
    padding: 12px 14px;
  }

  .nav-buttons {
    flex-direction: column-reverse;
  }

  .nav-buttons .primary-button,
  .nav-buttons .secondary-button {
    width: 100%;
  }
}

.test-list {
  display: grid;
  gap: 12px;
  margin-bottom: 8px;
}

.test-button {
  width: 100%;
  padding: 18px 20px;
  border: 1px solid #c7d2fe;
  border-radius: 12px;
  background: #eef2ff;
  color: #312e81;
  font-size: 1.05rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.test-button:hover {
  background: #e0e7ff;
  transform: translateY(-1px);
}

.test-button .test-count {
  display: block;
  margin-top: 4px;
  font-size: 0.85rem;
  font-weight: 400;
  color: #6366f1;
}

.answer-review .review-explanation {
  display: block;
  margin-top: 6px;
  padding: 8px 10px;
  background: #f1f5f9;
  border-left: 3px solid #94a3b8;
  border-radius: 4px;
  color: #334155;
  font-size: 0.9rem;
  line-height: 1.6;
}

.section-title {
  margin: 28px 0 4px;
  font-size: 1.05rem;
  color: #1e293b;
  border-top: 1px solid #e2e8f0;
  padding-top: 20px;
}

.section-note {
  margin: 0 0 12px;
  font-size: 0.85rem;
  color: #64748b;
}

.wip-tag {
  color: #dc2626;
  font-weight: 700;
  margin-left: 6px;
  font-size: 0.95rem;
}

.material-button {
  display: block;
  text-decoration: none;
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}

.material-button:hover {
  background: #d1fae5;
}

.material-button .test-count {
  color: #047857;
}

.test-button:disabled {
  opacity: 0.55;
  cursor: default;
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #64748b;
}

.test-button:disabled:hover {
  transform: none;
  background: #f1f5f9;
}

.admin-fab {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 100;
  padding: 10px 16px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #ffffff;
  color: #475569;
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.15);
  transition: background 0.2s ease, color 0.2s ease;
}

.admin-fab:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.admin-inline {
  display: block;
  margin: 14px auto 0;
  padding: 9px 18px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #ffffff;
  color: #475569;
  font-size: 0.85rem;
  cursor: pointer;
}

.admin-inline:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.question-image {
  display: block;
  max-width: 100%;
  max-height: 320px;
  margin: 0 auto 20px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  object-fit: contain;
  background: #f8fafc;
}

.admin-summary {
  font-weight: 700;
  color: #1e293b;
  background: #eef2ff;
  padding: 8px 10px;
  text-align: left;
}

.field-check {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  cursor: pointer;
}

.field-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  flex: 0 0 auto;
}

.field-check-label small {
  display: block;
  margin-top: 2px;
  color: #64748b;
  font-size: 0.8rem;
}

.track-badge {
  display: inline-block;
  margin-left: 10px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  vertical-align: middle;
}

.track-standard {
  background: #e2e8f0;
  color: #334155;
}

.track-multilingual {
  background: #fef3c7;
  color: #92400e;
}

.exam-log td.cell-track-multi {
  color: #92400e;
  background: #fffbeb;
  font-weight: 700;
}

.exam-log td.cell-track-standard {
  color: #475569;
}

.notice {
  margin: 0 0 20px;
  padding: 12px 14px;
  background: #fff5f5;
  border: 2px solid #dc2626;
  border-radius: 10px;
  color: #b91c1c;
}

.notice-title {
  margin: 0 0 8px;
  font-size: 0.95rem;
  color: #b91c1c;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-bottom: 1px solid #fecaca;
  padding-bottom: 6px;
}

.notice-heading {
  margin: 10px 0 4px;
  font-size: 0.85rem;
  color: #b91c1c;
  font-weight: 700;
}

.notice p {
  margin: 0 0 4px;
  color: #b91c1c;
  font-size: 0.78rem;
  line-height: 1.6;
}

.notice p:last-child {
  margin-bottom: 0;
}

.notice-info {
  background: #eff6ff;
  border-color: #2563eb;
  color: #1d4ed8;
}

.notice-info .notice-title,
.notice-info .notice-heading,
.notice-info p {
  color: #1d4ed8;
}

.notice-info .notice-title {
  border-bottom-color: #bfdbfe;
}

.notice-foot {
  margin: 0 0 20px;
  color: #1e293b;
  font-size: 0.85rem;
  line-height: 1.7;
}

.score-who {
  margin: 12px 0 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #1e293b;
  letter-spacing: 0.02em;
}
