@font-face { font-family: 'Nunito'; src: url(fonts/nunito-latin.woff2) format('woff2'); font-weight: 500 800; font-display: swap; }

/* Colours: purple is the app's colour (not blue: Kaliku; green: Jelajah Ayat; orange: Jago Jam; not red/yellow/green:
   they mean Belum hafal / Hampir hafal / Hafal). Each mode has its own accent: Latihan purple, Rumpang amber,
   Tantangan Waktu blue, Game Pecah Balon cyan, Game Cari Pasangan pink (as in Kaliku). */
:root {
  --bg: #F6F4FC; --card: #FFFFFF; --ink: #14213D; --muted: #5B6478; --line: #DCE3EF; --line-soft: #EDF1F7;
  --purple: #7C3AED; --purple-dark: #6D28D9; --purple-soft: #EDE7FD; --purple-ink: #5B21B6; --on-purple: #FFFFFF;
  --amber: #B45309; --amber-dark: #92400E; --amber-soft: #FFF1D6; --amber-ink: #8A5300; --on-amber: #FFFFFF;
  --blue: #2563EB; --blue-dark: #1D4ED8; --blue-soft: #E3ECFD; --blue-ink: #1D4ED8; --on-blue: #FFFFFF;
  --cyan: #0E7490; --cyan-dark: #155E75; --cyan-soft: #DDF4F8; --cyan-ink: #155E75; --on-cyan: #FFFFFF;
  --pink: #BE185D; --pink-dark: #9D174D; --pink-soft: #FCE7F3; --pink-ink: #9D174D; --on-pink: #FFFFFF;
  --veil: 91, 33, 182;
  --ok: #15803D; --ok-ink: #166534; --ok-soft: #DCFCE7;
  --bad: #C2410C; --bad-ink: #9A3412; --bad-soft: #FFF4EC;
  --gold: #FFD23F; --key-shadow: #D3DBE8;
  --l0: #E9EDF3; --l1: #F08A7E; --l2: #FFD966; --l3: #1F9254;
  --shadow: 0 1px 3px rgba(20, 33, 61, .10);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F172A; --card: #1E293B; --ink: #E5ECF8; --muted: #9AA8BF; --line: #334155; --line-soft: #273449;
    --purple: #A78BFA; --purple-dark: #8B5CF6; --purple-soft: #2E1F5E; --purple-ink: #DDD3FF; --on-purple: #150B33;
    --amber: #F5B451; --amber-dark: #D99A2B; --amber-soft: #3A2A0E; --amber-ink: #F5C46B; --on-amber: #1F1404;
    --blue: #60A5FA; --blue-dark: #3B82F6; --blue-soft: #1E3A8A; --blue-ink: #DBE7FF; --on-blue: #0B1530;
    --cyan: #22D3EE; --cyan-dark: #06B6D4; --cyan-soft: #123A45; --cyan-ink: #A5F3FC; --on-cyan: #062A33;
    --pink: #F472B6; --pink-dark: #EC4899; --pink-soft: #4A1530; --pink-ink: #FBCFE8; --on-pink: #2A0716;
    --veil: 46, 31, 94;
    --ok: #34B86E; --ok-ink: #86EFAC; --ok-soft: #12351F;
    --bad: #F08A5D; --bad-ink: #FDBA8C; --bad-soft: #3A1F12;
    --key-shadow: #0B1220;
    --l0: #334155; --l1: #E0705F; --l2: #E8C24E; --l3: #34B86E;
    --shadow: 0 1px 3px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F172A; --card: #1E293B; --ink: #E5ECF8; --muted: #9AA8BF; --line: #334155; --line-soft: #273449;
  --purple: #A78BFA; --purple-dark: #8B5CF6; --purple-soft: #2E1F5E; --purple-ink: #DDD3FF; --on-purple: #150B33;
  --amber: #F5B451; --amber-dark: #D99A2B; --amber-soft: #3A2A0E; --amber-ink: #F5C46B; --on-amber: #1F1404;
  --blue: #60A5FA; --blue-dark: #3B82F6; --blue-soft: #1E3A8A; --blue-ink: #DBE7FF; --on-blue: #0B1530;
  --cyan: #22D3EE; --cyan-dark: #06B6D4; --cyan-soft: #123A45; --cyan-ink: #A5F3FC; --on-cyan: #062A33;
  --pink: #F472B6; --pink-dark: #EC4899; --pink-soft: #4A1530; --pink-ink: #FBCFE8; --on-pink: #2A0716;
  --veil: 46, 31, 94;
  --ok: #34B86E; --ok-ink: #86EFAC; --ok-soft: #12351F;
  --bad: #F08A5D; --bad-ink: #FDBA8C; --bad-soft: #3A1F12;
  --key-shadow: #0B1220;
  --l0: #334155; --l1: #E0705F; --l2: #E8C24E; --l3: #34B86E;
  --shadow: 0 1px 3px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font-family: Nunito, system-ui, sans-serif; font-size: 16px; line-height: 1.4;
  -webkit-text-size-adjust: 100%; overscroll-behavior-y: none;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { cursor: default; }
a { color: var(--purple-dark); }
:focus-visible { outline: 3px solid var(--purple); outline-offset: 2px; }
.ic { display: inline-flex; flex: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 13px; }
.center { text-align: center; }
.grow { flex: 1 1 auto; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* Mode accent: purple by default (also for popups, which sit outside the screen), or set on a screen with
   .m-latihan / .m-rumpang / .m-tantangan. */
:root, .m-latihan { --acc: var(--purple); --acc-dark: var(--purple-dark); --acc-soft: var(--purple-soft); --acc-ink: var(--purple-ink); --on-acc: var(--on-purple); }
.m-rumpang { --acc: var(--amber); --acc-dark: var(--amber-dark); --acc-soft: var(--amber-soft); --acc-ink: var(--amber-ink); --on-acc: var(--on-amber); }
.m-tantangan { --acc: var(--blue); --acc-dark: var(--blue-dark); --acc-soft: var(--blue-soft); --acc-ink: var(--blue-ink); --on-acc: var(--on-blue); }
.m-balon { --acc: var(--cyan); --acc-dark: var(--cyan-dark); --acc-soft: var(--cyan-soft); --acc-ink: var(--cyan-ink); --on-acc: var(--on-cyan); }
.m-pasangkan { --acc: var(--pink); --acc-dark: var(--pink-dark); --acc-soft: var(--pink-soft); --acc-ink: var(--pink-ink); --on-acc: var(--on-pink); }

/* ---------- screen frame ---------- */
.screen {
  max-width: 480px; margin: 0 auto; min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; gap: 16px;
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
}
.topbar { display: flex; align-items: center; gap: 12px; min-height: 48px; }
.topbar .title { font-size: 22px; font-weight: 800; flex: 1; min-width: 0; }
.round-btn {
  flex: none; width: 48px; height: 48px; border-radius: 50%; background: var(--card); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; }
.brand .logo { width: 36px; height: 36px; border-radius: 11px; background: var(--purple); color: #fff; display: inline-flex; align-items: center; justify-content: center; }

.card { background: var(--card); border-radius: 20px; padding: 16px; box-shadow: var(--shadow); }
.section-label { font-size: 13px; font-weight: 800; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; padding: 4px 4px 0; }
.h1 { font-size: 28px; font-weight: 800; margin: 0; }
.h2 { font-size: 18px; font-weight: 800; margin: 0; }

.btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 100%;
  min-height: 60px; border-radius: 18px; padding: 12px 16px; font-size: 20px; font-weight: 800; text-decoration: none;
}
.btn .row { display: flex; align-items: center; gap: 10px; }
.btn small { font-size: 13px; font-weight: 700; opacity: .9; }
.btn.primary { background: var(--acc); color: var(--on-acc); box-shadow: 0 3px 0 var(--acc-dark); }
.btn.primary:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--acc-dark); }
.btn.primary:disabled { opacity: .45; box-shadow: none; }
.btn.secondary { background: var(--acc-soft); color: var(--acc-ink); font-size: 18px; min-height: 56px; }
.btn.secondary.danger { background: var(--card); border: 2px solid var(--line); color: var(--bad); }
.link-btn { color: var(--purple-dark); font-weight: 800; font-size: 15px; padding: 10px 6px; }
.link-btn.danger { color: var(--bad); }
:root[data-theme="dark"] .link-btn:not(.danger) { color: var(--purple); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .link-btn:not(.danger) { color: var(--purple); } }

