/* ============================================================
   Anak Pintar — gaya bersama untuk semua halaman
   ============================================================ */
:root {
  --bg1: #fff6d6;
  --bg2: #ffe0ec;
  --ink: #3a2e5c;
  --ink-soft: #6d6290;
  --white: #ffffff;
  --red: #ff5a5f;
  --orange: #ff9f1c;
  --yellow: #ffd23f;
  --green: #3ecf8e;
  --blue: #3fa7ff;
  --purple: #9b5de5;
  --pink: #ff70a6;
  --shadow: rgba(58, 46, 92, 0.18);
  --radius: 22px;
  --font: "Fredoka", "Baloo 2", "Comic Sans MS", system-ui, sans-serif;
}

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

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(160deg, var(--bg1) 0%, var(--bg2) 100%) fixed;
  min-height: 100vh;
  min-height: 100dvh;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  overflow-x: hidden;
}

button { font-family: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- Tombol ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  border: 0; cursor: pointer;
  font-size: 1.25rem; font-weight: 600;
  padding: .7em 1.4em;
  border-radius: 999px;
  background: var(--blue); color: #fff;
  box-shadow: 0 6px 0 rgba(0,0,0,.18), 0 10px 18px var(--shadow);
  transition: transform .08s, box-shadow .08s;
  text-decoration: none;
}
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0,0,0,.18), 0 4px 8px var(--shadow); }
.btn.green { background: var(--green); }
.btn.orange { background: var(--orange); }
.btn.pink { background: var(--pink); }
.btn.purple { background: var(--purple); }
.btn.red { background: var(--red); }
.btn.white { background: #fff; color: var(--ink); }
.btn.big { font-size: 1.7rem; padding: .8em 1.8em; }
.btn.round { width: 3rem; height: 3rem; padding: 0; font-size: 1.5rem; }

/* ---------- Top bar di halaman game ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: .6rem;
  padding: .6rem max(16px, env(safe-area-inset-left));
  background: rgba(255,255,255,.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 2px 10px var(--shadow);
}
.topbar .title {
  flex: 1; text-align: center;
  font-size: clamp(1.1rem, 4vw, 1.6rem); font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar .stars-pill {
  background: var(--yellow); border-radius: 999px;
  padding: .3em .8em; font-weight: 700; font-size: 1.1rem;
  box-shadow: 0 3px 0 rgba(0,0,0,.12);
}
.topbar .btn.round { box-shadow: 0 4px 0 rgba(0,0,0,.15); }

/* ---------- Area game ---------- */
.stage {
  width: 100%; max-width: 1000px; margin: 0 auto;
  padding: 16px;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.panel {
  background: #fff; border-radius: var(--radius);
  box-shadow: 0 8px 24px var(--shadow);
  padding: 18px;
}
.question {
  font-size: clamp(1.3rem, 5vw, 2rem); font-weight: 700; text-align: center;
  margin: 4px 0;
}
.big-emoji { font-size: clamp(4rem, 22vw, 9rem); line-height: 1; }

.choices {
  display: grid; gap: 14px; width: 100%; max-width: 640px;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}
.choice {
  border: 0; cursor: pointer;
  background: #fff; border-radius: var(--radius);
  font-size: clamp(2rem, 9vw, 3.4rem); font-weight: 700;
  min-height: 110px; padding: 10px;
  box-shadow: 0 6px 0 rgba(0,0,0,.1), 0 10px 20px var(--shadow);
  transition: transform .1s;
}
.choice:active { transform: scale(.95); }
.choice.correct { background: var(--green); color: #fff; }
.choice.wrong { background: var(--red); color: #fff; }

/* progres titik-titik */
.progress { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.progress .dot {
  width: 16px; height: 16px; border-radius: 50%;
  background: rgba(58,46,92,.15);
  transition: background .2s, transform .2s;
}
.progress .dot.done { background: var(--green); transform: scale(1.15); }
.progress .dot.now { background: var(--yellow); transform: scale(1.3); }

/* ---------- Animasi ---------- */
@keyframes shake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-10px)} 40%{transform:translateX(10px)} 60%{transform:translateX(-7px)} 80%{transform:translateX(7px)} }
@keyframes bounce { 0%,100%{transform:scale(1)} 40%{transform:scale(1.2)} 70%{transform:scale(.95)} }
@keyframes pop-in { 0%{transform:scale(0); opacity:0} 70%{transform:scale(1.1); opacity:1} 100%{transform:scale(1)} }
@keyframes float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-10px)} }
@keyframes wiggle { 0%,100%{transform:rotate(0)} 25%{transform:rotate(-8deg)} 75%{transform:rotate(8deg)} }
.shake { animation: shake .45s; }
.bounce { animation: bounce .5s; }
.pop-in { animation: pop-in .4s both; }
.float { animation: float 2.4s ease-in-out infinite; }
.wiggle { animation: wiggle .5s; }

