:root{
  --bgPanel: rgba(44, 57, 65, .92);    /* panel gelap seperti mockup */
  --textDark: #0e1114;
  --textLight: rgba(255,255,255,.88);
  --mutedLight: rgba(255,255,255,.68);
  --cardShadow: 0 18px 50px rgba(0,0,0,.28);
  --softShadow: 0 10px 24px rgba(0,0,0,.18);
  --radius: 22px;
  --radiusSm: 16px;
}

*{ box-sizing: border-box; }

html, body{ height: 100%; }

body{
  margin: 0;
  font-family: 'Poppins', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--textDark);
  background: #e6e6e6;
  overflow-x: hidden;
}

/* ===== Background image blurred & faded ===== */
body::before{
  content:"";
  position: fixed;
  inset: 0;
  background: url("assets/bg-desktop.webp") center/cover no-repeat;
  background-size: cover;   /* penting */
  filter: blur(3px);
  transform: scale(1.06);            /* supaya blur tidak muncul tepi */
  opacity: 1;                      /* pudar */
  z-index: -2;
}

body::after{
  content:"";
  position: fixed;
  inset: 0;
  background: rgba(240,240,240,0); /* layer abu-abu lembut */
  z-index: -1;
}

/* ===== Layout wrapper ===== */
.page{
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 16px;
}

/* Panel utama (header + content) */
.app-shell{
  position: relative;
  width: min(1200px, 100%);
  border-radius: var(--radius);
  overflow: hidden;
  isolation: isolate;
  box-shadow:
    0 30px 70px rgba(0,0,0,.35),
}

/* background image blur */
.app-shell::before{
  content:"";
  position:absolute;
  top:-10px; left:-10px; right:-10px; bottom:-10px;
  inset:0;
  background: url("assets/bg-desktop.webp") center/cover no-repeat;
  filter: blur(5px);
  transform: scale(1.06);
  opacity: 0;
  z-index: -2;
  border-radius: calc(var(--radius) + 8px); /* jaga rounding */
}

/* dark overlay + glossy highlight */
.app-shell::after{
  content:"";
  position:absolute;
  inset:0;
  top: -6px; left: -6px; right: -6px; bottom: -6px;
  background: rgba(18,26,30,0); /* satu warna rapih */
  z-index: -1;
  border-radius: calc(var(--radius) + 6px);
}

.info-btn{
  position: fixed;
  top: 50px;
  right: 50px;
  z-index: 60;               /* di atas banner & content */
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: none;
  background: rgba(228,231,64);
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  transition: transform .14s ease, background .14s ease;
}

.info-icon {
  font-family: "Poppins", sans-serif;
  font-weight: 600;
  font-size: 20px;
  color: #87202f;
}

.info-btn:hover{
  transform: scale(1.05);
  background: rgba(228,231,64);
}

.top-logo {
  position: fixed;
  top: 50px;
  left: 50px;
  z-index: 1000;
}

.top-logo img {
  height: 42px;
  width: auto;
  transition: transform .2s ease, opacity .2s ease;
  filter: drop-shadow(0 10px 10px rgba(0,0,0,.25));
}

.top-logo:hover img {
  transform: scale(1.05);
}

/* ===== Header banner ===== */
.header{
  background: transparent;
  margin-top: 10px;
  margin-bottom: -40px;
}

.banner-wrap{
  width: 100%;
  aspect-ratio: 1080 / 400;
  background: transparent;
  overflow:hidden;
  line-height: 0;
}

.banner-img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ===== Content area ===== */
.content{
  background: transparent;
  border-top: 0 !important;
}

/* ===== Grid ===== */
.grid{
  display: grid;
  gap: 22px 18px;
  grid-template-columns: repeat(5, minmax(0, 1fr)); /* desktop 5 */
  align-items: start;
}

@media (max-width: 640px){
  .info-btn{ width: 36px; height: 36px; font-size: 15px; top: 20px; right: 20px; }
}

@media (max-width: 640px){
  .top-logo{ top: 25px; left: 20px; }
  .top-logo img { height: 30px; width: auto; }
}

#infoModalOverlay{
  z-index: 99999; /* pastikan di atas elemen lain */
}

#infoModalOverlay .modal-title{ font-size:20px; }
#infoModalOverlay .modal-desc{ font-size:14px; color:#444; }

@media(max-width:640px){
  body::before{
    background: url('assets/bg-mobile.webp') no-repeat top center;
    background-size: cover;  /* tetap cover */
  }
}

/* mobile: ganti aspect ratio menjadi 1080 / 750 */
@media (max-width: 640px) {
  .banner-wrap{
    aspect-ratio: 1080 / 750;
  }
}

