:root {
  --bg-gradient: radial-gradient(circle at top, #eef2ff, #e0f2fe, #f9fafb);
  --card-bg: #ffffff;
  --primary: #2563eb;
  --primary-soft: #dbeafe;
  --danger: #ef4444;
  --success: #16a34a;
  --text-main: #0f172a;
  --text-muted: #6b7280;
  --shadow-soft: 0 14px 35px rgba(15, 23, 42, 0.18);
  --radius-xl: 24px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg-gradient);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  color: var(--text-main);
}

.app {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
  max-width: 720px;
  width: 100%;
  padding: 24px 24px 20px;
}

.header {
  text-align: center;
  margin-bottom: 16px;
}

.title {
  margin: 0 0 4px;
  font-size: 1.8rem;
  letter-spacing: 0.03em;
}

.subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.status-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 0.95rem;
}

.status-item .label {
  color: var(--text-muted);
}

.status-item .value {
  font-weight: 600;
}

.status-item.timer {
  background: #fee2e2;
  color: #b91c1c;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.9rem;
}

.status-item.timer .value {
  color: #b91c1c;
}

.game-card {
  background: linear-gradient(135deg, #eff6ff, #f9fafb);
  border-radius: 20px;
  padding: 18px 16px 16px;
  border: 1px solid #e5e7eb;
}

#grid-container {
  background: rgba(255,255,255,0.85);
  border-radius: 18px;
  padding: 14px;
  min-height: 160px;
  display: grid;
  gap: 6px;
  justify-content: center;
  align-content: center;
  transition: opacity 0.2s ease, filter 0.2s ease;
}

#grid-container.disabled {
  opacity: 0.5;
  filter: blur(0.2px);
}

.char-cell {
  border: none;
  border-radius: 12px;
  padding: 8px 0;
  min-width: 34px;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f3f4f6;
  color: var(--text-main);
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(15,23,42,0.12);
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.1s ease;
}

.char-cell:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(15,23,42,0.15);
  background: #e5e7eb;
}

.char-cell:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(15,23,42,0.12);
}

.char-cell.correct {
  background: #dcfce7;
}

.char-cell.wrong {
  background: #fee2e2;
}

.instruction {
  text-align: center;
  font-size: 0.95rem;
  color: var(--text-muted);
  margin: 10px 4px 4px;
}

.result-panel {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
}

.result-panel h2 {
  margin: 0 0 4px;
  font-size: 1.05rem;
}

.result-panel p {
  margin: 0;
  font-size: 0.9rem;
}

.hidden {
  display: none !important;
}

.actions {
  margin-top: 12px;
  display: flex;
  justify-content: center;
  gap: 10px;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 10px 22px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.15s ease;
}

.btn.primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.35);
}

.btn.primary:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.btn.primary:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.4);
}

.btn.secondary {
  background: var(--primary-soft);
  color: var(--primary);
}

.btn.secondary:hover {
  background: #bfdbfe;
}

.footer {
  margin-top: 12px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Responsif */
@media (max-width: 480px) {
  .app {
    padding: 18px 14px 16px;
  }
  .title {
    font-size: 1.5rem;
  }
  #grid-container {
    gap: 4px;
    padding: 10px;
  }
  .char-cell {
    min-width: 30px;
    min-height: 30px;
    font-size: 1rem;
  }
}

/* === STYLE IKLAN CUSTOM (In-Page Push, Interstitial, Vignette) === */

.ad-inpage {
  position: fixed;
  right: 12px;
  bottom: 12px;
  max-width: 320px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 14px 35px rgba(15, 23, 42, 0.25);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 99999;
  font-size: 0.9rem;
}

.ad-thumb img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 12px;
}

.ad-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ad-title {
  font-weight: 700;
  font-size: 0.92rem;
}

.ad-text {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.ad-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
  padding: 6px 10px;
  border-radius: 999px;
  border: none;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 6px 15px rgba(37, 99, 235, 0.4);
  cursor: pointer;
}

.ad-cta:hover {
  background: #1d4ed8;
}

.ad-close {
  position: absolute;
  top: 6px;
  right: 8px;
  border: none;
  background: transparent;
  font-size: 1rem;
  cursor: pointer;
  color: #9ca3af;
}

