:root {
  --langit: #3fb6e8;
  --laut: #1497d4;
  --pasir: #f3dc9a;
  --pink: #fe2c55;
  --turq: #25f4ee;
  --tinta: #1d1d1f;
  --putih: #ffffff;
  --kartu: #ffffff;
  --abu: #6b6b70;
  --bayang: 0 4px 0 rgba(0, 0, 0, 0.18);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: linear-gradient(180deg, var(--langit) 0%, #8fd8f5 60%, var(--pasir) 100%);
  color: var(--tinta);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none;
}
#app { max-width: 480px; margin: 0 auto; min-height: 100%; position: relative; }
.layar { padding: 20px 16px 32px; min-height: 100vh; min-height: 100dvh; }
[hidden] { display: none !important; }

h1, h2 { margin: 0; font-weight: 900; letter-spacing: 0.01em; }
h1 { font-size: 34px; line-height: 1; }
.sub { font-size: 20px; margin: 22px 0 10px; }
.kecil { font-size: 13px; font-weight: 700; color: var(--abu); margin: 0; }
.judul { display: flex; align-items: center; gap: 12px; }
.judul .kecil { color: var(--tinta); opacity: 0.7; letter-spacing: 0.12em; }
.presiden { width: 76px; height: 76px; border-radius: 50%; background: var(--putih); box-shadow: var(--bayang); }
.presiden.besar { width: 120px; height: 120px; display: block; margin: 24px auto 12px; }
.ajak { font-size: 17px; font-weight: 600; line-height: 1.4; margin: 16px 0 0; }
.catatan { font-size: 13px; color: var(--tinta); opacity: 0.75; text-align: center; margin: 18px 8px 0; line-height: 1.4; }
.prototipe { font-size: 12px; font-weight: 800; text-align: center; margin: 10px 0 0; color: var(--pink); }

.daftar-pulau { display: grid; gap: 12px; }
.tombol-pulau {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px;
  border: 0; border-radius: 18px; background: var(--kartu); box-shadow: var(--bayang);
  font: inherit; text-align: left; cursor: pointer;
}
.tombol-pulau:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18); }
.pulau-ikon { width: 54px; height: 54px; flex: none; }
.pulau-nama { font-size: 20px; font-weight: 900; display: block; }
.pulau-ket { font-size: 13px; color: var(--abu); font-weight: 600; }

