/* Pebble Playground (solo Pebble). Shared look comes from /pebble/pebble.css and /pebble/guide.css; this file is only what is different here:
   the full-screen picture scenes (rock wall, sandbox, wheel, playground) with buttons laid over the toys, and the problem screen.
   Scene pictures come in a landscape and a portrait version; a stage the shape of the picture is fitted inside the window (never cropped, never scrolls)
   and every button is positioned in % of that stage, so it stays on its toy at any window size. Text inside a stage is sized in cqw (% of the stage's width). */
html, body { height: 100%; margin: 0; overflow: hidden; }
#app { position: fixed; inset: 0; display: flex; flex-direction: column; }
.screen { flex: 1 1 auto; display: none; position: relative; min-height: 0; overflow: hidden; }
.screen.on { display: flex; flex-direction: column; }
.pg-body { --pg-ink: #12361f; }

/* ---------- full-picture screens: welcome and goodbye ---------- */
.pg-full { position: absolute; inset: 0; background-size: cover; background-position: center; display: grid; place-items: center; padding: 12px; box-sizing: border-box; }
.pg-welcome { background-image: url(assets/welcome-l.webp); }
.pg-bye { background-image: url(assets/bye-l.webp); }
@media (orientation: portrait) { .pg-welcome { background-image: url(assets/welcome-p.webp); } .pg-bye { background-image: url(assets/bye-p.webp); } }
.pg-welcome-box { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; max-width: 100%; }
.pg-logo { display: block; width: min(86vw, 760px, 38vh * 2.49); height: auto; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .25)); }
.pg-lead { margin: 0; font: 700 clamp(17px, 2.4vw, 26px) "Andika", sans-serif; color: var(--pg-ink); background: rgba(255, 250, 235, .82); border-radius: 14px; padding: 4px 14px; }
.pg-start { font-size: clamp(22px, 3vw, 34px); padding: 8px 34px; }
.pg-bye-box { background: #fffaf0; border: 4px solid #b9a77c; border-radius: 22px; padding: 16px 22px; text-align: center; box-shadow: 0 8px 0 rgba(60, 50, 20, .25); max-width: min(92vw, 560px); }
.pg-bye-title { margin: 0 0 6px; font: 700 clamp(28px, 4vw, 44px) "Fredoka", sans-serif; color: var(--pg-ink); }
.pg-bye-sum { margin: 0 0 12px; font: 700 clamp(16px, 2vw, 22px) "Andika", sans-serif; color: #3a2f1b; }

/* ---------- picture scenes ---------- */
.pg-scene { position: absolute; inset: 0; background: #7ec850; }
.pg-sc-blur { position: absolute; inset: -5%; background-size: cover; background-position: center; filter: blur(16px); }
[data-scene="wall"] .pg-sc-blur  { background-image: url(assets/wall-l.webp); }
[data-scene="style"] .pg-sc-blur { background-image: url(assets/style-l.webp); }
[data-scene="kind"] .pg-sc-blur  { background-image: url(assets/kind-l.webp); }
[data-scene="next"] .pg-sc-blur  { background-image: url(assets/next-l.webp); }
@media (orientation: portrait) {
  [data-scene="wall"] .pg-sc-blur  { background-image: url(assets/wall-p.webp); }
  [data-scene="style"] .pg-sc-blur { background-image: url(assets/style-p.webp); }
  [data-scene="kind"] .pg-sc-blur  { background-image: url(assets/kind-p.webp); }
  [data-scene="next"] .pg-sc-blur  { background-image: url(assets/next-p.webp); }
}
.pg-stage { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(100vw, calc(100vh * 1.7769)); width: min(100vw, calc(100dvh * 1.7769)); aspect-ratio: 1672 / 941; container-type: inline-size; }
@media (orientation: portrait) { .pg-stage { width: min(100vw, calc(100vh * 0.5628)); width: min(100vw, calc(100dvh * 0.5628)); aspect-ratio: 941 / 1672; } }
.pg-sc-img { display: block; width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; }
.pg-sc-title { position: absolute; left: 50%; top: 2.4%; transform: translateX(-50%); margin: 0; white-space: nowrap; font: 700 max(22px, 4.2cqw) "Fredoka", sans-serif; color: #fff; text-shadow: 0 .25cqw 0 #1b5e8f, 0 0 1.2cqw rgba(15, 70, 120, .7); pointer-events: none; }
@media (orientation: portrait) { .pg-sc-title { font-size: max(22px, 7.2cqw); top: 3%; } }
.pg-title-wall { left: 13.5%; top: 30%; width: 22%; white-space: normal; text-align: center; line-height: 1.05; font-size: max(20px, 3.3cqw); }
@media (orientation: portrait) { .pg-title-wall { left: 50%; top: 4%; width: 90%; font-size: max(22px, 7.4cqw); } }
.pg-nav-back { position: absolute; z-index: 5; top: 8px; left: calc(var(--zb-home-space, 60px) + 6px); }

/* every button over a toy: invisible until hovered, with its name on a chip */
.pg-hs { position: absolute; border: 0; padding: 0; background: transparent; cursor: pointer; border-radius: 2cqw; touch-action: manipulation; -webkit-tap-highlight-color: transparent; transition: background .15s, box-shadow .15s, transform .15s; }
.pg-hs:hover, .pg-hs:focus-visible { background: rgba(255, 255, 255, .2); box-shadow: 0 0 0 .5cqw rgba(255, 255, 255, .85), 0 0 2cqw rgba(255, 220, 120, .9); outline: none; }
.pg-hs:active { transform: scale(.98); }
.pg-hs[disabled] { opacity: .45; cursor: default; pointer-events: none; }
.pg-chip { position: absolute; left: 50%; bottom: 0; transform: translate(-50%, 72%); display: flex; flex-direction: column; align-items: center; white-space: nowrap; background: #fffaf0; color: var(--pg-ink); border: .3cqw solid #12361f; border-radius: 1.6cqw; padding: .25cqw 1.4cqw .35cqw; box-shadow: 0 .4cqw 0 rgba(0, 0, 0, .25); font-family: "Fredoka", sans-serif; pointer-events: none; }
.pg-chip b { font-size: max(15px, 2.5cqw); font-weight: 700; line-height: 1.1; }
.pg-chip small { font: 700 max(11px, 1.35cqw) "Andika", sans-serif; color: #4a3a22; }

/* the rock wall (ten label bars: --ly/--lh landscape, --py/--ph portrait, as a share of the picture) */
.lv { position: absolute; left: 37.4%; width: 25.2%; top: calc((var(--ly) - var(--lh) / 2) * 100%); height: calc(var(--lh) * 100%); display: flex; align-items: center; justify-content: center; border: 0; border-radius: 1.6cqw; background: transparent; cursor: pointer; padding: 0; color: #6b4310; font: 700 2.2cqw "Fredoka", sans-serif; letter-spacing: .01em; text-shadow: 0 .12cqw 0 rgba(255, 255, 255, .7); white-space: nowrap; touch-action: manipulation; transition: background .15s, transform .1s; }
.lv.top { color: #7a4b00; }
.lv:hover, .lv:focus-visible { background: rgba(255, 255, 255, .55); outline: .4cqw solid #f5a623; outline-offset: -.2cqw; }
.lv:active { transform: scale(.985); }
@media (orientation: portrait) { .lv { left: 34.5%; width: 31%; top: calc((var(--py) - var(--ph) / 2) * 100%); height: calc(var(--ph) * 100%); font-size: 4.6cqw; } }

/* where each toy is (left / top / width / height in % of the picture) */
#hsPlace  { left: 3.6%; top: 54%; width: 43%; height: 29%; }
#hsMc     { left: 56%;  top: 64%; width: 40%; height: 18%; }
#hsRandom { left: 12%;  top: 27%; width: 25%; height: 57%; }
#hsOwn    { left: 65%;  top: 40%; width: 25%; height: 45%; }
#toySetup   { left: 0.4%;  top: 46.5%; width: 8.2%;  height: 19%; }
#toyHarder  { left: 8.8%;  top: 34.5%; width: 20.5%; height: 28%; }
#toyEasier  { left: 32.3%; top: 41.5%; width: 13%;   height: 21%; }
#toyAnother { left: 46%;   top: 46%;   width: 13%;   height: 15%; }
#toyAgain   { left: 59%;   top: 52%;   width: 12%;   height: 12%; }
#toySwitch  { left: 72.5%; top: 52%;   width: 13%;   height: 10%; }
#toyLeave   { left: 86.8%; top: 43.5%; width: 10%;   height: 19%; }
@media (orientation: portrait) {
  #hsPlace  { left: 4%;  top: 32%; width: 92%; height: 19%; }
  #hsMc     { left: 5%;  top: 67%; width: 90%; height: 13%; }
  #hsRandom { left: 26%; top: 17%; width: 47%; height: 34%; }
  #hsOwn    { left: 25%; top: 60%; width: 49%; height: 28%; }
  #toyHarder  { left: 11.5%; top: 26.3%; width: 39%; height: 19.5%; }
  #toyEasier  { left: 64%;   top: 30.5%; width: 28%; height: 16%; }
  #toyAnother { left: 5.5%;  top: 49%;   width: 27%; height: 11%; }
  #toyAgain   { left: 38.5%; top: 52.5%; width: 23%; height: 9%; }
  #toySwitch  { left: 68%;   top: 51%;   width: 29%; height: 10%; }
  #toySetup   { left: 9%;    top: 65%;   width: 17.5%; height: 13%; }
  #toyLeave   { left: 63.5%; top: 64%;   width: 36%; height: 15%; }
  .pg-toy .pg-chip b { font-size: max(13px, 3.6cqw); }
  .pg-toy .pg-chip { transform: translate(-50%, 72%); }
  .pg-hs:not(.pg-toy) .pg-chip b { font-size: max(16px, 4.6cqw); }
  .pg-hs:not(.pg-toy) .pg-chip small { font-size: max(12px, 2.8cqw); }
}
.pg-toy .pg-chip b { font-size: max(13px, 1.75cqw); }
.pg-toy .pg-chip { transform: translate(-50%, calc(72% + var(--row, 0) * 112%)); }          /* neighbors' labels sit on two rows so they never touch */
.pg-revealed .pb-outside-box { display: none !important; }       /* after Submit the "doesn't belong" box can no longer be used */
.pg-recap { position: absolute; left: 50%; top: 11.5%; transform: translateX(-50%); display: flex; gap: 1.2cqw; flex-wrap: wrap; justify-content: center; width: 92%; pointer-events: none; }
@media (orientation: portrait) { .pg-recap { top: 9%; } }
.pg-recap span { background: #fffaf0; border: .3cqw solid #12361f; border-radius: 1.6cqw; padding: .3cqw 1.6cqw; font: 700 max(14px, 2cqw) "Fredoka", sans-serif; color: var(--pg-ink); box-shadow: 0 .35cqw 0 rgba(0, 0, 0, .22); }
@media (orientation: portrait) { .pg-recap span { font-size: max(14px, 3.5cqw); } }

/* ---------- the problem ---------- */
.pg-playbg { position: absolute; inset: 0; background: url(assets/play-l.webp) center / cover; }
@media (orientation: portrait) { .pg-playbg { background-image: url(assets/play-p.webp); } }
/* the right padding is the MEASURED width of the corner buttons (app.js sets --pg-corner), so nothing can sit under them; if the row is still too full it wraps */
.pg-topbar { position: relative; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 4px 8px; padding: 4px var(--pg-corner, 430px) 0 max(12px, var(--zb-home-space, 60px)); min-height: 48px; box-sizing: border-box; }
.pg-topbar .pg-levelchip { margin-right: auto; }
.pg-topbar .pb-pill { padding: 2px 12px; font-size: 18px; white-space: nowrap; }
.pg-spacer { flex: 1 1 auto; }
/* the level (or "My Own Pebble Problem") is the title of the screen: big, gold, easy to read across a room */
.pg-levelchip { display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; padding: 3px 22px 5px; border-radius: 18px; background: linear-gradient(#ffe9a6, #f5b53a); border: 4px solid #12361f; box-shadow: 0 4px 0 rgba(0, 0, 0, .28); color: #12361f; font-family: "Fredoka", sans-serif; text-align: center; white-space: nowrap; }
.pg-levelchip small { font: 700 clamp(11px, 1.1vw, 14px) "Andika", sans-serif; letter-spacing: .12em; text-transform: uppercase; color: #6b4310; margin-bottom: 1px; }
.pg-levelchip small[hidden] { display: none; }
.pg-levelchip b { font-size: clamp(24px, 2.8vw, 38px); font-weight: 700; }
.pg-levelchip.own { padding-top: 6px; }
.pg-streak { background: #fff1cf; }
.pg-main { position: relative; z-index: 1; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; justify-content: center; padding: 0 6px; overflow: hidden; }
.pg-act, .pg-result { position: relative; z-index: 2; display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; padding: 4px 10px calc(28px + env(safe-area-inset-bottom, 0px)); }
.pg-act[hidden], .pg-result[hidden], .pg-mc[hidden] { display: none; }
.pg-act .pb-big { min-height: 52px; padding-top: 6px; padding-bottom: 6px; }
.pg-act .pb-outside-box { margin: 0; min-height: 52px; flex: 0 1 auto; display: flex; gap: 10px; align-items: center; font-weight: 700; font-size: clamp(14px, 1.8vw, 19px); background: #fff; border: 3px solid #b9a77c; border-radius: 14px; padding: 4px 14px; box-sizing: border-box; }
.pg-act .pb-outside-box[hidden] { display: none !important; }
.pg-act .pb-outside-box input { width: 28px; height: 28px; accent-color: #1f8a3c; flex: 0 0 auto; }
.pg-mc { display: flex; gap: 10px; width: min(560px, 100%); }
.pg-mc button { flex: 1 1 0; min-width: 0; min-height: 56px; border-radius: 16px; border: 4px solid #fff; background: var(--vc, #1d6fd1); color: #fff; cursor: pointer; font: 700 30px "Fredoka", "Andika", sans-serif; box-shadow: 0 4px 0 rgba(0, 0, 0, .3); touch-action: manipulation; }
.pg-mc button small { display: block; font: 600 12px "Andika", sans-serif; }
/* the chosen letter is unmistakable: bigger, gold glow, a check label; the others fade back */
.pg-mc button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; transition: transform .12s, opacity .12s, filter .12s; }
.pg-mc.picked button:not([aria-pressed="true"]) { opacity: .4; filter: grayscale(.6); transform: scale(.94); }
.pg-mc button[aria-pressed="true"] { transform: scale(1.14); z-index: 2; border-color: #ffe08a; outline: 6px solid #f5a623; outline-offset: 2px; box-shadow: 0 0 0 4px #12361f, 0 0 26px 8px rgba(255, 196, 60, .95), 0 5px 0 rgba(0, 0, 0, .3); }
.pg-mc button[aria-pressed="true"]::after { content: "\2713 My pick"; display: block; white-space: nowrap; color: #ffe08a; font: 700 13px/1.1 "Andika", sans-serif; }
.pg-mc.locked { pointer-events: none; }
.pg-mc button:disabled { opacity: .5; box-shadow: none; }
.pg-res-head { background: #fffaf0; border: 3px solid #b9a77c; border-radius: 16px; padding: 4px 14px; text-align: center; min-width: 190px; }
.pg-res-text { font: 700 clamp(20px, 2.6vw, 28px) "Fredoka", sans-serif; color: var(--pg-ink); line-height: 1.15; }
.pg-res-text.good { color: #1f6a2a; } .pg-res-text.meh { color: #8a5a00; }
.pg-res-sub { font: 700 clamp(13px, 1.5vw, 16px) "Andika", sans-serif; color: #4a3a22; }
.pg-coach { display: flex; gap: 8px; flex: 1 1 340px; max-width: 880px; }
.pg-coach > div { flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 8px; background: #fffaf0; border: 3px solid #b9a77c; border-radius: 14px; padding: 4px 8px; font: 700 clamp(12px, 1.35vw, 15px) / 1.2 "Andika", sans-serif; color: #2c2414; }
.pg-coach > div.good { background: #e8f3df; border-color: #6cb44a; }
.pg-coach > div.tip { background: #fff5dc; border-color: #f5a623; }
.pg-coach img { flex: none; width: 40px; height: 40px; object-fit: contain; }
.pg-sparks { position: absolute; inset: 0; z-index: 5; pointer-events: none; overflow: hidden; }
.pg-sparks img { position: absolute; width: 56px; height: auto; opacity: 0; animation: pgSpark 1.5s ease-out forwards; }
@keyframes pgSpark { 0% { opacity: 0; transform: scale(.3) rotate(-20deg); } 25% { opacity: 1; } 100% { opacity: 0; transform: translateY(-40px) scale(1.15) rotate(20deg); } }
@media (prefers-reduced-motion: reduce) { .pg-sparks img { animation: none; } }

/* corner buttons */
.pg-topright { position: fixed; right: 8px; top: 4px; z-index: 50; display: flex; align-items: flex-start; gap: 8px; }
.pg-topright .pb-btn { min-height: 44px; border-radius: 22px; white-space: nowrap; }
.pg-topright .pb-btn[hidden] { display: none; }
#tipsBtn[aria-pressed="true"] { background: #fff1cf; color: var(--pg-ink); }
/* the corner buttons are small round icons (the words are still there for screen readers); full screen is an icon too */
.pg-topright .pg-icon, .pg-topright .pb-fs { width: 46px; min-width: 46px; padding: 0; font-size: 22px; line-height: 1; justify-content: center; }
.pg-topright .pb-fs .pb-fs-t { display: none; }
.pg-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* make your own problem */
.pg-modal { position: fixed; inset: 0; z-index: 3000; background: rgba(0, 0, 0, .45); display: grid; place-items: center; padding: 12px; }
.pg-modal[hidden] { display: none; }
.pg-own { width: min(560px, 96vw); }
.pg-own-row { display: flex; gap: 10px; flex-wrap: wrap; }
.pg-own-row label { flex: 1 1 140px; display: flex; flex-direction: column; gap: 2px; font: 700 15px "Andika", sans-serif; color: #3a2f1b; }
.pg-own-row input[aria-invalid="true"] { border-color: #c0392b; }
.pg-own-err { min-height: 2.6em; margin: 6px 0; font-size: 18px; }
#toastHost { position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); z-index: 4000; }

@media (max-width: 1000px) { .pg-topbar { padding-right: 12px; padding-top: 52px; flex-wrap: wrap; justify-content: center; } .pg-spacer { display: none; } }
@media (max-height: 700px) { .pg-topbar { min-height: 40px; } .pg-act, .pg-result { padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); } .pg-coach img { width: 32px; height: 32px; } }

/* tall windows (kept last so these win over the landscape sizes above) */
@media (orientation: portrait) {
  .pg-toy .pg-chip b { font-size: max(13px, 3.4cqw); }
  .pg-hs:not(.pg-toy) .pg-chip b { font-size: max(16px, 4.6cqw); }
}

/* the help bubbles for young readers: bigger, friendlier */
.pg-bubble.pg-kids { width: min(400px, calc(100vw - 16px)); border-width: 5px; border-radius: 22px; padding: 14px 16px 12px; }
.pg-bubble.pg-kids .pg-t { font: 700 22px/1.3 "Andika", sans-serif; }
.pg-bubble.pg-kids .pg-n { font-size: 13px; }
.pg-bubble.pg-kids .pg-b { font-size: 18px; min-height: 44px; padding: 6px 16px; }
.pg-bubble.pg-kids .pg-next { background: #2f8f3a; border-color: #12361f; }
.pg-bubble.pg-kids .pg-off { font-size: 15px; }
.pg-bubble.pg-kids .pg-x { width: 44px; height: 44px; font-size: 32px; }
@media (max-height: 700px) { .pg-bubble.pg-kids .pg-t { font-size: 19px; } }

/* short screens (small laptops, Chromebooks): a slimmer title row so the path keeps its size */
.pg-levelchip.own b { font-size: clamp(20px, 2.3vw, 32px); }
@media (max-height: 700px) {
  .pg-levelchip { padding: 2px 16px 3px; border-width: 3px; }
  .pg-levelchip b { font-size: clamp(20px, 2.2vw, 28px); }
  .pg-levelchip.own b { font-size: clamp(18px, 1.9vw, 25px); }
  .pg-levelchip small { display: none; }
  .pg-topbar .pb-pill { font-size: 16px; padding: 2px 9px; }
  .pg-topbar .pb-btn { padding-left: 10px; padding-right: 10px; }
}
