@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 { 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;
  text-decoration: none;
}
.back-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #E7DCCF; }

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

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

.avatar-stage {
  width: 220px;
  height: 220px;
  margin: 4px auto 16px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 6px 0 #EFE3D4;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.avatar-stage svg { width: 86%; height: 86%; 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; min-height: 64px; }

.thumb-grid, .color-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.thumb-btn {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  border: 3px solid transparent;
  background: #fff;
  box-shadow: 0 4px 0 #EFE3D4;
  cursor: pointer;
  padding: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}
.thumb-btn img { width: 100%; height: 100%; object-fit: contain; }
.thumb-btn.active {
  border-color: var(--primary);
  transform: translateY(-5px) scale(1.08);
  box-shadow: 0 10px 0 rgba(0,0,0,0.1);
}
.thumb-btn:active { transform: translateY(2px) scale(0.97); }

.color-dot {
  width: 44px;
  height: 44px;
  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.12); }

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

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

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