.bar-atas { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.label-pulau { font-size: 22px; font-weight: 900; padding: 6px 14px; border-radius: 999px; color: var(--putih); box-shadow: var(--bayang); }
.tombol-kecil {
  border: 0; border-radius: 999px; padding: 9px 14px; font: inherit; font-size: 14px; font-weight: 800;
  background: var(--putih); box-shadow: var(--bayang); cursor: pointer;
}
.kartu-info { background: rgba(255, 255, 255, 0.85); border-radius: 16px; padding: 12px 16px; margin: 16px 0; }
.kartu-info p { margin: 2px 0; font-weight: 600; }

.kartu-proyek { background: var(--kartu); border-radius: 20px; padding: 16px; margin-bottom: 14px; box-shadow: var(--bayang); }
.proyek-atas { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.proyek-nama { font-size: 22px; font-weight: 900; margin: 0; }
.proyek-persen { font-size: 20px; font-weight: 900; }
.proyek-usul { font-size: 13px; color: var(--abu); font-weight: 700; margin: 2px 0 10px; }
.bar { height: 14px; background: #e4e4e8; border-radius: 999px; overflow: hidden; position: relative; }
.bar > div { height: 100%; border-radius: 999px; background: var(--pink); transition: width 0.6s ease; }
.bar .bonus { position: absolute; top: 0; background: repeating-linear-gradient(45deg, #ffd75e 0 6px, #f5b800 6px 12px); }
.proyek-bahan { font-size: 13px; font-weight: 700; margin: 8px 0 12px; }
.kosong { text-align: center; padding: 22px 16px; }
.kosong p { margin: 6px 0; font-weight: 600; }

.tombol-besar {
  display: block; width: 100%; border: 0; border-radius: 16px; padding: 15px; font: inherit;
  font-size: 20px; font-weight: 900; letter-spacing: 0.04em; color: var(--putih); background: var(--pink);
  box-shadow: 0 5px 0 #b3123a; cursor: pointer; margin-top: 8px;
}
.tombol-besar:active { transform: translateY(3px); box-shadow: 0 2px 0 #b3123a; }
.tombol-teks { display: block; margin: 12px auto 0; border: 0; background: none; font: inherit; font-weight: 800; font-size: 15px; color: var(--tinta); text-decoration: underline; cursor: pointer; }

.layar-game { padding: 0; position: fixed; inset: 0; max-width: 480px; margin: 0 auto; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
#kanvas { display: block; width: 100%; height: 100%; }
.hud { position: absolute; top: max(12px, env(safe-area-inset-top)); left: 12px; right: 12px; display: flex; justify-content: space-between; pointer-events: none; }
.pil { background: var(--putih); color: var(--tinta); font-weight: 900; font-size: 20px; padding: 6px 14px; border-radius: 999px; box-shadow: var(--bayang); min-width: 64px; text-align: center; }
.pil-pink { background: var(--pink); color: var(--putih); }

.tutorial { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.kartu-tutorial { background: var(--putih); border-radius: 22px; padding: 22px 20px; width: 100%; text-align: center; }
.kartu-tutorial h2 { font-size: 28px; margin: 4px 0 10px; }
.kartu-tutorial p { font-size: 16px; font-weight: 600; line-height: 1.4; margin: 8px 0 12px; }
.tut-gambar { font-size: 15px; font-weight: 800; background: #eaf6fc; border-radius: 14px; padding: 14px; line-height: 1.6; }

.hasil-teks { font-size: 20px; font-weight: 800; text-align: center; line-height: 1.35; margin: 8px 4px; }
#layar-hasil h2 { text-align: center; font-size: 28px; }

/* ---------- layar awal: peta ---------- */
.layar-peta { padding: 0; display: flex; flex-direction: column; height: 100vh; height: 100dvh; min-height: 0; }
.peta { position: relative; flex: 1; min-height: 0; overflow: hidden; background: #8fd8f5; }
.peta canvas { display: block; width: 100%; height: 100%; }
.sapa { position: absolute; top: max(12px, env(safe-area-inset-top)); left: 12px; right: 12px; display: flex; align-items: flex-start; gap: 10px; z-index: 2; pointer-events: none; }
.sapa .presiden { width: 64px; height: 64px; flex: none; }
.balon { background: var(--putih); border-radius: 18px 18px 18px 4px; padding: 9px 13px; box-shadow: var(--bayang); }
.balon p { margin: 0; }
.balon #sapaan { font-size: 16px; font-weight: 800; line-height: 1.3; }
.muat { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 70%; text-align: center; background: rgba(255,255,255,.9); border-radius: 16px; padding: 14px; z-index: 2; }
.muat .bar { margin-top: 8px; }
#muat-bar { width: 5%; }
.penanda {
  position: absolute; left: 0; top: 0; z-index: 1; border: 0; border-radius: 14px; padding: 7px 12px 6px;
  background: var(--warna); color: var(--putih); font: inherit; cursor: pointer; box-shadow: 0 4px 0 rgba(0,0,0,.25);
  display: flex; flex-direction: column; align-items: center; line-height: 1.15; white-space: nowrap;
}
.penanda::after { content: ""; position: absolute; left: 50%; bottom: -7px; margin-left: -7px; border: 7px solid transparent; border-bottom: 0; border-top-color: var(--warna); }
.penanda b { font-size: 16px; font-weight: 900; }
.penanda span { font-size: 11px; font-weight: 700; opacity: .9; }
.penanda.punyaku { outline: 3px solid var(--putih); }
.panel { background: rgba(255,255,255,.96); border-radius: 22px 22px 0 0; padding: 14px 16px max(16px, env(safe-area-inset-bottom)); box-shadow: 0 -4px 16px rgba(0,0,0,.12); max-height: 62vh; overflow-y: auto; }
.panel-atas { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.panel-atas h1 { font-size: 28px; }
.panel-atas .kecil { letter-spacing: .12em; color: var(--tinta); opacity: .6; }
.pil-cutoff { font-size: 12px; font-weight: 800; background: #fff3c4; color: #7a5a00; border-radius: 999px; padding: 6px 10px; text-align: center; }
.panel .daftar-pulau { margin-top: 12px; }
.panel .catatan { margin-top: 12px; }
.panel-atas h1, .panel-atas .kecil { white-space: nowrap; }
.pil-cutoff { max-width: 50%; line-height: 1.3; }

/* ---------- peringkat ---------- */
.baris-teks { display: flex; justify-content: center; gap: 22px; }
.baris-teks .tombol-teks { margin: 12px 0 0; }
.tab { display: flex; gap: 6px; background: rgba(255,255,255,.6); border-radius: 999px; padding: 4px; margin: 16px 0 12px; }
.tab button { flex: 1; border: 0; border-radius: 999px; padding: 9px 8px; font: inherit; font-weight: 800; font-size: 14px; background: none; cursor: pointer; color: var(--tinta); }
.tab button[aria-selected="true"] { background: var(--putih); box-shadow: var(--bayang); }
.kartu-peringkat { background: var(--kartu); border-radius: 20px; padding: 14px 16px; box-shadow: var(--bayang); margin-bottom: 14px; }
.kartu-peringkat h3 { margin: 0 0 2px; font-size: 18px; font-weight: 900; }
.baris-pulau { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 8px; margin: 12px 0 4px; font-weight: 800; }
.baris-pulau .angka { font-size: 15px; }
.baris-pulau + .bar { height: 12px; }
.ranking { list-style: none; margin: 8px 0 0; padding: 0; }
.ranking li { display: grid; grid-template-columns: 30px 1fr auto; gap: 8px; align-items: center; padding: 8px 4px; border-bottom: 1px solid #eee; font-weight: 700; font-size: 15px; }
.ranking li:last-child { border-bottom: 0; }
.ranking .no { font-weight: 900; color: var(--abu); text-align: center; }
.ranking li.top .no { color: var(--putih); background: #f5b800; border-radius: 50%; width: 26px; height: 26px; line-height: 26px; }
.ranking li.kamu { background: #fff3c4; border-radius: 12px; }
.ranking .nama small { display: block; font-size: 11px; color: var(--abu); font-weight: 700; }
.pilih-pulau { display: flex; gap: 6px; flex-wrap: wrap; }
.pilih-pulau button { border: 0; border-radius: 999px; padding: 6px 12px; font: inherit; font-weight: 800; font-size: 13px; color: var(--putih); opacity: .45; cursor: pointer; }
.pilih-pulau button[aria-pressed="true"] { opacity: 1; box-shadow: var(--bayang); }

/* tanpa zoom di HP: matikan ketuk-dua-kali zoom, pilih teks, dan menu tahan lama */
html, body { touch-action: manipulation; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.peta, .peta canvas { touch-action: none; }

/* peringkat realtime */
.live { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; background: #999; vertical-align: 2px; }
.live.nyala { background: #3ddc84; box-shadow: 0 0 0 0 rgba(61,220,132,.7); animation: denyut 1.6s infinite; }
.live.mati { background: #f5b800; }
@keyframes denyut { 70% { box-shadow: 0 0 0 8px rgba(61,220,132,0); } 100% { box-shadow: 0 0 0 0 rgba(61,220,132,0); } }
.naik { animation: naik 1.2s ease; }
@keyframes naik { 0% { color: #18a957; transform: scale(1.25); } 100% { color: inherit; transform: scale(1); } }
.baris-pulau .pemain { display: block; font-size: 11px; color: var(--abu); font-weight: 700; }
.ranking span.naik { display: inline-block; }
.kosong-kecil { font-weight: 700; text-align: center; padding: 16px 0 6px; margin: 0; }
#hasil-kirim { margin-top: 6px; color: var(--tinta); }
