/* Math Fun Quest — Stylesheet
   Warna brand di-inject dari config.js via CSS custom properties. */

:root {
  --brand: #5B4FD6;
  --brand-dark: #4338a8;
  --brand-soft: #edeaff;
  --accent: #FFB627;
  --accent-dark: #8a5a00;
  --accent-soft: #fff2d6;
  --success: #1D9E75;
  --success-soft: #dcf5eb;
  --danger: #E24B4A;
  --danger-soft: #fde7e7;
  --ink: #2b2a33;
  --ink-soft: #6b6a76;
  --paper: #fdfcf7;
  --line: #e4e1d8;
  --card: #ffffff;
  --radius: 18px;
  --font-display: "Fredoka", sans-serif;
  --font-body: "Nunito", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

/* Nyaman untuk sentuhan: hilangkan jeda 300ms & zoom dobel-ketuk pada tombol */
button, a, .btn, .answer, .game-card, .mode-btn, .level-card, .feature-card, .why-card, select, input {
  touch-action: manipulation;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background-color: var(--paper);
  /* kertas berpetak seperti buku matematika */
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 28px 28px;
  min-height: 100vh;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

/* Cegah teks soal/jawaban panjang meluber ke samping */
.question, .answer, .fb-ex, .mascot-bubble, .game-name, .feature-card p, .why-card p {
  overflow-wrap: break-word;
}

.wrap { max-width: 720px; margin: 0 auto; padding: 24px 16px 60px; }
@supports (padding: max(0px)) {
  .wrap {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    padding-bottom: max(60px, env(safe-area-inset-bottom));
  }
}

/* ---------- Header ---------- */
.site-head {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 0 22px;
}
.logo-badge {
  width: 52px; height: 52px; flex: none;
  border-radius: 16px;
  background: var(--brand);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 600; font-size: 22px;
  box-shadow: 0 4px 0 var(--brand-dark);
  overflow: hidden;
}
.logo-badge img { width: 100%; height: 100%; object-fit: cover; }
.site-head > div { min-width: 0; }
.site-title {
  font-family: var(--font-display);
  font-weight: 600; font-size: 26px; line-height: 1.2;
}
.site-tagline { font-size: 14px; color: var(--ink-soft); }
.head-actions { margin-left: auto; display: flex; gap: 8px; flex: none; align-items: center; }

/* ---------- Kartu & tombol "stiker" ---------- */
.card {
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 0 5px 0 rgba(43, 42, 51, .85);
  padding: 22px;
  margin-bottom: 18px;
}

.btn {
  font-family: var(--font-display);
  font-weight: 500; font-size: 16px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  padding: 10px 18px;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(43, 42, 51, .85);
  transition: transform .08s ease, box-shadow .08s ease;
  display: inline-flex; align-items: center; gap: 8px;
  text-decoration: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(43,42,51,.85); }
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-accent { background: var(--accent); color: var(--ink); }
.btn-ghost { box-shadow: none; border-color: var(--line); background: transparent; }
.btn-sm { font-size: 14px; padding: 6px 12px; border-radius: 10px; box-shadow: 0 3px 0 rgba(43,42,51,.85); }
.btn[disabled] { opacity: .5; cursor: default; }
.btn-install { background: var(--accent); color: var(--ink); white-space: nowrap; }


/* ---------- Layar sambutan / nama ---------- */
.welcome-card { text-align: center; padding: 34px 22px; }
.welcome-star {
  font-size: 46px; line-height: 1;
  animation: pop-bounce 2.4s ease-in-out infinite;
}
.welcome-title {
  font-family: var(--font-display); font-weight: 600; font-size: 30px;
  margin: 12px 0 6px;
}
.welcome-sub { color: var(--ink-soft); font-size: 16px; margin-bottom: 20px; }
.welcome-form {
  display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
  max-width: 460px; margin: 0 auto;
}
.welcome-form input[type=text] { flex: 1 1 200px; min-width: 0; }
.welcome-form .btn { flex: none; }
.welcome-error { color: var(--danger); font-weight: 700; font-size: 14px; margin-top: 10px; min-height: 18px; }

.greet-line {
  font-family: var(--font-display); font-weight: 600; font-size: 22px;
  color: var(--brand); margin-bottom: 4px;
}
.greet-line .greet-change {
  font-family: var(--font-body); font-weight: 700; font-size: 13px;
  color: var(--ink-soft); text-decoration: underline; cursor: pointer;
  background: none; border: none; margin-left: 8px; padding: 0;
}

@keyframes pop-bounce {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  50% { transform: translateY(-8px) rotate(6deg); }
}

/* ---------- Pilih level ---------- */
.level-grid { display: grid; gap: 14px; }
.level-card {
  display: flex; align-items: center; gap: 16px;
  width: 100%; text-align: left;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 0 5px 0 rgba(43,42,51,.85);
  padding: 18px 20px;
  cursor: pointer;
  transition: transform .08s ease;
  font-family: var(--font-body);
}
.level-card:hover { transform: translateY(-2px); }
.level-card:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(43,42,51,.85); }
.level-num {
  width: 54px; height: 54px; flex: none;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 600; font-size: 24px;
  border: 2px solid var(--ink);
}
.lv-1 .level-num { background: var(--brand-soft); color: var(--brand); }
.lv-2 .level-num { background: var(--success-soft); color: var(--success); }
.lv-3 .level-num { background: var(--accent-soft); color: var(--accent-dark); }
.level-name { font-family: var(--font-display); font-weight: 500; font-size: 19px; }
.level-desc { font-size: 14px; color: var(--ink-soft); }

/* ---------- Badge bintang di header ---------- */
.star-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-soft); border: 2px solid var(--ink);
  border-radius: 999px; padding: 5px 12px 5px 10px;
  box-shadow: 0 3px 0 rgba(43,42,51,.85);
  font-family: var(--font-display); font-weight: 600;
}
.star-badge-ico { font-size: 16px; line-height: 1; }
.star-badge-num { color: var(--accent-dark); min-width: 12px; text-align: center; }
.star-badge.pop { animation: badge-pop .45s ease; }
@keyframes badge-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.28) rotate(-6deg); }
  100% { transform: scale(1); }
}

