/* Toddler Learns — shared engine styles.
   Games can override the theme via CSS variables on :root (see each game's HTML). */
:root {
  --tt-bg-top: #ff9ecd;
  --tt-bg-bottom: #ffd36e;
  --tt-accent: #ff4d94;
  --tt-accent-dark: #d6336c;
  --tt-text: #d6336c;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: #ffe9f3;
  font-family: "Comic Sans MS", "Segoe UI", sans-serif;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
#game { display: block; width: 100vw; height: 100vh; }

/* Opening "start" screen (also unlocks audio on first tap, which browsers require) */
#start {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--tt-bg-top), var(--tt-bg-bottom));
  z-index: 10; cursor: default; text-align: center;
  overflow-y: auto; padding: 4vh 0;
}
#start h1 {
  color: #fff; font-size: min(10vw, 54px); text-shadow: 0 4px 0 rgba(0,0,0,.15);
  animation: wobble 1.2s ease-in-out infinite;
}
#start .big {
  margin-top: 2vh; font-size: min(18vw, 90px); animation: bounce 1s ease-in-out infinite;
}
#start .hint {
  margin-top: 2.5vh; color: #fff; font-size: min(3.4vw, 18px); opacity: .9;
}
/* "All games" link on the start screen (back to the Toddler Learns home). */
#start .allgames {
  position: absolute; top: 14px; left: 16px;
  color: #fff; text-decoration: none; font-size: min(3.6vw, 16px);
  background: rgba(255,255,255,0.2); padding: 8px 14px; border-radius: 16px;
}

/* Level picker — sized for a parent to tap, labelled by age. */
#levels {
  margin-top: 1.6vh; display: flex; gap: 14px; flex-wrap: wrap; justify-content: center;
  padding: 0 4vw;
}
#levels button {
  border: none; border-radius: 18px; padding: 14px 18px; cursor: pointer;
  font-family: inherit; color: var(--tt-text); background: rgba(255,255,255,.85);
  box-shadow: 0 3px 0 rgba(0,0,0,.12); line-height: 1.25; min-width: 110px;
}
#levels button .lvl { display: block; font-weight: bold; font-size: min(4.4vw, 20px); }
#levels button .age { display: block; font-size: min(2.8vw, 14px); opacity: .75; }
#levels button.sel {
  background: #fff; color: var(--tt-accent); outline: 4px solid #fff;
  transform: translateY(-2px) scale(1.04); box-shadow: 0 6px 0 rgba(0,0,0,.15);
}

#start .play {
  margin-top: 2.6vh; border: none; border-radius: 30px; padding: 16px 48px;
  font-family: inherit; font-size: min(6vw, 28px); color: #fff; background: var(--tt-accent);
  box-shadow: 0 5px 0 var(--tt-accent-dark); cursor: pointer;
}
#start .play:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--tt-accent-dark); }

/* Grown-up voice tuning panel (collapsed by default). */
#voicePanel {
  margin-top: 2.4vh; width: min(92vw, 360px); color: #fff; text-align: left;
  background: rgba(255,255,255,0.18); border-radius: 16px; padding: 10px 14px;
  font-size: 15px;
}
#voicePanel summary {
  cursor: pointer; font-weight: bold; list-style: none; text-align: center;
  padding: 4px; user-select: none;
}
#voicePanel summary::-webkit-details-marker { display: none; }
#voicePanel .row { margin-top: 10px; }
#voicePanel label { display: block; font-size: 13px; opacity: .9; margin-bottom: 4px; }
#voicePanel input[type="range"] { width: 78%; vertical-align: middle; }
#voicePanel .val { display: inline-block; min-width: 2.6em; text-align: right; font-weight: bold; }
#voicePanel .test {
  margin-top: 12px; width: 100%; border: none; border-radius: 20px; padding: 10px;
  font-family: inherit; font-size: 16px; color: var(--tt-text); background: #fff; cursor: pointer;
}

@keyframes wobble { 0%,100%{transform:rotate(-3deg)} 50%{transform:rotate(3deg)} }
@keyframes bounce { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-4vh)} }

/* Floating controls */
#mute, #home, #exit {
  position: fixed; top: 12px; z-index: 20;
  width: 56px; height: 56px; border: none; border-radius: 50%;
  background: rgba(255,255,255,0.75); backdrop-filter: blur(4px);
  font-size: 28px; line-height: 56px; text-align: center;
  cursor: pointer; display: none; box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
#mute { right: 12px; }
#home { left: 12px; }
#exit { left: 76px; }   /* back to the Toddler Learns home (all games) */
#mute:active, #home:active, #exit:active { transform: scale(0.9); }

/* "Add to Home Screen" hint (appears only when installable) */
#install {
  position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%);
  z-index: 20; display: none; border: none; border-radius: 24px;
  padding: 12px 22px; font-size: 18px; font-family: inherit; color: #fff;
  background: var(--tt-accent); box-shadow: 0 4px 12px rgba(0,0,0,.2); cursor: pointer;
}
