/* ==========================================================================
   dasar.css — kerangka kota tiga dimensi

   Kota memenuhi layar. Merek di kiri atas, alat ukur palung di kanan atas,
   kendali kamera di kanan tengah, kabar warga dan dok menu di bawah,
   panel isi di sisi kiri.
   ========================================================================== */

:root {
  --malam: #050c17;
  --malam-2: #030811;
  --panel: #0b1424;
  --panel-2: #111c30;
  --panel-3: #182541;

  --emas: #f5d34a;
  --emas-2: #ffdf6b;
  --emas-tua: #b8952a;

  --tinta: #eef3fb;
  --redup: #8b96ab;
  --samar: #5d6a80;

  --garis: rgba(255, 255, 255, .08);
  --garis-2: rgba(255, 255, 255, .14);

  --hijau: #3ddc84;
  --merah: #ff6b7a;

  --teks: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          "Noto Sans", Arial, sans-serif;
  --lengkung: cubic-bezier(.22, 1, .36, 1);

  --lebar-panel: 400px;
  --tinggi-dok: 74px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--malam);
  color: var(--tinta);
  font-family: var(--teks);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

h1, h2, h3, h4 { margin: 0; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
p { margin: 0; }
a { color: var(--emas); text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
img { max-width: 100%; display: block; }
input, select, textarea { font: inherit; }

::selection { background: rgba(245, 211, 74, .3); color: #fff; }
:focus-visible { outline: 2px solid var(--emas); outline-offset: 2px; border-radius: 6px; }

.lewat {
  position: absolute;
  left: -9999px;
  z-index: 300;
  padding: 10px 18px;
  background: var(--emas);
  color: #1b1600;
  font-weight: 700;
  border-radius: 0 0 8px 0;
}
.lewat:focus { left: 0; }

/* ---------- Kota ---------- */
.dunia {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: #050c17;
}

.kanvas-dunia {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}
.kanvas-dunia.menyeret { cursor: grabbing; }

/* Lapisan gelap di tepi layar supaya HUD terbaca. */
.kabut {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background:
    radial-gradient(120% 62% at 50% 0%, rgba(5, 12, 23, .38), transparent 40%),
    radial-gradient(120% 62% at 50% 100%, rgba(5, 12, 23, .50), transparent 44%),
    linear-gradient(to bottom, rgba(5, 12, 23, .28), transparent 12%, transparent 82%, rgba(5, 12, 23, .38));
}

/* ---------- Label tempat ---------- */
.label-lapis {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

.label {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px 4px 6px;
  border-radius: 999px;
  background: rgba(8, 15, 27, .82);
  border: 1px solid rgba(255, 255, 255, .14);
  color: #dbe4f4;
  font-size: .71rem;
  font-weight: 700;
  letter-spacing: -.01em;
  white-space: nowrap;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
  transform-origin: 50% 100%;
  transition: background .18s ease, border-color .18s ease, color .18s ease, opacity .2s ease;
  will-change: transform, opacity;
}
.label:hover {
  background: rgba(19, 32, 54, .95);
  border-color: rgba(245, 211, 74, .6);
  color: #fff;
}
.label-titik {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--emas);
  box-shadow: 0 0 8px rgba(245, 211, 74, .9);
  flex: none;
}
.label.terpilih {
  background: var(--emas);
  border-color: var(--emas);
  color: #1e1800;
}
.label.terpilih .label-titik { background: #1e1800; box-shadow: none; }

/* ---------- Merek, kiri atas ---------- */
.merek {
  position: fixed;
  top: 16px;
  left: 18px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 16px 9px 10px;
  border-radius: 999px;
  background: rgba(9, 17, 30, .82);
  border: 1px solid rgba(255, 255, 255, .09);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 14px 38px rgba(0, 0, 0, .5);
}

.merek-cap {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--emas);
  background: rgba(245, 211, 74, .1);
  border: 1px solid rgba(245, 211, 74, .32);
  flex: none;
}
.merek-cap svg { width: 21px; height: 21px; }

.merek-teks { display: grid; line-height: 1.15; }
.merek-teks strong {
  font-size: .84rem;
  font-weight: 800;
  letter-spacing: .01em;
  text-transform: uppercase;
}
.merek-teks em {
  font-style: normal;
  font-size: .58rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--samar);
}

/* ---------- Alat ukur, kanan atas ---------- */
.status {
  position: fixed;
  top: 16px;
  right: 18px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-pil {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px 7px 9px;
  border-radius: 999px;
  background: rgba(9, 17, 30, .82);
  border: 1px solid rgba(255, 255, 255, .09);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .45);
}

.status-ikon {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(245, 211, 74, .1);
  color: var(--emas);
  flex: none;
}
.status-ikon svg { width: 14px; height: 14px; }

.status-isi { display: grid; line-height: 1.05; }
.status-isi b {
  font-size: .8rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}
.status-isi i {
  font-style: normal;
  font-size: .52rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--samar);
}

/* ---------- Kendali kamera, kanan tengah ---------- */
.kendali {
  position: fixed;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.kendali-tombol {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(9, 17, 30, .82);
  border: 1px solid rgba(255, 255, 255, .09);
  color: var(--redup);
  font-size: 1.05rem;
  font-weight: 700;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.kendali-tombol svg { width: 17px; height: 17px; }
.kendali-tombol:hover {
  background: rgba(24, 37, 65, .95);
  border-color: rgba(245, 211, 74, .45);
  color: var(--tinta);
}

.kendali-keliling {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  margin-top: 3px;
  border-radius: 12px;
  background: rgba(9, 17, 30, .82);
  border: 1px solid rgba(255, 255, 255, .12);
  color: var(--emas);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.kendali-keliling svg { width: 18px; height: 18px; }
.kendali-keliling:hover { background: rgba(24, 37, 65, .95); border-color: rgba(245, 211, 74, .45); }
.kendali-keliling.aktif {
  background: var(--emas);
  border-color: var(--emas);
  color: #1e1800;
}
.kendali-keliling.aktif svg { color: #1e1800; }

/* ---------- Kabar warga ---------- */
.ticker-warga {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--tinggi-dok) + 18px);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(440px, calc(100vw - 300px));
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(9, 17, 30, .78);
  border: 1px solid rgba(255, 255, 255, .07);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  overflow: hidden;
}

.ticker-tanda {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--hijau);
  box-shadow: 0 0 8px rgba(61, 220, 132, .9);
  flex: none;
  animation: denyutHijau 2.4s ease-in-out infinite;
}
@keyframes denyutHijau {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .4; transform: scale(.75); }
}

.ticker-jendela {
  position: relative;
  flex: 1;
  height: 18px;
  overflow: hidden;
  mask-image: linear-gradient(to right, transparent, #000 6%, #000 90%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, #000 6%, #000 90%, transparent);
}

.ticker-alur {
  display: flex;
  flex-direction: column;
  transition: transform .5s var(--lengkung);
}
.ticker-alur span {
  height: 18px;
  line-height: 18px;
  font-size: .71rem;
  color: var(--redup);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ticker-alur b { color: var(--emas); font-weight: 700; }

/* ---------- Dok menu, bawah ---------- */
.dok {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 45;
  display: flex;
  align-items: stretch;
  gap: 2px;
  padding: 6px;
  border-radius: 20px;
  background: rgba(8, 15, 27, .88);
  border: 1px solid rgba(255, 255, 255, .09);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 22px 60px rgba(0, 0, 0, .62);
}

.menu-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 62px;
  padding: 8px 10px 7px;
  border-radius: 14px;
  color: var(--redup);
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: background .18s ease, color .18s ease, transform .18s var(--lengkung);
}
.menu-item svg { width: 18px; height: 18px; }
.menu-item:hover {
  background: rgba(255, 255, 255, .07);
  color: var(--tinta);
  transform: translateY(-1px);
}
.menu-item.aktif { background: var(--emas); color: #1e1800; }
.menu-item.aktif svg { color: #1e1800; }

.menu-tanda {
  position: absolute;
  top: 6px;
  right: 9px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--merah);
  box-shadow: 0 0 7px rgba(255, 107, 122, .9);
}
.menu-item.aktif .menu-tanda { background: #7a1220; box-shadow: none; }

/* ---------- Panel kiri ---------- */
.panel {
  position: fixed;
  left: 18px;
  top: 80px;
  bottom: 18px;
  z-index: 50;
  width: var(--lebar-panel);
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .65), 0 0 0 1px rgba(0, 0, 0, .35);
  overflow: hidden;
  animation: panelMasuk .34s var(--lengkung) both;
}
.panel[hidden] { display: none; }

@keyframes panelMasuk {
  from { opacity: 0; transform: translateX(-26px); }
  to   { opacity: 1; transform: none; }
}

.panel-tutup {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, .07);
  color: var(--redup);
  transition: background .18s ease, color .18s ease, transform .2s ease;
}
.panel-tutup:hover { background: rgba(255, 255, 255, .16); color: var(--tinta); transform: rotate(90deg); }
.panel-tutup svg { width: 15px; height: 15px; }

.panel-gulir {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px;
  outline: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .16) transparent;
}
.panel-gulir::-webkit-scrollbar { width: 6px; }
.panel-gulir::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .16);
  border-radius: 3px;
}

