@font-face { font-family: "Nunito"; src: url("/fonts/nunito-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("/fonts/nunito-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("/fonts/nunito-latin-800-normal.woff2") format("woff2"); font-weight: 800; font-display: swap; }

:root {
  --v700: #4B1A9E; --v600: #6A1FD1; --v500: #9A1DFA; --v100: #F1E8FF; --v50: #FAF6FF;
  --sun: #FED85F; --org: #F0A23F;
  --ink: #1B0424; --ink6: #5B4A75; --ink5: #7A6B93; --line: #E7DCF8;
  --night: #1A0B33; --onnight: #D9CCF2;
  --ok6: #1F8A4C; --ok1: #E3F6EA; --wr9: #6B4A00; --wr1: #FFEDB3; --dg6: #C62E4E; --dg1: #FDE7EC;
  --r-md: 16px; --r-lg: 24px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-weight: 500; color: var(--ink); background: var(--v50);
  -webkit-tap-highlight-color: transparent; transition: background .2s;
}
body.gelap { background: var(--night); }

#app { max-width: 480px; margin: 0 auto; min-height: 100dvh; padding: 0 20px 40px; }
.layar { display: none; }
.layar.aktif { display: block; animation: muncul .25s ease-out; }
@keyframes muncul { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.uji {
  position: sticky; top: 0; z-index: 5; background: var(--sun); color: var(--wr9);
  text-align: center; font-size: 11px; font-weight: 800; padding: 4px; letter-spacing: .08em;
}

h1 { font-size: 24px; line-height: 30px; font-weight: 800; margin: 12px 0 6px; }
h2 { font-size: 17px; font-weight: 800; margin: 28px 0 10px; }
.tengah { min-height: 70dvh; display: grid; place-items: center; }

/* ---------- masuk ---------- */
.hero { text-align: center; padding: 32px 0 20px; }
.hero-logo { width: 120px; height: 120px; }
.hero p { color: var(--ink6); margin: 0; }

.kartu {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 20px; box-shadow: 0 6px 20px rgba(75, 26, 158, .08);
}
label, legend { display: block; font-size: 13px; font-weight: 800; color: var(--ink6); margin: 0 0 6px; padding: 0; }
fieldset { border: 0; padding: 0; margin: 16px 0 0; }
input, select {
  width: 100%; font: inherit; font-size: 17px; padding: 14px; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: var(--r-md); background: #fff;
}
select { appearance: none; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%237A6B93' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 10px center / 18px; padding-right: 30px; }
input:focus, select:focus { outline: none; border-color: var(--v600); box-shadow: 0 0 0 3px var(--v100); }
.tgl { display: grid; grid-template-columns: 1fr 1.6fr 1.25fr; gap: 8px; }
.galat { color: var(--dg6); font-weight: 700; font-size: 14px; min-height: 20px; margin: 12px 0 0; }

/* ---------- tombol ---------- */
.tombol {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  border: 0; border-radius: var(--r-md); font: inherit; font-weight: 800; font-size: 17px;
  padding: 16px; cursor: pointer; margin-top: 12px; transition: transform .1s;
}
.tombol svg { width: 26px; height: 26px; }
.tombol.utama { background: var(--v600); color: #fff; box-shadow: 0 6px 16px rgba(106, 31, 209, .3); }
.tombol.scan {
  background: var(--sun); color: var(--ink); font-size: 20px; padding: 22px; margin-top: 16px;
  border-radius: var(--r-lg); box-shadow: 0 8px 20px rgba(240, 162, 63, .35);
}
.tombol.kedua { background: #fff; color: var(--v700); border: 1.5px solid var(--line); }
.tombol.kedua.terang { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .35); }
.tombol:active { transform: scale(.98); }
.tombol[disabled] { opacity: .6; cursor: default; }
.tombol:focus-visible, .ikon:focus-visible, .tautan:focus-visible { outline: 3px solid var(--v500); outline-offset: 2px; }

.kecil { font-size: 13px; color: var(--ink5); text-align: center; margin: 14px 0 0; }
.kecil.kiri { text-align: left; }
.tautan {
  background: none; border: 0; color: var(--ink5); font: inherit; font-weight: 700;
  text-decoration: underline; display: block; margin: 28px auto 0; padding: 8px; cursor: pointer;
}

/* ---------- beranda ---------- */
.kepala { display: flex; align-items: center; gap: 14px; padding: 22px 0 16px; }
.kepala-logo { width: 56px; height: 56px; flex: none; }
.sapa { margin: 0; color: var(--ink5); font-weight: 700; }
.kepala h1 { margin: 0; font-size: 22px; line-height: 28px; }
.kelas { margin: 2px 0 0; color: var(--v600); font-weight: 800; font-size: 14px; }

.poin { background: linear-gradient(135deg, var(--v700), var(--v500)); color: #fff; border: 0; }
.poin .label { margin: 0; opacity: .85; font-weight: 700; }
.angka { font-size: 48px; font-weight: 800; margin: 4px 0 12px; line-height: 1; }
.bar { height: 10px; background: rgba(255, 255, 255, .22); border-radius: 999px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--sun); border-radius: 999px; transition: width .6s ease; }
.poin .kecil { color: #fff; opacity: .92; }

.banner { margin-top: 12px; background: var(--wr1); color: var(--wr9); border-radius: var(--r-md); padding: 12px 14px; font-weight: 700; font-size: 14px; }

.riwayat { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.riwayat li {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.r-nama { font-weight: 800; margin: 0; }
.r-info { margin: 2px 0 0; font-size: 13px; color: var(--ink5); }
.r-poin { font-weight: 800; color: var(--ok6); white-space: nowrap; }
.r-poin.batal { color: var(--dg6); font-size: 13px; }
.riwayat li.kosong { display: block; color: var(--ink5); text-align: center; border-style: dashed; }

/* ---------- scan dan kode ---------- */
.scan-atas { display: flex; align-items: center; gap: 12px; padding: 18px 0 14px; color: #fff; }
.scan-atas h1 { margin: 0; font-size: 20px; }
.scan-atas.terang { color: var(--ink); }
.ikon {
  width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer; flex: none;
  background: rgba(255, 255, 255, .14); color: inherit; display: grid; place-items: center;
}
.scan-atas.terang .ikon { background: #fff; border: 1px solid var(--line); }
.ikon svg { width: 22px; height: 22px; }

.kamera { position: relative; width: 100%; aspect-ratio: 1 / 1; border-radius: var(--r-lg); overflow: hidden; background: #000; }
.kamera video { width: 100%; height: 100%; object-fit: cover; display: block; }
.bingkai { position: absolute; inset: 16%; border: 3px solid var(--sun); border-radius: 20px; box-shadow: 0 0 0 999px rgba(26, 11, 51, .35); }
.scan-info { color: var(--onnight); text-align: center; margin: 16px 0 4px; font-weight: 700; min-height: 44px; }

.kode-input { text-align: center; font-size: 30px; letter-spacing: .28em; font-weight: 800; text-transform: uppercase; }

/* ---------- hasil ---------- */
.hasil { text-align: center; padding: 56px 0 16px; position: relative; }
.h-ikon { width: 104px; height: 104px; border-radius: 50%; margin: 0 auto; display: grid; place-items: center; }
.h-ikon svg { width: 52px; height: 52px; }
.h-ikon.ok { background: var(--ok1); color: var(--ok6); animation: pop .45s cubic-bezier(.2, 1.4, .4, 1); }
.h-ikon.info { background: var(--wr1); color: var(--wr9); }
.h-ikon.simpan { background: var(--v100); color: var(--v600); }
.h-ikon.gagal { background: var(--dg1); color: var(--dg6); }
.hasil h1 { margin-top: 20px; }
.h-lokasi { font-weight: 800; font-size: 18px; color: var(--v700); margin: 4px 0; }
.h-poin { display: inline-block; background: var(--sun); color: var(--ink); font-weight: 800; font-size: 22px; padding: 8px 20px; border-radius: 999px; margin: 12px 0 4px; }
.h-poin:empty, .h-lokasi:empty { display: none; }
.h-pesan { color: var(--ink6); margin: 10px auto 0; max-width: 320px; }
@keyframes pop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.konfeti { position: absolute; top: 100px; left: 50%; width: 10px; height: 10px; border-radius: 2px; animation: tabur 1.1s ease-out forwards; pointer-events: none; }
@keyframes tabur { from { transform: translate(0, 0) rotate(0); opacity: 1; } to { transform: translate(var(--x), var(--y)) rotate(var(--r)); opacity: 0; } }

.memuat { width: 40px; height: 40px; border: 4px solid var(--v100); border-top-color: var(--v600); border-radius: 50%; animation: putar .8s linear infinite; margin: 0 auto; }
@keyframes putar { to { transform: rotate(360deg); } }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 140px);
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 999px;
  font-weight: 700; font-size: 14px; max-width: calc(100% - 32px); text-align: center;
  transition: transform .3s ease; z-index: 10;
}
.toast.muncul { transform: translate(-50%, 0); }

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