/* Font disimpan lokal supaya tetap tampil tanpa internet */
@font-face { font-family: "Atkinson Next"; src: url("../fonts/atkinson-next.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Archivo Black"; src: url("../fonts/archivo-black.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url("../fonts/plex-mono-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url("../fonts/plex-mono-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --kertas: #EEF1F5;
  --putih: #FFFFFF;
  --tinta: #111827;
  --abu: #5B6472;
  --garis: #D5DAE2;
  --panel: #12294E;
  --ya: #15803D;
  --tidak: #B91C1C;
  --kunyit: #F5B800;
  --printer: #1F2530;
  --struk: #FCFCF9;
  --teks: "Atkinson Next", "Segoe UI", Roboto, sans-serif;
  --angka: "Archivo Black", "Arial Black", sans-serif;
  --mono: "Plex Mono", "Courier New", monospace;
  --skala: 1;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--kertas);
  color: var(--tinta);
  font-family: var(--teks);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; touch-action: manipulation; }
button:focus-visible { outline: 4px solid var(--kunyit); outline-offset: 3px; }

/* Panggung 844 x 390, diperbesar/diperkecil agar pas layar */
#stage {
  position: absolute;
  left: 50%; top: 50%;
  width: 844px; height: 390px;
  transform: translate(-50%, -50%) scale(var(--skala));
  transform-origin: center;
}

.layar { position: absolute; inset: 0; display: none; }
.layar.aktif { display: block; animation: muncul .2s ease-out; }
@keyframes muncul { from { opacity: 0; } to { opacity: 1; } }

.pita {
  display: inline-block;
  background: var(--kunyit);
  color: var(--tinta);
  font-weight: 800; font-size: 13px; letter-spacing: .12em;
  padding: 5px 12px; border-radius: 6px;
}
.pita-pojok { position: absolute; top: 16px; right: 24px; z-index: 2; }

/* ---------- Layar 1 ---------- */
.judul {
  position: absolute; left: 24px; right: 24px; top: 16px;
  display: flex; justify-content: space-between; align-items: center;
}
.judul h1 { font-size: 24px; font-weight: 800; }

.daftar {
  position: absolute; left: 24px; right: 24px; top: 64px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px;
}

.kartu {
  display: flex; flex-direction: column;
  background: var(--putih);
  border-radius: 16px; overflow: hidden;
  box-shadow: 0 4px 14px rgba(17, 24, 39, .10);
  outline: 0 solid var(--kunyit);
  transition: transform .2s ease, outline-width .1s ease;
  text-align: center;
}
.kartu.dipilih { outline-width: 6px; transform: scale(1.03); }

.kartu .nomor {
  background: var(--tinta);
  padding: 8px 0;
  display: flex; justify-content: center;
}
.kartu .nomor span {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--putih); color: var(--tinta);
  font-family: var(--angka); font-size: 27px; line-height: 44px;
}
.kartu .foto { height: 196px; background: var(--panel); overflow: hidden; }
.kartu .foto img { width: 100%; height: 100%; object-fit: cover; object-position: center top; display: block; }
.kartu .foto img.siluet { object-position: center bottom; }
/* Foto calon diperbesar supaya wajah lebih jelas dikenali */
.kartu .foto img:not(.siluet) { transform: translateY(-24px) scale(1.3); transform-origin: 50% 0; }
.kartu.kecil .foto img:not(.siluet) { transform: translateY(-16px) scale(1.3); }
.kartu .nama { padding: 10px 8px; font-size: 19px; font-weight: 700; }

/* Kartu kecil di layar konfirmasi */
.kartu.kecil { width: 180px; pointer-events: none; }
.kartu.kecil .nomor span { width: 36px; height: 36px; font-size: 22px; line-height: 36px; }
.kartu.kecil .foto { height: 172px; }
.kartu.kecil .nama { font-size: 15px; padding: 9px 6px; }

/* ---------- Layar 2 ---------- */
.konfirmasi-isi {
  position: absolute; left: 56px; right: 40px; top: 12px; height: 276px;
  display: flex; align-items: center; gap: 36px;
}
.pertanyaan { display: flex; flex-direction: column; gap: 10px; max-width: 520px; }
.pertanyaan-awal { font-size: 24px; color: var(--abu); }
.pertanyaan h2 { font-size: 34px; font-weight: 800; line-height: 1.15; }
.bantu { font-size: 18px; color: var(--abu); }