/* ---------- Feedback melayang ---------- */
.feedback {
  position: fixed; left: 50%; top: 40%; z-index: 300;
  transform: translate(-50%, -50%);
  font-size: clamp(2rem, 9vw, 3.5rem); font-weight: 700;
  padding: .3em .9em; border-radius: 999px;
  background: #fff; box-shadow: 0 10px 30px var(--shadow);
  pointer-events: none;
  animation: fb 1s forwards;
  white-space: nowrap;
}
.feedback.ok { color: var(--green); }
.feedback.no { color: var(--red); }
@keyframes fb {
  0% { opacity: 0; transform: translate(-50%,-30%) scale(.6); }
  20% { opacity: 1; transform: translate(-50%,-50%) scale(1.05); }
  75% { opacity: 1; transform: translate(-50%,-55%) scale(1); }
  100% { opacity: 0; transform: translate(-50%,-75%) scale(.9); }
}

/* ---------- Layar mulai & modal menang ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  background: rgba(58,46,92,.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.overlay .box {
  background: #fff; border-radius: 30px;
  width: 100%; max-width: 420px;
  padding: 28px 22px; text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
  animation: pop-in .4s both;
}
.overlay .box h2 { margin: .2em 0; font-size: 2rem; }
.overlay .box p { margin: .4em 0 1em; font-size: 1.2rem; color: var(--ink-soft); }
.overlay .box .btns { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.win-stars { font-size: 3.4rem; letter-spacing: .1em; margin: .1em 0; }
.win-stars span { display: inline-block; animation: pop-in .4s both; }
.win-stars span.off { filter: grayscale(1); opacity: .3; }

/* gerbang orang tua */
.pg-show {
  font-size: 2.4rem; font-weight: 700; letter-spacing: .1em;
  background: #f4f1ff; border-radius: 16px; padding: .2em; margin: 0 auto 12px; max-width: 200px;
}
.pg-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 280px; margin: 0 auto; }
.pg-pad .btn { padding: .55em 0; font-size: 1.4rem; }

#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 250; }

/* ---------- Halaman menu (index) ---------- */
.hero {
  text-align: center; padding: 28px 16px 8px;
}
.hero .logo { font-size: clamp(2.2rem, 8vw, 3.6rem); font-weight: 700; margin: 0; line-height: 1.1; }
.hero .logo span:nth-child(1){color:var(--red)} .hero .logo span:nth-child(2){color:var(--orange)}
.hero .logo span:nth-child(3){color:var(--green)} .hero .logo span:nth-child(4){color:var(--blue)}
.hero .logo span:nth-child(5){color:var(--purple)} .hero .logo span:nth-child(6){color:var(--pink)}
.hero .sub { font-size: 1.2rem; color: var(--ink-soft); margin: .4em 0 0; }
.hero .total { display: inline-block; margin-top: 12px; }

.filters {
  display: flex; gap: 10px; flex-wrap: wrap; justify-content: center;
  padding: 12px 16px;
}
.chip {
  border: 0; cursor: pointer;
  background: #fff; border-radius: 999px;
  padding: .5em 1em; font-size: 1.05rem; font-weight: 600;
  box-shadow: 0 4px 0 rgba(0,0,0,.08);
}
.chip.active { background: var(--ink); color: #fff; }

.grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  max-width: 1100px; margin: 0 auto; padding: 8px 16px 40px;
}
.game-card {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-decoration: none; color: #fff;
  border-radius: 26px; padding: 18px 10px 14px;
  min-height: 190px;
  box-shadow: 0 7px 0 rgba(0,0,0,.15), 0 12px 24px var(--shadow);
  transition: transform .15s;
  overflow: hidden;
}
.game-card:hover { transform: translateY(-4px) rotate(-1deg); }
.game-card:active { transform: scale(.96); }
.game-card::before {
  content: ""; position: absolute; width: 140px; height: 140px; border-radius: 50%;
  background: rgba(255,255,255,.18); top: -50px; right: -40px;
}
.game-card .emo { font-size: 4.2rem; line-height: 1; filter: drop-shadow(0 4px 4px rgba(0,0,0,.15)); }
.game-card .name { font-size: 1.25rem; font-weight: 700; margin-top: 10px; text-align: center; line-height: 1.15; }
.game-card .meta { font-size: .9rem; opacity: .92; margin-top: 4px; }
.game-card .mystars {
  position: absolute; top: 10px; left: 10px;
  background: rgba(255,255,255,.9); color: var(--ink);
  font-size: .85rem; font-weight: 700; border-radius: 999px; padding: 2px 8px;
}

.footer { text-align: center; color: var(--ink-soft); padding: 0 16px 30px; font-size: .95rem; }

@media (max-width: 420px) {
  .topbar { gap: .35rem; padding-left: 10px; padding-right: 10px; }
  .topbar .btn.round { width: 2.5rem; height: 2.5rem; font-size: 1.2rem; }
  .topbar .stars-pill { font-size: .95rem; padding: .25em .6em; }
  .topbar .title { font-size: 1.05rem; }
  .topbar .title .t-emo { display: none; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .game-card { min-height: 160px; }
  .game-card .emo { font-size: 3.4rem; }
  .game-card .name { font-size: 1.05rem; }
}
