@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@500;700;800&family=Nunito:wght@400;600;700;800&display=swap');

:root {
  --primary: #E7508F;
  --primary-dark: #C13B72;
  --sky: #2FA0CF;
  --sky-dark: #1D7CA6;
  --bg: #FFFDF7;
  --ink: #3A2E28;
  --muted: #8A7B72;
  --card-radius: 26px;
  color-scheme: light;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Nunito', sans-serif;
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

h1, h2, h3, .headline { font-family: 'Baloo 2', sans-serif; }

.app-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px calc(env(safe-area-inset-top, 0px) + 8px);
  padding-top: max(16px, env(safe-area-inset-top));
}

.back-btn {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: none;
  background: #fff;
  box-shadow: 0 4px 0 #E7DCCF;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  cursor: pointer;
}
.back-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #E7DCCF; }

.app-header h1 {
  font-size: 22px;
  margin: 0;
  color: var(--primary-dark);
}

.hub-wrap, .page-wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 8px 20px 48px;
}

.hero {
  text-align: center;
  padding: 12px 0 20px;
}
.hero h1 {
  font-size: 34px;
  margin: 8px 0 4px;
  color: var(--primary-dark);
}
.hero p { margin: 0; color: var(--muted); font-weight: 600; }
.hero .rainbow-strip {
  height: 14px;
  border-radius: 8px;
  margin: 18px auto 0;
  max-width: 320px;
  background: linear-gradient(90deg,#EF4444,#F97316,#FACC15,#22C55E,#3B82F6,#6366F1,#A855F7);
}

.card-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr;
}
@media (min-width: 480px) {
  .card-grid { grid-template-columns: 1fr 1fr; }
}

.mode-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  background: #fff;
  border-radius: var(--card-radius);
  padding: 26px 18px;
  text-decoration: none;
  color: var(--ink);
  box-shadow: 0 6px 0 #EFE3D4;
  transition: transform .12s ease;
}
.mode-card:active { transform: translateY(4px); box-shadow: 0 2px 0 #EFE3D4; }
.mode-card .emoji { font-size: 56px; }
.mode-card h2 { margin: 0; font-size: 20px; color: var(--primary-dark); }
.mode-card p { margin: 0; color: var(--muted); font-size: 14px; font-weight: 600; }

.btn {
  font-family: 'Baloo 2', sans-serif;
  font-weight: 700;
  font-size: 17px;
  border: none;
  border-radius: 16px;
  padding: 14px 26px;
  cursor: pointer;
  color: #fff;
  background: var(--primary);
  box-shadow: 0 5px 0 var(--primary-dark);
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--primary-dark); }
.btn.secondary {
  background: var(--sky);
  box-shadow: 0 5px 0 var(--sky-dark);
}
.btn.ghost {
  background: #fff;
  color: var(--primary-dark);
  box-shadow: 0 5px 0 #EFE3D4;
}

.center-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 700;
  font-family: 'Baloo 2', sans-serif;
  opacity: 0;
  transition: all .25s ease;
  pointer-events: none;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

#confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 60;
}
.confetti-piece {
  position: absolute;
  top: -20px;
  border-radius: 3px;
  animation: confetti-fall linear forwards;
}
@keyframes confetti-fall {
  to { transform: translateY(110vh) rotate(540deg); opacity: .9; }
}

.install-hint {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  margin-top: 28px;
}

/* ---- Susun Pelangi ---- */
.pony-mount {
  width: 160px;
  margin: 6px auto 0;
  animation: pony-bob 2.2s ease-in-out infinite;
}
.pony-mount.cheer { animation: pony-cheer 0.6s ease-in-out infinite; }
@keyframes pony-bob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-6px) rotate(-2deg); }
}
@keyframes pony-cheer {
  0%, 100% { transform: translateY(0) scale(1) rotate(0deg); }
  50% { transform: translateY(-18px) scale(1.06) rotate(4deg); }
}

.arc-wrap {
  position: relative;
  width: 340px;
  height: 186px;
  margin: 8px auto 0;
  max-width: 100%;
}
.arc-stage {
  position: absolute;
  inset: 0;
  z-index: 2;
}
.arc-cloud {
  position: absolute;
  width: 76px;
  height: auto;
  z-index: 1;
  filter: drop-shadow(0 3px 3px rgba(0,0,0,0.08));
}
.arc-cloud-left { left: -20px; bottom: -8px; }
.arc-cloud-right { right: -20px; bottom: -8px; transform: scaleX(-1); }