.tombol-bawah { position: absolute; left: 0; right: 0; bottom: 0; height: 96px; display: flex; }
.tombol-besar {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 14px;
  color: var(--putih);
  font-size: 34px; font-weight: 800; letter-spacing: .06em;
  transition: filter .1s ease;
}
.tombol-besar:active { filter: brightness(.88); }
.tombol-besar svg { width: 36px; height: 36px; fill: none; stroke: currentColor; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.tombol-besar.ya { background: var(--ya); }
.tombol-besar.tidak { background: var(--tidak); }

/* ---------- Printer & struk ---------- */
.printer { position: absolute; width: 260px; }
.celah { position: relative; z-index: 2; height: 30px; border-radius: 10px; background: var(--printer); }
.celah::after { content: ""; position: absolute; left: 14px; right: 14px; top: 20px; height: 5px; border-radius: 3px; background: #000; }
.jalur { position: relative; margin-top: -6px; overflow: hidden; padding: 0 20px 16px; }
.struk {
  background: var(--struk);
  box-shadow: 0 6px 12px rgba(0, 0, 0, .14);
  padding: 18px 16px 16px;
  font-family: var(--mono); font-size: 11px; line-height: 1.45;
  text-align: center; color: var(--tinta);
}
.struk .tebal { font-weight: 700; }
.struk .judul-struk { font-weight: 700; font-size: 12px; }
.struk .nomor-struk { font-weight: 700; font-size: 22px; line-height: 1.3; }
.struk .garis { overflow: hidden; white-space: nowrap; }
.struk .sah { font-weight: 700; font-size: 13px; }

.printer-cetak { left: 500px; top: 96px; }
.printer-cetak .jalur { height: 176px; }
.printer-cetak .struk { transform: translateY(-100%); }
#layar-cetak.aktif .printer-cetak .struk { animation: keluar var(--lama-cetak, 2.8s) linear forwards; }
@keyframes keluar { from { transform: translateY(-100%); } to { transform: translateY(-38%); } }

.printer-selesai { left: 520px; top: 58px; }

/* ---------- Layar 3 & 4 ---------- */
.pesan { position: absolute; left: 64px; display: flex; flex-direction: column; }
.pesan h2 { font-size: 34px; font-weight: 800; line-height: 1.15; }
.pesan p { color: var(--abu); }

.pesan-cetak { top: 120px; width: 400px; gap: 12px; }
.pesan-cetak p { font-size: 22px; }
.progres { width: 320px; height: 10px; border-radius: 5px; background: var(--garis); overflow: hidden; }
.progres span { display: block; height: 100%; width: 0; border-radius: 5px; background: var(--panel); }
#layar-cetak.aktif .progres span { animation: isi var(--lama-cetak, 2.8s) linear forwards; }
@keyframes isi { to { width: 100%; } }

.pesan-selesai { top: 60px; width: 420px; gap: 14px; }
.pesan-selesai h2 { font-size: 32px; }
.pesan-selesai p { font-size: 21px; line-height: 1.3; }
.tanda-selesai { width: 56px; height: 56px; border-radius: 50%; background: var(--ya); display: grid; place-items: center; }
.tanda-selesai svg { width: 32px; height: 32px; fill: none; stroke: var(--putih); stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; }

.kaki { position: absolute; left: 64px; bottom: 24px; display: flex; align-items: center; gap: 16px; font-size: 16px; color: var(--abu); }
.tombol-kecil {
  padding: 8px 16px; border-radius: 8px;
  border: 1.5px solid var(--abu);
  font-size: 16px; font-weight: 700; color: var(--tinta);
  min-height: 44px;
}

/* ---------- Relawan ---------- */
.sudut-relawan { position: absolute; left: 0; top: 0; width: 56px; height: 56px; z-index: 5; }
.panel-relawan { position: absolute; inset: 0; z-index: 10; background: rgba(17, 24, 39, .55); display: grid; place-items: center; }
.panel-relawan[hidden] { display: none; }
.panel-isi { background: var(--putih); border-radius: 16px; padding: 24px 28px; display: flex; flex-direction: column; gap: 12px; min-width: 420px; }
.panel-isi h3 { font-size: 22px; }
.panel-isi p { font-size: 18px; }
.panel-tombol { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Putar HP ---------- */
.putar {
  position: fixed; inset: 0; z-index: 20;
  background: var(--panel); color: var(--putih);
  display: none; flex-direction: column; align-items: center; justify-content: center;
  gap: 24px; padding: 32px; text-align: center;
}
.putar h2 { font-size: 40px; font-weight: 800; }
.putar p { font-size: 22px; line-height: 1.3; color: #D6DEF2; max-width: 300px; }
.ikon-putar { width: 200px; }
.ikon-putar .hp-lama { fill: none; stroke: #8FA3D6; stroke-width: 4; stroke-dasharray: 8 6; }
.ikon-putar .hp-baru { fill: none; stroke: var(--kunyit); stroke-width: 5; }
.ikon-putar .panah { fill: none; stroke: var(--putih); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }

@media (orientation: portrait) {
  .putar { display: flex; }
}

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

/* ---------- Wajib pasang aplikasi ---------- */
.pasang { display: none; }
.wajib-pasang #stage,
.wajib-pasang .putar { display: none !important; }
.wajib-pasang .pasang {
  position: fixed; inset: 0; z-index: 30;
  display: flex; flex-direction: column; align-items: center; justify-content: safe center;
  gap: 20px; padding: 24px 20px;
  background: var(--panel); color: var(--putih);
  overflow-y: auto;
}
.pasang-ikon { width: 96px; height: 96px; border-radius: 22px; border: 2px solid rgba(255, 255, 255, .25); box-shadow: 0 6px 18px rgba(0, 0, 0, .3); flex-shrink: 0; }
.pasang-isi { max-width: 460px; display: flex; flex-direction: column; gap: 16px; }
.pasang h1 { font-size: 32px; font-weight: 800; line-height: 1.15; }
.pasang p, .pasang li { font-size: 19px; line-height: 1.4; color: #D6DEF2; }
.pasang strong { color: var(--putih); }
.pasang ol { padding-left: 24px; display: flex; flex-direction: column; gap: 8px; }
.pasang .sukses { color: var(--putih); font-size: 22px; font-weight: 800; }
.pasang-langkah[hidden], .tombol-pasang[hidden] { display: none; }
.tombol-pasang {
  min-height: 72px; border-radius: 14px;
  background: var(--kunyit); color: var(--tinta);
  font-size: 26px; font-weight: 800;
}
.tombol-pasang:active { filter: brightness(.9); }

/* HP mendatar: ikon di kiri, teks di kanan */
@media (orientation: landscape) {
  .wajib-pasang .pasang { flex-direction: row; justify-content: center; align-items: safe center; gap: 32px; padding: 20px 40px; }
  .pasang-isi { max-width: 560px; }
}
