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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1d1410;
  font-family: Verdana, Geneva, Arial, sans-serif;
  /* cegah scroll / pull-to-refresh / zoom saat main di HP */
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* area game di dalam batas aman layar: di aplikasi terpasang (layar penuh),
   HUD tidak tertutup poni / lubang kamera. Di browser biasa semua inset = 0. */
#game {
  position: fixed;
  top: env(safe-area-inset-top, 0px);
  right: env(safe-area-inset-right, 0px);
  bottom: env(safe-area-inset-bottom, 0px);
  left: env(safe-area-inset-left, 0px);
  display: flex;
  align-items: center;
  justify-content: center;
}

#game canvas {
  touch-action: none;
  display: block;
}

/* ---- tautan halaman situs (hanya di menu game; body.in-game = disembunyikan) ---- */
#site-nav {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 6px);
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  gap: 4px;
  padding: 3px 6px;
  border-radius: 14px;
  background: rgba(29, 20, 16, 0.55);
  white-space: nowrap;
  font-size: 12px;
}
#site-nav a {
  padding: 3px 7px;
  color: #fdfbf5;
  text-decoration: none;
  touch-action: manipulation;
}
#site-nav a:hover, #site-nav a:focus { text-decoration: underline; }
body.in-game #site-nav { display: none; }
noscript { display: block; max-width: 600px; margin: 40px auto; padding: 16px; color: #fdfbf5; line-height: 1.6; }
noscript a { color: #ffd257; }

/* ---- iklan tiruan (ADS.PROVIDER 'mock' / 'auto' saat lokal) ---- */
.ad-mock {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(18, 12, 8, 0.94);
  color: #fdfbf5;
  font-family: Verdana, Arial, sans-serif;
  touch-action: manipulation;
}
.ad-mock-box {
  width: min(86vw, 340px);
  padding: 22px 20px;
  border: 2px dashed #b0703a;
  border-radius: 16px;
  background: #2b1b0e;
  text-align: center;
}
.ad-mock-tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  background: #ffd257;
  color: #5b3a20;
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 2px;
}
.ad-mock-title { margin: 14px 0 6px; font-size: 20px; font-weight: bold; }
.ad-mock-note { font-size: 12px; line-height: 1.5; opacity: 0.75; }
.ad-mock-count { margin: 16px 0; font-size: 42px; font-weight: bold; color: #ffd257; }
.ad-mock-actions { display: flex; flex-direction: column; gap: 10px; }
.ad-mock button {
  padding: 12px;
  border: 0;
  border-radius: 12px;
  background: #fdfbf5;
  color: #5b3a20;
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}
.ad-mock button.primary { background: #ffd257; font-weight: bold; }
.ad-mock button:disabled { opacity: 0.4; cursor: default; }

/* ---- kotak isian nama papan peringkat (Board.askName, js/board.js) ---- */
.name-box {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(43, 27, 14, 0.7);
  font-family: Verdana, Arial, sans-serif;
  touch-action: manipulation;
}
.name-box form {
  width: min(86vw, 340px);
  padding: 22px 20px 18px;
  border-radius: 18px;
  background: #fdfbf5;
  color: #5b3a20;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.name-box h2 { margin: 0 0 6px; font-size: 18px; }
.name-box p { margin: 0 0 14px; font-size: 12px; line-height: 1.5; color: #8b7358; }
.name-box input {
  box-sizing: border-box;
  width: 100%;
  padding: 11px 12px;
  border: 2px solid #d9c9b3;
  border-radius: 12px;
  background: #ffffff;
  color: #5b3a20;
  font: 17px Verdana, Arial, sans-serif;
  text-align: center;
}
.name-box input:focus { outline: none; border-color: #f2b632; }
.name-box .err { min-height: 18px; margin: 8px 0 4px; font-size: 12px; color: #b0452b; }
.name-box .row { display: flex; gap: 10px; }
.name-box button {
  flex: 1;
  padding: 12px;
  border: 0;
  border-radius: 12px;
  background: #efe6d8;
  color: #5b3a20;
  font: 15px Verdana, Arial, sans-serif;
  cursor: pointer;
}
.name-box button.primary { background: #ffd257; font-weight: bold; }
