/* FRACTIONS PIZZERIA — flat bright kid aesthetic, touch-first, no fonts/images
   fetched. Pattern copied from electricity-3d style.css. The WebGL canvas has a
   transparent clear color, so the warm pizzeria behind the counter IS this
   gradient: deep oven-shadow brown at the top, tomato-and-crust warmth building
   toward the counter where the heat lamps pool light. */
* { 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(30, 14, 12) 0%,
    rgb(56, 24, 18) 24%,
    rgb(92, 40, 26) 46%,
    rgb(136, 64, 34) 68%,
    rgb(180, 96, 46) 86%,
    rgb(222, 140, 66) 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: #a03d2a; 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; }

/* ---------- wonky cutter pill: same 56px .pillBtn look, mirrored top-left;
   .on = mis-cut mode armed (tomato blush + a jaunty tilt) ---------- */
#wonkyBtn {
  position: fixed; top: calc(10px + env(safe-area-inset-top)); left: 14px; z-index: 8;
}
#wonkyBtn.on { background: #ffe3e3; transform: rotate(-8deg); }

/* ---------- thirds cutter pill: stacked under #wonkyBtn; .on = mint blush +
   a slight opposite tilt (mirror of the wonky tilt) ---------- */
#thirdsBtn {
  position: fixed; top: calc(74px + env(safe-area-inset-top)); left: 14px; z-index: 8;
}
#thirdsBtn.on { background: #d3f9d8; transform: rotate(8deg); }

/* ---------- chocolate bar pill: stacked under #thirdsBtn ---------- */
#chocoBtn {
  position: fixed; top: calc(138px + env(safe-area-inset-top)); left: 14px; z-index: 8;
}
#chocoBtn.on { background: #d3f9d8; transform: rotate(-8deg); }

/* ---------- which-is-bigger pill: stacked under #chocoBtn ---------- */
#compareBtn {
  position: fixed; top: calc(202px + env(safe-area-inset-top)); left: 14px; z-index: 8;
}
#compareBtn.on { background: #d3f9d8; transform: rotate(8deg); }

/* ---------- 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,.25), 0 0 26px rgba(0,0,0,.35);   /* round-2: lifted off the dark wall */
  z-index: 7; pointer-events: none; min-height: 1em;
}
/* per-beat label colors: pizza = oven gold, half = tomato red, quarter = basil
   green, eighth = crust tan, share = plate blue, spin = white-gold — round 2:
   deeper ink + a grounding shadow so each pill reads at tablet distance over the
   dark oven wall */
#wordLabel[data-link="pizza"]   { background: #ffec99; color: #8a6400; box-shadow: 0 5px 0 rgba(0,0,0,.3), 0 0 26px rgba(0,0,0,.45); }
#wordLabel[data-link="half"]    { background: #ffe3e3; color: #a51111; box-shadow: 0 5px 0 rgba(0,0,0,.3), 0 0 26px rgba(0,0,0,.45); }
#wordLabel[data-link="quarter"] { background: #d3f9d8; color: #1e6b30; box-shadow: 0 5px 0 rgba(0,0,0,.3), 0 0 26px rgba(0,0,0,.45); }
#wordLabel[data-link="eighth"]  { background: #ffe8cc; color: #99400f; box-shadow: 0 5px 0 rgba(0,0,0,.3), 0 0 26px rgba(0,0,0,.45); }
#wordLabel[data-link="share"]   { background: #d0ebff; color: #0b4f8f; box-shadow: 0 5px 0 rgba(0,0,0,.3), 0 0 26px rgba(0,0,0,.45); }
#wordLabel[data-link="spin"]    { background: #fff9e6; color: #7a5c00; box-shadow: 0 5px 0 rgba(0,0,0,.3), 0 0 26px rgba(0,0,0,.45); }
#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)); } }
/* phone: the cutter pills run as a ROW under the topbar (a vertical column
   would sit on the word label and the pizza) */
@media (max-width: 900px) { #thirdsBtn { top: calc(10px + env(safe-area-inset-top)); left: 78px; } }
@media (max-width: 900px) { #chocoBtn { top: calc(10px + env(safe-area-inset-top)); left: 142px; } }
@media (max-width: 900px) { #compareBtn { top: calc(10px + env(safe-area-inset-top)); left: 206px; } }

/* ---------- micro-pop (THE WHOLE! / ALL THE SAME SIZE! / SMALLER SLICES!) —
   small, near the pizza, deliberately quieter than the big word label; words
   only, never digits ---------- */
#microPop {
  position: fixed; top: 24%; left: 50%; transform: translateX(-50%) scale(.6);
  padding: 8px 22px; border-radius: 20px; z-index: 7; pointer-events: none;
  background: rgba(255,255,255,.92); color: #7a4a22;
  font-size: clamp(18px, 3vmin, 30px); font-weight: 900; opacity: 0;
  box-shadow: 0 3px 0 rgba(0,0,0,.15);
}
#microPop.pop { animation: microPop 1.0s ease-out; }
@keyframes microPop { 0% { opacity: 0; transform: translateX(-50%) scale(.6); }
                      18% { opacity: 1; transform: translateX(-50%) scale(1.06); }
                      75% { opacity: 1; transform: translateX(-50%) scale(1); }
                      100% { opacity: 0; transform: translateX(-50%) scale(.94); } }
/* phone: micro-pop drops below the big word label so the fuse-beat pair never
   stacks on each other (must sit AFTER the base rule above — media queries add
   no specificity, and 36% of 800 = 288px clears the label bottom ~230px) */
@media (max-width: 560px) { #microPop { top: 36%; } }

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

/* phone (<=520px): the factBtn/lessonBtn join #topbar on the right, so the 900px
   pill row (top 10, left 78/142/206) collides with the 4-button topbar cluster
   on 360-390px screens. Push ALL FOUR cutter pills into their own second row
   under the topbar; the word label drops below that row. Must sit AFTER the
   900px rules above — same specificity, later wins. Pills stay 56px round. */
@media (max-width: 520px) {
  #wonkyBtn   { top: calc(74px + env(safe-area-inset-top)); left: 10px; }
  #thirdsBtn  { top: calc(74px + env(safe-area-inset-top)); left: 68px; }
  #chocoBtn   { top: calc(74px + env(safe-area-inset-top)); left: 126px; }
  #compareBtn { top: calc(74px + env(safe-area-inset-top)); left: 184px; }
  #wordLabel  { top: calc(140px + env(safe-area-inset-top)); }
}