/* ---------- Maskot ---------- */
.mascot {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 14px;
}
.mascot-face {
  width: 56px; height: 56px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 34px; line-height: 1;
  background: var(--brand-soft); border: 2px solid var(--ink);
  border-radius: 50%; box-shadow: 0 4px 0 rgba(43,42,51,.85);
}
.mascot-face.react { animation: mascot-react .5s ease; }
@keyframes mascot-react {
  0% { transform: scale(1); }
  30% { transform: scale(1.25) rotate(8deg); }
  60% { transform: scale(.95) rotate(-6deg); }
  100% { transform: scale(1); }
}
.mascot-bubble {
  position: relative;
  background: #fff; border: 2px solid var(--ink); border-radius: 14px;
  padding: 8px 14px; font-weight: 700; font-size: 15px;
  box-shadow: 0 3px 0 rgba(43,42,51,.85);
}
.mascot-bubble::before {
  content: ""; position: absolute; left: -9px; top: 50%; transform: translateY(-50%);
  border-top: 7px solid transparent; border-bottom: 7px solid transparent;
  border-right: 9px solid var(--ink);
}
.float-pts {
  position: absolute; left: 20px; top: 0;
  font-family: var(--font-display); font-weight: 600; font-size: 24px;
  color: var(--success); pointer-events: none; z-index: 5;
  animation: float-up 1.1s ease forwards;
}
@keyframes float-up {
  0% { transform: translateY(6px); opacity: 0; }
  25% { opacity: 1; }
  100% { transform: translateY(-42px); opacity: 0; }
}

/* ---------- Bonus kecepatan ---------- */
.bonus-wrap { margin: 2px 0 16px; }
.bonus-label { font-size: 12px; font-weight: 800; color: var(--accent-dark); }
.bonus-track {
  height: 9px; border: 2px solid var(--ink); border-radius: 999px;
  background: #fff; overflow: hidden; margin-top: 5px;
}
.bonus-fill {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, var(--accent), var(--danger));
}
.flames { letter-spacing: -2px; }
.q-card { animation: q-enter .35s cubic-bezier(.2,.9,.3,1.2) both; }
@keyframes q-enter {
  0% { transform: translateY(14px) scale(.98); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
.hud .pill.bump { animation: pill-bump .4s ease; }
@keyframes pill-bump {
  0% { transform: scale(1); }
  45% { transform: scale(1.35); background: var(--accent); }
  100% { transform: scale(1); }
}
.answer.shake { animation: shake .4s ease; }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-7px); }
  40%, 60% { transform: translateX(7px); }
}

