/* Gaya "Kota Mainan" dengan warna identitas Lomboku: hijau logo (--merek) untuk tombol utama, hitam logo
   (--teks) untuk tepi dan tulisan, huruf Lexend. */
:root {
  --teks: #12160e;
  --lembut: #4d5741;
  --merek: #8cc63e;
  --aksen: #b4472d;
  --emas: #ffd23f;
  --gading: #f7f2e4;
  --gelap: rgba(18, 22, 14, .9);
  --ui: "Lexend", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #74c8e6; color: var(--teks);
  font: 14px/1.3 var(--ui);
  -webkit-user-select: none; user-select: none;
  overscroll-behavior: none;
}
#peta { position: fixed; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; display: block; }
#peta.seret { cursor: grabbing; }
/* kanvas bangunan dan kanvas tulisan menumpang di atas peta; sentuhan diteruskan ke kanvas peta */
.lapis { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; display: block; }

.pil {
  background: var(--gading); color: var(--teks);
  border: 2px solid var(--teks); border-radius: 999px;
  box-shadow: 0 3px 0 var(--teks);
  font: inherit; font-weight: 700;
}
.judul {
  position: fixed; left: max(12px, env(safe-area-inset-left)); top: max(12px, env(safe-area-inset-top));
  padding: 6px 18px 6px 7px; display: flex; align-items: center; gap: 9px;
  background: var(--gelap); border-color: transparent; box-shadow: none;
}
.judul .logo { width: 30px; height: 30px; border-radius: 9px; display: block; flex: none; }   /* sudut membulat seperti ikon aplikasi, supaya tiga titik logonya tidak terpotong */
.judul strong { font-size: 19px; font-weight: 800; letter-spacing: .2px; color: #fff; }
.judul span { font-size: 12px; font-weight: 600; color: #cfe6ae; }

.kompas {
  position: fixed; right: max(12px, env(safe-area-inset-right)); top: max(12px, env(safe-area-inset-top));
  width: 44px; height: 44px; border-radius: 50%; background: var(--gelap);
  display: grid; place-items: center; cursor: pointer;
}
.kompas i {                                        /* jarum: segitiga merah yang berputar */
  position: absolute; inset: 0; display: block;
}
.kompas i::before {
  content: ""; position: absolute; left: 50%; top: 4px; margin-left: -5px;
  border: 5px solid transparent; border-top: 0; border-bottom: 9px solid #ff6b57;
}
.kompas b { font-size: 12px; font-weight: 800; color: #fff; margin-top: 5px; }

.petunjuk {
  position: fixed; left: 50%; top: max(66px, calc(env(safe-area-inset-top) + 66px));
  transform: translateX(-50%); padding: 7px 16px; font-size: 12px; font-weight: 600;
  width: max-content; max-width: calc(100vw - 32px); text-align: center; border-radius: 18px;
}

.aku {
  position: fixed; left: 50%; bottom: max(64px, calc(env(safe-area-inset-bottom) + 64px));
  width: 70px; height: 70px; margin-left: -35px; padding: 0; border-radius: 50%;
  background: var(--merek); border: 3px solid var(--teks); box-shadow: 0 5px 0 var(--teks);
  font: 31px/1 var(--ui); cursor: pointer; display: grid; place-items: center;
}
.aku:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--teks); }
.aku b {
  position: absolute; left: 50%; top: 100%; transform: translateX(-50%); margin-top: 11px;
  padding: 2px 12px; border-radius: 999px; background: var(--gelap); color: #fff;
  font: 700 11px/1.5 var(--ui); white-space: nowrap;
}

.dok {
  position: fixed; right: max(12px, env(safe-area-inset-right));
  bottom: max(42px, calc(env(safe-area-inset-bottom) + 42px));
  display: flex; flex-direction: column; align-items: flex-end; gap: 9px;
}
.dok button { padding: 9px 16px; cursor: pointer; }
.dok button:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--teks); }
.dok .bulat { width: 44px; height: 44px; padding: 0; font-size: 22px; line-height: 1; }
.dok .pisah { height: 4px; }

