/* huruf tebal untuk angka/huruf di dalam gambar thumbnail (OFL, disimpan di server) */
@font-face { font-family: 'Archivo Black'; src: url('/fonts/ArchivoBlack-Regular.ttf') format('truetype'); font-display: swap; }
/* semangatsekolah.io — gaya dasar (terinspirasi papergames.io) */
:root {
  --bg: #F4F6FB;
  --kartu: #FFFFFF;
  --garis: #E3E7F1;
  --teks: #1E2340;
  --redup: #5B6178;
  --sedang: #4A5068;
  --biru: #3461E0;
  --biru-tua: #2446A8;
  --biru-muda: #EAF0FF;
  --kuning: #F2A20C;
  --kuning-tua: #B87A06;
  --hijau: #1F8F4E;
  --hijau-tua: #156638;
  --hijau-muda: #D8F3E3;
  --merah: #C93A3A;
  --merah-tua: #8F2424;
  --merah-muda: #FDE2E2;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--teks);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--biru); }
a:hover { color: var(--biru-tua); }
h1, h2, h3 { margin: 0; font-weight: 900; letter-spacing: -0.3px; }
p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- kepala halaman ---------- */
.kepala { background: var(--kartu); border-bottom: 2px solid var(--garis); }
.kepala-isi { max-width: 1200px; margin: 0 auto; padding: 12px 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--teks); font-size: 22px; font-weight: 900; letter-spacing: -0.3px; }
.logo b { color: var(--biru); font-weight: 900; }
.logo:hover { color: var(--teks); }
.menu { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 auto; }
.menu a { padding: 10px 16px; border-radius: 12px; color: var(--sedang); font-weight: 700; text-decoration: none; }
.menu a[aria-current="page"] { background: var(--biru-muda); color: var(--biru-tua); font-weight: 800; }
.akun { display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #FFE8A3; color: #6B4400; display: inline-flex; align-items: center; justify-content: center; font-weight: 900; flex: none; }

/* ---------- tata letak ---------- */
.isi { max-width: 1200px; margin: 0 auto; padding: 36px 24px 64px; }
.kartu { background: var(--kartu); border: 2px solid var(--garis); border-radius: 20px; padding: 24px; }
.redup { color: var(--redup); font-weight: 600; }
.kecil { font-size: 14px; }
.baris { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.antara { justify-content: space-between; }
.tumpuk { display: flex; flex-direction: column; gap: 14px; }

/* ---------- tombol ---------- */
.tbl {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px; border-radius: 13px;
  font-weight: 800; font-size: 16px; text-decoration: none; cursor: pointer;
  border: 2px solid var(--garis); background: var(--kartu); color: var(--teks);
  transition: transform .06s ease, box-shadow .06s ease;
}
.tbl:hover { color: var(--teks); background: #FAFBFE; }
.tbl:active { transform: translateY(2px); }
.tbl:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.tbl-biru { background: var(--biru); color: #fff; border-color: var(--biru); box-shadow: 0 4px 0 var(--biru-tua); }
.tbl-biru:hover { background: #2E57CF; color: #fff; }
.tbl-hijau { background: var(--hijau); color: #fff; border-color: var(--hijau); box-shadow: 0 4px 0 var(--hijau-tua); }
.tbl-hijau:hover { background: #1B7F45; color: #fff; }
.tbl-kuning { background: var(--kuning); color: var(--teks); border-color: var(--kuning); box-shadow: 0 4px 0 var(--kuning-tua); }
.tbl-kuning:hover { background: #E59909; color: var(--teks); }
.tbl-merah { background: var(--kartu); color: var(--merah-tua); border-color: #F2C4C4; }
.tbl-besar { min-height: 56px; font-size: 18px; font-weight: 900; border-radius: 16px; }
.tbl-penuh { width: 100%; }
.tbl-ikon { width: 44px; min-height: 44px; padding: 0; flex: none; }

/* ---------- formulir ---------- */
.medan { display: flex; flex-direction: column; gap: 7px; }
.medan label, .label { font-weight: 800; font-size: 15px; }
.input {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 12px;
  border: 2px solid var(--garis); background: #fff; font-weight: 600; font-size: 16px;
}
.input:focus { outline: none; border-color: var(--biru); box-shadow: 0 0 0 3px #D5E0FF; }
textarea.input { resize: vertical; min-height: 84px; }
.pesan-galat { background: var(--merah-muda); color: var(--merah-tua); border-radius: 12px; padding: 10px 14px; font-weight: 700; }

/* ---------- tab ---------- */
.tab { display: flex; gap: 6px; background: #F1F3F9; border-radius: 14px; padding: 5px; }
.tab button {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; border-radius: 10px; border: none; background: transparent;
  font-weight: 800; font-size: 15px; color: var(--sedang); cursor: pointer;
}
.tab button[aria-selected="true"] { background: #fff; color: var(--biru-tua); box-shadow: 0 2px 0 #D3D9E8; }

/* ---------- kartu permainan ---------- */
.judul-kategori { display: flex; align-items: center; gap: 14px; margin: 34px 0 16px; }
.judul-kategori:first-of-type { margin-top: 6px; }
.judul-kategori .no { flex: none; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; color: #fff; font-size: 22px; font-weight: 900; box-shadow: 0 4px 0 rgba(30,35,64,.25); }
.judul-kategori h2 { font-size: 24px; font-weight: 900; margin: 0; }
.judul-kategori p { margin: 2px 0 0; font-size: 15px; }
.grid-permainan { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 20px; }
/* beranda: 3 kolom agar rapi & simetris (Kelompok 3 = 1 baris, Individu 9 = 3×3) */
#grid-kelompok, #grid-individu { grid-template-columns: repeat(3, 1fr); gap: 22px; }
@media (max-width: 860px) { #grid-kelompok, #grid-individu { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { #grid-kelompok, #grid-individu { grid-template-columns: 1fr; } }
.kartu-permainan {
  display: flex; flex-direction: column; gap: 12px; background: #fff; border: 2px solid var(--garis);
  border-radius: 20px; padding: 16px; text-decoration: none; color: var(--teks); box-shadow: 0 5px 0 var(--garis);
  transition: transform .1s ease, box-shadow .1s ease;
}
.kartu-permainan:hover { color: var(--teks); transform: translateY(-3px); box-shadow: 0 8px 0 var(--garis); }
.kartu-permainan .gambar { height: 120px; border-radius: 14px; display: flex; align-items: center; justify-content: center; }
.gambar.bergambar { overflow: hidden; line-height: 0; border: 2px solid #1E2340; }
.gambar.bergambar svg { width: 100%; height: 100%; display: block; }
.kartu-permainan .gambar.bergambar { height: auto; aspect-ratio: 3 / 2; transition: transform .15s ease; }
.kartu-permainan:hover .gambar.bergambar svg { transform: scale(1.04); transition: transform .2s ease; }
.kartu-alat .gambar.bergambar { width: 150px; height: 100px; }
.kartu-permainan .nama { font-size: 19px; font-weight: 900; }
.label-mode { align-self: flex-start; font-size: 12px; font-weight: 800; color: var(--sedang); background: #F1F3F9; border-radius: 999px; padding: 4px 10px; }
.pil { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; font-weight: 800; font-size: 14px; background: var(--biru-muda); color: var(--biru-tua); }

/* ---------- daftar soal ---------- */
.soal { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--garis); background: #fff; }
.soal.dipilih { border-color: var(--biru); background: #F3F6FF; }
.soal .centang { width: 28px; height: 28px; flex: none; border-radius: 8px; border: 2px solid #B7BFD6; background: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; margin-top: 2px; }
.soal.dipilih .centang { background: var(--biru); border-color: var(--biru); }
.soal .badan { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.soal .judul-soal { font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; }
.soal .kunci { font-size: 13px; font-weight: 800; color: var(--redup); overflow-wrap: anywhere; }
.soal .aksi { display: flex; gap: 6px; flex: none; }
.soal img { width: 72px; height: 54px; object-fit: cover; border-radius: 8px; border: 2px solid var(--garis); }

.kosong { text-align: center; padding: 36px 16px; border: 3px dashed var(--garis); border-radius: 16px; color: var(--redup); font-weight: 700; }

/* pegangan untuk menyeret soal */
.soal .pegangan { width: 30px; min-height: 44px; margin: -6px -4px -6px -8px; border: none; background: transparent; color: #9AA1B8; cursor: grab; touch-action: none; display: flex; align-items: center; justify-content: center; flex: none; border-radius: 8px; }
.soal .pegangan:hover, .soal .pegangan:focus-visible { color: var(--biru); background: var(--biru-muda); }
.soal.diseret { position: relative; z-index: 3; background: #fff; box-shadow: 0 16px 34px rgba(30,35,64,.25); border-color: var(--biru); opacity: .97; }
body.sedang-seret, body.sedang-seret * { cursor: grabbing !important; user-select: none; }

/* ---------- scan & unggah ---------- */
.kotak-scan { border: 3px dashed #C9D3EE; border-radius: 16px; background: #F7F9FF; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.kode-besar { display: flex; gap: 8px; }
.kode-besar span { width: 44px; height: 56px; border-radius: 12px; background: var(--biru); color: #fff; font-size: 30px; font-weight: 900; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 0 var(--biru-tua); }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumb { position: relative; width: 64px; height: 84px; border-radius: 8px; border: 2px solid var(--garis); background: #fff center/cover no-repeat; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 12px; color: var(--redup); }
.thumb button { position: absolute; top: -10px; right: -10px; width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; background: var(--merah); color: #fff; font-weight: 900; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 14px; line-height: 1; }
.pemisah { display: flex; align-items: center; gap: 10px; color: var(--redup); font-size: 14px; font-weight: 700; }
.pemisah::before, .pemisah::after { content: ''; flex: 1; height: 2px; background: var(--garis); }

.stepper { display: flex; align-items: center; gap: 10px; }
.stepper output { min-width: 56px; text-align: center; font-size: 26px; font-weight: 900; }

.saklar { display: flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 700; }
.saklar input { width: 22px; height: 22px; accent-color: var(--biru); }

.pilihan-kunci { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.pilihan-kunci label { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; border: 2px solid var(--garis); font-weight: 700; cursor: pointer; }
.pilihan-kunci input[type="radio"] { width: 20px; height: 20px; accent-color: var(--hijau); flex: none; }
.pilihan-kunci .input { min-height: 40px; padding: 6px 10px; }

/* ---------- avatar murid ---------- */
.avatar-murid { border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; overflow: hidden; flex: none; background: #fff; box-sizing: border-box; }
.avatar-murid img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- pemberitahuan ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--teks); color: #fff; padding: 12px 20px; border-radius: 14px; font-weight: 800; z-index: 50; box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: calc(100% - 32px); }
.toast.galat { background: var(--merah-tua); }
.memuat { display: inline-block; width: 18px; height: 18px; border: 3px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: putar .8s linear infinite; }
.memuat.gelap { border-color: #D3D9E8; border-top-color: var(--biru); }
@keyframes putar { to { transform: rotate(360deg); } }

/* ---------- halaman tengah (masuk, scan, beranda umum) ---------- */
.tengah { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 20px; gap: 24px; }
.kotak-sempit { width: 100%; max-width: 420px; }

@media (max-width: 640px) {
  .isi { padding: 24px 16px 48px; }
  .kepala-isi { padding: 10px 16px; }
  .kartu { padding: 18px; }
  .menu { order: 3; flex-basis: 100%; }
}

/* kunci jawaban disembunyikan */
body.kunci-tersembunyi .soal .kunci { display: none; }
/* Tebak Gambar: tombol pasang gambar di kartu soal */
.pasang-gambar { flex: none; width: 92px; height: 70px; border-radius: 12px; border: 3px dashed #8FD3DB; background: #F0FBFC center / cover no-repeat; color: #0F6B75; font: inherit; font-weight: 800; font-size: 13px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; position: relative; overflow: hidden; }
.pasang-gambar.ada { border: 2px solid var(--garis); }
.pasang-gambar .ganti { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(30, 35, 64, .7); color: #fff; font-size: 12px; padding: 2px 0; text-align: center; opacity: 0; transition: opacity .2s; }
.pasang-gambar.ada:hover .ganti, .pasang-gambar.ada:focus-visible .ganti { opacity: 1; }
.pasang-gambar.memuat-gambar { opacity: .5; pointer-events: none; }
@media (hover: none) { .pasang-gambar.ada .ganti { opacity: 1; } }
/* kartu alat evaluasi (Pre-Test & Post-Test) di beranda */
.kartu-alat { display: flex; align-items: center; gap: 18px; background: var(--kartu); border: 2px solid var(--garis); border-radius: 22px; padding: 16px 20px; box-shadow: 0 4px 0 var(--garis); text-decoration: none; color: var(--teks); }
.kartu-alat:hover { border-color: #C9BDF5; color: var(--teks); }
.kartu-alat .gambar { width: 84px; height: 84px; border-radius: 18px; display: flex; align-items: center; justify-content: center; flex: none; }
.kartu-alat .nama { font-size: 20px; font-weight: 900; }
@media (max-width: 640px) { .kartu-alat { flex-wrap: wrap; } }