/* ---------- Nyawa / hati ---------- */
.hearts { margin-left: 8px; letter-spacing: 1px; white-space: nowrap; }
.hearts .heart { color: var(--danger); font-size: 15px; transition: transform .2s ease; display: inline-block; }
.hearts .heart.lost { color: var(--line); transform: scale(.8); }
.hearts.hit { animation: hearts-hit .45s ease; }
@keyframes hearts-hit {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px) scale(1.1); }
  75% { transform: translateX(4px); }
}

/* ---------- Hitung mundur ---------- */
.countdown-ov {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  background: rgba(43, 42, 51, .55); backdrop-filter: blur(2px);
}
.countdown-num {
  font-family: var(--font-display); font-weight: 600; color: #fff;
  font-size: 120px; line-height: 1;
  text-shadow: 0 6px 0 rgba(0,0,0,.25);
  animation: count-pop .7s ease forwards;
}
.countdown-num.go { color: var(--accent); font-size: 84px; animation: count-go .62s ease forwards; }
@keyframes count-pop {
  0% { transform: scale(.3); opacity: 0; }
  30% { transform: scale(1.15); opacity: 1; }
  70% { transform: scale(1); opacity: 1; }
  100% { transform: scale(.8); opacity: 0; }
}
@keyframes count-go {
  0% { transform: scale(.4) rotate(-8deg); opacity: 0; }
  40% { transform: scale(1.2) rotate(4deg); opacity: 1; }
  100% { transform: scale(1.05); opacity: 1; }
}

/* ---------- Lencana: baru terbuka (hasil) ---------- */
.gameover-tag {
  display: inline-block; font-family: var(--font-display); font-weight: 600;
  background: var(--danger-soft); color: var(--danger);
  border: 2px solid var(--danger); border-radius: 999px;
  padding: 4px 16px; margin-bottom: 12px;
}
.badges-panel {
  border: 2px dashed var(--accent); background: var(--accent-soft);
  border-radius: 14px; padding: 14px; margin: 4px auto 16px; max-width: 380px;
}
.badges-head { font-family: var(--font-display); font-weight: 600; margin-bottom: 10px; }
.badge-new {
  display: flex; align-items: center; gap: 12px; text-align: left;
  background: #fff; border: 2px solid var(--ink); border-radius: 12px;
  padding: 8px 12px; margin-bottom: 8px;
  animation: badge-drop .5s cubic-bezier(.2,.9,.3,1.3) both;
}
.badge-new:last-child { margin-bottom: 0; }
.badge-ico { font-size: 30px; flex: none; }
.badge-txt { display: flex; flex-direction: column; }
.badge-desc { font-size: 13px; color: var(--ink-soft); font-weight: 700; }
@keyframes badge-drop {
  0% { transform: translateY(-14px) scale(.9); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* ---------- Lencana: koleksi (home) ---------- */
.ach-collection {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 10px;
}
.ach-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  border: 2px solid var(--line); border-radius: 14px; padding: 12px 6px;
  background: var(--paper); opacity: .6;
}
.ach-item.got { opacity: 1; border-color: var(--ink); background: #fff; box-shadow: 0 3px 0 rgba(43,42,51,.85); }
.ach-ico { font-size: 28px; line-height: 1; }
.ach-name { font-size: 12px; font-weight: 800; }
.ach-item.got .ach-name { color: var(--brand); }

/* ---------- Pilihan mode (Main Bareng / Tantangan) ---------- */
.mode-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 8px; }
.mode-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center;
  background: var(--card); border: 2px solid var(--ink); border-radius: var(--radius);
  box-shadow: 0 5px 0 rgba(43,42,51,.85); padding: 16px 12px; cursor: pointer;
  font-family: var(--font-body); transition: transform .08s ease;
}
.mode-btn:hover { transform: translateY(-2px); }
.mode-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(43,42,51,.85); }
.mode-ico { font-size: 30px; line-height: 1; }
.mode-name { font-family: var(--font-display); font-weight: 600; font-size: 17px; }
.mode-sub { font-size: 12px; color: var(--ink-soft); font-weight: 700; }
.mode-or { text-align: center; color: var(--ink-soft); font-size: 13px; font-weight: 700; margin: 4px 0 14px; }