/* Interstitial overlay - mobile friendly */

.ad-interstitial {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ad-interstitial-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
}

.ad-interstitial-box {
  position: relative;
  background: #ffffff;
  border-radius: 20px;
  padding: 18px 18px 16px;
  max-width: 380px;
  width: 92%;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.35);
  z-index: 99999;
}

.ad-interstitial-content h3 {
  margin: 0 0 6px;
  font-size: 1.1rem;
  text-align: center;
}

.ad-interstitial-content p {
  margin: 4px 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
}

.ad-countdown {
  font-size: 0.9rem;
  color: #111827;
  font-weight: 600;
  margin-top: 6px;
}

/* Banner iklan di dalam interstitial */
.interstitial-ad-banner {
  margin-top: 12px;
  padding: 10px;
  border-radius: 14px;
  background: linear-gradient(135deg, #f97316, #fb923c);
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.interstitial-ad-thumb img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 14px;
  border: 2px solid rgba(255,255,255,0.7);
}

.interstitial-ad-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
}

.interstitial-ad-text strong {
  font-size: 0.95rem;
}

/* Vignette banner bawah layar */

.ad-vignette {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99999;
  padding: 8px 10px;
  background: linear-gradient(90deg, #1d4ed8, #6366f1);
  color: #ffffff;
}

.ad-vignette-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ad-vignette-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.85rem;
}

.ad-vignette-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ad-vignette .ad-cta {
  background: #ffffff;
  color: #1d4ed8;
  box-shadow: none;
}

.ad-vignette .ad-close {
  position: static;
  padding: 5px 10px;
  border-radius: 999px;
  border: none;
  font-size: 0.8rem;
  color: #e5e7eb;
  background: rgba(15, 23, 42, 0.2);
}

/* Responsif untuk layar kecil */
@media (max-width: 480px) {
  .ad-inpage {
    left: 8px;
    right: 8px;
    bottom: 8px;
  }

  .ad-vignette-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .ad-interstitial-box {
    width: 90%;
    padding: 16px 14px 14px;
  }

  .ad-interstitial-content h3 {
    font-size: 1rem;
  }

  .ad-interstitial-content p,
  .ad-countdown {
    font-size: 0.85rem;
  }

  .interstitial-ad-banner {
    flex-direction: row;
    align-items: flex-start;
  }
}

/* === STYLE HALAMAN HASIL === */

.result-summary {
  margin-top: 8px;
  text-align: center;
}

.result-summary .score {
  font-size: 2.2rem;
  font-weight: 800;
  margin: 0;
}

.result-summary .percent {
  font-size: 1rem;
  color: var(--text-muted);
  margin-top: -4px;
}

.result-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  margin-top: 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  background: #dcfce7;
  color: #166534;
}

.result-category-text {
  margin-top: 10px;
  font-size: 0.9rem;
  color: var(--text-main);
}