.arc-band {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  box-sizing: border-box;
  border-style: solid;
  border-bottom: none;
  border-radius: 999px 999px 0 0;
  transition: border-color .25s ease, box-shadow .25s ease;
  cursor: pointer;
}
.arc-band.filled { box-shadow: 0 0 14px rgba(0,0,0,0.08) inset; cursor: default; }
.arc-band.pulse { animation: arc-pulse .5s ease; }
.arc-band.hint-shake { animation: arc-shake .4s ease; }
@keyframes arc-pulse {
  0% { transform: translateX(-50%) scale(1); }
  40% { transform: translateX(-50%) scale(1.05); }
  100% { transform: translateX(-50%) scale(1); }
}
@keyframes arc-shake {
  0%, 100% { transform: translateX(-50%); }
  25% { transform: translateX(calc(-50% - 8px)); }
  75% { transform: translateX(calc(-50% + 8px)); }
}

.chip-tray {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-top: 24px;
  min-height: 76px;
}
.color-chip {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 3px solid rgba(0,0,0,0.12);
  box-shadow: 0 5px 0 rgba(0,0,0,0.15);
  cursor: pointer;
  position: relative;
  z-index: 5;
  transition: transform .15s ease, box-shadow .15s ease;
}
.color-chip.selected {
  transform: translateY(-8px) scale(1.1);
  box-shadow: 0 12px 0 rgba(0,0,0,0.12), 0 0 0 4px var(--primary);
}
.color-chip.placed { visibility: hidden; }

.win-banner {
  text-align: center;
  margin-top: 18px;
}
.win-banner h2 {
  color: var(--primary-dark);
  font-size: 24px;
  margin: 0 0 10px;
}

/* ---- Pakaikan Boneka ---- */
.doll-stage {
  width: 220px;
  margin: 4px auto 12px;
}
.doll-stage svg { width: 100%; height: auto; display: block; }

.cat-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 16px;
}
.cat-tab {
  flex: 0 0 auto;
  border: none;
  background: #fff;
  border-radius: 14px;
  padding: 10px 16px;
  font-family: 'Baloo 2', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--muted);
  box-shadow: 0 4px 0 #EFE3D4;
  cursor: pointer;
  white-space: nowrap;
}
.cat-tab.active {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 4px 0 var(--primary-dark);
}

.picker-section { margin-bottom: 18px; }
.picker-label {
  font-family: 'Baloo 2', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 8px 4px;
}
.shape-row, .color-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.shape-btn {
  min-height: 52px;
  padding: 10px 18px;
  border-radius: 16px;
  border: 3px solid transparent;
  background: #fff;
  box-shadow: 0 4px 0 #EFE3D4;
  cursor: pointer;
  font-family: 'Baloo 2', sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
}
.shape-btn.active { border-color: var(--primary); color: var(--primary-dark); }
.color-dot {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid transparent;
  box-shadow: 0 3px 0 rgba(0,0,0,0.15);
  cursor: pointer;
}
.color-dot.active { border-color: var(--ink); transform: scale(1.1); }

/* ---- Hias Pemandangan ---- */
.scene-wrap {
  position: relative;
  width: 100%;
  max-width: 460px;
  margin: 8px auto 0;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 6px 0 #EFE3D4;
  aspect-ratio: 400 / 460;
}
.scene-bg { width: 100%; height: 100%; display: block; }
.sticker-layer { position: absolute; inset: 0; }
.sticker {
  position: absolute;
  font-size: 34px;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  transform: translate(-50%, -50%);
  animation: sticker-pop 0.25s ease;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.15));
}
@keyframes sticker-pop {
  from { transform: translate(-50%, -50%) scale(0); }
  to { transform: translate(-50%, -50%) scale(1); }
}

.sticker-tray {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 10px;
  padding: 14px 4px;
  margin-top: 6px;
}
.sticker-btn {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  border: none;
  background: #fff;
  box-shadow: 0 4px 0 #EFE3D4;
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.sticker-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #EFE3D4; }
.sticker-btn.selected {
  transform: translateY(-6px) scale(1.08);
  box-shadow: 0 10px 0 rgba(0,0,0,0.1), 0 0 0 3px var(--primary);
}
.scene-wrap { cursor: pointer; }