/* ---------- Alur 3 langkah (level → fokus → game) ---------- */
.step-bar { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 6px 0 16px; }
.step-dot {
  width: 30px; height: 30px; flex: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 600; font-size: 15px;
  background: var(--card); color: var(--ink-soft); border: 2px solid var(--line);
}
.step-dot.on {
  background: var(--brand); color: #fff; border-color: var(--ink);
  box-shadow: 0 3px 0 rgba(43,42,51,.85);
}
.step-line { width: 26px; height: 3px; background: var(--line); border-radius: 999px; }

.pick-head { text-align: center; margin-bottom: 16px; }
.pick-crumb {
  display: inline-block; font-size: 12px; font-weight: 800;
  background: var(--card); border: 2px solid var(--line); border-radius: 999px;
  padding: 3px 12px; margin-bottom: 8px;
}
.pick-crumb.lv-1 { color: var(--brand); }
.pick-crumb.lv-2 { color: var(--success); }
.pick-crumb.lv-3 { color: var(--accent-dark); }
.pick-crumb.lv-4 { color: var(--danger); }
.pick-title { font-family: var(--font-display); font-weight: 600; font-size: 24px; text-align: center; margin-bottom: 4px; }
.pick-desc { color: var(--ink-soft); font-size: 14px; }

.pick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.pick-card {
  display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center;
  background: var(--card); border: 2px solid var(--ink); border-radius: var(--radius);
  box-shadow: 0 5px 0 rgba(43,42,51,.85); padding: 18px 12px; cursor: pointer;
  font-family: var(--font-body); transition: transform .08s ease;
}
.pick-card:hover { transform: translateY(-2px); }
.pick-card:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(43,42,51,.85); }
.pick-card:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.pick-badge, .pick-ico {
  width: 48px; height: 48px; flex: none; border-radius: 50%; margin-bottom: 6px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 600; font-size: 24px;
  border: 2px solid var(--ink); background: var(--brand-soft);
}
.pick-ico { border: none; font-family: var(--font-body); }
.pick-card.lv-1 .pick-badge, .pick-card.lv-1 .pick-ico { background: var(--brand-soft); color: var(--brand); }
.pick-card.lv-2 .pick-badge, .pick-card.lv-2 .pick-ico { background: var(--success-soft); color: var(--success); }
.pick-card.lv-3 .pick-badge, .pick-card.lv-3 .pick-ico { background: var(--accent-soft); color: var(--accent-dark); }
.pick-card.lv-4 .pick-badge, .pick-card.lv-4 .pick-ico { background: var(--danger-soft); color: var(--danger); }
.pick-name { font-family: var(--font-display); font-weight: 600; font-size: 17px; }
.pick-sub { font-size: 12.5px; color: var(--ink-soft); font-weight: 700; }
.pick-count {
  margin-top: 6px; font-size: 11.5px; font-weight: 800; color: var(--ink-soft);
  background: var(--paper); border: 2px solid var(--line); border-radius: 999px; padding: 2px 10px;
}
.pick-card.mix { border-style: dashed; }
.pick-card.mix .pick-ico { background: var(--accent); }

@media (max-width: 420px) {
  .pick-card { padding: 14px 10px; }
  .pick-name { font-size: 15px; }
  .pick-sub { font-size: 11.5px; }
}

