/* Portrait saja. Tata letak berbasis lebar kontainer (cqw) agar skala mengikuti ukuran layar. */
:root {
  color-scheme: dark;
  --latar: #0e0f1a; --latar2: #191b2e; --kartu: #222540;
  --teks: #f4f4fb; --teks-pudar: #a9acc9;
  --aksen: #ffb347; --aksen2: #ff6f91; --bahaya: #ff6b6b; --ok: #5fe3a1;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #000; color: var(--teks);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
input { user-select: text; -webkit-user-select: text; }

/* Kolom portrait di tengah (di layar lebar, tetap rasio portrait) */
.app {
  position: relative; margin: 0 auto; height: 100dvh;
  width: min(100vw, calc(100dvh * 0.75));
  container-type: size; overflow: hidden;
  background: radial-gradient(120% 90% at 50% 0%, var(--latar2), var(--latar));
}
.layar { position: absolute; inset: 0; display: none; flex-direction: column; padding: 4cqw 5cqw; }
.layar.aktif { display: flex; }

.kepala { text-align: center; padding: 1cqw 0 2.4cqw; }
.kepala h2 { margin: 0; font-size: 5.4cqw; line-height: 1.15; }
.badan { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 3cqw; }
.scroll { overflow-y: auto; padding-bottom: 6cqw; }
.tengah { margin: auto; text-align: center; padding: 0 6cqw; }
.tengah h2 { font-size: 6cqw; margin: 3cqw 0 2cqw; }

.pudar { color: var(--teks-pudar); }
.kecil { font-size: 2.7cqw; margin: 1cqw 0; }

/* Tombol */
.tombol {
  font: inherit; font-weight: 700; font-size: 4cqw; color: #1a1205; cursor: pointer;
  background: linear-gradient(135deg, var(--aksen), var(--aksen2));
  border: 0; border-radius: 4cqw; padding: 3.2cqw 6cqw; min-height: 11cqw; flex: 1;
  box-shadow: 0 1.2cqw 3cqw rgba(0,0,0,.35);
}
.tombol:active { transform: scale(.97); }
.tombol:disabled { opacity: .4; box-shadow: none; }
.tombol.sekunder { background: var(--kartu); color: var(--teks); box-shadow: none; }
.tombol.besar { font-size: 6.4cqw; padding: 5cqw 14cqw; min-height: 18cqw; flex: none; }
.baris-tombol { display: flex; gap: 3cqw; margin-top: auto; padding-top: 2cqw; }

/* Idle */
#layar-idle { justify-content: center; }
.idle-isi { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 3cqw; }
.idle-logo { width: 22cqw; height: 22cqw; color: var(--aksen); }
.idle-isi h1 { margin: 0; font-size: 9cqw; line-height: 1.1; }
.idle-isi p { margin: 0; font-size: 3.6cqw; }
#btn-mulai { margin-top: 6cqw; animation: denyut 2.2s ease-in-out infinite; }
@keyframes denyut { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }

/* Formulir */
.bidang { display: flex; flex-direction: column; gap: 1.2cqw; font-size: 3.4cqw; color: var(--teks-pudar); }
.bidang input[type=text], .bidang input[type=tel] {
  font: inherit; font-size: 4.4cqw; color: var(--teks); background: var(--kartu);
  border: .5cqw solid transparent; border-radius: 3cqw; padding: 3cqw 3.4cqw; outline: none; }
.bidang input:focus { border-color: var(--aksen); }
.setuju { display: flex; gap: 3cqw; align-items: flex-start; background: var(--kartu); border-radius: 3cqw;
  padding: 3cqw; font-size: 3cqw; line-height: 1.4; color: var(--teks-pudar); }
.setuju input { width: 7cqw; height: 7cqw; flex: none; accent-color: var(--aksen); margin: 0; }
.galat { color: var(--bahaya); font-size: 2.8cqw; min-height: 1em; }

/* Kisi gaya */
.kisi-gaya { display: grid; grid-template-columns: 1fr 1fr; gap: 3.2cqw; flex: 1; min-height: 0; grid-template-rows: 1fr 1fr; }
.kartu-gaya { border: .8cqw solid transparent; border-radius: 4cqw; overflow: hidden; background: var(--kartu);
  cursor: pointer; padding: 0; text-align: left; min-height: 0; color: var(--teks); font: inherit; display: flex; flex-direction: column; }
.kartu-gaya .thumb { flex: 1 1 0; min-height: 0; width: 100%; display: flex; align-items: flex-end; padding: 3cqw; }
.kartu-gaya .thumb span { font-size: 9cqw; font-weight: 800; opacity: .35; line-height: 1; }
.kartu-gaya .nama { padding: 2cqw 3cqw 0; font-weight: 700; font-size: 3.8cqw; }
.kartu-gaya .ket { padding: 0 3cqw 2.4cqw; font-size: 2.8cqw; color: var(--teks-pudar); }
.kartu-gaya.pilih { border-color: var(--aksen); box-shadow: 0 0 0 .6cqw var(--aksen2); }

/* Kamera */
.kamera-badan { align-items: center; }
.bingkai { position: relative; width: 100%; max-height: 100%; aspect-ratio: 3/4; flex: 0 1 auto; min-height: 0;
  background: #000; border-radius: 4cqw; overflow: hidden; }
.bingkai video, .bingkai img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.bingkai.cermin video { transform: scaleX(-1); }
.hitung { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 34cqw; font-weight: 800; color: #fff; text-shadow: 0 0 6cqw rgba(0,0,0,.7); background: rgba(0,0,0,.25); }
.kilat { position: absolute; inset: 0; background: #fff; animation: kilat .35s ease-out forwards; }
@keyframes kilat { from { opacity: .95; } to { opacity: 0; } }
.pesan-bingkai { position: absolute; left: 3cqw; right: 3cqw; bottom: 3cqw; background: rgba(14,15,26,.92);
  border-radius: 3cqw; padding: 3cqw; font-size: 3.2cqw; line-height: 1.35; text-align: center; }
.pesan-bingkai.galat-besar { top: 3cqw; bottom: 3cqw; display: flex; align-items: center; justify-content: center; font-size: 3.8cqw; }
.pesan-bingkai b { color: var(--aksen); }
.kamera-badan .baris-tombol { width: 100%; }
[hidden] { display: none !important; }

/* Proses */
.spinner { width: 16cqw; height: 16cqw; margin: 0 auto; border-radius: 50%;
  border: 1.6cqw solid var(--kartu); border-top-color: var(--aksen); animation: putar 1s linear infinite; }
@keyframes putar { to { transform: rotate(360deg); } }

/* Hasil */
.hasil-badan { align-items: center; gap: 2.4cqw; }
.hasil-foto { flex: 1 1 0; min-height: 0; width: 100%; display: flex; justify-content: center; }
#hasil-img { height: 100%; width: auto; max-width: 100%; aspect-ratio: 3/4; object-fit: contain; border-radius: 3cqw;
  box-shadow: 0 2cqw 6cqw rgba(0,0,0,.5); }
.qr-kotak { text-align: center; }
#qr-svg { width: 24cqw; height: 24cqw; margin: 0 auto 1cqw; border-radius: 2cqw; overflow: hidden; background: #fff; }
#qr-svg svg, #qr-svg img { width: 100%; height: 100%; display: block; }

/* Peringatan kecil (mis. mode contoh) */
.peringatan { position: absolute; left: 50%; top: 1cqw; transform: translateX(-50%); font-size: 2.4cqw;
  color: var(--teks-pudar); background: rgba(0,0,0,.45); border-radius: 2cqw; padding: .6cqw 2cqw; pointer-events: none; }

@media (prefers-reduced-motion: reduce) { #btn-mulai { animation: none; } .spinner { animation-duration: 2.5s; } }