/* ---------- Halaman penuh ---------- */
.halaman {
  position: fixed;
  inset: 0;
  z-index: 80;
  overflow-y: auto;
  background: var(--malam);
  animation: halamanMasuk .3s ease both;
}
.halaman[hidden] { display: none; }

@keyframes halamanMasuk {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Tombol ---------- */
.tombol {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: .9rem;
  font-weight: 700;
  transition: transform .18s var(--lengkung), box-shadow .2s ease, background .2s ease;
}
.tombol svg { width: 17px; height: 17px; }

.tombol-emas {
  background: var(--emas);
  color: #1e1800;
  box-shadow: 0 10px 26px rgba(245, 211, 74, .22);
}
.tombol-emas:hover { background: var(--emas-2); transform: translateY(-1px); }

.tombol-garis {
  border: 1px solid var(--garis-2);
  background: rgba(255, 255, 255, .04);
  color: var(--tinta);
}
.tombol-garis:hover { background: rgba(255, 255, 255, .1); }

.tombol-lebar { width: 100%; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tinggi-dok) + 74px);
  z-index: 120;
  transform: translate(-50%, 14px);
  padding: 11px 20px;
  border-radius: 999px;
  background: rgba(19, 29, 49, .97);
  border: 1px solid var(--garis-2);
  font-size: .86rem;
  box-shadow: 0 16px 44px rgba(0, 0, 0, .6);
  opacity: 0;
  transition: opacity .22s ease, transform .3s var(--lengkung);
}
.toast.tampil { opacity: 1; transform: translate(-50%, 0); }
.toast[hidden] { display: none; }

