@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 .cross-strip {
  height: 6px;
  border-radius: 8px;
  margin: 18px auto 0;
  max-width: 220px;
  background: var(--sky);
}

.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; }

/* ---- Periksa Pasien ---- */
.pasien-stage {
  width: 230px;
  margin: 4px auto 8px;
  position: relative;
}
.pasien-stage svg { width: 100%; height: auto; display: block; }

.zone-hit {
  fill: transparent;
  pointer-events: none;
}
.zone-hit.active-zone {
  fill: rgba(47, 160, 207, 0.28);
  stroke: var(--sky);
  stroke-width: 3;
  pointer-events: auto;
  cursor: pointer;
  animation: zone-pulse 0.9s ease-in-out infinite;
}
@keyframes zone-pulse {
  0%, 100% { opacity: 0.55; r: var(--r, 26); }
  50% { opacity: 1; }
}
.zone-badge { animation: badge-pop 0.3s ease; }
@keyframes badge-pop {
  from { transform: scale(0); }
  to { transform: scale(1); }
}
.zone-badge circle, .zone-badge path { transform-origin: center; }

.tool-tray {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 12px;
  margin-top: 18px;
}
.tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border: none;
  background: #fff;
  border-radius: 16px;
  padding: 12px 8px;
  box-shadow: 0 4px 0 #EFE3D4;
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
}
.tool-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #EFE3D4; }
.tool-emoji { font-size: 30px; }
.tool-name { font-size: 12px; font-weight: 700; color: var(--ink); }
.tool-btn.selected {
  transform: translateY(-4px);
  box-shadow: 0 8px 0 rgba(0,0,0,0.08), 0 0 0 3px var(--sky);
}
.tool-btn.done { opacity: 0.4; pointer-events: none; }
.tool-btn.done .tool-emoji::after { content: ' ✅'; }

#btn-restart { display: none; margin: 20px auto 0; }
#btn-restart.show { display: block; }

/* ---- Kenalan Alat Dokter ---- */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
  gap: 12px;
  margin-top: 8px;
}
.tool-chip {
  font-size: 32px;
  border: none;
  background: #fff;
  border-radius: 16px;
  padding: 14px 0;
  box-shadow: 0 4px 0 #EFE3D4;
  cursor: pointer;
}
.tool-chip:active { transform: translateY(3px); box-shadow: 0 1px 0 #EFE3D4; }
.tool-chip.active { box-shadow: 0 4px 0 #EFE3D4, 0 0 0 3px var(--primary); }

.info-card {
  margin-top: 22px;
  background: #fff;
  border-radius: var(--card-radius);
  padding: 24px;
  text-align: center;
  box-shadow: 0 6px 0 #EFE3D4;
  display: none;
}
.info-card.show { display: block; animation: badge-pop 0.25s ease; }
.info-emoji { font-size: 54px; }
.info-nama { margin: 8px 0 4px; font-size: 22px; color: var(--primary-dark); }
.info-fungsi { margin: 0; color: var(--muted); font-weight: 600; font-size: 15px; }
