:root {
  --biru: #0b4f8a; --biru-tua: #083a66; --biru-muda: #e8f1fa;
  --hijau: #1f9d55; --kuning: #f2b705; --merah: #d64545;
  --abu: #6b7280; --garis: #dde3ea; --latar: #f4f6f9; --teks: #1f2933;
  --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--teks); background: var(--latar); }
a { color: var(--biru); }
button { font: inherit; cursor: pointer; }
.btn { border: 0; border-radius: 8px; padding: .6rem 1rem; background: var(--biru); color: #fff; font-weight: 600; }
.btn:hover { background: var(--biru-tua); }
.btn.sekunder { background: #fff; color: var(--biru); border: 1px solid var(--biru); }
.btn.kuning { background: var(--kuning); color: #222; }
.btn.merah { background: var(--merah); }
.btn.hijau { background: var(--hijau); }
.btn:disabled { opacity: .5; cursor: default; }

header.atas { background: var(--biru); color: #fff; display: flex; align-items: center; gap: 1rem;
  padding: .6rem 1rem; position: sticky; top: 0; z-index: 5; }
header.atas .logo { font-weight: 800; letter-spacing: .3px; white-space: nowrap; }
header.atas nav { display: flex; gap: .25rem; overflow-x: auto; }
header.atas nav a { color: #dbe8f5; text-decoration: none; padding: .35rem .6rem; border-radius: 6px; white-space: nowrap; }
header.atas nav a.aktif, header.atas nav a:hover { background: rgba(255,255,255,.15); color: #fff; }
main { max-width: 1100px; margin: 0 auto; padding: 1.2rem 1rem 4rem; }
h1 { font-size: 1.5rem; margin: .2rem 0 1rem; }
h2 { font-size: 1.15rem; margin: 1.4rem 0 .6rem; }
.kartu { background: #fff; border: 1px solid var(--garis); border-radius: var(--radius); padding: 1rem 1.1rem; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.kecil { font-size: .85rem; color: var(--abu); }
.pill { display: inline-block; font-size: .75rem; font-weight: 700; padding: .1rem .5rem; border-radius: 99px;
  background: var(--biru-muda); color: var(--biru); }
.pill.hijau { background: #e3f6ea; color: var(--hijau); }
.pill.merah { background: #fde8e8; color: var(--merah); }
.pill.kuning { background: #fff5d6; color: #8a6700; }
.angka-besar { font-size: 2rem; font-weight: 800; }
.daftar-topik { list-style: none; padding: 0; margin: .5rem 0 0; }
.daftar-topik li { display: flex; justify-content: space-between; align-items: center; gap: .5rem;
  padding: .45rem 0; border-top: 1px solid var(--garis); }
.daftar-topik li:first-child { border-top: 0; }
.peringatan { background: #fff5d6; border: 1px solid #f2d27a; padding: .7rem 1rem; border-radius: 8px; margin: .8rem 0; }

/* ---------- tampilan CAT ---------- */
.cat { position: fixed; inset: 0; background: #fff; z-index: 10; display: flex; flex-direction: column; }
.cat-atas { background: var(--biru); color: #fff; display: flex; align-items: center; justify-content: space-between;
  padding: .55rem 1rem; gap: 1rem; }
.cat-atas .waktu { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.25rem;
  background: rgba(0,0,0,.2); padding: .2rem .7rem; border-radius: 6px; }
.cat-atas .waktu.habis { background: var(--merah); }
.cat-isi { flex: 1; display: grid; grid-template-columns: 1fr 300px; min-height: 0; }
.cat-soal { overflow-y: auto; padding: 1.2rem 1.5rem 6rem; }
.cat-soal .label { color: var(--abu); font-weight: 600; margin-bottom: .6rem; }
.cat-soal .teks { font-size: 1.05rem; white-space: pre-wrap; }
.cat-soal .gambar svg { max-width: 100%; height: auto; }
.opsi { list-style: none; padding: 0; margin: 1rem 0; }
.opsi li { margin: .45rem 0; }
.opsi label { display: flex; gap: .7rem; align-items: flex-start; padding: .6rem .8rem; border: 1px solid var(--garis);
  border-radius: 8px; cursor: pointer; }
.opsi label:hover { background: var(--biru-muda); }
.opsi input { margin-top: .3rem; }
.opsi .huruf { font-weight: 700; min-width: 1.2rem; }
.opsi .isi svg { max-height: 90px; width: auto; }
.opsi.figur { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .5rem; }
.opsi.figur li { margin: 0; }
.opsi.figur label { flex-direction: column; align-items: center; }
@media (max-width: 500px) { .opsi.figur { grid-template-columns: repeat(3, 1fr); } }
.opsi label.benar { border-color: var(--hijau); background: #e3f6ea; }
.opsi label.salah { border-color: var(--merah); background: #fde8e8; }
.cat-tombol { position: sticky; bottom: 0; display: flex; gap: .5rem; flex-wrap: wrap; padding: .8rem 0; background: #fff; }
.cat-nav { border-left: 1px solid var(--garis); padding: 1rem; overflow-y: auto; background: #fafbfc; }
.nomor-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.nomor-grid button { aspect-ratio: 1; border: 1px solid #c9d2dc; background: #fff; border-radius: 6px; font-weight: 600; font-size: .85rem; padding: 0; }
.nomor-grid button.terjawab { background: var(--hijau); color: #fff; border-color: var(--hijau); }
.nomor-grid button.belum { background: #fbe9e9; color: var(--merah); border-color: #f1b5b5; }
.nomor-grid button small { display: block; font-size: .7rem; line-height: 1; }
.nomor-grid button { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.nomor-grid button.kini { outline: 3px solid var(--biru); outline-offset: 1px; }
.subtes-judul { font-weight: 700; margin: .8rem 0 .4rem; font-size: .85rem; color: var(--biru); }
.legenda { display: flex; flex-wrap: wrap; gap: .6rem; font-size: .78rem; color: var(--abu); margin-top: 1rem; }
.legenda i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 3px; border: 1px solid #c9d2dc; }
.kotak-bahas { border-left: 4px solid var(--biru); background: var(--biru-muda); padding: .8rem 1rem; border-radius: 6px; margin-top: 1rem; }
.kotak-bahas .ref { font-size: .85rem; margin-top: .6rem; }
.nav-buka { display: none; }

@media (max-width: 800px) {
  .cat-isi { grid-template-columns: 1fr; }
  .cat-nav { display: none; position: fixed; inset: 52px 0 0 0; z-index: 12; }
  .cat-nav.buka { display: block; }
  .nav-buka { display: inline-block; }
  .cat-soal { padding: 1rem 1rem 6rem; }
  .nomor-grid { grid-template-columns: repeat(8, 1fr); }
}

/* hasil & statistik */
table.tabel { width: 100%; border-collapse: collapse; background: #fff; }
table.tabel th, table.tabel td { padding: .5rem .6rem; border-bottom: 1px solid var(--garis); text-align: left; }
table.tabel th { font-size: .8rem; text-transform: uppercase; color: var(--abu); }
.bar { height: 10px; background: #e5e9ef; border-radius: 99px; overflow: hidden; min-width: 80px; }
.bar > span { display: block; height: 100%; background: var(--biru); }
.materi h1 { margin-top: 0; } .materi table { border-collapse: collapse; } .materi td, .materi th { border: 1px solid var(--garis); padding: .3rem .5rem; }
.materi blockquote { margin: .6rem 0; padding: .4rem .9rem; border-left: 4px solid var(--kuning); background: #fffaf0; }
textarea, input[type=password], input[type=number], select { font: inherit; padding: .5rem .6rem; border: 1px solid #c9d2dc; border-radius: 8px; }
