:root {
  --ink: #16202e;
  --ink-soft: #55637a;
  --ink-faint: #8a95a8;
  --line: #dde3ec;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --brand: #1f5fa9;
  --brand-dark: #17497f;
  --brand-tint: #eaf1fa;
  --good: #1f7a4d;
  --good-tint: #e8f5ee;
  --warn: #9a6414;
  --warn-tint: #fdf3e0;
  --bad: #b3271e;
  --bad-tint: #fceceb;

  --radius: 0.625rem;
  --shadow: 0 1px 2px rgba(22, 32, 46, 0.06), 0 4px 12px rgba(22, 32, 46, 0.05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

h1,
h2,
h3 {
  line-height: 1.25;
  margin: 0 0 0.5rem;
  letter-spacing: -0.01em;
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.175rem; }
h3 { font-size: 1rem; }

p { margin: 0 0 0.75rem; }

a { color: var(--brand); }

:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
  border-radius: 3px;
}

.page {
  max-width: 60rem;
  margin: 0 auto;
  padding: 1.25rem 1rem 4rem;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.site-header .inner {
  max-width: 60rem;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}

.who {
  font-size: 0.875rem;
  color: var(--ink-soft);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font: inherit;
  font-weight: 600;
  padding: 0.625rem 1.125rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover { background: var(--brand-dark); }

.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--surface);
  color: var(--brand);
  border-color: var(--line);
}

.btn-secondary:hover {
  background: var(--brand-tint);
}

.btn-block { width: 100%; }

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  font: inherit;
  padding: 0.5625rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  margin-bottom: 0.875rem;
}

.muted { color: var(--ink-soft); }
.small { font-size: 0.875rem; }

.notice {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  margin-bottom: 1rem;
}

.notice-error { background: var(--bad-tint); color: var(--bad); }
.notice-info { background: var(--brand-tint); color: var(--brand-dark); }

.stat-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.875rem 1rem;
}

.stat .value {
  font-size: 1.625rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.stat .label {
  font-size: 0.8125rem;
  color: var(--ink-soft);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

th,
td {
  text-align: left;
  padding: 0.5rem 0.5rem;
  border-bottom: 1px solid var(--line);
}

th {
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}

td.num,
th.num { text-align: right; }

.pill {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
}

.pill-good { background: var(--good-tint); color: var(--good); }
.pill-warn { background: var(--warn-tint); color: var(--warn); }
.pill-bad  { background: var(--bad-tint);  color: var(--bad); }
.pill-idle { background: var(--brand-tint); color: var(--brand-dark); }

/* Distribusi nilai. Dibuat dari batang CSS biasa, bukan pustaka grafik —
   satu-satunya hal yang perlu dibaca guru di sini adalah perbandingan panjang. */
.bar-row {
  display: grid;
  grid-template-columns: 4.5rem 1fr 2.5rem;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 0.375rem;
  font-size: 0.875rem;
}

.bar-track {
  background: var(--bg);
  border-radius: 999px;
  height: 1.25rem;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--brand);
  border-radius: 999px;
}

.bar-fill.is-low { background: var(--bad); }

/* Analisis butir soal */
.item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.875rem 1rem;
  margin-bottom: 0.75rem;
  background: var(--surface);
}

.item.is-weak {
  border-color: var(--bad);
  background: var(--bad-tint);
}

.item-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.opt-row {
  display: grid;
  grid-template-columns: 1.5rem 1fr auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0.25rem 0;
  font-size: 0.875rem;
  border-top: 1px solid var(--line);
}

.opt-key {
  font-weight: 700;
  color: var(--ink-faint);
}

.opt-row.is-correct .opt-key { color: var(--good); }
.opt-row.is-trap .opt-key { color: var(--bad); }

/* Halaman mengerjakan ujian */
.exam-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 0.625rem 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
}

.timer {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1.25rem;
}

.timer.is-urgent { color: var(--bad); }

.save-state {
  font-size: 0.8125rem;
  color: var(--ink-soft);
}

.question {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.125rem;
  margin-bottom: 0.875rem;
}

.question .stem {
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.choice {
  display: flex;
  gap: 0.625rem;
  align-items: flex-start;
  padding: 0.5rem 0.625rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 0.375rem;
  cursor: pointer;
}

.choice:hover { background: var(--brand-tint); }

.choice input { margin-top: 0.3rem; }

.choice.is-picked {
  border-color: var(--brand);
  background: var(--brand-tint);
}

.choice.is-answer {
  border-color: var(--good);
  background: var(--good-tint);
}

.choice.is-wrong {
  border-color: var(--bad);
  background: var(--bad-tint);
}

.explain {
  font-size: 0.875rem;
  color: var(--ink-soft);
  border-left: 3px solid var(--line);
  padding-left: 0.75rem;
  margin-top: 0.5rem;
}

@media (min-width: 48rem) {
  h1 { font-size: 1.875rem; }
  .page { padding: 2rem 1rem 5rem; }
  .stat-row { grid-template-columns: repeat(4, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