/* ---------- Katalog permainan (grid per kategori) ---------- */
.cat { margin-bottom: 26px; }
.cat-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.cat-title { font-family: var(--font-display); font-weight: 600; font-size: 21px; }
.cat-title.lv-1 { color: var(--brand); }
.cat-title.lv-2 { color: var(--success); }
.cat-title.lv-3 { color: var(--accent-dark); }
.cat-title.lv-4 { color: var(--danger); }
.cat-count {
  flex: none; font-size: 12px; font-weight: 800; color: var(--ink-soft);
  background: var(--card); border: 2px solid var(--line); border-radius: 999px; padding: 3px 12px;
}
.game-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.game-card {
  display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center;
  background: var(--card); border: 2px solid var(--ink); border-radius: 16px;
  box-shadow: 0 4px 0 rgba(43,42,51,.85); padding: 16px 10px; cursor: pointer;
  font-family: var(--font-body); transition: transform .08s ease;
}
.game-card:hover { transform: translateY(-2px); }
.game-card:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(43,42,51,.85); }
.game-card:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.game-ico {
  width: 54px; height: 54px; border-radius: 50%; margin-bottom: 6px;
  display: flex; align-items: center; justify-content: center; font-size: 26px;
  background: var(--brand-soft);
}
.game-card.lv-1 .game-ico { background: var(--brand-soft); }
.game-card.lv-2 .game-ico { background: var(--success-soft); }
.game-card.lv-3 .game-ico { background: var(--accent-soft); }
.game-card.lv-4 .game-ico { background: var(--danger-soft); }
.game-name { font-family: var(--font-display); font-weight: 600; font-size: 16px; }
.game-sub { font-size: 12.5px; color: var(--ink-soft); font-weight: 700; }
.game-card.mix { border-style: dashed; }
.game-card.mix .game-ico { background: var(--accent); }

