/* Little Sprout — flat bright kid aesthetic, touch-first, no fonts/images fetched.
   Pattern copied from lifecycle-3d / foodchain-3d style.css. The WebGL canvas has
   a transparent clear color, so the sunny SKY behind the garden plot IS this
   gradient (warmer than the pond siblings: soil + sun theme). */
* { 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(135, 206, 250) 0%, rgb(206, 238, 255) 46%, rgb(255, 241, 199) 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: #b06a2c; 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;
}
/* per-beat label colors: brown = underground beats, green = growing, gold = bloom/finale */
#wordLabel[data-link="soil"]    { background: #f1e0cd; color: #7a4a21; }
#wordLabel[data-link="grow"]    { background: #d3f9d8; color: #2b8a3e; }
#wordLabel[data-link="bloom"]   { background: #fff3bf; color: #a8590a; }   /* was #e8890c: 2.4:1 on the cream pill; now 4.6:1 (QA watch item) */
/* phone width: a wide word (SPROUT!, FLOWER!) would slide under the pill
   buttons and hide the read-again control — drop the label below the top bar. */
@media (max-width: 900px) { #wordLabel { top: calc(78px + env(safe-area-inset-top)); } }
#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); } }

/* ---------- 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: #8a5a2b;
  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 */

/* 2026-11-06 seed packets + part tags (Claude Code). Packets sit above the hint; the tag pops up where a plant part was tapped. */
#seedBar { position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); transform: translate(-50%, 30px); z-index: 7;
  display: flex; gap: 10px; opacity: 0; pointer-events: none; transition: opacity .35s, transform .35s; }
#seedBar.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.packet { border: 0; cursor: pointer; font-family: inherit; display: flex; flex-direction: column; align-items: center; gap: 2px;
  width: 92px; padding: 8px 6px 7px; border-radius: 16px 16px 10px 10px; background: #fff8ec; color: #7a4a21;
  box-shadow: 0 4px 0 rgba(0,0,0,.18), inset 0 6px 0 #f3d9b4; }
.packet .pi { font-size: 34px; line-height: 1.1; } .packet .pn { font-size: 15px; font-weight: 900; }
.packet.on { background: #fff3bf; box-shadow: 0 4px 0 rgba(0,0,0,.18), inset 0 6px 0 #ffd43b, 0 0 0 4px #ffd43b; transform: translateY(-4px); }
.packet:active { transform: translateY(2px); }
#partTag { position: fixed; z-index: 9; pointer-events: none; transform: translate(-50%, -140%) scale(.6); opacity: 0;
  padding: 7px 16px; border-radius: 18px; background: #fff; color: #2b8a3e; font-size: 20px; font-weight: 900; letter-spacing: 1px;
  box-shadow: 0 4px 0 rgba(0,0,0,.18); transition: opacity .25s, transform .25s; white-space: nowrap; }
#partTag::after { content: ''; position: absolute; left: 50%; bottom: -9px; margin-left: -9px; border: 9px solid transparent; border-bottom: 0; border-top-color: #fff; }
#partTag.show { opacity: 1; transform: translate(-50%, -140%) scale(1); }
@media (max-width: 640px) { #seedBar { bottom: calc(96px + env(safe-area-inset-bottom)); gap: 8px; } .packet { width: 84px; } .packet .pi { font-size: 30px; } }
@media (prefers-reduced-motion: reduce) { #seedBar, #partTag { transition: none; } }

/* plant doctor */
#docBtn { position: fixed; left: 14px; top: calc(10px + env(safe-area-inset-top)); z-index: 8; }
#docBtn.on { background: #d3f9d8; box-shadow: 0 4px 0 rgba(0,0,0,.15), 0 0 0 4px #69db7c; }
#docPanel { position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); width: min(94vw, 520px); z-index: 9;
  transform: translate(-50%, 40px); opacity: 0; pointer-events: none; transition: opacity .3s, transform .3s;
  background: #fffdf6; border-radius: 22px; padding: 12px 18px 10px; box-shadow: 0 6px 0 rgba(0,0,0,.15); color: #2b3a55; }
#docPanel.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#docClose { position: absolute; right: 10px; top: 8px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: #f1f3f5; font-size: 18px; cursor: pointer; }
.dTitle { font-size: 15px; font-weight: 900; color: #5a6b8a; }
.dHead { font-size: 26px; font-weight: 900; margin-top: 2px; }
#docPanel[data-st="ok"] .dHead { color: #2b8a3e; } #docPanel[data-st="dry"] .dHead, #docPanel[data-st="hot"] .dHead { color: #c2410c; }
#docPanel[data-st="wet"] .dHead { color: #1971c2; } #docPanel[data-st="dark"] .dHead { color: #5f3dc4; }
.dText { font-size: 16px; font-weight: 700; line-height: 1.3; min-height: 2.6em; margin: 2px 0 6px; }
.dRow { display: flex; align-items: center; gap: 10px; } .dEnd { font-size: 26px; width: 32px; text-align: center; }
.dLbl { text-align: center; font-size: 13px; font-weight: 900; color: #8a5a2b; margin: -2px 0 4px; letter-spacing: 1px; text-transform: uppercase; }
.dRow input[type=range] { flex: 1; height: 44px; -webkit-appearance: none; appearance: none; background: transparent; }
.dRow input[type=range]::-webkit-slider-runnable-track { height: 14px; border-radius: 7px; background: linear-gradient(90deg, #ffe8cc, #d3f9d8 35%, #d3f9d8 65%, #ffe3e3); }
#docWater::-webkit-slider-runnable-track { background: linear-gradient(90deg, #ffe8cc, #d3f9d8 35%, #d3f9d8 65%, #d0ebff) !important; }
.dRow input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 38px; height: 38px; margin-top: -12px; border-radius: 50%; background: #ffd43b; border: 4px solid #fff; box-shadow: 0 3px 0 rgba(0,0,0,.2); }
.dRow input[type=range]::-moz-range-track { height: 14px; border-radius: 7px; background: #d3f9d8; }
.dRow input[type=range]::-moz-range-thumb { width: 32px; height: 32px; border-radius: 50%; background: #ffd43b; border: 4px solid #fff; }
@media (max-width: 640px) { .dHead { font-size: 22px; } .dText { font-size: 15px; } }
#shade { position: fixed; inset: 0; z-index: 1; pointer-events: none; transition: background .3s; }
body.doc #wordLabel { display: none; }
