/* VOICE a toy
   IDEA an unpainted vinyl figure that gets painted by whatever you show it
   PICTURE the creature in a toy landscape that follows the clock; each colour eaten grows a flower there
   COLOUR page colours set live by app.js (--bg, --ink); white controls; colour belongs to the creature
   TYPE the system's rounded face, so nothing is downloaded and Greek matches
   LAYOUT name on top, creature in the middle, three needs at the thumb */
:root{--bg:#f3c93f;--ink:#1c1a2b;color-scheme:light}
*{box-sizing:border-box;min-width:0}
[hidden]{display:none!important}
html,body{height:100%;margin:0;overflow:hidden;background:var(--bg);overscroll-behavior:none}
body{color:var(--ink);font:500 17px/1.4 ui-rounded,"SF Pro Rounded",system-ui,sans-serif;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}
button,input{font:inherit;color:inherit}
button,.btn{cursor:pointer;touch-action:manipulation}
:focus-visible{outline:3px solid var(--ink);outline-offset:3px}
#back,#stage,#fx{position:fixed;inset:0;width:100%;height:100%}
#stage{touch-action:none;outline-offset:-6px;opacity:0}
#fx{pointer-events:none;z-index:1}

#top{position:fixed;top:max(18px,env(safe-area-inset-top));left:22px;right:18px;display:flex;justify-content:space-between;align-items:flex-start;pointer-events:none}
#top button{pointer-events:auto}
#tools{display:flex;align-items:center}
#coinBtn{border:0;border-radius:24px;background:#fff;color:#1c1a2b;height:44px;padding:0 14px 0 8px;margin-right:4px;font-weight:800}
#coinBtn,#purseBox{display:flex;align-items:center;gap:7px;font-variant-numeric:tabular-nums}
#coinBtn i,#purseBox i,.price::before{width:26px;height:26px;border-radius:50%;background:#ffbe2e;box-shadow:inset 0 0 0 4px #ffdf7a}
#purseBox{margin-left:auto;font-weight:800;font-size:20px}
h1{font-size:34px;line-height:1.05;margin:0;font-weight:800;letter-spacing:-.02em;overflow-wrap:anywhere}
#age{margin:4px 0 0}
.round{width:48px;height:48px;flex:none;border:0;border-radius:50%;background:none;display:grid;place-items:center}
.round svg{width:28px;fill:none;stroke:currentColor;stroke-width:2.6;stroke-linecap:round}

#bubble{position:fixed;left:50%;top:0;margin:0;width:max-content;max-width:min(300px,calc(100vw - 40px));padding:12px 18px;border-radius:22px;background:#fff;color:#1c1a2b;font-weight:600;line-height:1.3;text-align:center;text-wrap:balance;pointer-events:none;opacity:0;transform:translate(-50%,-100%) scale(.9);transform-origin:50% 100%;transition:opacity .18s,transform .25s cubic-bezier(.3,1.5,.5,1)}
#bubble::after{content:"";position:absolute;left:calc(50% + var(--ax,0px));bottom:-7px;width:18px;height:18px;margin-left:-9px;background:#fff;border-radius:4px;transform:rotate(45deg)}
#bubble.flat::after{display:none}
#bubble.on{opacity:1;transform:translate(-50%,-100%)}
#dot{display:inline-block;width:16px;height:16px;border-radius:50%;margin-right:8px;vertical-align:-2px}
#dot:not([style*=background]){display:none}
#score{position:fixed;top:max(84px,calc(env(safe-area-inset-top) + 70px));left:0;right:0;text-align:center;font-size:84px;line-height:1;font-weight:800;pointer-events:none;font-variant-numeric:tabular-nums}
#orb{position:fixed;left:0;top:0;width:56px;height:56px;margin:-28px;border-radius:50%;pointer-events:none;opacity:0}

#bar,#gamebar,#palbar,#pads{position:fixed;left:max(16px,env(safe-area-inset-left));right:max(16px,env(safe-area-inset-right));bottom:max(20px,env(safe-area-inset-bottom));max-width:460px;margin:auto;display:grid;grid-template-columns:1fr 1.25fr 1fr;gap:10px}
#gamebar{grid-template-columns:1fr 1fr}
#rainBtn#rainBtn{grid-column:1/-1;min-height:72px;font-size:20px}
/* chunky toy buttons: the dark edge underneath disappears when pressed */
#bar button,#gamebar button,#palbar button,#pads button{border:0;border-radius:24px;background:#fff;color:#1c1a2b;min-height:60px;font-weight:700;font-size:17px;position:relative;overflow:hidden;box-shadow:inset 0 -6px 0 #1c1a2b26;padding:4px 6px 9px;transition:transform .1s,box-shadow .1s}
#bar button{min-height:84px;display:grid;place-content:center;justify-items:center;gap:3px}
/* each need is its own gauge: it empties as the need grows */
.need::before{content:"";position:absolute;inset:0;z-index:0;background:var(--tint);transform:translateY(calc(100% - var(--v,0)*1%));transition:transform .6s;box-shadow:inset 0 -6px 0 #1c1a2b26}
.need span,.need svg{position:relative}
.need svg{width:28px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
#bar .main svg{width:34px}
#bar button:active,#gamebar button:active,#palbar button:active,#pads button:active,#pads button.lit{transform:translateY(4px) scale(.97);box-shadow:inset 0 -2px 0 #1c1a2b26}
#palbar{grid-template-columns:repeat(6,1fr)}
#palbar button{grid-column:span 2}
#hugBtn#hugBtn,#byeBtn#byeBtn{grid-column:span 3}
#pads{grid-template-columns:1fr 1fr}
#pads button{min-height:72px}
#pads button:nth-child(1){background:#ffd84a}#pads button:nth-child(2){background:#6fd3a0}#pads button:nth-child(3){background:#ff9ec0}#pads button:nth-child(4){background:#8ec5ff}
#pads[data-off]{opacity:.55;pointer-events:none}
#list{display:grid;gap:8px;margin:12px 0}
#list button{display:flex;align-items:center;gap:14px;border:0;border-radius:22px;background:#f1eff6;padding:8px 14px;text-align:left;min-height:72px;font-weight:700;font-size:19px}
#list canvas{width:52px;height:56px;flex:none}
#list small{display:block;font-size:15px;font-weight:600;color:#1c7a45}
#qr{display:block;width:min(210px,56vw);aspect-ratio:1;margin:0 auto;image-rendering:pixelated}
#list{max-height:32dvh;overflow:auto}
/* colours it knows, one tap away; the first button opens the riddles */
#strip{position:fixed;left:max(16px,env(safe-area-inset-left));right:0;bottom:calc(max(20px,env(safe-area-inset-bottom)) + 92px);max-width:460px;margin:auto;display:flex;align-items:center;gap:8px}
#bookBtn{flex:none;border:0;border-radius:20px;background:#1c1a2b;color:#fff;height:46px;padding:0 14px;font-weight:800;font-variant-numeric:tabular-nums}
#bookBtn::before{content:"? ";color:#ffdf7a}
#pots{display:flex;gap:8px;overflow-x:auto;padding:4px 16px 4px 2px;scrollbar-width:none;touch-action:pan-x}
#pots button{width:44px;height:44px;flex:none;border:3px solid #fff;border-radius:50%;box-shadow:inset 0 -5px 0 #1c1a2b26;transition:transform .1s}
#pots button:active{transform:scale(.85)}
#riddles{display:grid;gap:8px;max-height:56dvh;overflow:auto;padding:4px}
#riddles>*{display:flex;align-items:center;gap:12px;min-height:76px;border:0;border-radius:20px;background:#f1eff6;padding:4px 12px 4px 6px;text-align:left;font-weight:600;line-height:1.25}
#riddles>*>span:nth-child(2){flex:1}
#riddles .found{font-weight:800;font-size:19px}
#riddles .found[aria-pressed=true]{box-shadow:0 0 0 3px #1c1a2b}
.who canvas{display:block;width:68px;height:68px}
div>.who canvas{filter:brightness(0);opacity:.16}
#riddles .price{flex:none;border:0;border-radius:16px;background:#fff;height:44px;padding:0 12px;font-weight:800}
#riddles .price:disabled{opacity:.5}
.dots{display:flex;gap:5px}
.dots i{width:24px;height:24px;border-radius:50%;border:2px solid #fff}
#ask{position:fixed;left:16px;right:16px;bottom:max(20px,env(safe-area-inset-bottom));max-width:420px;margin:auto;background:#fff;color:#1c1a2b;border-radius:28px;padding:18px 20px 12px}
#ask p{margin:0;font-weight:700;font-size:19px;line-height:1.3;text-wrap:balance}
/* the shop leaves the creature in view, so you see what it tries on */
#shop{height:min(50dvh,460px);padding-bottom:14px}
#shop[open]{display:flex;flex-direction:column;gap:10px}
#shop::backdrop{background:none}
#items{flex:1;overflow:auto;display:grid;grid-template-columns:repeat(auto-fill,minmax(92px,1fr));gap:8px;align-content:start;padding:4px}
#items button{border:0;border-radius:20px;background:#f1eff6;padding:4px 4px 8px;display:grid;justify-items:center;font-size:15px}
#items button.try,#items button[aria-pressed=true]{box-shadow:0 0 0 3px #1c1a2b}
#items canvas{width:78px;height:78px;border-radius:18px}
.price{display:flex;align-items:center;gap:5px}
.price::before{content:"";width:16px;height:16px;box-shadow:inset 0 0 0 3px #ffdf7a}
#buyBtn:disabled{background:#f1eff6;color:#5d5a70;border-color:#f1eff6}
@media(max-width:899px){body:has(#shop[open]) :is(#back,#stage,#fx){transform:translateY(-20dvh)}#shop{width:100%;max-width:none;margin:auto 0 0;border-radius:30px 30px 0 0;padding-bottom:max(14px,env(safe-area-inset-bottom))}}
@media(min-width:900px){#shop{margin:auto 24px 24px auto;height:min(76dvh,560px)}}
.wide{width:100%;grid-column:1/-1}

#naming{position:fixed;left:16px;right:16px;bottom:max(24px,env(safe-area-inset-bottom));max-width:420px;margin:auto;background:#fff;color:#1c1a2b;border-radius:28px;padding:20px}
#naming label{font-weight:700;font-size:20px}
#naming div{display:flex;gap:10px;margin-top:12px}
input#nameIn{flex:1;height:52px;border:2px solid #1c1a2b;border-radius:18px;padding:0 16px;background:#fff;font-weight:600;-webkit-user-select:text;user-select:text}
#naming button,.btn{border:2px solid #1c1a2b;border-radius:18px;min-height:52px;padding:8px 18px;background:#fff;font-weight:700;display:grid;place-items:center;text-align:center;line-height:1.2}
#naming button,.btn.solid{background:#1c1a2b;color:#fff}

dialog{border:0;padding:20px;color:#1c1a2b;background:#fff;border-radius:30px;width:min(440px,calc(100vw - 24px));max-height:calc(100dvh - 40px);margin:auto auto max(12px,env(safe-area-inset-bottom));overflow:auto;overscroll-behavior:contain}
dialog::backdrop{background:#1c1a2b66}
dialog[open]{animation:up .28s cubic-bezier(.2,1.1,.4,1)}
@keyframes up{from{transform:translateY(40px);opacity:0}}
h2{font-size:20px;line-height:1.2;margin:0;font-weight:700}
.row{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:16px 0 8px}
#lens h2{margin-top:16px}
#view{display:block;width:100%;height:min(56dvh,460px);border-radius:20px;background:#1c1a2b;touch-action:none;cursor:crosshair}
#lensEmpty{margin:0;padding:34px 8px;font-size:19px;text-align:center;text-wrap:balance}
#file{position:absolute;width:1px;height:1px;opacity:0}
#file:focus-visible+*,.btn:has(+#file:focus-visible){outline:3px solid #1c1a2b;outline-offset:3px}
.head,.line{display:flex;justify-content:space-between;align-items:center;gap:12px}
.head{margin:-6px -8px 0 0}
.line{min-height:52px}
#album{display:grid;grid-template-columns:repeat(auto-fill,minmax(34px,1fr));gap:6px;margin-top:10px;max-height:170px;overflow:auto}
#album i{aspect-ratio:1;border-radius:12px}
#note:empty{display:none}
.seg{display:flex;gap:4px}
.seg button{width:48px;height:44px;border:0;border-radius:14px;background:none;font-weight:700}
.seg button[aria-pressed=true]{background:#1c1a2b;color:#fff}
#sound,#remind{width:26px;height:26px;accent-color:#1c1a2b}
.small{font-size:15px;margin:8px 0}
.small a{color:inherit;margin-right:14px;display:inline-block;padding:8px 0}
.text{border:0;background:none;padding:12px 0;text-decoration:underline;text-underline-offset:4px}
@media(prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}
