/* Font tulisan tangan untuk angka dan teks yang berubah di layar bergaya kertas (Patrick Hand, lisensi OFL,
   disimpan lokal supaya game tetap jalan tanpa internet) */
@font-face {
  font-family: 'Patrick Hand';
  src: url('../assets/font/PatrickHand-Regular.ttf') format('truetype');
  font-display: block;
}

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1f2a24;
}

/* Wadah memenuhi layar dan menaruh canvas di tengah.
   Memakai dvh agar tinggi menyesuaikan layar terlihat di HP/tablet (tidak terpotong address bar). */
#game-wrap {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Canvas tetap 16:9, sebesar mungkin tanpa terpotong */
#game {
  width: min(100vw, calc(100vh * 16 / 9));
  height: min(100vh, calc(100vw * 9 / 16));
  width: min(100vw, calc(100dvh * 16 / 9));
  height: min(100dvh, calc(100vw * 9 / 16));
  background: #000;
  display: block;
  cursor: none; /* kursor bawaan disembunyikan; game menggambar kursornya sendiri (tangan atau mouse) */
  touch-action: none; /* cegah layar HP bergulir/zoom saat menyeret sampah dengan jari */
  user-select: none;
}

#camera {
  display: none;
}

.tersembunyi {
  display: none !important;
}

/* Layar Login: buku catatan cat air berspiral PILAH. di atas canvas
   (input HTML asli agar keyboard HP/tablet otomatis muncul saat mengetik) */
#login-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px 18px;
  overflow-y: auto;
  background: transparent;
  cursor: none;
}

#login-overlay * {
  cursor: none;
}

#kursor-overlay {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(100vw, calc(100dvh * 16 / 9));
  height: min(100dvh, calc(100vw * 9 / 16));
  pointer-events: none;
  z-index: 30;
}

#login-overlay.mode-kanvas {
  padding: 0;
}

/* Panggung 16:9 mengikuti ukuran persis <canvas id="game"> agar desain Canva sejajar 1:1 */
.login-panggung {
  position: relative;
  width: min(100vw, calc(100dvh * 16 / 9));
  height: min(100dvh, calc(100vw * 9 / 16));
  container-type: size;
  margin: auto;
  flex-shrink: 0;
}

.login-gambar-panel {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  user-select: none;
}

.login-form-kanvas {
  position: absolute;
  inset: 0;
}

.login-kotak-input {
  position: absolute;
  background: transparent;
  border: none;
  outline: none;
  padding: 0 1cqw;
  font-family: 'Patrick Hand', "Segoe Print", "Comic Sans MS", sans-serif;
  color: #22150a;
}

.login-kotak-input:focus,
.login-kotak-input:focus-visible {
  outline: none;
  box-shadow: none;
}

.login-kotak-input::placeholder {
  color: #8a7355;
}

.login-kotak-nama {
  left: 35.8%;
  top: 48.9%;
  width: 28.7%;
  height: 4.9%;
  font-size: 2.05cqw;
  line-height: 1;
}

.login-kotak-sekolah {
  left: 35.7%;
  top: 59.7%;
  width: 28.9%;
  height: 4.9%;
  padding-right: 3.4cqw; /* sisakan ruang kanan untuk panah ▼ di gambar */
  font-size: 1.9cqw;
  appearance: none;
  cursor: pointer;
}

.login-kotak-sekolah.kosong {
  color: #8a7355;
}

.login-kotak-sekolah option {
  background: #fff8e6;
  color: #22150a;
}

/* Tombol potongan gambar dari login_tombol.png */
.login-btn-gambar {
  position: absolute;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: transform 0.14s ease, filter 0.14s ease, opacity 0.14s ease;
}

.login-potong {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
}

.login-potong img {
  position: absolute;
  max-width: none;
  display: block;
}

.login-btn-gambar:hover:not(:disabled) {
  transform: scale(1.05) translateY(-0.4cqh);
  filter: drop-shadow(0 0.6cqh 0.9cqh rgba(34, 21, 10, 0.32));
}

.login-btn-gambar:active:not(:disabled) {
  transform: scale(0.98) translateY(0.2cqh);
}

.login-btn-gambar:disabled {
  opacity: 0.65;
  cursor: wait;
}

.login-btn-gender.aktif {
  transform: scale(1.05) translateY(-0.3cqh);
  filter: drop-shadow(0 0 0.8cqw rgba(63, 148, 52, 0.85));
}

.login-btn-gender.redup {
  opacity: 0.78;
}

.login-centang {
  display: none;
  position: absolute;
  top: -8%;
  right: -4%;
  width: 2.2cqw;
  height: 2.2cqw;
  border-radius: 50%;
  background: #4c9e38;
  border: 2.5px solid #22150a;
  color: #fffdf5;
  font-family: 'Patrick Hand', sans-serif;
  font-size: 1.5cqw;
  font-weight: bold;
  line-height: 1;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(34, 21, 10, 0.3);
  pointer-events: none;
}

.login-btn-gender.aktif .login-centang {
  display: flex;
}

.login-toast {
  position: absolute;
  top: 3.5%;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.6cqh 1.8cqw;
  background: #fff8e6;
  border: 2.5px solid #22150a;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(34, 21, 10, 0.25);
  font-family: 'Patrick Hand', "Segoe Print", "Comic Sans MS", sans-serif;
  font-size: 1.7cqw;
  color: #2f6b3a;
  white-space: nowrap;
  pointer-events: none;
}

.login-toast:empty {
  display: none;
}

.login-toast.error {
  color: #b71c1c;
}

/* Kotak isi profil dinamis di tengah kartu Selamat Datang (login_lanjut_panel.png) */
.login-lanjut-profil {
  position: absolute;
  left: 35.8%;
  top: 43.4%;
  width: 31.1%;
  height: 12.2%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.7cqh;
  padding: 0 0.8cqw;
  text-align: center;
  pointer-events: none;
}

.login-lanjut-nama {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: 'Patrick Hand', "Segoe Print", "Comic Sans MS", sans-serif;
  font-size: 2.35cqw;
  font-weight: bold;
  line-height: 1.05;
  color: #2f6b3a;
}

.login-lanjut-lencana {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.65cqw;
}

.login-lanjut-badge {
  padding: 0.22cqh 1.05cqw;
  background: #fff2cc;
  border: 1.8px solid #22150a;
  border-radius: 999px;
  font-family: 'Patrick Hand', "Segoe Print", "Comic Sans MS", sans-serif;
  font-size: 1.35cqw;
  line-height: 1.15;
  color: #3a2715;
  white-space: nowrap;
}

@media (max-height: 460px) {
  #login-overlay.mode-kanvas {
    align-items: flex-start;
  }
  .login-panggung {
    width: min(100vw, 760px);
    height: auto;
    aspect-ratio: 16 / 9;
  }
}
