:root {
  --merah: #8c1d1d; --merah-tua: #6f1515; --latar: #f6f4f3; --kartu: #ffffff; --teks: #231f1f; --redup: #6b6464;
  --garis: #e2dddb; --hijau: #1f7a4d; --bahaya: #b3261e;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --latar: #181514; --kartu: #221e1d; --teks: #f1ecea; --redup: #a39a98; --garis: #373130; color-scheme: dark; }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font: 15px/1.5 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; background: var(--latar); color: var(--teks); }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.25; text-wrap: balance; }
a { color: var(--merah); }
button, input, select, textarea { font: inherit; color: inherit; }
.tombol { background: var(--merah); color: #fff; border: 0; border-radius: 10px; padding: .6em 1.1em; font-weight: 600; cursor: pointer; }
.tombol:hover { background: var(--merah-tua); }
.tombol:disabled { opacity: .5; cursor: default; }
.tombol.sekunder { background: transparent; color: var(--teks); border: 1px solid var(--garis); }
.tombol.sekunder:hover { background: color-mix(in srgb, var(--garis) 40%, transparent); }
.tombol.bahaya { background: var(--bahaya); }
.tombol.kecil { padding: .35em .8em; font-size: .88em; }
.redup { color: var(--redup); }
.kecil { font-size: .86em; }

/* ---------- admin ---------- */
.bungkus { max-width: 1000px; margin: 0 auto; padding: 20px 16px 60px; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.kartu { background: var(--kartu); border: 1px solid var(--garis); border-radius: 14px; padding: 16px; }
.daftar-event { display: grid; gap: 12px; }
.event { display: grid; gap: 8px; }
.event h3 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lencana { font-size: .72em; font-weight: 700; padding: .15em .6em; border-radius: 99px; background: var(--garis); color: var(--teks); }
.lencana.hijau { background: color-mix(in srgb, var(--hijau) 18%, transparent); color: var(--hijau); }
.baris-tombol { display: flex; gap: 8px; flex-wrap: wrap; }
.kode { font: 600 1.05em ui-monospace, Menlo, monospace; letter-spacing: .08em; }
.tautan { word-break: break-all; font: .85em ui-monospace, Menlo, monospace; background: color-mix(in srgb, var(--garis) 40%, transparent); padding: .4em .6em; border-radius: 8px; }
.dialog-latar { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: start center; padding: 24px 12px; overflow-y: auto; z-index: 20; }
.dialog { background: var(--kartu); border-radius: 16px; width: min(640px, 100%); padding: 20px; }
.kisi { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
label { display: block; font-weight: 600; font-size: .9em; margin: 10px 0 4px; }
input[type=text], input[type=password], input[type=number], select, textarea { width: 100%; padding: .55em .7em; border-radius: 9px; border: 1px solid var(--garis); background: var(--kartu); }
input[type=color] { width: 100%; height: 40px; border: 1px solid var(--garis); border-radius: 9px; padding: 2px; background: var(--kartu); }
.centang { display: flex; align-items: center; gap: 8px; font-weight: 500; margin: 12px 0 0; }
.pesan { padding: .7em 1em; border-radius: 10px; margin: 0 0 12px; }
.pesan.galat { background: color-mix(in srgb, var(--bahaya) 14%, transparent); color: var(--bahaya); }
.pesan.sukses { background: color-mix(in srgb, var(--hijau) 14%, transparent); color: var(--hijau); }
.galeri-mini { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-top: 12px; }
.galeri-mini figure { margin: 0; position: relative; }
.galeri-mini img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 8px; border: 1px solid var(--garis); background: var(--garis); }
.galeri-mini button { position: absolute; top: 4px; right: 4px; }
.masuk { max-width: 380px; margin: 12vh auto 0; }

/* ---------- booth (warna tema dari event lewat --bg / --fg) ---------- */
body.booth { --bg: #8c1d1d; --fg: #ffffff; background: var(--bg); color: var(--fg); min-height: 100dvh; overflow: hidden; user-select: none; -webkit-user-select: none; }
.layar { position: fixed; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 20px; gap: 14px; }
.layar.aktif { display: flex; }
.booth .logo-besar { max-height: 90px; max-width: 70%; object-fit: contain; }
.booth h1 { font-size: clamp(2rem, 6vw, 4rem); margin: 0; }
.booth .sub { font-size: clamp(1.1rem, 3vw, 1.8rem); opacity: .9; }
.booth .persetujuan { max-width: 640px; font-size: .95rem; opacity: .85; }
.booth .tombol-besar { font-size: clamp(1.4rem, 4vw, 2.2rem); padding: .7em 1.8em; border-radius: 99px; border: 3px solid var(--fg); background: var(--fg); color: var(--bg); font-weight: 800; cursor: pointer; }
.booth .tombol-besar.garis { background: transparent; color: var(--fg); }
.booth .tombol-besar:disabled { opacity: .5; }
#video-bungkus { position: relative; width: min(94vw, 150vh * 4 / 3 * .72); aspect-ratio: 4 / 3; border-radius: 18px; overflow: hidden; border: 6px solid var(--fg); background: #000; }
#video { width: 100%; height: 100%; object-fit: cover; }
#video.cermin { transform: scaleX(-1); }
#hitung { position: absolute; inset: 0; display: grid; place-items: center; font-size: clamp(6rem, 28vw, 16rem); font-weight: 900; color: #fff; text-shadow: 0 6px 30px rgba(0,0,0,.6); pointer-events: none; }
#kilat { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
#kilat.nyala { animation: kilat .45s ease-out; }
@keyframes kilat { 0% { opacity: .95; } 100% { opacity: 0; } }
#status-foto { font-size: 1.4rem; font-weight: 700; }
.mini { display: flex; gap: 8px; justify-content: center; min-height: 64px; }
.mini img { height: 64px; border-radius: 6px; border: 2px solid var(--fg); }
.hasil { display: flex; gap: 24px; align-items: center; justify-content: center; flex-wrap: wrap; width: 100%; max-height: 100%; }
#hasil-gambar { max-height: 78dvh; max-width: min(46vw, 560px); border-radius: 10px; border: 4px solid var(--fg); background: #fff; }
.qr-kotak { background: #fff; color: #111; padding: 14px; border-radius: 16px; width: min(280px, 60vw); }
.qr-kotak img { width: 100%; display: block; }
.booth .kecil-teks { font-size: .95rem; opacity: .85; max-width: 320px; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: #111c; color: #fff; padding: .6em 1.2em; border-radius: 99px; display: none; }
.toast.nyala { display: block; }
.pojok { position: fixed; top: 10px; right: 10px; opacity: .45; display: flex; gap: 6px; }
.pojok button { background: transparent; border: 1px solid var(--fg); color: var(--fg); border-radius: 8px; padding: .2em .6em; }

/* ---------- galeri ---------- */
body.galeri { --bg: #8c1d1d; --fg: #fff; }
.galeri .kepala { background: var(--bg); color: var(--fg); padding: 22px 16px; text-align: center; }
.galeri main { max-width: 560px; margin: 0 auto; padding: 16px; text-align: center; }
.galeri img { width: 100%; border-radius: 12px; border: 1px solid var(--garis); background: #fff; }