.result-actions {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.btn-whatsapp {
  background: #22c55e;
  color: #ffffff;
  box-shadow: 0 10px 20px rgba(22, 163, 74, 0.35);
}

.btn-whatsapp:hover {
  background: #16a34a;
}

.result-voucher {
  margin-top: 20px;
}

.result-voucher h2 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

/* Kartu voucher model Shopee */
.result-voucher {
  margin-top: 20px;
}

.result-voucher h2 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

/* Ucapan terima kasih di atas voucher */
.voucher-thanks {
  margin-top: 20px;
  margin-bottom: 10px;
  text-align: center;
  font-size: 0.95rem;
  color: #374151;
  line-height: 1.5;
  animation: fadeInSmooth 0.8s ease-out forwards;
}

.voucher-thanks strong {
  color: #111827;
}

/* Animasi fade-in umum */
@keyframes fadeInSmooth {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Kupon voucher ala Shopee */
.voucher-card {
  margin-top: 10px;
  border-radius: 18px;
  background: #ffffff;
  display: flex;
  align-items: stretch;
  overflow: hidden;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
  position: relative;
  max-width: 100%;
  animation: fadeInSmooth 0.8s ease-out forwards;
}

/* Efek "sobekan" di antara sisi kiri dan kanan kupon */
.voucher-card::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 120px;
  width: 16px;
  background:
    radial-gradient(circle at 0 8px, transparent 8px, #ffffff 8px) 0 0 / 16px 16px repeat-y;
  z-index: 99999;
}

.voucher-card-left {
  background: #00bfa5; /* hijau toska ala Shopee */
  padding: 14px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  position: relative;
  z-index: 99999;
}

.voucher-logo {
  max-width: 100%;
  max-height: 64px;
  width: auto;
  height: auto;
  border-radius: 8px;
  object-fit: contain;
  background: #ffffff;
  padding: 4px 6px;
}

.voucher-card-right {
  flex: 1;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  z-index: 99999;
}

.voucher-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.voucher-main-title {
  font-weight: 700;
  font-size: 1rem;
  color: #111827;
}

.voucher-subtitle {
  font-size: 0.9rem;
  color: #4b5563;
}

.voucher-tag {
  font-size: 0.8rem;
  background: #fee2e2;
  color: #b91c1c;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
}

.voucher-expiry {
  font-size: 0.85rem;
  color: #6b7280;
}

.voucher-btn {
  align-self: flex-start;
  margin-top: 4px;
  padding: 8px 20px;
  border-radius: 999px;
  background: #00bfa5;
  color: #ffffff;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 10px 20px rgba(0, 191, 165, 0.35);
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.15s ease;
}

.voucher-btn:hover {
  background: #00a48e;
  transform: translateY(-1px);
}

.voucher-btn:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(0, 191, 165, 0.4);
}

/* Responsif – auto resize kupon untuk layar kecil */
@media (max-width: 600px) {
  .voucher-card {
    flex-direction: row;
  }

  .voucher-card::before {
    left: 100px;
    width: 14px;
    background-size: 14px 14px;
  }

  .voucher-card-left {
    min-width: 100px;
    padding: 10px 8px;
  }

  .voucher-card-right {
    padding: 10px 12px;
  }

  .voucher-main-title {
    font-size: 0.95rem;
  }

  .voucher-subtitle,
  .voucher-expiry {
    font-size: 0.8rem;
  }

  .voucher-btn {
    padding: 7px 16px;
    font-size: 0.85rem;
  }
}

@media (max-width: 400px) {
  .voucher-card::before {
    left: 90px;
  }

  .voucher-card-left {
    min-width: 90px;
  }
}
/* === TAMBAHAN UNTUK HALAMAN BLOG & LEGAL === */

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 15px;
  margin-bottom: 15px;
  padding: 0;
  list-style: none;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--primary);
}

/* Layout khusus halaman artikel/teks */
.content-page {
  text-align: left; /* Reset text center dari body */
}

.article-body {
  line-height: 1.7;
  color: #374151;
  font-size: 1rem;
}

.article-body h2 {
  color: var(--text-main);
  margin-top: 24px;
  font-size: 1.4rem;
}

.article-body ul {
  padding-left: 20px;
}

.article-body li {
  margin-bottom: 8px;
}

/* Kartu daftar blog di halaman /blog/index.html */
.blog-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.blog-item {
  display: block;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  text-decoration: none;
  transition: transform 0.1s, box-shadow 0.1s;
}

.blog-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  border-color: var(--primary-soft);
}

.blog-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 6px;
}

.blog-excerpt {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0;
}
/* === OPTIMALISASI BLOG UNTUK MOBILE (HP) === */

/* Pastikan gambar dalam artikel tidak pernah melebihi lebar layar */
.article-body img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
  margin: 15px auto; /* Tengah otomatis */
}