.kartu {
  position: fixed; left: 50%; transform: translateX(-50%);
  top: max(66px, calc(env(safe-area-inset-top) + 66px));
  background: var(--gading); border: 2px solid var(--teks); border-radius: 18px;
  box-shadow: 0 4px 0 var(--teks);
  padding: 10px 16px 10px 10px; display: flex; align-items: center; gap: 10px;
  max-width: min(calc(100vw - 24px), 380px);
}
.kartu[hidden], .petunjuk[hidden] { display: none; }
.kartu strong { display: block; font-size: 15px; font-weight: 700; }
.kartu span { font-size: 12px; color: var(--lembut); }
.lencana {
  flex: none; width: 38px; height: 38px; border-radius: 50%;
  background: #fff; border: 2px solid var(--teks);
  display: grid; place-items: center; font-size: 20px;
}

.kaki {
  position: fixed; left: 0; right: 0; bottom: 0;
  padding: 4px max(10px, env(safe-area-inset-right)) max(4px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  display: flex; align-items: center; gap: 10px; justify-content: flex-end;
  font-size: 11px; color: var(--teks); background: rgba(247, 242, 228, .82);
  white-space: nowrap;
}
.kaki a { color: inherit; }
.skala { margin-right: auto; display: flex; align-items: center; gap: 6px; font-weight: 700; }
.skala i { display: block; height: 6px; border: 2px solid var(--teks); border-top: 0; }
#waktu:empty { display: none; }
@media (max-width: 480px) {
  .judul span, #waktu { display: none; }
}

/* ---------- penyunting karakter ---------- */
.lembar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  max-width: 560px; margin: 0 auto; height: min(62vh, 520px);
  display: flex; flex-direction: column;
  background: var(--gading); border: 2px solid var(--teks); border-bottom: 0;
  border-radius: 22px 22px 0 0; box-shadow: 0 -4px 0 rgba(18, 22, 14, .18);
  padding-bottom: env(safe-area-inset-bottom);
}
.lembar[hidden] { display: none; }
body.sunting .dok, body.sunting .aku, body.sunting .kaki { display: none; }
.lembar-atas { display: flex; gap: 12px; align-items: center; padding: 10px 14px 6px; }
#pratinjau {
  flex: none; width: 132px; height: 164px; border-radius: 16px;
  background: #cfe9a6; border: 2px solid var(--teks);
}
.lembar-isi { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.lembar-isi label { font-size: 12px; font-weight: 700; color: var(--lembut); }
.lembar-isi input {
  width: 100%; padding: 9px 12px; border: 2px solid var(--teks); border-radius: 12px;
  background: #fff; color: var(--teks); font: 700 15px var(--ui);
  -webkit-user-select: text; user-select: text;
}
.lembar-tombol { display: flex; gap: 8px; margin-top: 4px; }
.lembar-tombol button { flex: 1; padding: 9px 10px; cursor: pointer; }
.lembar-tombol button:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--teks); }
.lembar .utama { background: var(--merek); }

.tab { display: flex; gap: 6px; padding: 6px 12px 8px; overflow-x: auto; scrollbar-width: none; flex: none; }
.tab::-webkit-scrollbar { display: none; }
.tab-tombol {
  flex: none; padding: 6px 13px; border-radius: 999px; cursor: pointer;
  border: 2px solid var(--teks); background: #fff; color: var(--teks); font: 700 12.5px var(--ui);
}
.tab-tombol.terpilih { background: var(--teks); color: #fff; }

.pilihan { flex: 1; overflow-y: auto; padding: 2px 12px 14px; -webkit-overflow-scrolling: touch; }
.pilihan h3 { margin: 10px 2px 6px; font-size: 12px; font-weight: 800; color: var(--lembut); text-transform: uppercase; letter-spacing: .05em; }
.kisi { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.ubin {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 2px 6px;
  border: 2px solid #d9d2bd; border-radius: 14px; background: #fff; color: var(--teks);
  font: 600 10.5px/1.15 var(--ui); cursor: pointer; text-align: center;
}
.ubin canvas { display: block; }
.ubin.terpilih { border-color: var(--teks); background: #e6f4cf; box-shadow: 0 2px 0 var(--teks); }
.kisi.warna { grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); }
.ubin-warna { padding: 4px; border-radius: 50%; aspect-ratio: 1; justify-content: center; }
.ubin-warna i { display: block; width: 100%; height: 100%; border-radius: 50%; border: 1.5px solid rgba(18, 22, 14, .35); }
.ubin-warna span { display: none; }
