/* ====== Kids Games Site - Shared Styles ====== */
:root {
  --pink: #ff5fa2;
  --purple: #9b5de5;
  --blue: #4cc9f0;
  --green: #43d17a;
  --yellow: #ffd23f;
  --orange: #ff924c;
  --red: #ff5a5f;
  --sky: #bdeaff;
  --cream: #fffaf0;
  --ink: #2b2d42;
  --shadow: 0 8px 0 rgba(0,0,0,0.12), 0 14px 24px rgba(0,0,0,0.14);
  --font: 'Baloo 2', 'Fredoka', 'Comic Sans MS', system-ui, -apple-system, sans-serif;
}

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

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  color: var(--ink);
  min-height: 100%;
  overscroll-behavior: none;
}

body {
  background: linear-gradient(160deg, #a0e9ff 0%, #c8b6ff 45%, #ffc8dd 100%);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

/* Floating decorative clouds */
.bg-deco {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.bg-deco span {
  position: absolute;
  font-size: clamp(2rem, 8vw, 5rem);
  opacity: 0.5;
  animation: floaty 9s ease-in-out infinite;
}
@keyframes floaty {
  0%,100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-22px) rotate(4deg); }
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px clamp(12px, 4vw, 28px) 60px;
}

/* ====== Headings ====== */
.site-title {
  text-align: center;
  font-size: clamp(2.2rem, 9vw, 4.2rem);
  margin: 10px 0 4px;
  color: #fff;
  text-shadow: 0 4px 0 var(--purple), 0 6px 12px rgba(0,0,0,0.25);
  letter-spacing: 1px;
}
.site-sub {
  text-align: center;
  font-size: clamp(1rem, 4vw, 1.5rem);
  margin: 0 0 22px;
  color: #4a3b6b;
  font-weight: 700;
}

/* ====== Home grid ====== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: clamp(12px, 3vw, 22px);
}
.card {
  background: #fff;
  border: none;
  border-radius: 28px;
  padding: 20px 12px 16px;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .12s ease, box-shadow .12s ease;
  text-decoration: none;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  border: 5px solid #fff;
  position: relative;
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--c, var(--blue));
  opacity: 0.14;
}
.card:active { transform: scale(0.95) translateY(2px); }
@media (hover:hover) {
  .card:hover { transform: translateY(-6px) rotate(-1deg); box-shadow: 0 14px 0 rgba(0,0,0,0.12), 0 22px 30px rgba(0,0,0,0.18); }
}
.card .emoji {
  font-size: clamp(3rem, 13vw, 4.6rem);
  line-height: 1;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.18));
  position: relative;
  animation: bob 3s ease-in-out infinite;
}
.card:nth-child(even) .emoji { animation-delay: .6s; }
@keyframes bob { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-8px)} }
.card .name {
  font-size: clamp(1rem, 4vw, 1.35rem);
  font-weight: 800;
  position: relative;
}

/* ====== Game page chrome ====== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.btn {
  font-family: var(--font);
  font-weight: 800;
  border: none;
  border-radius: 999px;
  padding: 12px 22px;
  font-size: clamp(1rem, 3.5vw, 1.25rem);
  cursor: pointer;
  color: #fff;
  background: var(--purple);
  box-shadow: 0 5px 0 rgba(0,0,0,0.18);
  transition: transform .08s ease, box-shadow .08s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  min-height: 52px;
}
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0,0,0,0.18); }
.btn.home { background: var(--pink); }
.btn.green { background: var(--green); }
.btn.blue { background: var(--blue); color:#073b4c; }
.btn.orange { background: var(--orange); }

.game-title {
  font-size: clamp(1.4rem, 6vw, 2.4rem);
  margin: 0;
  color: #fff;
  text-shadow: 0 3px 0 var(--purple), 0 5px 8px rgba(0,0,0,0.22);
}

.scorebar {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 6px 0 16px;
}
.chip {
  background: #fff;
  border-radius: 999px;
  padding: 8px 18px;
  font-weight: 800;
  font-size: clamp(1rem, 4vw, 1.4rem);
  box-shadow: var(--shadow);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.panel {
  background: rgba(255,255,255,0.55);
  border-radius: 30px;
  padding: clamp(14px, 4vw, 28px);
  box-shadow: var(--shadow);
  backdrop-filter: blur(3px);
}

.center { text-align: center; }
.hint {
  text-align: center;
  font-size: clamp(1.1rem, 4.5vw, 1.6rem);
  font-weight: 800;
  margin: 4px 0 16px;
  color: #4a3b6b;
}

/* Big celebration overlay text */
.cheer {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(3rem, 16vw, 8rem);
  font-weight: 900;
  color: #fff;
  text-shadow: 0 6px 0 var(--pink), 0 10px 18px rgba(0,0,0,0.3);
  pointer-events: none;
  z-index: 50;
  opacity: 0;
}
.cheer.show { animation: cheerPop 1.2s ease forwards; }
@keyframes cheerPop {
  0% { opacity: 0; transform: scale(0.3) rotate(-12deg); }
  30% { opacity: 1; transform: scale(1.15) rotate(4deg); }
  70% { opacity: 1; transform: scale(1) rotate(0); }
  100% { opacity: 0; transform: scale(1.1); }
}

/* Sound toggle floating button */
.sound-toggle {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 40;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: none;
  background: #fff;
  font-size: 1.6rem;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.footer {
  text-align: center;
  margin-top: 30px;
  color: #5b4b7a;
  font-weight: 700;
  opacity: 0.8;
}

/* Shared pulse for prompts */
.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.08)} }

/* shake for wrong */
.shake { animation: shake .4s; }
@keyframes shake {
  0%,100%{transform:translateX(0)}
  20%{transform:translateX(-8px)}
  40%{transform:translateX(8px)}
  60%{transform:translateX(-6px)}
  80%{transform:translateX(6px)}
}