/* ---------- avatars / players ---------- */
.av { flex: none; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.av.lg { width: 80px; height: 80px; font-size: 44px; }
.av.md { width: 38px; height: 38px; font-size: 21px; }
.players { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.player-card {
  width: 100%; background: var(--card); border-radius: 22px; padding: 22px 12px 18px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: 10px; font-size: 20px; font-weight: 800;
  overflow-wrap: anywhere; text-align: center;
}
.player-wrap { position: relative; display: grid; }
.player-wrap .player-edit { position: absolute; top: 6px; right: 6px; width: 40px; height: 40px; background: var(--line-soft); box-shadow: none; color: var(--muted); }
.player-card.add { background: transparent; border: 2px dashed var(--line); box-shadow: none; color: var(--purple-dark); }
.player-card.add .av { background: var(--purple-soft); color: var(--purple-ink); }
.who-pill {
  display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 14px 0 5px; background: var(--card);
  border-radius: 999px; box-shadow: var(--shadow); font-weight: 800; font-size: 17px; min-width: 0;
}
.who-pill .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; gap: 4px; flex: none; margin-left: auto; align-self: flex-start; }
/* Round icon button with its name underneath (Beranda: Riwayat, Pengaturan). Same as Kaliku 045d1bd. */
.labeled-btn { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 56px; font-size: 12px; font-weight: 800; color: var(--muted); }
.avatar-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.avatar-opt { aspect-ratio: 1.4; border-radius: 20px; font-size: 36px; border: 3px solid transparent; display: flex; align-items: center; justify-content: center; }
.avatar-opt[aria-pressed="true"] { border-color: var(--purple); }
.text-input {
  width: 100%; height: 56px; border-radius: 16px; border: 2px solid var(--line); background: var(--card);
  padding: 0 16px; font-size: 20px; font-weight: 700;
}
.text-input:focus { border-color: var(--purple); outline: none; }
.need-name { margin: 0; text-align: center; font-size: 15px; font-weight: 700; color: var(--muted); }

/* ---------- Beranda ---------- */
.hello p { margin: 2px 0 0; font-size: 16px; font-weight: 600; }
.peta-card {
  display: flex; flex-direction: column; gap: 12px; width: 100%; text-align: left; background: var(--purple); color: var(--on-purple);
  border-radius: 20px; padding: 16px;
}
.peta-card .head { display: flex; align-items: center; gap: 6px; font-size: 17px; font-weight: 800; }
.peta-card .head .grow { flex: 1; }
.peta-card .head small { font-size: 15px; font-weight: 700; }
.peta-card .big { display: flex; align-items: baseline; gap: 6px; font-weight: 700; }
.peta-card .big b { font-size: 34px; line-height: 1; font-weight: 800; }
.peta-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: rgba(255, 255, 255, .25); }
.peta-bar .h { background: #FFFFFF; } .peta-bar .k { background: var(--l2); }
:root[data-theme="dark"] .peta-bar { background: rgba(11, 21, 48, .25); } :root[data-theme="dark"] .peta-bar .h { background: var(--on-purple); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .peta-bar { background: rgba(11, 21, 48, .25); } :root:not([data-theme="light"]) .peta-bar .h { background: var(--on-purple); } }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.peta-card .chip { background: rgba(255, 255, 255, .2); border-radius: 12px; padding: 4px 10px; font-size: 14px; font-weight: 700; }
.mode-card {
  display: flex; align-items: center; gap: 16px; width: 100%; text-align: left; background: var(--card);
  border-radius: 20px; padding: 8px 14px; box-shadow: var(--shadow); min-height: 66px;
}
.modes { display: flex; flex-direction: column; gap: 10px; }
.app-link {
  display: flex; align-self: center; align-items: center; gap: 8px; min-height: 48px; padding: 4px 10px 4px 8px; margin-top: 8px;
  border: 1.5px solid var(--line); border-radius: 14px; color: var(--ink); font-size: 15px; font-weight: 800; text-decoration: none;
}
.app-link img { flex: none; width: 30px; height: 30px; border-radius: 8px; }
.app-link .chev { color: var(--muted); display: flex; }
.mode-card .tag { flex: none; width: 96px; height: 50px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 19px; background: var(--acc-soft); color: var(--acc-ink); }
.mode-card .txt { flex: 1; min-width: 0; }
.mode-card b { display: block; font-size: 19px; }
.mode-card small { display: block; font-size: 14px; color: var(--muted); font-weight: 600; }
/* The two games share one row of half-width cards: picture on top, name under it. */
.game-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mode-card.half { flex-direction: column; align-items: stretch; gap: 6px; padding: 10px; text-align: center; }
.mode-card.half .tag { width: auto; height: 48px; font-size: 17px; }
.mode-card.half b { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mode-card.half small { font-size: 13px; font-weight: 800; color: var(--acc-ink); line-height: 1.2; }

/* ---------- pilih tabel ---------- */
.tables { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.tbl {
  position: relative; height: 60px; border-radius: 16px; border: 2px solid var(--line); background: var(--card);
  font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums;
}
.tbl[aria-pressed="true"] { background: var(--acc); border-color: var(--acc); color: var(--on-acc); }
.tbl .badge { position: absolute; top: -9px; right: -7px; font-size: 16px; }
.tbl.campur { height: 56px; font-size: 18px; width: 100%; }
.check-row { display: flex; align-items: center; gap: 12px; min-height: 48px; font-size: 16px; font-weight: 700; }
.check-row input { width: 24px; height: 24px; margin: 0; accent-color: var(--acc); flex: none; }
.check-row.off { color: var(--muted); }
.check-row small { display: block; font-size: 13px; font-weight: 600; color: var(--muted); }
.checks { display: flex; flex-direction: column; }
.stepper { display: flex; align-items: center; justify-content: space-between; }
.stepper button { width: 56px; height: 56px; border-radius: 50%; background: var(--acc-soft); color: var(--acc-ink); font-size: 28px; font-weight: 800; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.stepper button:disabled { opacity: .4; }
.stepper .num { font-size: 40px; font-weight: 800; font-variant-numeric: tabular-nums; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; }
.seg.n button { height: 56px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); font-size: 22px; font-weight: 800; }
.seg.n button[aria-pressed="true"] { background: var(--acc); border-color: var(--acc); color: var(--on-acc); }
.seg.theme { gap: 4px; background: var(--line-soft); border-radius: 14px; padding: 4px; }
.seg.theme button { border-radius: 10px; min-height: 44px; font-size: 15px; font-weight: 800; color: var(--muted); }
.seg.theme button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
/* Mulai on pilih tabel: stays on screen while the page scrolls (short phones), over a strip of background. */
.sticky-foot {
  position: sticky; bottom: 0; z-index: 2; margin: -8px -16px calc(-24px - env(safe-area-inset-bottom));
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); background: linear-gradient(to bottom, transparent, var(--bg) 16px);
}
body.has-update .sticky-foot { bottom: calc(72px + env(safe-area-inset-bottom)); }
.note { display: flex; align-items: center; gap: 12px; background: var(--acc-soft); color: var(--acc-ink); border-radius: 16px; padding: 14px 16px; font-size: 15px; font-weight: 700; }

/* ---------- soal ---------- */
.progress { flex: 1; height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress > div { height: 100%; border-radius: 999px; background: var(--acc); transition: width .3s; }
.count { font-size: 16px; font-weight: 800; color: var(--muted); min-width: 40px; text-align: right; font-variant-numeric: tabular-nums; }
.q-area { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; min-height: 220px; }
.eq { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: min(56px, 12vw); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.eq .op { color: var(--muted); }
.ans {
  position: relative; min-width: 104px; height: 92px; padding: 0 16px; border-radius: 22px; border: 3px solid var(--acc);
  background: var(--card); display: inline-flex; align-items: center; justify-content: center; gap: 4px; font-size: min(56px, 12vw); font-weight: 800;
}
.ans.small { min-width: 80px; height: 84px; padding: 0 10px; }
.ans .caret { width: 4px; height: 52px; border-radius: 2px; background: var(--acc); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .ans .caret { animation: none; } .progress > div { transition: none; } }
.ans.ok { border-color: var(--ok); background: var(--ok-soft); color: var(--ok-ink); }
.ans.bad { border-color: var(--bad); background: var(--bad-soft); color: var(--bad-ink); }
.res-mark { position: absolute; top: -14px; right: -14px; width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; }
.res-mark.ok { background: var(--ok); } .res-mark.bad { background: var(--bad); }
:root[data-theme="dark"] .res-mark { color: #0B1530; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .res-mark { color: #0B1530; } }
.mode-pill { font-size: 15px; font-weight: 800; color: var(--acc-ink); background: var(--acc-soft); border-radius: 12px; padding: 4px 12px; }
.eq-wrap { position: relative; }
.right-msg { position: absolute; top: 100%; left: 0; right: 0; margin-top: 20px; text-align: center; font-size: 26px; font-weight: 800; color: var(--ok-ink); }
.keypad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.key {
  height: 64px; border-radius: 16px; background: var(--card); color: var(--ink); font-size: 30px; font-weight: 800;
  box-shadow: 0 3px 0 var(--key-shadow); display: flex; align-items: center; justify-content: center;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.key:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--key-shadow); }
.key.erase { background: var(--acc-soft); color: var(--acc-ink); }
.key.ok { background: var(--acc); color: var(--on-acc); box-shadow: 0 3px 0 var(--acc-dark); font-size: 22px; }
.key:disabled { opacity: .45; }
.after-wrong { display: flex; flex-direction: column; justify-content: flex-end; gap: 16px; }
.feedback { background: var(--card); border-radius: 22px; padding: 18px 20px; box-shadow: 0 2px 8px rgba(20, 33, 61, .10); display: flex; flex-direction: column; gap: 6px; }
.feedback .lbl { font-size: 17px; font-weight: 800; color: var(--bad-ink); }
.feedback .fact { display: flex; align-items: center; gap: 8px; font-size: min(40px, 10vw); font-weight: 800; flex-wrap: wrap; }
.feedback .because { font-size: 19px; font-weight: 800; color: var(--muted); }
.feedback .hl.inl { padding: 2px 10px; }
.hl { background: var(--ok-soft); color: var(--ok-ink); border-radius: 14px; padding: 2px 14px; }

/* ---------- Game Pecah Balon ---------- */
.ans .qm { color: var(--muted); opacity: .6; }
/* Same height as the Papan angka, so the soal sits where it does in Latihan. Balloons rise in, then bob gently;
   they never fly away (no hurry: Hafal has no speed condition). */
.balloons { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; height: 286px; overflow: hidden; padding-top: 8px; }
.balloon {
  position: relative; justify-self: center; width: 100%; max-width: 84px; height: 104px; color: #fff;
  border-radius: 50% 50% 46% 46% / 56% 56% 44% 44%; font-size: 36px; font-weight: 800; font-variant-numeric: tabular-nums;
  background: radial-gradient(circle at 32% 26%, rgba(255, 255, 255, .5), transparent 30%), var(--bc);
  box-shadow: inset -6px -8px 0 rgba(0, 0, 0, .12); touch-action: manipulation; user-select: none; -webkit-user-select: none;
  animation: bl-rise .7s ease-out both, bl-bob 2.6s ease-in-out .7s infinite alternate;
}
.balloon span { position: relative; z-index: 1; }
.balloon::before { /* knot */
  content: ''; position: absolute; left: 50%; bottom: -7px; margin-left: -6px; border: 6px solid transparent; border-bottom: 9px solid var(--bc); border-top: 0;
}
.balloon::after { /* string */
  content: ''; position: absolute; left: 50%; top: 100%; width: 2px; height: 70px; margin: 2px 0 0 -1px; background: var(--muted); opacity: .5; pointer-events: none;
}
.balloon.c0 { --bc: #7C3AED; margin-top: 40px; } .balloon.c1 { --bc: #2563EB; margin-top: 0; animation-delay: .08s, .78s; }
.balloon.c2 { --bc: #DB2777; margin-top: 56px; animation-delay: .16s, .86s; } .balloon.c3 { --bc: #EA580C; margin-top: 16px; animation-delay: .24s, .94s; }
.balloon:disabled { cursor: default; }
.balloons:has(.pop, .miss) .balloon:not(.pop):not(.miss) { opacity: .5; transition: opacity .2s; }
.balloon.pop { animation: bl-pop .35s ease-out forwards; }
.balloon.miss { animation: bl-miss .5s ease-in forwards; }
@keyframes bl-rise { from { transform: translateY(240px); } to { transform: none; } }
@keyframes bl-bob { from { transform: translateY(0); } to { transform: translateY(-10px); } }
@keyframes bl-pop { 0% { transform: scale(1); opacity: 1; } 60% { transform: scale(1.35); opacity: .8; } 100% { transform: scale(1.6); opacity: 0; } }
@keyframes bl-miss { to { transform: translateY(50px) scale(.65, .55); opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .balloon, .balloon.pop, .balloon.miss { animation: none; } .balloon.pop { opacity: 0; } .balloon.miss { opacity: .4; } }
/* The little balloons on the Beranda mode card and the pilih tabel note. */
.bl-tag { display: inline-flex; gap: 4px; align-items: flex-end; flex: none; }
.bl-tag i { font-style: normal; width: 24px; height: 30px; border-radius: 50% 50% 46% 46% / 56% 56% 44% 44%; background: var(--acc); color: var(--on-acc); font-size: 15px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.bl-tag i:nth-child(2) { margin-bottom: 8px; }

/* ---------- Game Cari Pasangan (copied from Kaliku) ---------- */
.board-wrap { position: relative; flex: 1; display: flex; flex-direction: column; }
.board { flex: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: minmax(76px, 1fr); gap: 10px; }
.board.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pk-card {
  position: relative; border-radius: 18px; display: flex; align-items: center; justify-content: center; font-weight: 800;
  white-space: nowrap; font-variant-numeric: tabular-nums; touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.pk-card.down { font-size: 40px; }
.pk-card.q.down { background: var(--acc); color: var(--on-acc); box-shadow: 0 3px 0 var(--acc-dark); }
.pk-card.a.down { background: var(--acc-soft); color: var(--acc-ink); box-shadow: 0 3px 0 var(--key-shadow); }
.pk-card.down:active { transform: translateY(2px); }
/* One card open: the face-down cards of the same kind can't be its pair, so they fade (a hint, still tappable). */
.board[data-want="a"] .pk-card.q.down, .board[data-want="q"] .pk-card.a.down { opacity: .35; }
.pk-card.down { transition: opacity .15s; }
.pk-card.up, .pk-card.done { background: var(--card); border: 3px solid var(--acc); color: var(--ink); font-size: min(26px, 7vw); }
.pk-card.a.up, .pk-card.a.done { font-size: min(36px, 10vw); }
.pk-card.up { animation: pk-flip .18s ease-out; }
.pk-card.done { background: var(--ok-soft); border-color: var(--ok-soft); color: var(--ok-ink); }
.pk-ok { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; background: var(--ok); color: #fff; display: flex; align-items: center; justify-content: center; }
:root[data-theme="dark"] .pk-ok { color: #0B1530; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pk-ok { color: #0B1530; } }
@keyframes pk-flip { from { transform: scaleX(.1); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .pk-card.up { animation: none; } }
.pk-hint { margin: 0; min-height: 52px; display: flex; align-items: center; justify-content: center; text-align: center; font-size: 19px; font-weight: 800; color: var(--acc-ink); }
.pk-how { width: 100%; text-align: left; min-height: 64px; }
.pk-how .txt { flex: 1; min-width: 0; }
.pk-how b { display: block; font-size: 17px; }
.pk-how small { display: block; font-size: 14px; font-weight: 700; opacity: .9; }
.pk-help-row { display: flex; align-items: center; gap: 12px; font-weight: 700; }
.pk-help-row b { white-space: nowrap; }
.pk-mini { flex: none; width: 40px; height: 50px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 800; }
.pk-mini.q { background: var(--acc); color: var(--on-acc); }
.pk-mini.a { background: var(--acc-soft); color: var(--acc-ink); }
.pk-help ol { margin: 4px 0 0; padding-left: 22px; font-weight: 700; line-height: 1.5; }
.pk-help ol li { margin: 2px 0; }
.pk-pop {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 2; pointer-events: none;
  display: flex; align-items: center; gap: 10px; white-space: nowrap; padding: 16px 22px; border-radius: 22px;
  background: var(--card); border: 3px solid var(--ok); font-size: min(40px, 10vw); font-weight: 800;
  box-shadow: 0 8px 30px rgba(8, 14, 30, .25);
}

/* ---------- Gambar Rahasia ---------- */
/* The picture (SVG) under a grid of keping: v0 covered, v1–v2 clearing up, v3 open. */
.gr-pic { position: relative; display: block; width: 100%; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--l0); }
.gr-svg, .gr-svg svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.gr-tiles { position: absolute; inset: 0; display: grid; }
.gt {
  display: flex; align-items: center; justify-content: center; min-width: 0; color: #fff; font-size: min(13px, 3.4vw); font-weight: 800;
  white-space: nowrap; letter-spacing: -.02em; font-variant-numeric: tabular-nums; text-shadow: 0 1px 2px rgba(0, 0, 0, .45);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22); transition: background-color .3s;
}
.gt.v3 { box-shadow: none; }
.gr-tiles.c5 .gt { font-size: min(10px, 2.7vw); letter-spacing: -.04em; }
.gr-pic.big .gr-tiles.c5 .gt { font-size: min(15px, 3.9vw); }
.gt.v0 { background: rgb(var(--veil)); } .gt.v1 { background: rgba(var(--veil), .78); } .gt.v2 { background: rgba(var(--veil), .5); } .gt.v3 { background: transparent; }
.gr-pic.big { border-radius: 18px; }
.gr-pic.big .gt { font-size: min(17px, 4.4vw); }
button.gt { min-height: 48px; }
.gambar-card {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; background: var(--card); color: var(--ink);
  border-radius: 18px; padding: 5px 14px 5px 5px; box-shadow: var(--shadow); min-height: 56px;
}
.gambar-card .thumb { flex: none; width: 46px; }
.gr-won-item .thumb { flex: none; width: 56px; }
.gambar-card .thumb .gr-pic, .gr-won-item .thumb .gr-pic { border-radius: 10px; }
.gambar-card .txt { flex: 1; min-width: 0; }
.gambar-card b { display: block; font-size: 17px; }
.gambar-card small { display: block; font-size: 14px; color: var(--muted); font-weight: 700; }
.gambar-card .chev { color: var(--muted); }
.gr-intro { margin: -4px 4px 0; font-size: 15px; font-weight: 700; color: var(--muted); line-height: 1.4; }
.gr-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.gr-card { display: flex; flex-direction: column; gap: 8px; padding: 10px; text-align: left; color: var(--ink); }
.gr-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.gr-head b { font-size: 16px; }
.gr-head small { font-size: 14px; font-weight: 800; color: var(--muted); }
.gr-name { font-size: 14px; font-weight: 800; color: var(--muted); text-align: center; }
.gr-name.done { color: var(--ok-ink); }
.gr-detail { gap: 12px; }
.gr-detail .round-btn { width: 44px; height: 44px; box-shadow: none; background: var(--line-soft); }
.gr-won { display: flex; flex-direction: column; gap: 10px; padding: 12px 16px; width: 100%; text-align: left; color: var(--ink); }
.gr-won-row { display: flex; flex-direction: column; gap: 10px; }
.gr-won-item { display: flex; align-items: center; gap: 12px; }
.gr-won-item b { display: block; font-size: 16px; }
.gr-won-item small { display: block; font-size: 14px; font-weight: 700; color: var(--muted); }
.gr-won-more { display: flex; align-items: center; gap: 4px; font-size: 15px; font-weight: 800; color: var(--purple-dark); }
:root[data-theme="dark"] .gr-won-more { color: var(--purple); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .gr-won-more { color: var(--purple); } }

/* ---------- hasil ---------- */
.result-top { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding-top: 12px; }
.result-top .party { font-size: 48px; line-height: 1; }
.result-top .score { display: flex; align-items: baseline; gap: 6px; font-size: 18px; font-weight: 800; color: var(--muted); }
.result-top .score b { font-size: 44px; color: var(--acc-ink); }
.result-top .time { font-size: 24px; font-weight: 800; line-height: 1.1; color: var(--acc-ink); font-variant-numeric: tabular-nums; }
.result-top .time b { font-size: 64px; }
.win-card { display: flex; align-items: center; gap: 14px; background: var(--acc); color: var(--on-acc); border-radius: 20px; padding: 16px; }
.win-card .em { font-size: 40px; line-height: 1; }
.win-card b { display: block; font-size: 20px; }
.win-card small { display: block; font-size: 14px; font-weight: 700; opacity: .92; }
.again-row { display: flex; justify-content: space-between; font-size: 17px; font-weight: 800; padding: 8px 0; border-top: 1px solid var(--line-soft); }
.again-row:first-of-type { border-top: 0; }
.again-row .a { color: var(--ok-ink); }

/* ---------- Peta Hafalan ---------- */
.peta-table { display: flex; flex-direction: column; gap: 10px; padding: 12px; }
.peta-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.peta-head b { font-size: 17px; }
.peta-head small { font-size: 14px; font-weight: 700; color: var(--muted); }
.peta-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
/* One soal per box, written out ("56 : 7"); readable on all four colours, light and dark. 48 px tall to tap. */
.pc {
  min-height: 48px; border-radius: 10px; display: flex; align-items: center; justify-content: center; padding: 0 2px;
  font-size: min(15px, 3.9vw); font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}
.pc.lv0 { color: var(--muted); } .pc.lv1, .pc.lv2 { color: #2A1608; } .pc.lv3 { color: #FFFFFF; }
:root[data-theme="dark"] .pc.lv0 { color: #C3CCDA; } :root[data-theme="dark"] .pc.lv3 { color: #08210F; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pc.lv0 { color: #C3CCDA; } :root:not([data-theme="light"]) .pc.lv3 { color: #08210F; } }
.peta-key { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; font-weight: 700; color: var(--muted); padding: 0 4px; }
.peta-key span { display: inline-flex; align-items: center; gap: 6px; }
.peta-key i { width: 14px; height: 14px; border-radius: 4px; }
.peta-key .lv0 { box-shadow: inset 0 0 0 1px var(--line); }
.peta-note { margin: -6px 4px 0; font-size: 14px; font-weight: 600; color: var(--muted); line-height: 1.35; }
.lv0 { background: var(--l0); } .lv1 { background: var(--l1); } .lv2 { background: var(--l2); } .lv3 { background: var(--l3); }
.legend { display: flex; flex-direction: column; gap: 12px; }
.legend-row { display: flex; align-items: flex-start; gap: 10px; }
.legend-row b { display: block; font-size: 16px; font-weight: 800; }
.legend-row small { display: block; font-size: 14px; font-weight: 600; color: var(--muted); line-height: 1.35; }
.legend i { width: 20px; height: 20px; border-radius: 5px; flex: none; margin-top: 1px; }
.legend .lv0 { box-shadow: inset 0 0 0 1px var(--line); }
.badge-chip { background: var(--purple-soft); color: var(--purple-ink); border-radius: 12px; padding: 6px 10px; font-size: 14px; font-weight: 800; }
.all-row { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 700; color: var(--muted); }
.all-row .bar { flex: 1; height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.all-row .bar i { display: block; height: 100%; background: var(--l3); }

/* ---------- settings / lists ---------- */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; font-weight: 700; }
.switch-row input { width: 26px; height: 26px; accent-color: var(--purple); flex: none; margin: 0; }
.list-card { background: var(--card); border-radius: 18px; padding: 4px 16px; box-shadow: var(--shadow); }
.list-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 8px 0; text-align: left; color: var(--ink); text-decoration: none; font-weight: 700; }
.list-item .txt { flex: 1; min-width: 0; }
.hist-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.hist-row:last-child { border-bottom: 0; }
.hist-row .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.hist-row .txt { flex: 1; min-width: 0; }
.hist-row b { display: block; font-size: 16px; }
.hist-row small { display: block; color: var(--muted); font-size: 13px; font-weight: 600; }
.hist-row .score { text-align: right; white-space: nowrap; font-size: 17px; font-weight: 800; }
.changelog h3 { font-size: 17px; margin: 14px 0 4px; }
.changelog ul { margin: 0; padding-left: 20px; color: var(--muted); font-size: 15px; }
.changelog li { margin: 3px 0; }

.info-pop { position: fixed; inset: 0; z-index: 30; background: rgba(8, 14, 30, .5); display: flex; align-items: center; justify-content: center; padding: 24px; }
.info-pop .card { max-width: 380px; width: 100%; gap: 10px; padding: 20px; }
.info-pop .info-title { font-size: 19px; }
.info-pop p { margin: 0; color: var(--muted); line-height: 1.5; }
.info-pop .btn { margin-top: 8px; }

.splash { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: var(--muted); text-align: center; padding: 24px; }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-size: 15px; font-weight: 700;
  max-width: calc(100% - 32px); z-index: 10; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.install-hint {
  position: fixed; left: 50%; top: calc(10px + env(safe-area-inset-top)); transform: translate(-50%, -16px);
  width: min(440px, calc(100% - 24px)); z-index: 11; display: flex; align-items: center; gap: 10px;
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; padding: 10px 8px 10px 12px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .14); opacity: 0; transition: opacity .25s, transform .25s;
}
.install-hint.show { opacity: 1; transform: translate(-50%, 0); }
.install-hint img { border-radius: 9px; flex: none; }
.install-text { flex: 1; font-size: 14px; line-height: 1.35; font-weight: 600; }
.install-go { flex: none; border: 0; border-radius: 10px; padding: 9px 14px; background: var(--purple); color: var(--on-purple); font: inherit; font-size: 14px; font-weight: 800; cursor: pointer; }
.install-x { flex: none; border: 0; background: none; color: var(--muted); padding: 6px; display: grid; place-items: center; cursor: pointer; }
.update-hint { top: auto; bottom: calc(12px + env(safe-area-inset-bottom)); transform: translate(-50%, 16px); }
.update-hint.show { transform: translate(-50%, 0); }
body.has-update { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }

/* Touch targets: at least 48 × 48 px to tap, without changing how controls look (invisible ::after area). */
.link-btn, .player-edit, .tbl .badge { position: relative; }
.link-btn::after, .player-edit::after { content: ''; position: absolute; }
.link-btn::after { inset: -12px -4px; }
.player-edit::after { inset: -4px; }
.tbl .badge { pointer-events: none; }
