/* Shared styles for every Toybox page. */

@font-face {
  font-family: 'Andika';
  src: url('fonts/andika-regular.woff2') format('woff2');
  font-weight: 400;
  font-display: block;
}
@font-face {
  font-family: 'Andika';
  src: url('fonts/andika-bold.woff2') format('woff2');
  font-weight: 700;
  font-display: block;
}

:root {
  --bg: #fff6e5;
  --ink: #3b2a4a;
  --ink-soft: #7a6a86;
  --card: #ffffff;
  --shadow: 0 6px 0 rgba(59, 42, 74, 0.12), 0 10px 24px rgba(59, 42, 74, 0.10);
  --radius: 28px;
  --tap: 72px; /* minimum touch target for small fingers */
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg); /* same colour behind the safe areas: no white flash */
  color: var(--ink);
  font-family: 'Andika', system-ui, sans-serif;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

/* 100dvh keeps the bottom of the screen visible on iPhone (Safari's bars);
   100vh is the fallback for older browsers that don't know dvh. */
body {
  min-height: 100vh;
  min-height: 100dvh;
  padding: calc(var(--safe-t) + 12px) calc(var(--safe-r) + 12px) calc(var(--safe-b) + 12px) calc(var(--safe-l) + 12px);
  overflow: hidden;
}

img, svg { -webkit-user-drag: none; user-select: none; }

/* Play areas and anything she drags: stop iOS from scrolling or rubber-banding
   the page under her finger (overscroll-behavior alone doesn't). core/drag.js
   also sets this on every element it makes draggable. */
.play-area, .drag-zone, [data-drag] { touch-action: none; }

/* Full-screen helper for game layouts. */
.full-height { height: 100vh; height: 100dvh; }

/* Everything the child reads is in CAPITALS. Text is stored normally; <html lang>
   makes the capitals correct for each language. */
.kid-text {
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.04em;
}

button {
  font: inherit;
  color: inherit;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
}

.big-btn {
  min-width: var(--tap);
  min-height: var(--tap);
  border-radius: 999px;
  background: var(--card);
  box-shadow: var(--shadow);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease;
}
.big-btn:active { transform: scale(0.92) translateY(3px); }
.big-btn svg { width: 60%; height: 60%; }

/* Home button used by game pages. */
.home-btn {
  position: fixed;
  top: calc(var(--safe-t) + 10px);
  left: calc(var(--safe-l) + 10px);
  z-index: 50;
  width: var(--tap);
  height: var(--tap);
}

.hidden { display: none !important; }

/* Pop-in animation used for stickers and celebrations. */
@keyframes pop-in {
  0% { transform: scale(0.2); opacity: 0; }
  60% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); }
}
@keyframes wobble {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-6deg); }
  75% { transform: rotate(6deg); }
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}
.wobble { animation: wobble 0.45s ease 2; }
.pulse { animation: pulse 0.8s ease infinite; }

/* Celebration overlay (celebrate.js). */
.celebrate-layer {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
}
.celebrate-card {
  position: fixed;
  inset: 0;
  z-index: 210;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(255, 246, 229, 0.6);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: pop-in 0.4s ease;
}
.celebrate-card .mascot { width: min(34vmin, 200px); animation: bob 0.9s ease infinite; }
.celebrate-card .sticker { width: min(30vmin, 180px); animation: pop-in 0.5s ease 0.2s both; }
.celebrate-card .label { font-size: clamp(24px, 6vmin, 44px); }

/* Grown-up corner and panel (grownup.js). */
.grownup-corner {
  position: fixed;
  right: calc(var(--safe-r) + 6px);
  bottom: calc(var(--safe-b) + 6px);
  width: 56px;
  height: 56px;
  opacity: 0.35;
  z-index: 60;
  touch-action: none;
}
.grownup-corner svg { width: 100%; height: 100%; }
.grownup-corner .ring { transition: stroke-dashoffset 0.1s linear; }

.panel-backdrop {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(40, 28, 50, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--safe-t) + 16px) calc(var(--safe-r) + 16px) calc(var(--safe-b) + 16px) calc(var(--safe-l) + 16px);
}
.panel {
  background: #fff;
  border-radius: 20px;
  width: min(440px, 100%);
  max-height: 100%;
  overflow: auto;
  padding: 20px 22px;
  font-family: -apple-system, system-ui, sans-serif;
  font-size: 16px;
  color: #222;
  -webkit-user-select: text;
  user-select: text;
}
.panel h2 { margin: 0 0 12px; font-size: 22px; }
.panel h3 { margin: 18px 0 8px; font-size: 15px; color: #666; font-weight: 600; }
.panel .row { display: flex; flex-wrap: wrap; gap: 8px; }
.panel .opt {
  border: 2px solid #ddd;
  border-radius: 12px;
  padding: 10px 14px;
  min-height: 44px;
  background: #fafafa;
}
.panel .opt[aria-pressed='true'] { border-color: #6c4ad6; background: #efe9ff; font-weight: 600; }
.panel .danger { border-color: #e6a0a0; color: #a12828; }
.panel .primary { border-color: #6c4ad6; background: #6c4ad6; color: #fff; }
.panel .note { color: #666; font-size: 14px; margin: 8px 0 0; }
.panel .close { margin-top: 20px; width: 100%; }
