/* TILT! — flat bright kid aesthetic, touch-first, no fonts/images fetched.
   Pattern copied from atmosphere-3d / plants3d style.css. The WebGL canvas has
   a transparent clear color, so the space behind the orbit IS this gradient:
   deep space at the top fading down to a warm sunlit glow at the bottom where
   the Sun sits. */
* { 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(8, 8, 34) 0%,
    rgb(30, 22, 70) 24%,
    rgb(60, 45, 120) 46%,
    rgb(110, 90, 170) 68%,
    rgb(190, 140, 160) 86%,
    rgb(255, 214, 150) 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: #4a3a86; 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: 74vw; 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: tilt = violet, summer = green, autumn = orange, winter = blue, spring = pink */
#wordLabel[data-link="tilt"]   { background: #e5dbff; color: #6741d9; }
#wordLabel[data-link="summer"] { background: #d3f9d8; color: #2b8a3e; }
#wordLabel[data-link="autumn"] { background: #ffe8cc; color: #d9480f; }
#wordLabel[data-link="winter"] { background: #d0ebff; color: #1c63a7; }
#wordLabel[data-link="spring"] { background: #ffdeeb; color: #c2255c; }
/* phone width: a wide word (FAR AWAY, SUMMER!) 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: #4a3a86;
  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 */

/* ---------- daylight gauge ---------- */
#dayGauge { position: fixed; left: 12px; top: 40%; z-index: 6; width: 150px; padding: 8px 10px 6px; background: rgba(255,255,255,.78); border-radius: 14px; box-shadow: 0 4px 0 rgba(0,0,0,.14);
  pointer-events: none; font-family: inherit; color: #3b3b5c; text-align: center; }
#dayGauge b { display: block; font-size: 12px; letter-spacing: 1px; }
#dayGauge .bar { display: flex; height: 16px; margin: 4px 0; border-radius: 9px; overflow: hidden; background: #3a3a7a; }
#dayGauge .day { background: linear-gradient(90deg, #ffd43b, #ffa94d); transition: width .25s; }
#dayGauge .night { flex: 1; }
#dayGauge span { font-size: 13px; font-weight: 800; }
@media (max-width: 520px) { #dayGauge { top: 30%; left: 8px; width: 118px; } }
