/* ───────────────────────────────────────────────────────────
   Kambang–Muaralabuh: The Expedition — global / page-level UI
   In-game HUD, dialog & menus are drawn by Phaser (canvas).
   This file handles the page shell, fonts, loader, and scaling.
   ─────────────────────────────────────────────────────────── */

:root {
  --ink:    #0a0c0e;
  --deep:   #0d1117;
  --canopy: #0e1a10;
  --moss:   #1a2e1c;
  --fern:   #2d4a2e;
  --leaf:   #4a7c4e;
  --mist:   #7aab7e;
  --gold:   #c8a84b;
  --amber:  #e8c96a;
  --cream:  #f0e8d0;
  --fog:    #b8c4b0;
  --danger: #8b2020;
  --river:  #1a3a5c;
}

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

html, body {
  width: 100%;
  height: 100%;
  background: var(--ink);
  color: var(--cream);
  font-family: 'Crimson Pro', Georgia, serif;
  overflow: hidden;
  /* mobile: matikan scroll-bounce, pull-to-refresh, & gestur default */
  touch-action: none;
  overscroll-behavior: none;
  position: fixed;
  inset: 0;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

#game-root {
  width: 100%;
  height: 100%;
  height: 100dvh; /* hindari lompatan akibat bilah browser mobile */
  display: flex;
  align-items: center;
  justify-content: center;
  /* hormati notch (viewport-fit=cover) */
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

#game-root canvas { touch-action: none; }

/* ── Hint putar ke landscape (hanya HP portrait) ── */
#rotate-hint {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-align: center;
  padding: 24px;
  background: radial-gradient(ellipse at 50% 50%, var(--canopy) 0%, var(--ink) 80%);
}
#rotate-hint .rh-icon {
  font-size: 56px;
  animation: rh-rotate 2.4s ease-in-out infinite;
}
#rotate-hint .rh-text {
  font-family: 'Cinzel', serif;
  letter-spacing: 0.12em;
  color: var(--cream);
  font-size: 1.05rem;
}
#rotate-hint .rh-sub {
  font-family: 'Crimson Pro', serif;
  color: var(--mist);
  font-size: 0.9rem;
  font-style: italic;
}
@keyframes rh-rotate {
  0%, 40% { transform: rotate(0deg); }
  60%, 100% { transform: rotate(90deg); }
}

/* Tampilkan hanya di layar kecil orientasi portrait */
@media (orientation: portrait) and (max-width: 920px) {
  #rotate-hint { display: flex; }
}

/* Phaser's canvas — centered, crisp */
#game-root canvas {
  display: block;
  margin: 0 auto;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.8);
  image-rendering: -webkit-optimize-contrast;
}

/* ── Boot loader (hidden once Phaser READY) ── */
#boot-loader {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  /* cover.jpg di belakang, digelapkan agar spinner & teks terbaca;
     fallback gradient bila gambar tak ada */
  background:
    linear-gradient(rgba(10, 12, 14, 0.72), rgba(10, 12, 14, 0.92)),
    radial-gradient(ellipse at 50% 70%, var(--canopy) 0%, var(--ink) 75%);
  background-image:
    linear-gradient(rgba(10, 12, 14, 0.72), rgba(10, 12, 14, 0.92)),
    url('../assets/backgrounds/cover.jpg');
  background-size: cover, cover;
  background-position: center, center;
  z-index: 50;
  transition: opacity 0.6s ease;
}
#boot-loader.hidden { opacity: 0; pointer-events: none; }

.boot-ring {
  width: 52px;
  height: 52px;
  border: 3px solid rgba(200, 168, 75, 0.18);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: boot-spin 0.9s linear infinite;
}
.boot-text {
  font-family: 'Cinzel', serif;
  letter-spacing: 0.25em;
  font-size: 0.85rem;
  color: var(--mist);
  text-transform: uppercase;
}

@keyframes boot-spin { to { transform: rotate(360deg); } }
