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

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Baloo 2', 'Comic Sans MS', sans-serif;
  background: linear-gradient(160deg, #ffe5f4 0%, #e3d7ff 55%, #d4f1ff 100%);
  color: #46266b;
  display: flex;
  flex-direction: column;
  align-items: center;
  user-select: none;
}

h1 {
  font-size: clamp(2.2rem, 8vw, 3.6rem);
  font-weight: 800;
  margin: 0.5em 0 0;
  text-align: center;
}
/* Gradient goes on a span around the words only — clipping the whole
   h1 mangles emoji (they become gradient silhouettes with jagged edges). */
.grad-text {
  background: linear-gradient(90deg, #ff4fa3, #8a4fff, #00b4ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.subtitle { font-size: 1.15rem; opacity: 0.65; margin: 4px 0 26px; }

/* ── Home category cards ───────────────────────────── */
.menu {
  display: grid;
  gap: 22px;
  width: min(94vw, 540px);
  padding-bottom: 30px;
}
.cat-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px 26px;
  border-radius: 30px;
  text-decoration: none;
  color: white;
  box-shadow: 0 10px 24px rgba(70, 38, 107, 0.25);
  transition: transform 0.12s;
  position: relative;
  overflow: hidden;
}
.cat-card:active { transform: scale(0.97); }
.cat-card .emoji { font-size: 3.6rem; filter: drop-shadow(0 3px 4px rgba(0,0,0,0.25)); }
.cat-card .title { font-size: 1.8rem; font-weight: 800; line-height: 1.1; }
.cat-card .tagline { font-size: 1rem; opacity: 0.92; }
.cat-card .count {
  position: absolute;
  top: 14px; right: 18px;
  background: rgba(255,255,255,0.25);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 0.9rem;
  font-weight: 700;
}

.theme-puppies { background: linear-gradient(135deg, #ffb302, #ff7b54); }
.theme-circus  { background: linear-gradient(135deg, #ff3d68, #3d6bff); }
.theme-kpop    { background: linear-gradient(135deg, #b249f8, #ff49c1); }

.grownups {
  font-size: 0.95rem;
  color: #46266b;
  opacity: 0.5;
  text-decoration: none;
  padding-bottom: 30px;
}

/* ── Category page ─────────────────────────────────── */
.topbar {
  width: 100%;
  max-width: 1100px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  gap: 10px;
}
.pill {
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  text-decoration: none;
  background: white;
  border: none;
  border-radius: 999px;
  padding: 9px 20px;
  color: #46266b;
  box-shadow: 0 4px 12px rgba(70, 38, 107, 0.18);
  cursor: pointer;
}
.pill.active { background: #ff4fa3; color: white; }

.page-title { font-size: clamp(1.6rem, 6vw, 2.4rem); font-weight: 800; margin: 4px 0 14px; text-align: center; }

.grid {
  width: min(96vw, 1100px);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  padding-bottom: 90px;
}
.tile {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  aspect-ratio: 1;
  background: rgba(255,255,255,0.5);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(70,38,107,0.15);
  transition: transform 0.12s;
}
.tile:active { transform: scale(0.96); }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .heart-badge {
  position: absolute;
  top: 8px; right: 8px;
  font-size: 1.3rem;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));
}

.empty {
  text-align: center;
  font-size: 1.2rem;
  opacity: 0.65;
  padding: 40px 20px;
  line-height: 1.6;
}
.empty .big { font-size: 3.5rem; display: block; margin-bottom: 10px; }

.more-btn {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-family: inherit;
  font-size: 1.25rem;
  font-weight: 800;
  border: none;
  border-radius: 999px;
  padding: 14px 30px;
  color: white;
  background: linear-gradient(135deg, #ffb302, #ff7b54);
  box-shadow: 0 8px 20px rgba(255, 123, 84, 0.5);
  cursor: pointer;
  z-index: 20;
}
.more-btn:active { transform: translateX(-50%) scale(0.95); }
.more-btn:disabled { opacity: 0.6; }

/* ── Lightbox ──────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(20, 8, 40, 0.93);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: 92vw;
  max-height: 78vh;
  border-radius: 16px;
  box-shadow: 0 10px 50px rgba(0,0,0,0.6);
}
.lb-btn {
  position: absolute;
  font-family: inherit;
  font-size: 1.8rem;
  background: rgba(255,255,255,0.15);
  color: white;
  border: none;
  border-radius: 50%;
  width: 56px; height: 56px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lb-close { top: 16px; right: 16px; }
.lb-prev  { left: 12px; top: 50%; transform: translateY(-50%); }
.lb-next  { right: 12px; top: 50%; transform: translateY(-50%); }
.lb-heart {
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 72px; height: 72px;
  font-size: 2.2rem;
  background: rgba(255,255,255,0.2);
}
.lb-heart.loved { background: #ff4fa3; }

.heart-burst {
  position: fixed;
  font-size: 1.8rem;
  pointer-events: none;
  z-index: 200;
  animation: burst 1s ease-out forwards;
}
@keyframes burst {
  0%   { transform: translate(0, 0) scale(0.6); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(1.4); opacity: 0; }
}

/* ── Upload page ───────────────────────────────────── */
.upload-box {
  background: white;
  border-radius: 24px;
  padding: 28px;
  width: min(92vw, 440px);
  box-shadow: 0 10px 30px rgba(70,38,107,0.2);
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 40px;
}
.upload-box label { font-weight: 700; }
.upload-box select, .upload-box input {
  font-family: inherit;
  font-size: 1.1rem;
  padding: 10px 14px;
  border-radius: 12px;
  border: 2px solid #d8c8f0;
  width: 100%;
}
.upload-box button {
  font-family: inherit;
  font-size: 1.2rem;
  font-weight: 800;
  padding: 13px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #b249f8, #ff49c1);
  color: white;
  cursor: pointer;
}
.msg-ok  { color: #1d8a4e; font-weight: 700; }
.msg-err { color: #d62246; font-weight: 700; }

.theme-game { background: linear-gradient(135deg, #00c48c, #00b4ff); }