@media (max-width: 560px) {
  .game-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Layar setup ---------- */
.setup-title { font-family: var(--font-display); font-weight: 600; font-size: 24px; margin: 6px 0; }
.setup-desc { color: var(--ink-soft); font-size: 15px; margin-bottom: 16px; }
.setup-back { margin-bottom: 10px; }
.btn-big { width: 100%; justify-content: center; font-size: 18px; padding: 13px; margin-top: 6px; }
.party-name-row { display: flex; gap: 8px; margin-bottom: 8px; }
.party-name-row input { flex: 1; }
.party-del { flex: none; background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.ch-levels { display: grid; gap: 8px; }
.ch-level { justify-content: center; }
.ch-sep { border: none; border-top: 2px dashed var(--line); margin: 18px 0; }
.ch-result { text-align: center; border: 2px dashed var(--accent); background: var(--accent-soft); border-radius: 14px; padding: 16px; margin-top: 12px; }
.ch-code-big { font-family: var(--font-display); font-weight: 600; font-size: 40px; letter-spacing: 4px; color: var(--brand); }
.ch-code-cap { font-size: 13px; color: var(--ink-soft); font-weight: 700; margin-bottom: 12px; }
.ch-link { display: flex; gap: 8px; }
.ch-link input { flex: 1; font-size: 13px; }

/* ---------- Serah-terima (Main Bareng) ---------- */
.handoff { text-align: center; padding: 26px 20px; animation: q-enter .35s ease both; }
.handoff-emoji { font-size: 48px; animation: pop-bounce 2s ease-in-out infinite; }
.handoff-turn { font-family: var(--font-display); font-weight: 600; font-size: 26px; margin: 8px 0 2px; }
.handoff-sub { color: var(--ink-soft); font-size: 15px; margin-bottom: 16px; }
.handoff-board { list-style: none; max-width: 300px; margin: 0 auto 18px; }
.handoff-board li { display: flex; justify-content: space-between; align-items: center; padding: 7px 10px; border-bottom: 1.5px dashed var(--line); font-weight: 700; }
.handoff-board li:last-child { border-bottom: none; }
.handoff-board li.me { background: var(--brand-soft); border-radius: 10px; border-bottom: none; }

/* ---------- HUD multiplayer ---------- */
.turn-name { font-family: var(--font-display); font-weight: 600; color: var(--brand); }
.party-strip { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.party-chip {
  font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
  border: 2px solid var(--line); background: var(--card);
}
.party-chip.on { border-color: var(--ink); background: var(--brand-soft); color: var(--brand); }
.party-chip b { font-family: var(--font-display); }
.challenge-strip {
  font-size: 13px; font-weight: 700; text-align: center; color: var(--accent-dark);
  background: var(--accent-soft); border: 2px solid var(--accent); border-radius: 10px;
  padding: 6px 12px; margin-bottom: 10px;
}

/* ---------- Podium (hasil Main Bareng) ---------- */
.party-champ { font-family: var(--font-display); font-weight: 600; font-size: 22px; margin-bottom: 14px; }
.podium { list-style: none; text-align: left; max-width: 380px; margin: 0 auto 18px; }
.podium-row { display: flex; align-items: center; gap: 12px; padding: 10px; border-bottom: 1.5px dashed var(--line); cursor: pointer; border-radius: 10px; transition: background .12s ease; }
.podium-row:last-child { border-bottom: none; }
.podium-row:hover { background: var(--brand-soft); }
.podium-row:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.podium-name { min-width: 0; }
.podium-row.win { background: var(--accent-soft); border-radius: 12px; border-bottom: none; }
.podium-medal { font-size: 26px; flex: none; }
.podium-name { flex: 1; font-weight: 800; }
.podium-meta { font-size: 12px; color: var(--ink-soft); font-weight: 700; }
.podium-score { font-family: var(--font-display); font-weight: 600; font-size: 22px; color: var(--brand); }

/* ---------- Hasil tantangan ---------- */
.challenge-badge {
  display: inline-block; font-family: var(--font-display); font-weight: 600;
  background: var(--accent-soft); color: var(--accent-dark);
  border: 2px solid var(--accent); border-radius: 999px; padding: 4px 16px; margin-bottom: 10px;
}
.ch-board { text-align: left; max-width: 360px; margin: 4px auto 16px; }
.ch-board-head { font-family: var(--font-display); font-weight: 600; margin-bottom: 6px; }
.board-list-row { display: flex; align-items: center; gap: 12px; padding: 8px 4px; border-bottom: 1.5px dashed var(--line); font-weight: 700; }
.board-list-row:last-child { border-bottom: none; }

/* ---------- Game ---------- */
.hud {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 14px; color: var(--ink-soft); margin-bottom: 8px;
  font-weight: 700;
}
.hud .pill {
  background: var(--card); border: 2px solid var(--ink);
  border-radius: 999px; padding: 2px 12px; margin-left: 6px;
  color: var(--ink); font-weight: 700;
}
.progress {
  height: 12px; border: 2px solid var(--ink); border-radius: 999px;
  background: #fff; overflow: hidden; margin-bottom: 20px;
}
.progress > div {
  height: 100%; background: var(--accent); width: 0%;
  transition: width .3s ease;
}
.topic-tag {
  display: inline-block; font-size: 13px; font-weight: 800;
  background: var(--brand-soft); color: var(--brand);
  border-radius: 999px; padding: 4px 14px; margin-bottom: 10px;
}
.question {
  font-family: var(--font-display); font-weight: 500;
  font-size: 22px; line-height: 1.45; margin-bottom: 18px;
}
.answers { display: grid; gap: 10px; }
.answer {
  text-align: left; font-family: var(--font-body); font-weight: 700;
  font-size: 17px; background: #fff; color: var(--ink);
  border: 2px solid var(--ink); border-radius: 14px;
  padding: 13px 16px; cursor: pointer;
  box-shadow: 0 4px 0 rgba(43,42,51,.85);
  transition: transform .08s ease;
}
.answer:hover { transform: translateY(-1px); background: var(--paper); }
.answer:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.answer.correct { background: var(--success-soft); border-color: var(--success); color: var(--success); box-shadow: 0 4px 0 var(--success); }
.answer.wrong { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); box-shadow: 0 4px 0 var(--danger); }
.answer.locked { cursor: default; transform: none; }

.feedback {
  margin-top: 16px; border-radius: 14px; padding: 14px 16px;
  border: 2px solid var(--line); background: var(--paper);
}
.feedback.ok { border-color: var(--success); background: var(--success-soft); }
.feedback.no { border-color: var(--danger); background: var(--danger-soft); }
.feedback .fb-title { font-family: var(--font-display); font-weight: 500; margin-bottom: 4px; }
.feedback.ok .fb-title { color: var(--success); }
.feedback.no .fb-title { color: var(--danger); }
.feedback .fb-ex { font-size: 15px; }
.feedback .fb-ex strong { font-weight: 800; }

/* Tombol kembali di bawah setiap soal */
.q-back { text-align: center; margin-top: 14px; }
.q-back .btn { color: var(--ink-soft); }

/* ---------- Hasil ---------- */
.result { text-align: center; padding: 12px 0; }
.stars { font-size: 34px; letter-spacing: 4px; margin-bottom: 10px; }
.stars .on { color: var(--accent); }
.stars .off { color: var(--line); }
.result-score { font-family: var(--font-display); font-weight: 600; font-size: 40px; }
.result-meta { color: var(--ink-soft); font-size: 14px; margin-bottom: 6px; }
.result-msg { font-size: 17px; margin: 10px 0 20px; }
.result-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.result-saved {
  background: var(--accent-soft); border: 2px solid var(--accent);
  border-radius: 12px; padding: 10px 14px; font-weight: 700;
  max-width: 360px; margin: 0 auto 16px;
}
.result-saved strong { color: var(--accent-dark); }

/* ---------- Leaderboard ---------- */
.board-title {
  font-family: var(--font-display); font-weight: 500; font-size: 20px;
  margin-bottom: 12px; display: flex; align-items: center; gap: 8px;
}
.board-list { list-style: none; }
.board-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 4px; border-bottom: 1.5px dashed var(--line);
  font-weight: 700;
}
.board-list li:last-child { border-bottom: none; }
.board-rank {
  width: 30px; height: 30px; flex: none; border-radius: 50%;
  background: var(--paper); border: 2px solid var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 14px;
}
.board-list li:nth-child(1) .board-rank { background: var(--accent); }
.board-name { flex: 1; min-width: 0; }
.board-level { font-size: 12px; color: var(--ink-soft); font-weight: 700; }
.board-score { font-family: var(--font-display); font-weight: 600; color: var(--brand); flex: none; white-space: nowrap; }
.board-empty { color: var(--ink-soft); font-size: 15px; }

/* Header papan juara + tombol segarkan */
.board-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.board-head .board-title { margin-bottom: 0; }
.board-hint { font-size: 12.5px; color: var(--ink-soft); font-weight: 700; margin-bottom: 8px; }
#btn-board-refresh.spin { animation: spin-once .5s ease; }
@keyframes spin-once { from { transform: rotate(0); } to { transform: rotate(360deg); } }

/* Baris papan juara bisa diketuk */
.board-row { cursor: pointer; border-radius: 10px; transition: background .12s ease; }
.board-row:hover { background: var(--brand-soft); }
.board-row:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Modal serbaguna ---------- */
.modal-ov {
  position: fixed; inset: 0; z-index: 70;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(43, 42, 51, .5); backdrop-filter: blur(2px);
  animation: fade-in .18s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  position: relative; width: 100%; max-width: 420px;
  background: var(--card); border: 2px solid var(--ink); border-radius: 22px;
  box-shadow: 0 8px 0 rgba(43,42,51,.85); padding: 26px 22px 22px;
  text-align: center; animation: q-enter .3s cubic-bezier(.2,.9,.3,1.2) both;
  max-height: 90vh; overflow-y: auto;
}
.modal-x {
  position: absolute; top: 12px; right: 12px;
  width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid var(--ink); background: #fff; cursor: pointer;
  font-weight: 800; color: var(--ink); line-height: 1;
  box-shadow: 0 3px 0 rgba(43,42,51,.85);
}
.detail-stars { font-size: 24px; letter-spacing: 3px; min-height: 22px; }
.detail-stars .on { color: var(--accent); }
.detail-stars .off { color: var(--line); }
.detail-name { font-family: var(--font-display); font-weight: 600; font-size: 24px; margin: 4px 0 16px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.stat-cell {
  text-align: left; background: var(--paper);
  border: 2px solid var(--line); border-radius: 14px; padding: 10px 12px;
}
.stat-cell-k { font-size: 12px; font-weight: 800; color: var(--ink-soft); }
.stat-cell-v { font-family: var(--font-display); font-weight: 600; font-size: 17px; overflow-wrap: break-word; }
.stat-cell-wide { grid-column: 1 / -1; }
.detail-close { min-width: 120px; }
@media (max-width: 380px) { .detail-grid { grid-template-columns: 1fr; } }

/* ---------- Form ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 800; font-size: 14px; margin-bottom: 6px; }
.field .hint { font-weight: 400; color: var(--ink-soft); font-size: 13px; margin-top: 4px; }
input[type=text], input[type=password], input[type=number], input[type=url], select, textarea {
  width: 100%; font-family: var(--font-body); font-size: 16px;
  border: 2px solid var(--ink); border-radius: 12px;
  padding: 10px 14px; background: #fff; color: var(--ink);
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 1px;
}
input[type=color] {
  width: 54px; height: 40px; border: 2px solid var(--ink);
  border-radius: 10px; padding: 2px; background: #fff; cursor: pointer;
}
.color-row { display: flex; align-items: center; gap: 12px; }
.color-row span { font-size: 14px; font-weight: 700; }
.check-row { display: flex; align-items: center; gap: 10px; font-weight: 700; margin-bottom: 10px; }
.check-row input { width: 20px; height: 20px; accent-color: var(--brand); }

/* ---------- Admin ---------- */
.admin-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.tab-btn {
  font-family: var(--font-display); font-weight: 500; font-size: 15px;
  border: 2px solid var(--ink); border-radius: 999px;
  background: #fff; padding: 7px 16px; cursor: pointer;
}
.tab-btn.active { background: var(--brand); color: #fff; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.admin-note {
  font-size: 13px; color: var(--ink-soft); background: var(--paper);
  border: 1.5px dashed var(--line); border-radius: 12px;
  padding: 10px 14px; margin-bottom: 16px;
}
.save-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(80px);
  background: var(--ink); color: #fff; font-weight: 700;
  padding: 10px 20px; border-radius: 999px; opacity: 0;
  transition: all .25s ease; z-index: 50; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Footer ---------- */
.site-foot {
  text-align: center; color: var(--ink-soft); font-size: 13px;
  padding-top: 28px;
}
.site-foot a { color: var(--brand); font-weight: 700; }

/* ---------- Confetti ---------- */
.confetti {
  position: fixed; width: 10px; height: 14px; top: -20px;
  z-index: 40; pointer-events: none;
  animation: fall linear forwards;
}
@keyframes fall {
  to { transform: translateY(110vh) rotate(720deg); opacity: .8; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

@media (max-width: 600px) {
  /* HUD boleh turun ke dua baris agar tidak meluber */
  .hud { flex-wrap: wrap; gap: 4px 10px; font-size: 13px; }
  .hud > span:last-child { margin-left: auto; }
}

@media (max-width: 520px) {
  .site-title { font-size: 21px; }
  .question { font-size: 19px; }
  .head-actions .btn-label { display: none; }
}

@media (max-width: 480px) {
  .wrap { padding-top: 14px; }
  /* Header ringkas */
  .site-head { gap: 10px; padding: 4px 0 14px; }
  .logo-badge { width: 44px; height: 44px; font-size: 18px; border-radius: 13px; box-shadow: 0 3px 0 var(--brand-dark); }
  .site-title { font-size: 18px; }
  .site-tagline { font-size: 12px; line-height: 1.3; }
  .head-actions { gap: 6px; flex: none; }
  .head-actions .btn-sm { padding: 6px 9px; }
  .btn-install { font-size: 0; padding: 6px 8px; }          /* di HP cukup ikonnya saja */
  .btn-install::before { content: "⬇️"; font-size: 15px; }
  .star-badge { padding: 5px 9px 5px 8px; font-size: 15px; }

  /* Kartu & tombol lebih rapat */
  .card { padding: 18px 15px; }
  .btn { padding: 10px 15px; font-size: 15px; }

  /* Game */
  .hud .pill { padding: 2px 9px; margin-left: 4px; }
  .question { font-size: 18px; }
  .answer { font-size: 16px; padding: 12px 14px; }
  .mascot-face { width: 48px; height: 48px; font-size: 26px; }
  .mascot-bubble { font-size: 14px; padding: 7px 12px; }
  .countdown-num { font-size: 84px; }
  .countdown-num.go { font-size: 58px; }

  /* Katalog lebih padat */
  .cat-title { font-size: 18px; }
  .game-card { padding: 14px 8px; }
  .game-ico { width: 48px; height: 48px; font-size: 24px; }
  .result-score { font-size: 34px; }
}

@media (max-width: 360px) {
  .site-tagline { display: none; }
}
