/* KodeQuest — game.css: tema game gelap (hero, peta dunia, arena, lencana). */
.hero { text-align: center; padding: 1.6rem 0 .5rem; }
.hero-logo { width: 76px; height: 76px; margin-bottom: .5rem; }
.hero h1 { font-size: clamp(2.2rem, 8vw, 3rem); line-height: 1.15; margin: .2rem 0 0; color: var(--accent); text-shadow: 0 3px 0 #78350f; }
.tagline { font-size: 1.15rem; font-weight: 800; line-height: 1.4; margin: .5rem 0; }
.hero-sub { color: var(--muted); max-width: 560px; margin: 0 auto; line-height: 1.6; }

/* Halaman Masuk / Daftar: SATU kartu form di tengah (maks. 460px),
   bukan dua form berdampingan. */
.auth-single { max-width: 460px; margin: 1.4rem auto 0; }
.auth-card h2 { margin: 0 0 .9rem; line-height: 1.3; }
.auth-card .btn { width: 100%; }
.auth-switch { margin: 1rem 0 0; text-align: center; line-height: 1.5; }

/* Baris dua tombol ajakan (Masuk + Daftar) untuk tamu di arena. */
.cta-row { display: flex; gap: var(--gap-sm); flex-wrap: wrap; margin: .6rem 0 0; }

/* Peta dunia */
.world-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.world-card { cursor: pointer; transition: transform .12s ease, border-color .12s ease; position: relative; }
.world-card:hover:not(.locked) { transform: translateY(-3px); border-color: var(--accent); }
.world-card.locked { opacity: .55; cursor: not-allowed; }
.world-card.completed { border-color: var(--good); }
.world-num { font-size: .8rem; font-weight: 800; color: var(--accent-2); text-transform: uppercase; letter-spacing: .04em; }
.world-card h3 { margin: .35rem 0 .2rem; line-height: 1.3; }
.world-enemy { color: var(--muted); font-size: .92rem; line-height: 1.5; margin: .2rem 0 .7rem; }
.world-stars { font-size: 1.25rem; letter-spacing: .15em; color: #facc15; }
.world-stars .star-off { color: #475569; }
.world-badge { display: inline-block; margin-top: .5rem; font-size: .8rem; font-weight: 800; padding: .15rem .55rem; border-radius: 999px; }
.world-badge-done { background: #052e16; color: #86efac; }
.world-badge-lock { background: #450a0a; color: #fca5a5; }
.world-badge-open { background: #082f49; color: #7dd3fc; }

/* Arena pertarungan */
.hp-bars { display: grid; gap: .5rem; margin: 1rem 0; }
.hp-row { display: flex; align-items: center; gap: .7rem; }
/* Label HP arena (bug 2): nama musuh/pemain tidak boleh terpotong —
   teks panjang pindah baris, bukan "…". */
.hp-label { width: 150px; font-weight: 800; text-align: right; line-height: 1.4; overflow: visible; text-overflow: clip; overflow-wrap: break-word; }
.hp-bar { flex: 1; min-width: 0; height: 18px; background: #0b1220; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.hp-fill { height: 100%; width: 100%; transition: width .35s ease; }
.hp-monster .hp-fill { background: var(--bad); }
.hp-player .hp-fill { background: var(--good); }
.hp-num { width: 74px; font-weight: 800; white-space: nowrap; }
#btn-back-map { margin-bottom: .6rem; }

.mission-list { display: grid; gap: .6rem; margin-bottom: 1rem; }
.mission-item {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem .8rem;
  min-height: 48px;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: .8rem 1rem; cursor: pointer; text-align: left; color: var(--text); font: inherit;
}
.mission-item:hover { border-color: var(--accent); }
.mission-item.solved { border-color: var(--good); }
.mission-item .mi-title { font-weight: 800; line-height: 1.4; }
.mission-item .mi-xp { color: var(--accent); font-weight: 800; white-space: nowrap; }
.mission-item .mi-check { color: var(--good); font-weight: 800; }

.battle-card { margin-top: 1rem; }
.battle-card h3 { margin: 0 0 .5rem; line-height: 1.3; }
.question { font-size: 1.15rem; font-weight: 700; line-height: 1.5; margin: .5rem 0; }
.code-snippet {
  background: #0b1220; border: 1px solid var(--border); border-radius: 10px;
  padding: .8rem 1rem; overflow-x: auto; font-size: .95rem; white-space: pre-wrap;
}
.choices { display: grid; gap: .75rem; margin: 1rem 0; }
.choice-btn {
  min-height: 44px;
  text-align: left; background: var(--card-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px; padding: .75rem 1rem;
  font: inherit; line-height: 1.5; cursor: pointer;
}
.choice-btn:hover:not(:disabled) { border-color: var(--accent-2); }
.choice-btn:disabled { cursor: default; opacity: .75; }
.choice-btn.correct { border-color: var(--good); background: #052e16; }
.choice-btn.wrong { border-color: var(--bad); background: #450a0a; }
/* Hasil jawaban: teks penjelasan harus tampil penuh (bug 10) — jangan
   biarkan wadah memotong kata; teks panjang boleh pindah baris. */
.answer-result { border-radius: 10px; padding: .9rem 1rem; margin-bottom: 1rem; overflow-wrap: break-word; word-break: break-word; line-height: 1.55; }
.answer-result p { overflow-wrap: break-word; word-break: break-word; }
.answer-result.good { background: #052e16; border: 1px solid var(--good); }
.answer-result.bad { background: #450a0a; border: 1px solid var(--bad); }
.answer-result p { margin: .3rem 0; }

#btn-next-mission { margin-top: .6rem; }

/* Papan peringkat */
.leaderboard { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.leaderboard li {
  display: flex; gap: .4rem .9rem; align-items: baseline; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: .75rem 1rem;
  line-height: 1.5;
}
.lb-rank { font-weight: 800; color: var(--accent); width: 2rem; }
/* Nama peringkat (bug 2): tidak boleh terpotong dengan "…" — teks
   panjang boleh pindah baris. */
.lb-name { font-weight: 800; min-width: 0; overflow: visible; text-overflow: clip; overflow-wrap: break-word; }
.lb-title { color: var(--muted); font-size: .9rem; }
.lb-xp { margin-left: auto; font-weight: 800; color: var(--accent); }

/* Lencana */
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .8rem; }
.badge-card { text-align: center; }
.badge-card .badge-icon { font-size: 2rem; line-height: 1.2; }
.badge-card h3 { margin: .4rem 0 .3rem; line-height: 1.3; }
.badge-card p { color: var(--muted); font-size: .9rem; line-height: 1.5; margin: 0; }
.badge-card.locked-badge { opacity: .45; }
.badge-card.earned-badge { border-color: var(--accent); }

/* Layar sempit (±390px): label HP mengecil dan rata kiri supaya bilah
   HP tidak terjepit; judul arena dan kartu tetap punya ruang napas. */
@media (max-width: 640px) {
  .hero { padding: 1.2rem 0 .5rem; }
  .hero-logo { width: 60px; height: 60px; }
  .tagline { font-size: 1.05rem; }
  .hp-label { width: 88px; text-align: left; font-size: .85rem; }
  .hp-num { width: 62px; font-size: .85rem; }
  .hp-row { gap: .5rem; }
  .world-grid { grid-template-columns: 1fr; }
  .badge-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