/* ---------- Layar sedang ---------- */
@media (max-width: 1240px) {
  .menu-item { min-width: 54px; padding: 8px 7px 7px; font-size: .55rem; }
  .ticker-warga { width: min(340px, calc(100vw - 280px)); }
  .status-isi i { display: none; }
}

@media (max-width: 1040px) {
  .merek-teks em { display: none; }
  .status-pil { padding: 7px 10px 7px 8px; }
}

/* ---------- Ponsel ---------- */
@media (max-width: 820px) {
  :root { --lebar-panel: auto; --tinggi-dok: 66px; }

  .merek {
    top: 10px;
    left: 10px;
    padding: 7px 13px 7px 8px;
    gap: 8px;
  }
  .merek-cap { width: 30px; height: 30px; }
  .merek-cap svg { width: 17px; height: 17px; }
  .merek-teks strong { font-size: .72rem; }

  .status {
    top: 10px;
    right: 10px;
    gap: 5px;
  }
  .status-pil { padding: 5px 9px; gap: 0; }
  .status-ikon { display: none; }
  .status-isi b { font-size: .7rem; }

  .kendali {
    right: 10px;
    gap: 6px;
  }
  .kendali-tombol, .kendali-keliling { width: 34px; height: 34px; }

  .ticker-warga { display: none; }

  .dok {
    left: 0;
    right: 0;
    bottom: 0;
    transform: none;
    justify-content: flex-start;
    gap: 0;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-radius: 18px 18px 0 0;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .dok::-webkit-scrollbar { display: none; }
  .menu-item { flex: 1 1 0; min-width: 0; padding: 7px 2px 6px; font-size: .52rem; letter-spacing: 0; }
  .menu-item svg { width: 17px; height: 17px; }
  .menu-tanda { top: 5px; right: 8px; width: 5px; height: 5px; }

  .panel {
    left: 8px;
    right: 8px;
    top: auto;
    bottom: calc(var(--tinggi-dok) + 8px + env(safe-area-inset-bottom));
    width: auto;
    max-height: 64vh;
    border-radius: 18px;
    animation: panelNaik .3s var(--lengkung) both;
  }

  @keyframes panelNaik {
    from { opacity: 0; transform: translateY(26px); }
    to   { opacity: 1; transform: none; }
  }

  .toast { bottom: calc(var(--tinggi-dok) + 26px + env(safe-area-inset-bottom)); }

  .label { font-size: .62rem; padding: 3px 8px 3px 5px; }
  .label-titik { width: 6px; height: 6px; }

  /* Lencana alamat resmi ditanam penjaga.js dengan posisi bottom:8px, jadi di
     ponsel ia duduk persis di atas dok menu dan menutupi enam dari tujuh
     tombol. Aturan ini menaikkannya ke atas dok. Pemilihnya diberi id supaya
     menang dari .gh-lencana milik penjaga.js. */
  #gh-penjaga.gh-lencana {
    bottom: calc(var(--tinggi-dok) + 10px + env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
