/* Local interaction improvements. Preserve this episode's original backgrounds. */
body.thread-adventure #backToReading{display:none!important}
body.thread-adventure #playScreen .mission-step{display:none!important}
body.thread-adventure .stitch-heading{min-height:18px;justify-content:flex-end}
body.thread-adventure .stitch-heading .stitch-round,body.thread-adventure .stitch-reference-label{display:none}
body.thread-adventure .stitch-word-row{display:flex;gap:12px;align-items:center;justify-content:center}
body.thread-adventure .stitch-word-row .stitch-hear{position:static!important;min-width:48px;width:48px;height:48px;min-height:48px;flex:0 0 48px;padding:0;border:2px solid #fffaf0;border-radius:50%;font-size:24px;background:#c7edf5;box-shadow:0 3px #85b5c9}
body.thread-adventure .yarn-controls{display:grid;grid-template-columns:48px minmax(70px,1fr) 48px;gap:8px;width:100%}
body.thread-adventure .yarn-controls button{min-width:44px;min-height:48px}
body.thread-adventure .yarn-controls .yarn-roll{grid-column:auto!important;font-size:23px!important}
body.thread-adventure .yarn-controls :is(.yarn-aim-left,.yarn-aim-right){font-size:30px;padding:4px}
body.thread-adventure .yarn-world[data-phase=intro] .yarn-controls{display:none}
body.thread-adventure .yarn-gesture{font-size:32px}
body.thread-adventure .garden-world{touch-action:none;user-select:none;-webkit-user-select:none}
body.thread-adventure .garden-drawn-route{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:6;overflow:visible}
body.thread-adventure .garden-drawn-route path{fill:none;stroke:#fff5ac;stroke-width:7;stroke-linecap:round;stroke-linejoin:round;filter:drop-shadow(0 2px 1px #6f5966)}
body.thread-adventure .pollen-garden .butterfly-flyer{transition:none!important}
body.thread-adventure .garden-route-note{position:absolute;bottom:12px;left:50%;translate:-50% 0;max-width:90%;width:max-content;margin:0;padding:8px 18px;background:#fff9e9ed;border-radius:22px;color:#315b50;font:800 clamp(15px,1.5vw,21px)/1.2 'Trebuchet MS',sans-serif;z-index:10;pointer-events:none;text-align:center}
body.thread-adventure .flying-route .butterfly-flyer img{animation-duration:.22s}
body.thread-adventure .charge-whale{scale:var(--charge-scale,1);transition:scale .15s;transform-origin:50% 70%;isolation:isolate}
body.thread-adventure .charge-whale::after{content:'';position:absolute;inset:8%;border:5px solid #b9f8ff;border-radius:50%;opacity:calc(var(--charge-ratio,0) * .85);scale:calc(1 + var(--charge-ratio,0) * .15);filter:drop-shadow(0 0 10px #58e6ff);pointer-events:none;z-index:-1}
body.thread-adventure .charging .baby-whale-sprite{animation:threadPowerWiggle var(--charge-speed,1s) ease-in-out infinite;filter:drop-shadow(0 0 calc(var(--charge-ratio,0) * 24px) #8ef6ff)}
body.thread-adventure .charge-full .charge-whale::after{border-color:#fff28a;filter:drop-shadow(0 0 18px #ffdf4f)}
body.thread-adventure .charge-full .splash-power-track{box-shadow:0 0 14px #ffe16c}
@keyframes threadPowerWiggle{0%,100%{transform:translateY(2px) rotate(-2deg) scaleY(.97)}50%{transform:translateY(-8px) rotate(2deg) scaleY(1.04)}}
body.thread-adventure .thread-name-keyboard{display:grid;grid-template-columns:repeat(10,minmax(0,1fr));gap:6px;margin:8px 0 14px}
body.thread-adventure .thread-name-keyboard button{min-width:0;min-height:44px;padding:4px;font:800 20px/1 'Trebuchet MS',sans-serif;color:#273d60;background:#fff6db;border:2px solid #dfbcca;border-radius:10px;box-shadow:0 3px #cf9db3}
body.thread-adventure .thread-name-keyboard button:active{translate:0 2px;box-shadow:0 1px #cf9db3}
body.thread-adventure .thread-name-keyboard [data-key=Space],body.thread-adventure .thread-name-keyboard [data-key=Backspace]{grid-column:span 2;background:#eadcf7;font-size:18px}
body.thread-adventure .rrdd-certificate-preview>.rrdd-save-certificate{display:block;position:static!important;width:100%;margin:12px auto 0;min-height:48px;border-radius:16px;font-size:20px}
body.thread-adventure .adv-award-options{grid-template-columns:1fr!important}
@media(max-width:700px){body.thread-adventure .thread-name-keyboard{grid-template-columns:repeat(6,minmax(0,1fr))}body.thread-adventure .yarn-controls{grid-column:1/-1;grid-template-columns:52px minmax(70px,1fr) 52px}body.thread-adventure .stitch-word-row .stitch-hear{min-width:44px;width:44px;height:44px;min-height:44px;flex-basis:44px}}
@media(max-height:500px) and (orientation:landscape){body.thread-adventure .yarn-coach{gap:3px}body.thread-adventure .yarn-controls{gap:5px}body.thread-adventure .yarn-controls .yarn-roll{font-size:19px!important}body.thread-adventure .garden-route-note{bottom:4px;font-size:13px;padding:5px 12px}}
@media(prefers-reduced-motion:reduce){body.thread-adventure .charging .baby-whale-sprite{animation:none!important}body.thread-adventure .charge-whale{transition:none}}
body.thread-adventure.reduce-motion .charging .baby-whale-sprite{animation:none!important}
body.thread-adventure #sceneInteraction .garden-world{pointer-events:auto!important}
body.thread-adventure #sceneInteraction .pollen-garden .butterfly-flyer{pointer-events:auto!important;touch-action:none;cursor:crosshair}
body.thread-adventure .rrdd-certificate-preview{display:flex!important;flex-direction:column;align-items:center;justify-content:center;gap:12px}
body.thread-adventure .rrdd-certificate-preview>.rrdd-save-certificate{margin:0!important;flex:0 0 auto}
@media(max-width:700px){
 body.thread-adventure #certificateScreen{overflow-y:auto!important;overflow-x:hidden!important}
 body.thread-adventure #certificateScreen .rrdd-unified-result{display:flex!important;flex-direction:column;gap:14px;height:auto!important;min-height:100%;max-height:none!important;padding:12px!important}
 body.thread-adventure #certificateScreen .rrdd-completion-layout{display:flex!important;flex-direction:column;gap:16px;height:auto!important;max-height:none!important;overflow:visible!important}
 body.thread-adventure #certificateScreen .rrdd-certificate-preview{height:auto!important;min-height:0;flex:none;gap:10px}
 body.thread-adventure #certificateScreen .rrdd-card-preview-stage{width:min(260px,90%)!important;height:auto!important;flex:none}
 body.thread-adventure #certificateScreen .rrdd-certificate-preview canvas{width:100%!important;height:auto!important;max-height:none!important}
 body.thread-adventure #certificateScreen .rrdd-certificate-form{height:auto!important;max-height:none!important;overflow:visible!important;flex:none}
 body.thread-adventure #certificateScreen .rrdd-save-certificate{width:min(300px,100%)}
}
@media(max-width:700px){
 body.thread-adventure #certificateScreen .rrdd-unified-result{overflow-y:auto!important;min-height:0!important;height:auto!important}
 body.thread-adventure #certificateScreen .rrdd-completion-layout{flex:none!important;min-height:min-content!important}
 body.thread-adventure #certificateScreen .rrdd-certificate-preview{container-type:normal!important;position:static!important;align-self:center!important;width:100%;height:auto!important}
}
/* Read along with the measured Seth word times. */
body.thread-adventure #readingSentence .thread-reading-word{border-radius:7px;padding:1px 3px;margin:0 -3px;box-decoration-break:clone;-webkit-box-decoration-break:clone}
body.thread-adventure #readingSentence .thread-reading-word.active{background:#ffe07c;color:#173c61;box-shadow:0 3px 0 #d9a740}
/* Large, explicit controls: two direction buttons and a strong central roll action. */
body.thread-adventure .yarn-controls{grid-template-columns:minmax(68px,1fr) minmax(112px,1.7fr) minmax(68px,1fr);gap:10px;padding:8px;border-radius:26px;background:#fff7e6b8}
body.thread-adventure .yarn-controls button{min-height:84px!important;border:3px solid #fff!important;border-radius:20px!important;box-shadow:0 6px #7c8dba!important}
body.thread-adventure .yarn-controls :is(.yarn-aim-left,.yarn-aim-right){display:flex;flex-direction:column;gap:3px;justify-content:center;align-items:center;background:#bce7f7;font-size:42px!important;padding:6px!important}
body.thread-adventure .yarn-controls b{font-size:14px;line-height:1;letter-spacing:.04em}
body.thread-adventure .yarn-controls .yarn-roll{font-size:clamp(26px,2.4vw,36px)!important;background:#ffdc58;box-shadow:0 6px #c59128!important}
body.thread-adventure .yarn-controls button:focus-visible{outline:5px solid #2186ba;outline-offset:3px}
body.thread-adventure .garden-sparkles{filter:drop-shadow(0 0 4px #fff3b3)}
@media(max-height:500px) and (orientation:landscape){body.thread-adventure .yarn-controls{grid-template-columns:56px minmax(78px,1fr) 56px;padding:4px;gap:5px}body.thread-adventure .yarn-controls button{min-height:64px!important}body.thread-adventure .yarn-controls .yarn-roll{font-size:23px!important}body.thread-adventure .yarn-controls :is(.yarn-aim-left,.yarn-aim-right){font-size:30px!important}body.thread-adventure .yarn-controls b{font-size:11px}}