/* tablet */
@media (max-width: 1024px){
  .grid{ grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* mobile 2 kolom */
@media (max-width: 640px){
  .content{ padding: 6px 14px 22px; }
  .grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px){
  .user-input, .enter-btn{ width: 150px; }
  .ketupat-img{ width: 86px; }
}

/* ===== Card ===== */
.card{
  text-align: center;
  padding: 10px 10px 8px;
  border-radius: 18px;
  transition: transform .12s ease, background .12s ease;
}

.ketupat-btn{
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.ketupat-btn:hover{
  transform: translateY(-2px);
}

.ketupat-btn:active{
  transform: translateY(1px);
}

.ketupat-img{
  width: 92px;
  height: auto;
  display: inline-block;
  user-select: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 10px 10px rgba(0,0,0,.25));
}

/* ===== Input group beautify ===== */
.input-wrap{
  margin-top: 12px;
  display: grid;
  gap: 10px;
  justify-items: center;
}

.input-label{
  font-weight: 500;
  letter-spacing: .3px;
  color: white;
  background: transparent;
  padding: 6px 10px;
  margin-top: -30px;
  line-height: 1.15;
}

/* Input */
.user-input{
  width: 130px;
  text-align: center;
  padding: 10px 12px;
  border-radius: 25px;
  border: 1px solid rgba(0,0,0,.18);
  outline: none;
  font-weight: 600;
  text-transform: uppercase;
  background: rgba(255,255,255,.92);
  box-shadow: 0 10px 18px rgba(0,0,0,.12);
  transition: box-shadow .12s ease, transform .12s ease, border-color .12s ease;
}

.user-input:focus{
  border-color: rgba(0,0,0,.35);
  box-shadow: 0 14px 28px rgba(0,0,0,.18);
  transform: translateY(-1px);
  text-align: center;
}

/* Button */
.enter-btn{
  width: 130px;
  letter-spacing: .4px;
  padding: 10px 12px;
  border-radius: 25px;
  border: 1px solid rgba(0,0,0,.12);
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(245,245,245,.92));
  font-weight: 600;
  font-family: 'Poppins', system-ui, sans-serif;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(0,0,0,.14);
  transition: transform .12s ease, box-shadow .12s ease;
}

.enter-btn:hover{
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(0,0,0,.18);
}

.enter-btn:active{
  transform: translateY(1px);
  box-shadow: 0 10px 18px rgba(0,0,0,.12);
}

/* Status text */
.status{
  margin-top: 10px;
  min-height: 18px;
  font-size: 12px;
  font-weight: 500;
  color: var(--mutedLight);
}

/* ===== Opened state ===== */
.card.opened{
  opacity: .78;
}

.card.opened .ketupat-btn{
  cursor: not-allowed;
  filter: brightness(0.4) grayscale(0.4) blur(0.4px);
  pointer-events: none;
}

.card.opened .user-input,
.card.opened .enter-btn{
  opacity: .55;
  pointer-events: none;
}

/* ---------- Single Ketupat center layout ---------- */
.single-ketupat{
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 12px 30px;
}

.single-ketupat .panel{
  width: min(760px, 92%);
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 18px 28px;
  align-items: center;
  background: rgba(255,255,255,0); /* sedikit kontras di atas panel */
  padding: 22px;
  border-radius: 14px;
}

/* responsive: stack vertically on small screens */
@media (max-width: 760px){
  .single-ketupat .panel{
    grid-template-columns: 1fr;
  }
}

/* Ketupat area */
.ketupat-wrap{
  display: flex;
  flex-direction: column;   /* susun vertikal */
  align-items: center;
  gap: 12px;                /* jarak antara gambar & badge */
}

/* large ketupat */
.ketupat-large{
  width: 320px;
  max-width: 100%;
  transition: transform .18s ease, filter .2s ease, opacity .16s ease;
  will-change: transform, filter;
  user-select: none;
}

/* badge bawah ketupat */
.ketupat-badge{
  position: static;         /* HAPUS absolute */
  transform: none;
  background: linear-gradient(135deg,#F8F7F3,#FFFFFF);
  color: #000;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  display: none;
  box-shadow: 0 8px 18px rgba(0,0,0,.3);
  text-align: center;
  margin-top: -25px;
  margin-bottom: 25px;
}

/* control group */
.control-group{
  display:flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.main-input{
  width: 220px;
  text-align: center; /* center placeholder/text */
}

.main-open-btn{
  width: 220px;
  font-weight: 600;
  padding: 12px 14px;
}

/* status text */
#mainStatus{
  min-height: 20px;
  color: var(--mutedLight);
  font-weight: 500;
  text-align: center;
}

/* ---------- Jackpot animation styles ---------- */

/* spinning keyframes (fast then slow) */
@keyframes jt-spin {
  0% { transform: rotate(0deg) scale(1); filter: hue-rotate(0deg); }
  30% { transform: rotate(720deg) scale(1.02) }
  60% { transform: rotate(1440deg) scale(1.04) filter: hue-rotate(20deg); }
  100% { transform: rotate(1800deg) scale(1) }
}

/* flash glow */
@keyframes jt-flash {
  0%, 100% { box-shadow: none; }
  10%, 50%, 90% { box-shadow: 0 10px 40px rgba(255,255,255,0); transform: scale(1.03); }
}

/* apply during jackpot run */
.ketupat-jackpot {
  animation: jt-spin 2.2s cubic-bezier(.16,.96,.38,1) forwards, jt-flash 0.9s ease-in-out infinite;
}

/* final reveal scale */
.ketupat-reveal {
  transform: scale(1.06);
  transition: transform .22s ease, filter .22s ease;
}

/* opened appearance darker */
.card-opened .ketupat-large,
.ketupat-opened {
  filter: brightness(0.42) saturate(.6);
  opacity: .9;
}

/* ===== Modal (yang sudah kamu beautify) ===== */
.modal-overlay{
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  background: rgba(0,0,0,.6);
  padding: 20px;
  z-index: 9999;
}

.modal-overlay.is-open {
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal{
  position: relative;
  width: min(720px, 96%);          /* lebar responsif */
  max-width: 720px;
  max-height: calc(100vh - 48px);  /* pastikan modal tidak lebih tinggi dari viewport */
  background: #ffffff;
  border-radius: 20px;
  padding: 28px 22px 26px;
  box-shadow: 0 20px 40px rgba(0,0,0,.35);
  animation: pop .18s ease-out;
  overflow: hidden;                /* isi akan scroll di dalam .modal-body */
}
@keyframes pop{
  from{ transform: scale(.92); opacity: 0; }
  to{ transform: scale(1); opacity: 1; }
}

.modal-content{ 
  margin-top: 6px; /* pastikan area isi tidak melewati tinggi modal */
  max-height: calc(100vh - 140px); /* sedikit lebih kecil dari .modal untuk header + padding */
  overflow: auto;                  /* enable scroll bila perlu */
  -webkit-overflow-scrolling: touch; /* smooth scroll di iOS */
  padding-right: 6px;              /* sediakan ruang untuk scrollbar */
}

.modal-title{
  margin: 0 0 12px;
  font-size: 22px;
  font-weight: 900;
  text-align: center;
}

.modal-prize{
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 900;
  color: #1f7a4a;
  text-align: center;
}

.modal-desc{
  margin: 0;
  font-size: 14px;
  color: #555;
  line-height: 1.5;
  text-align: center;
}

.modal-desc ol {
  list-style: none;
  margin: 0.8em auto;        /* center the whole list box */
  padding: 0;
  counter-reset: step;
  display: inline-block;     /* so the whole list is centered in modal */
  text-align: left;          /* but item content stays left-aligned inside the box */
  max-width: 800px;          /* optional: limit width so lines wrap nicely */
}

/* each item: 2-column grid: number | content */
.modal-desc ol li {
  counter-increment: step;
  display: grid;
  grid-template-columns: min-content 1fr; /* number column + content column */
  column-gap: 14px;                        /* space between number and text */
  align-items: start;                      /* IMPORTANT: align at top of the row */
  margin: .5em 0;
  line-height: 1.6;
}

/* the number / counter in the first column (top-aligned) */
.modal-desc ol li::before {
  content: counter(step) ".";
  grid-column: 1;
  font-weight: 700;
  color: #444;
  /* align number to the top-right of its column */
  justify-self: end;
  padding-top: 2px;   /* small nudge so number visually aligns with first text line */
}

/* optional: adjust the content style */
.modal-desc ol li > * {
  grid-column: 2;     /* ensure paragraph or other children stay in second column */
  margin: 0;
}

.modal-x{
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 10;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: none;
  background: rgba(0,0,0,.06);
  cursor: pointer;
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
  display: grid;
  place-items: center;
}

.modal-x:hover{ background: rgba(0,0,0,.12); }

@media (max-width: 480px){
  .modal { width: calc(100% - 24px); max-height: calc(100vh - 32px); padding: 16px; }
  .modal-content { max-height: calc(100vh - 120px); }
  .modal-title{ font-size: 20px; }
  .modal-prize{ font-size: 18px; }
}

/* ================= CONFETTI ================= */

#confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 9999;
}

.confetti {
  position: absolute;
  width: 8px;
  height: 14px;
  opacity: 0.9;
  animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
  0% {
    transform: translateY(-10vh) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(110vh) rotate(720deg);
    opacity: 0;
  }
}