/* Font disimpan di server sendiri (SIL OFL), tanpa Google Fonts. */
@font-face { font-family: 'Jakarta'; font-weight: 400 800; font-display: swap; src: url(../fonts/plus-jakarta-sans-400-800-normal-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Jakarta'; font-weight: 400 800; font-display: swap; src: url(../fonts/plus-jakarta-sans-400-800-normal-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1EFF, U+20A0-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Judul'; font-weight: 700; font-display: swap; src: url(../fonts/poppins-700-normal-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: 'Judul'; font-weight: 800; font-display: swap; src: url(../fonts/poppins-800-normal-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: 'Judul'; font-weight: 700; font-display: swap; src: url(../fonts/poppins-700-normal-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02FF, U+1E00-1EFF; }
@font-face { font-family: 'Judul'; font-weight: 800; font-display: swap; src: url(../fonts/poppins-800-normal-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02FF, U+1E00-1EFF; }

:root {
  --bg: #15111f;
  --bg-2: #1c1629;
  --muka: #241c35;
  --muka-2: #2e2443;
  --garis: rgba(255, 255, 255, .08);
  --garis-2: rgba(255, 255, 255, .14);
  --teks: #f8f2e9;
  --redup: #b6abc8;
  --samar: #82779a;
  --koral: #ff6b4a;
  --matahari: #ffc53d;
  --mint: #3ddc97;
  --langit: #4cc9f0;
  --ungu: #b784f7;
  --merah-muda: #ff7eb6;
  --bahaya: #ff5d6c;

  --r-kontrol: 8px;
  --r-kartu: 12px;
  --r-besar: 16px;
  --r-sheet: 22px;

  --bayang-1: 0 1px 0 rgba(255, 255, 255, .05) inset, 0 1px 2px rgba(0, 0, 0, .35), 0 2px 6px rgba(0, 0, 0, .2);
  --bayang-2: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 2px 4px rgba(0, 0, 0, .3), 0 8px 20px rgba(0, 0, 0, .28);
  --bayang-3: 0 1px 0 rgba(255, 255, 255, .07) inset, 0 6px 12px rgba(0, 0, 0, .3), 0 24px 48px rgba(0, 0, 0, .45);

  --pegas: cubic-bezier(.16, 1, .3, 1);
  --lenting: cubic-bezier(.34, 1.56, .64, 1);
  --cepat: .18s;

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  font-family: 'Jakarta', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--teks);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { font-family: 'Judul', 'Jakarta', sans-serif; line-height: 1.12; margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--langit); }
:focus-visible { outline: 3px solid var(--matahari); outline-offset: 2px; }

/* Latar bertitik halus: memberi tekstur tanpa gambar. */
.latar-titik {
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(255, 107, 74, .16), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(76, 201, 240, .12), transparent 60%),
    radial-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px) 0 0 / 22px 22px,
    var(--bg);
}

/* ---------- logo ---------- */
.logo { display: inline-flex; align-items: center; gap: .5em; font-family: 'Judul', sans-serif; font-weight: 800; letter-spacing: -.02em; text-transform: lowercase; }
.logo-tanda { width: 1.6em; height: 1.6em; flex: none; }

/* ---------- tombol ---------- */
.tombol {
  --tw: var(--koral);
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 48px; padding: .7em 1.3em;
  border: 0; border-radius: var(--r-kontrol);
  background: var(--tw); color: #1b1020;
  font-weight: 800; font-size: 1rem; letter-spacing: .01em;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .35) inset, 0 -3px 0 rgba(0, 0, 0, .18) inset, 0 2px 4px rgba(0, 0, 0, .3), 0 8px 18px color-mix(in srgb, var(--tw) 30%, transparent);
  transition: transform var(--cepat) var(--pegas), box-shadow var(--cepat) var(--pegas), filter var(--cepat), opacity var(--cepat);
  user-select: none; touch-action: manipulation;
  text-decoration: none;
}
.tombol:hover { filter: brightness(1.06); }
.tombol:active { transform: scale(.97); box-shadow: 0 1px 0 rgba(255, 255, 255, .3) inset, 0 -1px 0 rgba(0, 0, 0, .18) inset, 0 1px 2px rgba(0, 0, 0, .3); }
.tombol:disabled, .tombol[aria-disabled='true'] { opacity: .45; cursor: not-allowed; transform: none; }
.tombol.besar { min-height: 60px; font-size: 1.15rem; border-radius: 10px; }
.tombol.penuh { width: 100%; }
.tombol.hantu { --tw: transparent; background: rgba(255, 255, 255, .06); color: var(--teks); box-shadow: 0 0 0 1px var(--garis-2) inset; }
.tombol.hantu:active { box-shadow: 0 0 0 1px var(--garis-2) inset; }
.tombol.kecil { min-height: 38px; padding: .45em .9em; font-size: .9rem; }
.tombol.mint { --tw: var(--mint); }
.tombol.matahari { --tw: var(--matahari); }
.tombol.langit { --tw: var(--langit); }
.tombol.yakin { --tw: var(--bahaya); color: #fff; background: var(--bahaya); }

/* ---------- kartu ---------- */
.kartu {
  background: linear-gradient(180deg, rgba(255, 255, 255, .035), transparent 40%), var(--muka);
  border-radius: var(--r-kartu);
  box-shadow: var(--bayang-1), 0 0 0 1px var(--garis) inset;
  padding: 18px;
}

/* ---------- avatar ---------- */
.ava {
  --w: var(--koral);
  display: inline-grid; place-items: center; flex: none;
  width: 2.2em; height: 2.2em; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--w) 70%, #fff) 0, var(--w) 55%, color-mix(in srgb, var(--w) 70%, #000) 100%);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, .25), 0 2px 6px rgba(0, 0, 0, .35);
  font-size: 1em; line-height: 1;
}
.ava.sedang { font-size: 1.4em; }
.ava.besar { font-size: 2.6em; }
.putus .ava, .ava.putus { filter: grayscale(1) brightness(.6); }

.chip {
  display: inline-flex; align-items: center; gap: .4em;
  padding: .25em .7em; border-radius: 999px;
  background: rgba(255, 255, 255, .07); box-shadow: 0 0 0 1px var(--garis) inset;
  font-size: .85rem; font-weight: 700; color: var(--redup);
}

/* ---------- layar & transisi ---------- */
.panggung { position: relative; }
.layar { animation: none; }
.layar-masuk { animation: layarMasuk .32s var(--pegas) both; }
.layar-keluar { position: absolute; inset: 0; pointer-events: none; animation: layarKeluar .18s ease both; }
@keyframes layarMasuk { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes layarKeluar { to { opacity: 0; transform: translateY(-8px); } }
.datang { animation: datang .38s var(--lenting) both; }
.pergi { animation: pergi .22s ease both; pointer-events: none; }
@keyframes datang { from { opacity: 0; transform: scale(.85) translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pergi { to { opacity: 0; transform: scale(.9); } }
.bump { animation: bump .32s var(--lenting); }
@keyframes bump { 40% { transform: scale(1.18); } }
.muncul { animation: datang .5s var(--lenting) both; }
.muncul-2 { animation: datang .5s .12s var(--lenting) both; }
.muncul-3 { animation: datang .5s .24s var(--lenting) both; }

/* ---------- waktu ---------- */
.waktu { --sisa: 1; position: relative; width: 64px; height: 64px; display: grid; place-items: center; flex: none; }
.waktu svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.waktu circle { fill: none; stroke-width: 4; }
.waktu-jalur { stroke: rgba(255, 255, 255, .1); }
.waktu-isi { stroke: var(--matahari); stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: calc(1 - var(--sisa)); transition: stroke .3s; }
.waktu-angka { font-family: 'Judul', sans-serif; font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.waktu.mepet .waktu-isi { stroke: var(--koral); }
.waktu.mepet .waktu-angka { color: var(--koral); animation: bump .4s var(--lenting); }
.batang-waktu { --sisa: 1; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.batang-waktu i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--koral), var(--matahari)); transform-origin: left; transform: scaleX(var(--sisa)); border-radius: inherit; }

/* ---------- papan skor ---------- */
.papan { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.papan li {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: var(--r-kartu);
  background: var(--muka); box-shadow: var(--bayang-1), 0 0 0 1px var(--garis) inset;
  transition: transform .4s var(--pegas);
}
.papan li.juara { background: linear-gradient(90deg, rgba(255, 197, 61, .18), transparent 70%), var(--muka); box-shadow: var(--bayang-2), 0 0 0 1px rgba(255, 197, 61, .35) inset; }
.papan-no { width: 1.6em; text-align: center; font-family: 'Judul', sans-serif; color: var(--redup); }
.juara .papan-no { color: var(--matahari); }
.papan-nama { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.papan-plus { color: var(--mint); font-weight: 800; font-size: .9em; animation: datang .5s .2s var(--lenting) both; }
.papan-skor { font-family: 'Judul', sans-serif; font-variant-numeric: tabular-nums; min-width: 4.5ch; text-align: right; }

/* ---------- toast ---------- */
.toast-wadah { position: fixed; z-index: 90; left: 0; right: 0; top: max(12px, env(safe-area-inset-top)); display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 12px; }
.toast {
  pointer-events: auto; position: relative; overflow: hidden; touch-action: none;
  max-width: min(440px, 100%); padding: 12px 18px 14px; border-radius: var(--r-kartu);
  background: #322749; color: var(--teks); font-weight: 600; box-shadow: var(--bayang-3), 0 0 0 1px var(--garis-2) inset;
  animation: toastMasuk .45s var(--lenting) both;
}
.toast.galat { background: #4a1f2b; }
.toast.sukses { background: #17402f; }
.toast-bar { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--matahari); transform-origin: left; animation: toastBar var(--lama) linear both; }
.toast-pergi { animation: toastPergi .26s ease both; }
@keyframes toastMasuk { from { opacity: 0; transform: translateY(-24px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastPergi { to { opacity: 0; transform: translateY(-16px); } }
@keyframes toastBar { to { transform: scaleX(0); } }

/* ---------- sheet ---------- */
.sheet-latar { position: fixed; inset: 0; z-index: 80; background: rgba(8, 5, 14, .6); opacity: 0; transition: opacity .28s ease; }
.sheet-latar.buka { opacity: 1; }
.sheet {
  position: fixed; z-index: 81; left: 0; right: 0; bottom: 0;
  max-height: 88dvh; display: flex; flex-direction: column;
  background: var(--bg-2); border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  box-shadow: var(--bayang-3), 0 0 0 1px var(--garis-2) inset;
  transform: translateY(105%); transition: transform .42s var(--pegas);
  padding-bottom: env(safe-area-inset-bottom);
  touch-action: none;
}
.sheet::after { content: ''; position: absolute; left: 0; right: 0; top: 100%; height: 100vh; background: var(--bg-2); }
.sheet.buka { transform: translateY(0); }
.sheet.seret { transition: none; }
.sheet-pegangan { padding: 10px 0 6px; display: grid; place-items: center; cursor: grab; }
.sheet-pegangan i { width: 42px; height: 5px; border-radius: 3px; background: var(--garis-2); }
.sheet-isi { overflow: auto; padding: 4px 20px 22px; touch-action: pan-y; }
.sheet h2 { font-size: 1.3rem; margin-bottom: 14px; }
@media (min-width: 720px) {
  .sheet { left: 50%; right: auto; bottom: 50%; width: 440px; border-radius: var(--r-sheet); transform: translate(-50%, 60%) scale(.94); opacity: 0; transition: transform .38s var(--pegas), opacity .25s; }
  .sheet.buka { transform: translate(-50%, 50%) scale(1); opacity: 1; }
  .sheet::after { display: none; }
}

/* ---------- formulir ---------- */
.isian { display: grid; gap: 6px; }
.isian label { font-weight: 700; font-size: .9rem; color: var(--redup); }
.isian input {
  width: 100%; min-height: 54px; padding: 12px 14px;
  background: var(--muka); border: 0; border-radius: var(--r-kontrol);
  box-shadow: 0 0 0 1px var(--garis-2) inset, 0 2px 0 rgba(0, 0, 0, .2) inset;
  font-size: 1.15rem; font-weight: 700;
  transition: box-shadow var(--cepat);
}
.isian input:focus { outline: none; box-shadow: 0 0 0 2px var(--matahari) inset; }
.isian input::placeholder { color: var(--samar); font-weight: 500; }

.sambungan-putus {
  position: fixed; z-index: 70; left: 0; right: 0; margin: 0 auto; width: fit-content; max-width: calc(100% - 24px); bottom: max(16px, env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-radius: 999px; background: #4a1f2b; font-weight: 700; font-size: .95rem;
  box-shadow: var(--bayang-3); animation: toastMasuk .4s var(--lenting) both;
}
.putar { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .25); border-top-color: #fff; animation: putar .8s linear infinite; flex: none; }
@keyframes putar { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
