/* Sense Safari — flat bright kid aesthetic, touch-first, no fonts/images fetched.
   Pattern adapted from states-3d / drippy-3d style.css. The WebGL canvas has a
   transparent clear color, so the SKY behind the diorama IS this gradient —
   the taste effect warms it by re-lerping these stops from JS (zero draw cost). */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  width: 100%; height: 100%; overflow: hidden;
  font-family: "Trebuchet MS", "Comic Sans MS", Verdana, sans-serif;
  background: linear-gradient(180deg, rgb(201, 232, 255) 0%, rgb(176, 222, 255) 55%, rgb(134, 209, 194) 100%);
  touch-action: none; -webkit-user-select: none; user-select: none;
  overscroll-behavior: none;
}
#game3d { position: fixed; inset: 0; display: block; touch-action: none; }

/* ---------- top bar ---------- */
#topbar {
  position: fixed; top: calc(10px + env(safe-area-inset-top)); right: 14px; z-index: 8;
  display: flex; gap: 10px;
}
.pillBtn {
  width: 56px; height: 56px; border: 0; border-radius: 50%;
  background: rgba(255,255,255,.85); color: #2f6b8f; font-size: 26px; cursor: pointer;
  box-shadow: 0 4px 0 rgba(0,0,0,.15);
}
.pillBtn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.15); }
.pillBtn.off { opacity: .45; }

/* ---------- big one-word label ---------- */
#wordLabel {
  position: fixed; top: calc(12px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  max-width: 66vw; padding: 14px 36px; border-radius: 30px;
  background: #ffffff; color: #2b3a55;
  font-size: clamp(26px, 5vmin, 52px); font-weight: 900; text-align: center;
  box-shadow: 0 5px 0 rgba(0,0,0,.15);
  z-index: 7; pointer-events: none; min-height: 1em;
}
#wordLabel[data-sense="eyes"]   { background: #fff3bf; color: #8a6100; }
#wordLabel[data-sense="ears"]   { background: #d0ebff; color: #1864ab; }
#wordLabel[data-sense="nose"]   { background: #d3f9d8; color: #2b8a3e; }
#wordLabel[data-sense="taste"]  { background: #ffe3e3; color: #c2255c; }
#wordLabel[data-sense="touch"]  { background: #e5dbff; color: #5f3dc4; }
#wordLabel[data-sense="senses"] { background: #ffd8a8; color: #d9480f; }
#wordLabel.pop { animation: labelPop .5s ease-out; }
@keyframes labelPop { 0% { transform: translateX(-50%) scale(.5); opacity: 0; }
                      60% { transform: translateX(-50%) scale(1.12); opacity: 1; }
                      100% { transform: translateX(-50%) scale(1); } }
/* phone: big word label drops below the topbar buttons */
@media (max-width: 900px) { #wordLabel { top: calc(78px + env(safe-area-inset-top)); } }

/* ---------- first-time hint ---------- */
#handHint {
  position: fixed; bottom: calc(22px + env(safe-area-inset-bottom)); left: 50%;
  transform: translateX(-50%);
  padding: 12px 26px; border-radius: 26px; z-index: 7; pointer-events: none;
  background: rgba(255,255,255,.88); color: #35617f;
  font-size: clamp(18px, 3.4vmin, 30px); font-weight: 900;
  box-shadow: 0 4px 0 rgba(0,0,0,.15);
  animation: hintBob 1.6s ease-in-out infinite;
  transition: opacity .6s ease, transform .6s ease;
}
#handHint.gone { opacity: 0; transform: translateX(-50%) translateY(30px); }
@keyframes hintBob { 0%,100% { margin-bottom: 0; } 50% { margin-bottom: 10px; } }

/* 2026-11-05 phone layout fixes (Claude Code, Ryan: "fix and finish all 18 learning apps").
   left:50% + translateX(-50%) with no width made these shrink-to-fit inside HALF the screen: on a phone the hint
   wrapped to 5-6 lines in a 192px bubble and two-word titles broke onto two lines. max-content + a screen-wide cap fixes it. */
#handHint { width: max-content; max-width: calc(100vw - 32px); text-align: center; }
#wordLabel { width: max-content; }
#wordLabel:empty { display: none; }   /* an empty white pill showed before the first word */

/* ---------- stimuli strip (stimuli.js): "choose what to try" pill row ----------
   bottom-center, above the canvas but below the lesson bar (z 65); round emoji
   buttons ~54px; hidden until showStim adds .on; when a lesson is on screen
   (#lessonBar.show) the bottom slot is the lesson's — the strip stays hidden. */
#stimStrip {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: none; gap: 14px; z-index: 9; pointer-events: auto;
}
#stimStrip.on { display: flex; }
#stimStrip button {
  width: 54px; height: 54px; border: 0; border-radius: 50%;
  background: rgba(255,255,255,.92); font-size: 26px; line-height: 1; cursor: pointer;
  box-shadow: 0 4px 0 rgba(0,0,0,.15);
}
#stimStrip button:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.15); }
@media (max-width: 520px) {
  #stimStrip { gap: 9px; flex-wrap: nowrap; }        /* phone: one row, smaller pills */
  #stimStrip button { width: 46px; height: 46px; font-size: 22px; }
}
body:has(#lessonBar.show) #stimStrip { display: none; }   /* lesson bar owns the bottom */

/* ---------- animal friends dock (animals.js): summon pills, vertical rail
   bottom-left above the safe area, same pill look as #stimStrip; hidden while
   a lesson owns the bottom slot (same body:has(#lessonBar.show) precedent). */
#friendDock {
  position: fixed; left: 14px; bottom: calc(20px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 10px; z-index: 9; pointer-events: auto;
}
#friendDock button {
  width: 50px; height: 50px; border: 0; border-radius: 50%;
  background: rgba(255,255,255,.92); font-size: 26px; line-height: 1; cursor: pointer;
  box-shadow: 0 4px 0 rgba(0,0,0,.15);
}
#friendDock button:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.15); }
@media (max-width: 520px) {
  #friendDock { gap: 8px; }                                  /* phone: smaller pills */
  #friendDock button { width: 46px; height: 46px; font-size: 22px; }
}
body:has(#lessonBar.show) #friendDock { display: none; }    /* lesson bar owns the bottom */
