/* Shared touch targets retain keyboard focus and browser page zoom. */
html{scroll-padding-top:5rem}
button,.slow-label,input[type=range]{touch-action:manipulation}
.icon-button{min-width:44px;min-height:44px;flex-shrink:0}
.sound-label{display:none}
.reset-button,.slow-label{min-height:44px;font-size:14px}
.reset-button{padding:10px 4px}
.slow-label input{inset:0;width:100%;height:100%;cursor:pointer}
.toggle{flex-shrink:0}
.stage canvas{touch-action:pan-y pinch-zoom;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
.fruit-touch{position:absolute;top:0;left:0;touch-action:pinch-zoom;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;cursor:grab}
.fruit-touch[hidden]{display:none}
.stage:has(canvas[data-tool="press"]) .fruit-touch{cursor:pointer}
.stage:has(canvas[data-tool="cut"]) .fruit-touch{cursor:crosshair}
.gesture svg,.bounce-button svg,.tool svg,.reset-button svg{flex-shrink:0}
.tool:focus-visible,.stage canvas:focus-visible{outline-offset:-3px}
.stage canvas[data-pointer-focus="true"]:focus{outline:none}
.stage canvas,.fruit-touch{-webkit-tap-highlight-color:transparent}
.brand-star,.tiny-star{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}
.brand-star svg,.tiny-star svg{display:block;width:1em;height:1em;fill:none;stroke:currentColor;stroke-width:3.5;stroke-linecap:butt}
input[type=range]{--softness:75%;height:44px;margin:8px 0 0;background:transparent;touch-action:pan-y;cursor:pointer}
input[type=range]::-webkit-slider-runnable-track{height:5px;border-radius:4px;background:linear-gradient(to right,var(--ink) var(--softness),#bdc778 var(--softness))}
input[type=range]::-webkit-slider-thumb{box-sizing:border-box;width:28px;height:28px;margin-top:-11.5px;border-width:5px;box-shadow:0 0 0 1px var(--ink)}
input[type=range]::-moz-range-track{height:5px;border-radius:4px;background:linear-gradient(to right,var(--ink) var(--softness),#bdc778 var(--softness))}
input[type=range]::-moz-range-thumb{box-sizing:border-box;width:28px;height:28px;border-width:5px}
@media(max-width:900px),(max-width:1000px) and (max-height:550px){
 :root{--mobile-bar:calc(58px + env(safe-area-inset-top,0px))}
 body{padding:0 env(safe-area-inset-right,0px) env(safe-area-inset-bottom,0px) env(safe-area-inset-left,0px)}
 .topbar{height:var(--mobile-bar);position:sticky;top:0;z-index:20;margin:0;padding:env(safe-area-inset-top,0px) 16px 0;background:var(--paper);gap:12px}
 .wordmark{font-size:25px;letter-spacing:-1.4px}.brand-star{font-size:29px}
 .top-note{display:none}
 .icon-button{width:auto;height:44px;border-radius:22px;display:flex;align-items:center;justify-content:center;gap:7px;padding:0 12px;font-size:14px}
 .sound-label{display:inline;white-space:nowrap}.icon-button[aria-pressed="true"]{background:var(--ink);color:var(--acid)}
 main{display:flex;flex-direction:column;height:auto;min-height:0;max-height:none;margin:10px 12px 0;gap:10px}
 .playground{position:sticky;top:var(--mobile-bar);z-index:10;display:grid;grid-template-areas:"specimen" "stage" "hint";height:auto;min-height:0;overflow:hidden;border-radius:10px;box-shadow:0 5px 14px #26291f0c}
 .intro{display:none}
 .stage{position:relative;inset:auto;grid-area:stage;height:260px;height:clamp(210px,35svh,320px);min-width:0}
 .specimen{position:static;grid-area:specimen;display:block;padding:10px 14px 0;min-width:0;pointer-events:auto;touch-action:pan-y pinch-zoom}
 .specimen>span:nth-child(2){font-size:20px;line-height:1.3;letter-spacing:-.5px;display:block}
 .specimen-number,.specimen-note{display:none}
 .stage-bottom{position:static;grid-area:hint;min-height:40px;height:auto;margin:0 12px;padding:9px 0;gap:8px;pointer-events:auto;touch-action:pan-y pinch-zoom}
 .gesture{font-size:13px;line-height:1.35;min-width:0;gap:8px}.gesture svg{width:17px;height:20px}
 .live-state{display:none}
 .controls{padding:12px 14px 14px;border-radius:10px;gap:0}
 .panel-top,.controls h2{display:none}
 .control-section{padding:13px 0}.tool-section{padding:0 0 13px;border-top:0}
 .field-label,.range-label label{font-size:12px;letter-spacing:1px;gap:9px;line-height:1.5}
 .tool-section>.field-label{display:none}
 .tools{margin:0;padding:4px;gap:3px;border-radius:9px;grid-template-columns:repeat(3,minmax(0,1fr))}
 .tool{min-height:46px;flex-direction:row;gap:7px;padding:9px 3px;font-size:15px}
 .tool svg{width:20px;height:20px}
 .flavours{margin-top:9px;gap:6px}
 .flavour{min-width:0;min-height:48px;flex-direction:row;gap:5px;padding:8px 3px;font-size:14px;line-height:1.25}
 .swatch{width:17px;height:17px}
 .texture{padding:13px 0 15px}.range-label{gap:8px}.range-label output{font-size:16px}
 input[type=range]{margin:3px 0 0;height:44px}
 .range-ends{font-size:12px;gap:12px;line-height:1.4}
 .bounce-button{min-height:50px;padding:13px 15px;font-size:16px}
 .bottom-controls{display:grid;grid-template-columns:1fr auto;gap:10px;margin:8px 0}
 .slow-label,.reset-button{font-size:14px;min-height:46px;gap:8px}
 .toggle{width:36px;height:22px}.toggle:after{width:14px;height:14px;top:3px;left:3px}.slow-label input:checked+.toggle:after{transform:translateX(14px)}
 .panel-footer{font-size:10px;line-height:1.5;letter-spacing:.5px;padding-top:11px;gap:12px;flex-wrap:wrap}
 .footer{height:auto;min-height:52px;margin:0 16px;padding:14px 0;gap:14px;flex-wrap:wrap;font-size:12px}.footer span:nth-child(2){font-size:10px;letter-spacing:1px}
}
@media(max-width:400px){
 .flavour{flex-direction:column;gap:4px;min-height:62px}
 .wordmark{font-size:23px}.brand-star{font-size:27px}
 .topbar{padding-right:12px;padding-left:12px}.gesture{font-size:12px}
}
/* Short landscape screens keep the fruit beside the scrolling controls. */
@media(min-width:600px) and (max-width:1000px) and (max-height:550px){
 main{display:grid;grid-template-columns:minmax(0,1.1fr) minmax(280px,1fr);align-items:start;gap:12px;margin-top:8px}
 .playground{top:var(--mobile-bar)}
 .stage{height:clamp(150px,calc(100svh - var(--mobile-bar) - 92px),340px)}
 .controls{padding:10px 12px 12px}.control-section{padding:10px 0}.tool-section{padding-top:0}
 .flavour{flex-direction:column;gap:4px;min-height:62px}
 .specimen{padding-top:8px}.specimen>span:nth-child(2){font-size:18px}
 .stage-bottom{min-height:36px;padding:7px 0}.gesture{font-size:12px}
}
/* At heavy page zoom, a stationary scene must not take over the viewport. */
@media(max-width:599px) and (max-height:450px){
 .topbar,.playground{position:relative;top:auto}.stage{height:200px}
}
@media(max-width:300px){
 .topbar{height:auto;min-height:58px;flex-wrap:wrap;padding-bottom:6px;gap:6px}.sound-label{display:none}
 .topbar,.playground{position:relative;top:auto}.flavours{grid-template-columns:repeat(2,minmax(0,1fr))}
 .tool{flex-direction:column;font-size:14px}.bottom-controls{grid-template-columns:1fr}.reset-button{justify-content:flex-start}
}

@media(max-width:900px),(max-width:1000px) and (max-height:550px){
 .category-tabs{margin-top:9px}.category-tab{min-height:44px}
 .animal-choice{flex-direction:column;min-height:72px;gap:5px}
 .animal-icon{font-size:27px}
}
