/* =========================================================
   Pintar Ceria — gaya "stiker mainan"
   Garis tebal biru tua + bayangan padat, warna ceria per pelajaran
   ========================================================= */
:root {
  --ink: #1D2B53;
  --paper: #FFF9E6;
  --sun: #FFD84D;
  --sky: #BDE8FF;
  --grass: #3DBE6A;
  --berry: #E5484D;
  --line: 3px solid var(--ink);
  --pop: 4px 4px 0 var(--ink);
  --pop-sm: 3px 3px 0 var(--ink);
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;
  --font: "Baloo 2", "Comic Neue", "Trebuchet MS", system-ui, sans-serif;
}
* { box-sizing: border-box; }
:root { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
html, body { margin: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background-color: var(--sky);
  background-image:
    radial-gradient(circle at 20px 20px, rgba(255,255,255,.55) 3px, transparent 4px);
  background-size: 40px 40px;
  min-height: 100vh;
  font-size: 18px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}
#app { max-width: 880px; margin: 0 auto; padding: 12px 16px 48px; }
h1, h2, h3 { margin: 0 0 .3em; line-height: 1.15; font-weight: 800; }
h1 { font-size: clamp(1.7rem, 5vw, 2.4rem); }
h2 { font-size: 1.5rem; }
button { font-family: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 4px solid #FF6B00; outline-offset: 3px; }

/* ---------- Tombol ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 1.1rem; font-weight: 700;
  padding: 12px 22px; min-height: 52px;
  border: var(--line); border-radius: var(--r-md);
  background: #fff; box-shadow: var(--pop);
  transition: transform .08s, box-shadow .08s;
}
.btn:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn-primary { background: var(--sun); }
.btn-secondary { background: #fff; }
.btn-ghost { background: transparent; box-shadow: none; border-style: dashed; }
.btn-danger { background: var(--berry); color: #fff; }
.btn-google { background: #fff; }
.btn-block { width: 100%; margin-top: 12px; }
.btn-sm { font-size: .95rem; min-height: 40px; padding: 6px 14px; box-shadow: var(--pop-sm); }
.link { background: none; border: 0; padding: 0; font-weight: 800; text-decoration: underline; font-size: inherit; }
.icon-btn {
  width: 46px; height: 46px; font-size: 1.3rem;
  border: var(--line); border-radius: 50%; background: #fff; box-shadow: var(--pop-sm);
}

/* ---------- Topbar ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.brand { font-weight: 800; font-size: 1.25rem; display: inline-flex; align-items: center; gap: 8px; }
.brand img { border-radius: 10px; border: 2px solid var(--ink); }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.coin-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--sun); border: var(--line); border-radius: 999px;
  padding: 4px 14px; font-size: 1.1rem; box-shadow: var(--pop-sm); min-height: 46px;
}
.avatar-btn {
  width: 50px; height: 50px; font-size: 1.8rem; border: var(--line); border-radius: 50%;
  background: #fff; box-shadow: var(--pop-sm); display: grid; place-items: center;
}

/* ---------- Kartu umum ---------- */
.card {
  background: var(--paper); border: var(--line); border-radius: var(--r-lg);
  box-shadow: 6px 6px 0 var(--ink); padding: 24px;
}
.narrow { max-width: 520px; margin: 12px auto; }
.center { text-align: center; }
.hint { font-size: .95rem; opacity: .8; margin: 10px 0 0; }
.warn { color: #9B2C00; opacity: 1; }
.empty { text-align: center; padding: 32px 12px; font-size: 1.1rem; }
.big-emoji { font-size: 4rem; line-height: 1; margin: 8px 0; }
.banner {
  background: #fff; border: var(--line); border-radius: var(--r-md);
  padding: 10px 14px; margin-top: 12px; font-size: 1rem;
}
.loading { display: grid; place-items: center; padding: 60px 0; font-size: 1.1rem; }
.spin { font-size: 3rem; display: inline-block; animation: spin 1.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Login ---------- */
.login { min-height: 90vh; display: grid; align-content: center; gap: 28px; text-align: center; }
.login-logo { margin: 0 auto; width: min(420px, 86vw); }
.login-logo img { width: 100%; height: auto; display: block; filter: drop-shadow(5px 5px 0 rgba(29,43,83,.9)); }
.lead { font-size: 1.3rem; font-weight: 600; max-width: 26ch; margin: 0 auto; }
.hero-emojis { display: flex; justify-content: center; gap: 10px; margin-bottom: 12px; }
.hero-emojis span {
  font-size: 2.2rem; width: 64px; height: 64px; display: grid; place-items: center;
  background: #fff; border: var(--line); border-radius: 18px; box-shadow: var(--pop-sm);
}
.hero-emojis span:nth-child(odd) { transform: rotate(-6deg); }
.hero-emojis span:nth-child(even) { transform: rotate(5deg) translateY(6px); }
.login-actions { display: grid; gap: 14px; max-width: 360px; margin: 0 auto; width: 100%; }

/* ---------- Beranda ---------- */
.greet { margin: 8px 0 20px; }
.greet p { margin: 0; font-size: 1.2rem; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.cat-card {
  background: var(--c); border: var(--line); border-radius: var(--r-lg); box-shadow: var(--pop);
  padding: 18px 12px; display: grid; justify-items: center; gap: 4px; text-align: center; color: #fff;
  transition: transform .1s;
}
.cat-card:nth-child(odd) { transform: rotate(-1.2deg); }
.cat-card:nth-child(even) { transform: rotate(1.2deg); }
.cat-card:active { transform: translate(3px, 3px) rotate(0); box-shadow: 1px 1px 0 var(--ink); }
.cat-emoji {
  font-size: 2.6rem; width: 76px; height: 76px; display: grid; place-items: center;
  background: #fff; border: var(--line); border-radius: 50%;
}
.cat-title { font-size: 1.3rem; font-weight: 800; text-shadow: 2px 2px 0 var(--ink); }
.cat-meta { font-size: .9rem; font-weight: 600; background: rgba(29,43,83,.35); border-radius: 999px; padding: 0 10px; }
.quick { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.quick .btn { flex: 1 1 200px; }

/* ---------- Kategori ---------- */
.cat-head {
  display: flex; align-items: center; gap: 16px; background: var(--c); color: #fff;
  border: var(--line); border-radius: var(--r-lg); box-shadow: var(--pop); padding: 14px 18px; margin-bottom: 18px;
}
.cat-head h1 { margin: 0; text-shadow: 2px 2px 0 var(--ink); }
.game-list { display: grid; gap: 12px; }
.game-item {
  display: flex; align-items: center; gap: 14px; text-align: left;
  background: #fff; border: var(--line); border-left: 12px solid var(--c);
  border-radius: var(--r-md); box-shadow: var(--pop-sm); padding: 12px 14px;
}
.game-item:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.game-item.locked { background: #EDEDED; }
.game-emoji { font-size: 2rem; width: 54px; text-align: center; flex: none; }
.game-info { display: grid; flex: 1; }
.game-info b { font-size: 1.2rem; }
.game-info small { font-size: .95rem; opacity: .8; }
.tag { color: #7A4A00; font-weight: 700; opacity: 1 !important; }
.stars { color: #F5A300; font-size: 1.3rem; letter-spacing: 1px; -webkit-text-stroke: 1px var(--ink); flex: none; }
.stars i { font-style: normal; color: #fff; }

/* ---------- Bermain ---------- */
.play-bar .progress {
  flex: 1; height: 22px; border: var(--line); border-radius: 999px; background: #fff; overflow: hidden;
}
.progress div { height: 100%; background: var(--c); transition: width .3s; }
.practice-note { text-align: center; margin: -6px 0 10px; font-weight: 700; font-size: .95rem; }
.question {
  background: var(--paper); border: var(--line); border-radius: var(--r-lg);
  box-shadow: 6px 6px 0 var(--ink); padding: 20px; text-align: center;
  border-top: 14px solid var(--c);
}
.q-count { margin: 0 0 6px; font-weight: 700; opacity: .7; font-size: 1rem; }
.q-visual { font-size: clamp(2.6rem, 10vw, 4.2rem); line-height: 1.25; margin: 6px 0 10px; word-break: break-word; }
.q-visual.small { font-size: clamp(1.8rem, 6vw, 2.6rem); }
.q-text { font-size: clamp(1.35rem, 4.5vw, 1.9rem); max-width: 30ch; margin: 0 auto 10px; }
.btn-listen { min-height: 42px; font-size: 1rem; padding: 4px 16px; margin-bottom: 16px; }
.options { display: grid; grid-template-columns: 1fr; gap: 12px; }
.options.big { grid-template-columns: repeat(2, 1fr); }
.options.two { grid-template-columns: repeat(2, 1fr); }
.opt {
  position: relative; font-size: 1.25rem; font-weight: 700; padding: 14px 12px; min-height: 64px;
  background: #fff; border: var(--line); border-radius: var(--r-md); box-shadow: var(--pop);
}
.options.big .opt { font-size: 2rem; min-height: 86px; }
.opt:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.opt:disabled { cursor: default; }
.opt.right { background: #9BE8B4; }
.opt.wrong { background: #FFB3B5; }
.pop { animation: pop .35s; }
.shake { animation: shake .4s; }
@keyframes pop { 50% { transform: scale(1.08); } }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.float-coin {
  position: absolute; right: 10px; top: -8px; font-size: 1.1rem; font-weight: 800;
  background: var(--sun); border: 2px solid var(--ink); border-radius: 999px; padding: 0 8px;
  animation: floatUp 1s forwards;
}
@keyframes floatUp { to { transform: translateY(-30px); opacity: 0; } }
.streak { font-weight: 800; margin: 14px 0 0; }

/* ---------- Hasil ---------- */
.result-stars { font-size: 4.5rem; line-height: 1; margin-bottom: 8px; }
.result-stars span { color: #fff; -webkit-text-stroke: 3px var(--ink); display: inline-block; }
.result-stars span.on { color: #FFC21A; animation: starIn .5s backwards; }
.result-stars span:nth-child(2) { font-size: 1.3em; animation-delay: .15s; }
.result-stars span:nth-child(3) { animation-delay: .3s; }
@keyframes starIn { from { transform: scale(0) rotate(-90deg); } }
.result-score { font-size: 1.25rem; margin: 0; }
.result-coin {
  display: inline-block; font-size: 2rem; font-weight: 800; margin: 12px 0;
  background: var(--sun); border: var(--line); border-radius: 999px; padding: 4px 22px; box-shadow: var(--pop-sm);
}
.result-actions { display: grid; gap: 10px; margin-top: 16px; }

/* ---------- Form profil ---------- */
.field { display: grid; gap: 6px; margin: 14px 0; font-weight: 700; }
.field input {
  font: inherit; font-size: 1.15rem; padding: 10px 14px; border: var(--line); border-radius: var(--r-sm); background: #fff;
}
.seg { display: flex; gap: 10px; }
.seg-btn { flex: 1; font-size: 1.1rem; font-weight: 700; padding: 10px; border: var(--line); border-radius: var(--r-sm); background: #fff; }
.seg-btn.on { background: var(--sun); box-shadow: var(--pop-sm); }
.avatar-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.avatar-opt { font-size: 1.9rem; aspect-ratio: 1; border: var(--line); border-radius: var(--r-sm); background: #fff; }
.avatar-opt.on { background: var(--sun); box-shadow: var(--pop-sm); transform: scale(1.06); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.stats div { background: #fff; border: var(--line); border-radius: var(--r-sm); padding: 8px 4px; }
.stats b { display: block; font-size: 1.4rem; }
.stats span { font-size: .8rem; line-height: 1.1; display: block; }

/* ---------- Toko ---------- */
.shop-head { margin-bottom: 14px; }
.tabs { display: flex; gap: 8px; }
.tab { flex: 1; font-size: 1.1rem; font-weight: 700; padding: 10px; border: var(--line); border-radius: var(--r-sm); background: #fff; }
.tab.on { background: var(--sun); box-shadow: var(--pop-sm); }
.shop-balance { font-size: 1.15rem; margin: 0 0 14px; }
.reward-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.reward {
  background: #fff; border: var(--line); border-radius: var(--r-md); box-shadow: var(--pop-sm);
  padding: 14px; text-align: center; display: grid; gap: 4px; justify-items: center;
}
.reward-emoji { font-size: 3rem; line-height: 1.1; }
.reward h3 { font-size: 1.1rem; margin: 0; }
.reward-cost { margin: 0; font-weight: 800; }
.mini-bar { width: 100%; height: 10px; border: 2px solid var(--ink); border-radius: 999px; overflow: hidden; background: #fff; }
.mini-bar div { height: 100%; background: var(--grass); }
.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.history li {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: #fff; border: var(--line); border-radius: var(--r-md); padding: 10px 14px;
}
.history li > div { flex: 1; display: grid; min-width: 140px; }
.h-emoji { font-size: 2rem; }
.history small { font-size: .9rem; opacity: .8; }
.note { font-style: italic; }
.status { font-weight: 700; font-size: .95rem; padding: 2px 10px; border-radius: 999px; border: 2px solid var(--ink); }
.s-pending { background: #FFF1B8; }
.s-approved { background: #C6F3D4; }
.s-rejected { background: #FFD0D1; }
.s-delivered { background: #D8E7FF; }

/* ---------- Papan juara ---------- */
.lb { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.lb li { display: flex; align-items: center; gap: 10px; background: #fff; border: var(--line); border-radius: var(--r-sm); padding: 8px 12px; }
.lb li.me { background: var(--sun); }
.rank { width: 34px; text-align: center; font-weight: 800; font-size: 1.2rem; }
.lb-av { font-size: 1.7rem; }
.lb-name { flex: 1; display: grid; font-weight: 700; }
.lb-name small { font-weight: 500; opacity: .7; font-size: .85rem; }

/* ---------- Pasang aplikasi ---------- */
.btn-install {
  width: 100%; margin-top: 16px; justify-content: flex-start; gap: 14px; text-align: left;
  background: #fff; padding: 10px 16px; min-height: 64px;
}
.btn-install img { border-radius: 12px; border: 2px solid var(--ink); flex: none; }
.btn-install span { display: grid; line-height: 1.2; }
.btn-install small { font-weight: 500; font-size: .9rem; opacity: .8; }
.install-preview { display: grid; justify-items: center; gap: 4px; margin: 4px 0 10px; font-weight: 700; font-size: .95rem; }
.install-preview img { border-radius: 18px; border: 3px solid var(--ink); box-shadow: var(--pop-sm); }
.install-steps { text-align: left; padding-left: 1.3em; margin: 8px 0; display: grid; gap: 8px; }
.kbd { display: inline-block; background: #fff; border: 2px solid var(--ink); border-radius: 8px; padding: 0 6px; line-height: 1.4; }

/* ---------- Modal & toast ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(29,43,83,.55); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { background: var(--paper); border: var(--line); border-radius: var(--r-lg); box-shadow: 6px 6px 0 var(--ink); padding: 22px; width: min(420px, 100%); text-align: center; }
.modal-body p { margin: 6px 0 0; }
.modal-body label { display: grid; text-align: left; gap: 4px; margin-top: 10px; font-weight: 700; }
.modal-body input, .modal-body textarea, .modal-body select { font: inherit; padding: 8px 12px; border: var(--line); border-radius: var(--r-sm); }
.modal-actions { display: flex; gap: 10px; justify-content: center; margin-top: 18px; }
.modal-actions .btn { flex: 1; }
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 120px); background: #fff; border: var(--line); border-radius: var(--r-md);
  box-shadow: var(--pop-sm); padding: 10px 18px; font-weight: 700; z-index: 60; transition: transform .25s; max-width: 90vw; text-align: center;
}
.toast.show { transform: translate(-50%, 0); }
.toast-success { background: #C6F3D4; }
.toast-error { background: #FFD0D1; }
.confetti { position: fixed; top: -40px; z-index: 70; pointer-events: none; animation: fall 3s ease-in forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }

@media (max-width: 420px) {
  .avatar-grid { grid-template-columns: repeat(4, 1fr); }
  .cat-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .cat-emoji { width: 62px; height: 62px; font-size: 2.1rem; }
  .card { padding: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