/* Penyesuaian Huruf di Layar Kecil ( < 600px ) */
@media (max-width: 600px) {
  
  /* Judul Artikel dikecilkan sedikit agar tidak makan tempat */
  .article-body h1, .header .title {
    font-size: 1.6rem; 
    line-height: 1.3;
  }

  /* Sub-judul H2 di dalam artikel */
  .article-body h2 {
    font-size: 1.25rem;
    margin-top: 20px;
  }

  /* Paragraf & List lebih renggang agar mata tidak sakit */
  .article-body p, .article-body li {
    font-size: 0.95rem; /* Ukuran standar HP */
    line-height: 1.6;   /* Jarak antar baris */
    text-align: left;   /* Rata kiri lebih enak dibaca di HP */
  }

  /* Menu Footer lebih rapat */
  .footer-links {
    justify-content: center;
    gap: 12px;
  }
  
  /* Tombol 'Back' di header blog */
  .subtitle a {
    padding: 8px 0;
    display: inline-block; /* Supaya mudah ditap jari jempol */
  }
}

/* Style untuk Banner Rotasi di dalam Game */
.game-banner {
  margin-top: 20px;
  margin-bottom: 10px;
  text-align: center;
  animation: fadeIn 0.5s ease-in-out;
}

.game-banner img {
  max-width: 100%;       /* Agar tidak melebar di HP */
  height: auto;          /* Tinggi menyesuaikan */
  max-height: 250px;     /* Batas tinggi maksimal */
  border-radius: 12px;   /* Sudut melengkung */
  box-shadow: 0 4px 10px rgba(0,0,0,0.1); /* Bayangan halus */
  border: 2px solid #ffffff;
  transition: transform 0.2s;
}

.game-banner img:hover {
  transform: scale(1.02); /* Efek zoom dikit pas di-hover */
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}
.progress-track {
  width: 100%;
  height: 14px;
  background-color: #f3f4f6; /* Abu-abu terang */
  border-radius: 99px;
  overflow: hidden;
  margin-top: 8px;
  margin-bottom: 15px;
  border: 1px solid #e5e7eb;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.progress-fill {
  height: 100%;
  width: 0%; /* Mulai dari 0 */
  background: linear-gradient(90deg, #2563eb, #60a5fa); /* Biru gradasi */
  border-radius: 99px;
  transition: width 2s linear; /* ANIMASI 2 DETIK */
}

/* === Performance patch: lighter shadows on mobile === */
/* Default: remove heavy shadows to reduce paint cost on low-end devices */
.char-cell { box-shadow: none; }

/* Re-enable subtle shadows only on devices that can hover (desktop/laptop) */
@media (hover:hover) and (pointer:fine) {
  .char-cell { box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12); }
  .char-cell:hover { box-shadow: 0 4px 10px rgba(15, 23, 42, 0.15); }
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  .char-cell, .btn, #grid-container { transition: none !important; }
}


/* Idle warning overlay */
.idle-warning{
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(0,0,0,0.78);
  color: #fff;
  font-size: 0.95rem;
  z-index: 99999;
  max-width: min(92vw, 520px);
  text-align: center;
  box-shadow: 0 8px 22px rgba(0,0,0,0.25);
}
.idle-warning.hidden{display:none;}
.idle-warning.error{background: rgba(160,0,0,0.85); font-weight: 600;}


/* Result extra line */
.extra{
  opacity: 0.85;
  margin: 6px 0 0;
  font-size: 0.95rem;
}

/* Idle countdown overlay (lightweight) */
#idleCountdownOverlay{
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  pointer-events: none;
  background: rgba(0,0,0,0.25);
  backdrop-filter: blur(0.5px);
}
#idleCountdownOverlay .idle-countdown-number{
  font-size: clamp(90px, 18vw, 200px);
  font-weight: 800;
  line-height: 1;
  padding: 10px 18px;
  border-radius: 18px;
  background: rgba(255,255,255,0.85);
  box-shadow: 0 8px 20px rgba(0,0,0,0.18);
}
#idleCountdownOverlay .idle-countdown-sub{
  margin-top: 10px;
  font-size: clamp(90px, 18vw, 200px);
  font-weight: 700;
  text-align: center;
  opacity: 0.95;
}
#idleCountdownOverlay .idle-countdown-wrap{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transform: translateY(-4px);
}

/* Bigger, clearer timer */
#timer{
  font-size: clamp(18px, 3.2vw, 26px) !important;
  font-weight: 800 !important;
  letter-spacing: 0.2px;
}
.timer-badge, .timer-pill, .badge-timer{
  font-size: clamp(16px, 3.0vw, 24px) !important;
}
