/* Screen composition: scale useful content, not empty instruction panels. */
:root {--page-gap:clamp(12px,1.5vw,44px);--panel-pad:clamp(10px,1.2vw,28px)}
.nickname-input {display:block;width:100%;min-height:3rem;padding:.7rem 1rem;border:2px solid #d9b6c8;border-radius:14px;background:#fff;color:var(--ink);font:inherit}
.welcome-name-label {display:block;margin-bottom:.5rem;color:var(--berry);font-size:1.15rem;font-weight:900}
.nickname-hint {margin:.4rem 0 0;font-size:.8rem;color:var(--muted)}
.start-zone {margin:0}
#profile-dialog {width:min(30rem,calc(100% - 32px))}
#profile-form {display:grid;gap:12px;padding:2rem}
#profile-form>.field-label,#profile-form>.eyebrow,#profile-form>h2 {margin:0}
#profile-form>h2 {padding-right:28px}
#profile-form>.primary-button {margin-top:4px;min-height:48px}
/* One focus ring with room around it. Programmatically focused headings
   remain available to screen readers without looking like giant buttons. */
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,[tabindex]:focus-visible,summary:focus-visible {outline:3px solid #74204d;outline-offset:2px;box-shadow:none}
.session-options input:focus-visible+span {outline:3px solid #74204d;outline-offset:2px;box-shadow:none}
h1[tabindex="-1"]:focus,h2[tabindex="-1"]:focus {outline:none;box-shadow:none}
.typing-zone:focus,.typing-zone:focus-visible,.intro-panel:focus-visible {outline:0;border-color:#a52b68;box-shadow:inset 0 0 0 1px #a52b68}
.session-options {gap:.65rem}
.result-celebration {position:relative;display:grid;align-content:center;justify-items:center;gap:1rem;min-width:0;border-radius:24px;background:#fff8fc;overflow:hidden}
.result-celebration>.buddy-art {width:min(90%,24rem,54dvh);max-height:none;aspect-ratio:1}
.result-celebration>p {position:relative;margin:0 1rem 1rem;color:var(--berry);font-weight:850;text-align:center}
.celebration-star {position:absolute;top:9%;right:12%;color:#d49a39;font-size:4rem;transform:rotate(15deg)}
.results-copy {min-width:0;text-align:left}
.profile-list>[role="listitem"],.profile-chip {min-width:0;max-width:100%}
.profile-chip strong {overflow-wrap:anywhere}
.results-card .session-keepsakes {justify-content:flex-start;padding:0;background:none}
.results-card .results-actions {justify-content:flex-start;gap:.75rem}
.results-card .level-note {text-align:left}

@media (min-width:701px) {
  :root {font-size:clamp(16px,min(1.15vw,1.75dvh),30px)}
  body,body.game-active {display:grid;grid-template-rows:auto minmax(0,1fr);height:100dvh;min-height:0;overflow-y:auto}
  .site-header,body.game-active .site-header {width:calc(100% - 2 * var(--page-gap));height:clamp(50px,7dvh,100px);min-height:50px}
  .brand-paw {width:2.65rem;height:2.65rem;border-radius:.9rem;font-size:1.3rem}
  .icon-button {min-height:2.65rem;padding:.4rem .7rem;border-radius:.8rem}
  .app-shell,body.game-active .app-shell,.app-shell:has(#results-screen.active) {width:calc(100% - 2 * var(--page-gap));height:100%;min-height:0;margin:0 auto;padding:0 0 max(8px,1dvh)}
  .screen.active {height:100%;min-height:0}
  .home-card,.results-card {height:100%;min-height:0;width:100%;max-width:none;margin:0;padding:var(--panel-pad);border-radius:1.6rem;gap:clamp(20px,3vw,80px)}
  .home-card {grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
  .home-copy {width:100%;max-width:36rem;justify-self:center;padding:clamp(8px,1.6vw,40px)}
  .home-card h1 {font-size:clamp(2.2rem,4vw,4rem);line-height:1.06;margin:0 0 .6rem;text-wrap:balance}
  .home-lede {font-size:1.05rem;margin-bottom:1.25rem}
  .start-zone {padding:1.1rem;border-radius:1.2rem}
  .profile-list {max-height:7rem;overflow-y:auto;padding:4px;margin:.5rem -4px}
  .profile-chip {padding:.5rem .75rem}
  .start-heading h2 {font-size:1.2rem}
  .session-fieldset {margin:1rem 0}
  .session-options {grid-template-columns:repeat(4,minmax(0,1fr))}
  .session-options span {padding:.6rem .25rem}
  .session-options small {font-size:.65rem}
  .start-zone>.primary-button {min-height:3rem;font-size:1.1rem}
  .hero-figure {display:block;align-self:stretch;min-height:0;height:100%;border-radius:1.2rem;overflow:hidden;background:#fae4e7}
  .hero-figure img {height:100%;width:100%;aspect-ratio:auto;object-fit:cover;object-position:52% center;transform:none;border:0;border-radius:0;box-shadow:none}
  .hero-figure figcaption {bottom:1rem;right:1rem;left:1rem;padding:.7rem 1rem;text-align:center;font-size:.9rem;border-radius:1rem;background:#fffcf1ed;box-shadow:0 4px 20px #54203915}
  .game-screen.active {height:100%;grid-template-rows:auto minmax(0,1fr) auto;gap:clamp(5px,1dvh,16px)}
  .game-head {min-height:0;align-items:center;gap:1rem;padding:0 .25rem}
  .game-head h1 {font-size:clamp(1.5rem,2.4vw,2.4rem);margin-bottom:0}
  .game-head .eyebrow {margin-bottom:.2rem}
  .stat-strip {gap:.5rem;padding:.3rem .5rem;border-radius:1rem}
  .stat-strip div {min-width:3.5rem;padding:.1rem .3rem}
  .stat-strip strong {font-size:1.05rem}.stat-strip span {font-size:.6rem}
  .game-main {height:100%;min-height:0;grid-template-columns:minmax(0,1fr) minmax(220px,30%);grid-template-rows:minmax(0,1fr);gap:var(--panel-pad);align-items:stretch}
  .practice-card {height:100%;min-width:0;min-height:0;align-self:stretch;grid-template-columns:minmax(0,1fr);justify-content:stretch;grid-template-rows:minmax(80px,1fr) clamp(88px,16dvh,9rem) minmax(1rem,auto) auto;gap:clamp(5px,.8dvh,14px);padding:var(--panel-pad);border-radius:1.6rem}
  .practice-card>.intro-panel,.practice-card>.typing-zone {min-height:0;min-width:0;max-height:none;margin:0}
  .intro-panel {grid-template-columns:auto minmax(0,32rem);justify-content:center;gap:1rem;padding:.6rem 1rem}
  .intro-key {height:4rem;width:4rem;font-size:2rem;border-radius:1rem}
  .intro-copy>p {font-size:1.05rem;line-height:1.35}
  .intro-pips {margin-top:.5rem}.intro-pips span {width:1.8rem;height:.45rem}
  .typing-zone {padding:.5rem 1rem .8rem;border-radius:1rem}
  .prompt-display {font-size:2rem;line-height:1.35}
  body.large-practice-text .prompt-display {font-size:2.6rem}
  .practice-footer {min-height:0}
  .round-feedback {margin:0;font-size:.78rem;line-height:1.25}
  .practice-card>.keyboard-panel {min-width:0;min-height:0;grid-template-columns:7rem minmax(0,1fr);padding:.5rem 0 0;margin:0;gap:1rem}
  .practice-card>.keyboard-panel .keyboard {container-type:inline-size;--key-gap:clamp(3px,.3vw,8px);max-width:60rem;min-width:0;width:100%;gap:var(--key-gap)}
  .keyboard-row {gap:var(--key-gap)}
  .key {flex:0 0 calc((100cqw - 11 * var(--key-gap))/12);width:calc((100cqw - 11 * var(--key-gap))/12);max-width:none;min-width:0;height:clamp(25px,5.3dvh,4rem);font-size:.82rem;border-radius:.5rem}
  .key.space-key {flex:0 1 58%;width:58%;height:clamp(23px,3.6dvh,2.3rem);max-width:none}
  .hand-guide {grid-template-columns:minmax(0,1fr);width:100%;padding:.5rem .25rem;gap:.5rem;border-radius:1rem}
  .hand-figures {width:6rem;height:3rem;gap:.25rem;transform:none}
  .guide-hand {width:2.8rem;height:2.4rem;gap:.1rem;padding:0 .15rem .6rem}
  .guide-finger {width:.37rem}.guide-finger.pinky {height:.95rem}.guide-finger.ring {height:1.3rem}.guide-finger.middle {height:1.6rem}.guide-finger.pointer {height:1.45rem}.guide-finger.thumb {width:.42rem;height:.8rem}
  .guide-palm {left:.37rem;width:2.05rem;height:1rem}
  .hand-caption {max-width:100%;font-size:.65rem;gap:.25rem}
  .hand-caption strong {font-size:.75rem;min-width:1.7rem;min-height:1.6rem}
  .mission {container-type:size;--actor-size:clamp(52px,65cqh,18rem);--end-space:clamp(60px,10cqw,160px);border-radius:1rem}
  .mission-heading {font-size:.85rem;top:.55rem;left:.7rem;padding:.2rem .6rem}
  .mission .scene-yarn {width:clamp(26px,18cqh,90px);height:clamp(26px,18cqh,90px);bottom:calc(var(--actor-size)*.13)}
  .mission .scene-shadow {bottom:calc(var(--actor-size)*.12)}
  .mission .scene-cushion {width:calc(var(--actor-size)*.65);height:calc(var(--actor-size)*.16);bottom:calc(var(--actor-size)*.09)}
  .level-picture-card {display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr) auto;min-height:0;height:100%;align-self:stretch;gap:1rem;padding:var(--panel-pad);border-radius:1.6rem;background:linear-gradient(155deg,#fff,#fff6fa)}
  .level-picture-heading {margin:0;gap:.5rem;align-items:center}
  .level-picture-heading h2 {font-size:1.25rem}.level-picture-heading .eyebrow {font-size:.65rem}
  .level-picture-heading>strong {font-size:.8rem;padding:.3rem .6rem}
  .level-picture-slot {container-type:size;min-height:0;min-width:0;display:grid;place-items:center}
  .level-picture-slot>.level-picture-frame {width:min(100cqw,100cqh);height:auto;max-width:100%;aspect-ratio:1;margin:0;border-radius:1.2rem}
  .kitty-fact {margin:0;padding:.9rem;border-radius:1rem}.kitty-fact>p {font-size:.88rem;line-height:1.45}
  .game-actions {min-height:0;gap:1rem}.game-actions button {min-height:2.6rem;padding:.5rem 1rem}
  .results-card {display:grid;grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr);align-items:stretch}
  .results-copy {align-self:center;padding:clamp(8px,2vw,40px);max-width:40rem;max-height:100%;overflow-y:auto}
  .results-card h1 {font-size:clamp(2.2rem,4vw,3.6rem);text-wrap:balance}
  .results-card .session-keepsakes {margin:1.4rem 0}.session-keepsakes p {font-size:1rem;margin:.65rem 0}
  .results-card .level-note {padding:1rem;border-radius:1rem}
  .results-card .results-actions {margin-top:1.25rem;flex-wrap:wrap}
}
@media (min-width:701px) and (max-height:700px) {
  .home-card,.results-card {gap:1rem}.home-copy,.results-copy {padding:.6rem}
  .home-card h1 {font-size:2.2rem}.home-lede {margin-bottom:.6rem;font-size:.9rem}
  .start-zone {padding:.75rem}.nickname-input {min-height:2.5rem;padding:.4rem .7rem}
  .session-fieldset {margin:.65rem 0}.session-options span {padding:.4rem .15rem}
  .start-zone>.primary-button {min-height:2.6rem;font-size:1rem}.welcome-name-label {font-size:1rem}
  .practice-card {grid-template-rows:minmax(65px,1fr) 88px minmax(16px,auto) auto;gap:5px;padding:9px}
  .practice-card>.keyboard-panel {grid-template-columns:105px minmax(0,1fr);gap:10px;padding-top:5px}
  .key {height:clamp(24px,5.1dvh,35px)}.key.space-key {height:25px}
  .prompt-display {font-size:1.75rem}body.large-practice-text .prompt-display {font-size:2.1rem}
  .intro-key {width:3rem;height:3rem;font-size:1.7rem}.intro-copy>p {font-size:.9rem}
  .level-picture-card {gap:.6rem;padding:10px}.level-picture-heading h2 {font-size:1.05rem}.kitty-fact {padding:.6rem}.kitty-fact>p {font-size:.76rem}
  .mission-heading {font-size:.72rem;top:4px;left:6px;padding:2px 6px}
  .results-card h1 {font-size:2.2rem}.results-card .session-keepsakes {margin:.65rem 0}.session-keepsakes p {font-size:.88rem;margin:.4rem 0}
  .results-card .level-note {padding:.65rem}.results-card .results-actions {margin-top:.7rem;gap:.5rem}
}
@media (min-width:701px) and (max-height:540px) {
  .site-header,body.game-active .site-header {height:44px;min-height:44px}
  .brand-paw {height:34px;width:34px;font-size:1rem}.icon-button {min-height:34px;padding:4px 8px}
  .brand small {display:none}.game-head h1 {font-size:1.3rem}.game-head .eyebrow {font-size:.6rem}
  .stat-strip {padding:2px;gap:3px}.stat-strip strong {font-size:.85rem}
  .game-screen.active {gap:4px}.game-main {grid-template-columns:minmax(0,1fr) minmax(170px,26%);gap:8px}
  .practice-card {grid-template-rows:minmax(48px,1fr) 66px minmax(14px,auto) auto;gap:4px;padding:8px}
  .practice-card>.keyboard-panel {grid-template-columns:85px minmax(0,1fr);gap:8px;padding-top:4px}
  .practice-card>.keyboard-panel .keyboard {--key-gap:3px}
  .hand-figures {transform:scale(.68);height:29px}.hand-guide {gap:2px;padding:3px}.hand-caption {font-size:.58rem}
  .hand-caption strong {font-size:.65rem;min-width:23px;min-height:22px}
  .key,.key.space-key {height:22px;font-size:.65rem;border-bottom-width:3px}
  .intro-panel {gap:.6rem;padding:4px 8px}.intro-key {height:40px;width:40px;font-size:1.4rem}.intro-copy>p {font-size:.8rem}.intro-pips {margin-top:4px}
  .typing-zone {padding:4px 8px 10px}.prompt-display {font-size:1.5rem}body.large-practice-text .prompt-display {font-size:1.75rem}
  .round-feedback {font-size:.68rem}.game-actions button {min-height:34px;padding:4px 12px}
  .level-picture-card {padding:8px;gap:6px}.kitty-fact>p {font-size:.7rem}.kitty-fact>span {font-size:.6rem}
  .level-picture-heading h2 {font-size:.9rem}.level-picture-heading>strong {font-size:.7rem;padding:2px 5px}
  .home-copy,.results-copy {padding:4px}.home-card h1 {font-size:1.8rem}.home-copy>.eyebrow {font-size:.6rem;margin-bottom:4px}.home-lede {font-size:.8rem;margin-bottom:6px}
  .welcome-name-label {font-size:.95rem;margin-bottom:4px}.nickname-hint {font-size:.7rem;margin-top:3px}
  .nickname-input {min-height:36px}.start-zone {padding:9px}.session-fieldset {margin:6px 0}.session-fieldset legend {font-size:.8rem;margin-bottom:4px}
  .session-options {gap:5px}.session-options span {font-size:.8rem;padding:4px 2px}.session-options small {font-size:.56rem}
  .start-zone>.primary-button {min-height:36px;padding:5px;font-size:.9rem}.start-helper {font-size:.65rem;margin-top:5px}
  .start-heading h2 {font-size:1rem}.start-heading .text-button {padding:4px;font-size:.8rem}.profile-chip {padding:3px 8px}.profile-list {margin:3px -4px;max-height:60px}
  .hero-figure figcaption {font-size:.7rem;padding:.5rem;bottom:.5rem;right:.5rem;left:.5rem}
  .results-card h1 {font-size:1.8rem}.results-details {margin:.5rem 0}.results-card .session-keepsakes {margin:.5rem 0}.results-card .level-note {font-size:.85rem;padding:.5rem}
  .result-celebration>p {font-size:.8rem}.results-card .results-actions>button {font-size:.8rem;padding:6px 10px;min-height:36px}
  .challenge-scene {height:72px}
}
/* Extreme zoom stays scrollable instead of clipping or shrinking text again. */
@media (min-width:701px) and (max-height:449px) {
  body,body.game-active {height:auto;min-height:100dvh;display:block}
  .screen.active {height:auto;min-height:400px}.game-screen.active {height:400px}
  .home-card,.results-card {min-height:400px}
}
@media (max-width:700px) {
  .level-picture-slot {grid-column:1;grid-row:1/3;width:110px;height:110px}
  .level-picture-slot>.level-picture-frame {width:100%;height:100%}
  .result-celebration {min-height:180px;margin-bottom:18px}.result-celebration>.buddy-art {width:150px}.result-celebration>p {font-size:.8rem}
  .results-copy {text-align:center}.results-card .results-actions {justify-content:center}
  .nickname-input {min-height:44px}.welcome-name-label {font-size:1.05rem}
}
