/* Original illustrated title; gameplay styles remain in their own views. */
.startup-screen{position:fixed;inset:0;z-index:1000;display:flex;align-items:center;padding:48px clamp(28px,6vw,100px);background:#032d61;color:white;overflow:auto;font-family:Arial,sans-serif;isolation:isolate;border-top:5px solid #f47920}
.startup-screen::before{content:"";position:absolute;inset:0;z-index:-2;background:url('assets/wigwam-title-key-art-v3.webp') right center/contain no-repeat;pointer-events:none}
.startup-screen::after{content:"";position:absolute;inset:0;z-index:-1;background:linear-gradient(90deg,#032d61 0%,#032d61f5 23%,#032d61c2 40%,#032d6122 64%,transparent),linear-gradient(0deg,#032d61,transparent 18%,transparent 85%,#032d61);pointer-events:none}
.startup-card{width:min(100%,490px);margin-block:auto;line-height:1.6;overflow-wrap:anywhere}
.startup-card img{display:block;width:112px;height:auto;aspect-ratio:476/471;object-fit:contain;margin-bottom:24px}
.startup-card .startup-eyebrow{font-size:.875rem;font-weight:700;letter-spacing:.16em;color:#ffb46e;margin:0 0 16px}
.startup-card h1{font-size:clamp(60px,7vw,100px);font-weight:900;line-height:.94;letter-spacing:-.055em;margin:0 0 24px;text-shadow:0 5px #002a59}.startup-card h1 span{color:#ff9b42}
.startup-card .startup-tagline{font-size:1.125rem;font-weight:700;margin:0 0 28px}
.startup-status{padding:16px 0;border-top:1px solid #8db0d366;border-bottom:1px solid #8db0d366;font-size:1rem;max-width:390px}.startup-status p{margin:0}
.startup-status .load-meter{margin-top:6px}
.load-meter{display:grid;grid-template-columns:minmax(0,1fr) 4ch;gap:10px;align-items:center}
.load-meter progress{display:block;appearance:none;box-sizing:border-box;width:100%;height:16px;overflow:hidden;border:1px solid #9ac2e3;border-radius:99px;background:#285382;color:#ff9f46;accent-color:#ff9f46}
.load-meter progress::-webkit-progress-bar{background:#285382}
.load-meter progress::-webkit-progress-value{border-radius:inherit;background:#ff9f46}
.load-meter progress::-moz-progress-bar{border-radius:inherit;background:#ff9f46}
.load-percent{color:#ffb46e;text-align:right;font-weight:700;font-variant-numeric:tabular-nums}
.visit-loading{position:fixed;inset:0;z-index:999;display:grid;place-items:center;box-sizing:border-box;padding:16px;background:#032d61dc;color:#fff}
.visit-loading-card{width:min(100%,24rem);box-sizing:border-box;padding:clamp(16px,4vw,30px);border:1px solid #91b9e0;border-radius:16px;background:#032d61;box-shadow:0 12px 34px #001a3e99}
.visit-loading-card p{margin:0 0 12px;color:#fff;font-weight:700}
.load-meter[hidden],.visit-loading[hidden]{display:none}
.startup-card a{display:inline-flex;align-items:center;min-height:48px;padding:10px 0;margin-top:16px;color:#fff;font-size:.875rem;font-weight:bold;text-underline-offset:5px}.startup-card a:focus-visible{outline:3px solid white;outline-offset:5px}
.startup-caption{position:absolute;right:5vw;bottom:22px;font-size:.875rem;color:white;text-shadow:0 2px 8px #032d61}
html[data-boot="error"] .startup-status{border-color:#ffb46e}html[data-boot="error"] .startup-card a{padding-inline:18px;background:#f47920;color:#132e48;border-radius:10px;text-decoration:none}
.masthead #sound-button:has(#startup-audio-notice:not([hidden])) > :not(#startup-audio-notice){display:none}
.masthead #startup-audio-notice:not([hidden]){display:inline-block;max-width:4em;color:inherit;font:700 .75rem/1.1 Arial,sans-serif}
@media(max-width:760px){.startup-screen{display:block;padding:250px 24px 28px}.startup-screen::before{height:300px;bottom:auto;background-position:78% center;background-size:auto 300px}.startup-screen::after{background:linear-gradient(180deg,transparent 100px,#032d61 300px);height:330px;bottom:auto}.startup-card{margin:auto}.startup-card img{width:80px;margin-bottom:20px}.startup-card h1{font-size:64px}.startup-caption{position:static;font-size:.875rem;margin:28px 0 0}.startup-status{max-width:none}}
body:has(#intro:not([hidden])){padding:0;background:#032d61}
.game-shell:has(#intro:not([hidden])){min-height:100svh;margin:auto;border:0;border-radius:0;box-shadow:none;background:#032d61}
.game-shell:has(#intro:not([hidden])) .masthead{background:#004b91;border-bottom:3px solid #f47920}
.game-shell:has(#intro:not([hidden])) .playfield{aspect-ratio:auto;height:auto;min-height:0;max-height:none;container-type:normal;overflow:visible;background:#032d61}
.game-shell:has(#intro:not([hidden])) #world,.game-shell:has(#intro:not([hidden])) #title-3d{display:none!important}
.game-shell #intro{position:relative;inset:auto;isolation:isolate;display:block;min-height:790px;height:auto;width:100%;padding:36px clamp(28px,5vw,80px) 24px;color:#fff;background:#032d61;overflow:hidden}
.game-shell #intro[hidden]{display:none}
.intro-art{position:absolute;inset:0;z-index:-2;pointer-events:none}
.intro-art picture{display:block;width:100%;height:100%}
.intro-art img{display:block;width:100%;height:100%;object-fit:contain;object-position:right center}
.game-shell #intro::before{content:"";position:absolute;inset:0;z-index:-1;background:linear-gradient(90deg,#032d61f5 0%,#032d61ed 25%,#032d61c2 37%,#032d6129 57%,transparent 78%),linear-gradient(0deg,#032d61d9,transparent 25%);pointer-events:none}
.game-shell #intro .intro-copy{position:relative;z-index:1;width:min(470px,43%);max-width:none;padding:0;color:#fff}
.intro-brand-row{display:flex;align-items:center;gap:22px;margin-bottom:16px}
.intro-logo{display:block;object-fit:contain;width:80px;height:auto;aspect-ratio:476/471}
.title-readiness{font-size:.875rem;line-height:1.5;color:#edf5ff;max-width:180px;margin:0}
.title-readiness::before{content:"";display:inline-block;vertical-align:middle;margin-right:8px;width:8px;height:8px;background:#ffab51;border-radius:50%}
.title-ready .title-readiness::before{background:#8ee0bc}
.game-shell #intro .eyebrow{font:700 .8rem/1.4 Arial,sans-serif;letter-spacing:.18em;color:#ffb46e;margin:0 0 12px;display:block}
.game-shell #intro h1{position:relative;font:900 clamp(48px,5.9vw,82px)/.94 Arial,sans-serif;letter-spacing:-.055em;color:#fff;margin:0 0 18px;text-shadow:0 4px 0 #002a59}
.game-shell #intro h1>span:not(.sr-only){color:#ff9b42}
.game-shell #intro .intro-summary{font:600 1.125rem/1.5 Arial,sans-serif;color:#fff;margin:0 0 18px;max-width:360px}
.game-shell #intro .intro-description{font:400 .875rem/1.6 Arial,sans-serif;color:#e2edfa;margin:0 0 16px;max-width:360px}
.game-shell #intro .avatar-picker{position:static;display:block;margin:18px 0 20px;color:#fff}
.game-shell #intro .avatar-picker>span{display:block;max-width:none;font:700 .75rem/1.4 Arial,sans-serif;letter-spacing:.1em;margin:0 0 9px;color:#e2edfa}
.game-shell #intro #avatars{display:flex;gap:10px;flex-wrap:wrap}
.game-shell #intro #avatars .avatar{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;gap:3px;min-width:92px;width:104px;height:auto;min-height:105px;padding:6px 8px 9px;border:2px solid #afc9e773;border-radius:14px;background:#004b84db;color:white;box-shadow:inset 0 -3px #002c57;overflow:hidden}
.game-shell #intro #avatars .avatar.selected{border-color:#ffab51;background:#005dab;box-shadow:0 0 0 2px #032d61,inset 0 -3px #002c57}
.avatar-preview{display:block;width:56px;height:66px;object-fit:contain;border-radius:8px;pointer-events:none}
.buddy-portrait{position:relative;display:inline-flex;min-width:0;max-width:100%;border-radius:8px;overflow:hidden;pointer-events:none}
@media(prefers-reduced-motion:no-preference){
 .avatar[aria-pressed="true"] .poses-ready::after{
   content:"";position:absolute;inset:0;background-image:var(--buddy-poses);
   background-size:2400% 100%;background-repeat:no-repeat;
   animation:buddy-arrival 2.3s steps(23,end) both;
 }
 @keyframes buddy-arrival{from{background-position-x:0%}to{background-position-x:100%}}
}
.game-shell #intro .character-name{font:700 1rem/1.2 Arial,sans-serif}
.avatar-check{display:none;position:absolute;top:5px;right:7px;font:800 .875rem/1 Arial,sans-serif;color:#ffb46e}
.avatar[aria-pressed="true"] .avatar-check{display:block}
.game-shell #intro .primary.start-button{display:flex;align-items:center;justify-content:space-between;gap:24px;width:min(100%,352px);min-width:0;min-height:60px;padding:14px 22px;border:2px solid #ffb16b;border-radius:14px;background:#f47920;color:#132e48;font:800 1.125rem/1.25 Arial,sans-serif;box-shadow:0 5px 0 #a7470d;text-align:left;margin:0 0 11px}
.start-symbol{font-size:1.125rem;letter-spacing:0}
.game-shell #intro .start-button span:not(.start-symbol){font:inherit}
.game-shell #intro .continue-button{display:block;min-height:48px;padding:10px 0;margin:0 0 6px;color:#fff;font:700 1rem/1.4 Arial,sans-serif;text-align:left}
.game-shell #intro .continue-button[hidden]{display:none}
.game-shell #intro .intro-links{display:flex;gap:16px;flex-wrap:wrap;margin:8px 0;color:#e2edfa}
.game-shell #intro .intro-links button{min-height:44px;font:700 .875rem/1.35 Arial,sans-serif;color:#fff;text-align:left;text-decoration:underline;text-underline-offset:4px}
.game-shell #intro .intro-links>span{display:none}
.game-shell #intro .more-modes{display:flex;flex-wrap:wrap;gap:6px 12px;margin:4px 0 12px;max-width:440px}
.game-shell #intro .more-modes button{min-height:44px;padding:7px 10px;border:1px solid #afc9e76b;border-radius:8px;background:#003c75b8;color:#fff;font:600 .875rem/1.35 Arial,sans-serif}
.game-shell #intro .save-explainer{display:block;color:#dfebf9;font:400 .75rem/1.6 Arial,sans-serif;max-width:380px}
.game-shell #intro .intro-bottom{position:relative;inset:auto;display:flex;flex-wrap:wrap;justify-content:flex-start;gap:12px 24px;width:100%;padding:24px 0 0;margin:0;border:0;background:none;color:#e4effb;font:400 .75rem/1.5 Arial,sans-serif}
.game-shell #intro .intro-bottom kbd{color:#fff;background:#00457a;border-color:#97badb}
.game-shell #intro button:focus-visible,.game-shell #intro summary:focus-visible{outline:3px solid #fff;outline-offset:4px}
.game-shell #intro button:hover{filter:brightness(1.09)}
.game-shell:has(#intro:not([hidden])) .game-footer{background:#032d61;color:#d4e4f5;padding:14px 28px;font-size:.75rem;border-top:1px solid #6387ad55}
.game-shell:has(#intro:not([hidden])) .game-footer button,.game-shell:has(#intro:not([hidden])) .game-footer a{color:#fff}
.game-shell #intro.title-art-unavailable::before{background:radial-gradient(ellipse at 75% 30%,#005dab,#032d61 75%)}
@media(min-width:761px) and (prefers-reduced-motion:no-preference){.title-ready .intro-art img{animation:title-breathe 16s ease-in-out infinite alternate;transform-origin:75% 50%}@keyframes title-breathe{from{transform:scale(1)}to{transform:scale(1.025)}}}
@media(max-width:1000px) and (min-width:761px){.game-shell #intro{padding-left:32px;padding-right:32px}.game-shell #intro .intro-copy{width:48%}.game-shell #intro::before{background:linear-gradient(90deg,#032d61fa,#032d61db 35%,#032d6155 60%,transparent)}.game-shell #intro h1{font-size:62px}}
@media(max-width:760px){
 .startup-screen{padding-top:70vw}
 .startup-screen::before{height:80vw;background-image:url('assets/wigwam-title-mobile-v1.webp');background-size:contain;background-position:center top}
 .startup-screen::after{height:82vw;background:linear-gradient(180deg,transparent 52vw,#032d61 79vw)}
 .game-shell #intro{padding:70vw 24px 24px;min-height:0}
 .intro-art{height:auto;aspect-ratio:1402/1122;bottom:auto}
 .intro-art img{object-fit:contain;object-position:center top}
 .game-shell #intro::before{background:linear-gradient(180deg,transparent 52vw,#032d61 79vw);height:82vw;bottom:auto}
 .game-shell #intro .intro-copy{width:100%;max-width:560px;margin:0 auto}
 .intro-brand-row{margin-bottom:14px;gap:18px}.intro-logo{width:70px}
 .game-shell #intro h1{font-size:clamp(56px,16vw,76px);line-height:.97;margin-bottom:18px}
 .game-shell #intro .intro-summary{font-size:1.0625rem}
 .game-shell #intro #avatars .avatar{width:calc((100% - 20px)/3);min-width:76px;min-height:112px}
 .game-shell #intro .primary.start-button{width:100%;max-width:440px;min-height:58px}
 .game-shell #intro .intro-bottom{max-width:560px;margin:0 auto;gap:12px;line-height:1.7}
 .game-shell #intro .intro-bottom span:last-child{display:block}
 .game-shell:has(#intro:not([hidden])) .game-footer{padding:16px 24px;line-height:1.6;font-size:.75rem;gap:10px;align-items:flex-start}
 .game-shell:has(#intro:not([hidden])) .game-footer>span:nth-child(2){font-size:.75rem}
}
@media(max-width:350px){.game-shell #intro{padding-left:18px;padding-right:18px}.game-shell #intro #avatars{gap:8px}.game-shell #intro #avatars .avatar{width:calc((100% - 16px)/3);min-width:70px;padding-left:5px;padding-right:5px}.game-shell #intro .more-modes{gap:7px}.game-shell #intro .intro-links{gap:12px}}
.text-large #intro .intro-copy{max-width:100%;width:min(620px,55%)}
.text-large #intro h1{font-size:clamp(56px,7vw,100px)}
.text-large #intro #avatars .avatar{min-width:110px;width:auto;flex:1}
.text-large #intro .intro-art{opacity:.6}
@media(max-width:760px){.text-large #intro .intro-copy{width:100%}.text-large #intro h1{font-size:clamp(56px,16vw,90px)}.text-large #intro #avatars .avatar{min-width:0;width:calc((100% - 20px)/3)}.text-large #intro .character-name{font-size:1rem}.text-large #intro .intro-links{gap:8px}}
@media(prefers-reduced-motion:reduce){.intro-art img{animation:none!important;transform:none!important}}

/* The frame is the viewport when the game is embedded. Let larger text grow
   naturally, and budget the ordinary title around the actual available height. */
.game-shell:has(#intro:not([hidden])){display:flex;flex-direction:column;min-height:100dvh}
.game-shell:has(#intro:not([hidden])) .playfield{display:flex;flex:1 0 auto}
.game-shell #intro{display:flex;flex-direction:column;align-items:stretch;justify-content:center;min-height:0;padding-block:clamp(12px,2.8dvh,36px)}
.game-shell #intro .intro-copy{width:min(490px,49%)}
.game-shell #intro .intro-brand-row{margin-bottom:6px}
.game-shell #intro .intro-logo{width:clamp(40px,7dvh,76px)}
.game-shell #intro h1{font-size:clamp(38px,min(6vw,8dvh),80px);margin-bottom:8px}
.game-shell #intro .intro-summary,.game-shell #intro .intro-description{margin-bottom:8px}
.game-shell #intro .avatar-picker{margin:10px 0 12px}
.game-shell #intro #avatars .avatar{min-height:48px}
.game-shell #intro .avatar-preview{height:clamp(36px,6dvh,66px);width:auto;max-width:100%}
@media (min-width:1100px) and (min-height:850px), (max-width:650px) and (min-height:760px){
 .game-shell #intro .avatar-preview{height:clamp(58px,8.5dvh,84px)}
}
.game-shell #intro .intro-bottom{padding-top:10px}
.game-shell #intro .more-modes{max-width:none;gap:5px}
.game-shell #intro .title-actions{min-width:0}

@media(max-height:1080px),(max-width:1024px){
 .game-shell:has(#intro:not([hidden])) .masthead{height:auto;min-height:52px;padding:max(3px,env(safe-area-inset-top)) max(14px,env(safe-area-inset-right)) 3px max(14px,env(safe-area-inset-left))}
 .game-shell:has(#intro:not([hidden])) .official-brand-logo{width:42px;height:42px}
 .game-shell:has(#intro:not([hidden])) .toolbar button{min-height:44px;min-width:44px}
 .game-shell #intro .intro-description,.game-shell #intro .eyebrow,.game-shell #intro .intro-bottom{display:none}
 .game-shell:has(#intro:not([hidden])) .game-footer{padding:0 max(14px,env(safe-area-inset-right)) env(safe-area-inset-bottom) max(14px,env(safe-area-inset-left));display:flex;align-items:center;flex-wrap:nowrap;min-height:44px;gap:8px}
 .game-shell:has(#intro:not([hidden])) .game-footer :is(.footer-tagline,#save-notice){display:none}
 .game-shell:has(#intro:not([hidden])) .game-footer :is(a,button){display:inline-flex;align-items:center;min-height:44px;font-size:.75rem;margin:0}
 .game-shell #intro .primary.start-button{min-height:48px;padding:10px 16px;margin-bottom:4px}
 .game-shell #intro .intro-links,.game-shell #intro .more-modes,.game-shell #intro .continue-button{margin:0}
 .game-shell #intro .continue-button{padding-block:4px;min-height:44px}
 .game-shell #intro .save-explainer{margin-top:5px}
}
@media(max-width:760px) and (orientation:portrait){
 .game-shell #intro{justify-content:flex-end;padding:clamp(12px,2dvh,24px) max(16px,env(safe-area-inset-right)) clamp(10px,2dvh,20px) max(16px,env(safe-area-inset-left))}
 .game-shell #intro .intro-art{inset:0 0 auto;height:58%;aspect-ratio:auto}
 .game-shell #intro .intro-art img{object-position:center top}
 .game-shell #intro::before{inset:0;height:auto;background:linear-gradient(to top,#032d61 39%,#032d61e8 56%,#032d6112 90%)}
 .game-shell #intro .intro-copy{width:100%;max-width:500px;margin:0 auto}
 .game-shell #intro h1{font-size:clamp(32px,min(10vw,6dvh),48px);margin-bottom:4px}
 .game-shell #intro h1 br{display:none}
 .game-shell #intro h1>span:last-child::before{content:" "}
 .game-shell #intro .intro-summary{margin:0;font-size:1rem}
 .game-shell #intro .intro-summary br{display:none}
 .game-shell #intro .intro-summary{max-width:100%}
 .game-shell #intro #avatars{flex-wrap:nowrap;gap:8px}
 .game-shell #intro #avatars .avatar{flex:1;min-width:0;width:auto;min-height:48px;padding:4px}
 .game-shell #intro .more-modes{display:grid;grid-template-columns:repeat(3,minmax(0,1fr))}
 .game-shell #intro .more-modes button{min-height:44px;font-size:.8125rem;padding:3px}
 .game-shell #intro .primary.start-button{max-width:none}
}
@media(max-height:740px){
 .game-shell #intro .intro-summary,.game-shell #intro .save-explainer{display:none}
 .game-shell #intro .intro-brand-row{margin-bottom:3px;gap:10px}
 .game-shell #intro .intro-logo{width:36px}
 .game-shell #intro .avatar-picker{margin:5px 0 8px}
 .game-shell #intro .avatar-picker>span{margin-bottom:3px}
}
@media(orientation:landscape) and (max-height:570px), (orientation:landscape) and (max-width:760px){
 .game-shell #intro{padding:8px max(14px,env(safe-area-inset-right)) 8px max(14px,env(safe-area-inset-left))}
 .game-shell #intro .intro-copy{width:min(760px,100%);max-width:none;margin:0;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.25fr);column-gap:clamp(14px,3vw,40px);align-content:center;align-items:center}
 .game-shell #intro .intro-brand-row,.game-shell #intro h1,.game-shell #intro .avatar-picker{grid-column:1}
 .game-shell #intro .title-actions{grid-column:2;grid-row:1 / span 5}
 .game-shell #intro .intro-art{inset:0;height:100%;aspect-ratio:auto}
 .game-shell #intro .intro-art img{object-position:right center}
 .game-shell #intro::before{inset:0;height:auto;background:linear-gradient(90deg,#032d61ee,#032d61ca 55%,#032d6155)}
 .game-shell #intro h1{font-size:clamp(32px,8dvh,46px);margin:3px 0}
 .game-shell #intro #avatars{gap:5px;flex-wrap:nowrap}
 .game-shell #intro #avatars .avatar{width:auto;min-width:0;padding:3px;flex:1}
 .game-shell #intro .more-modes{display:grid;grid-template-columns:repeat(3,minmax(0,1fr))}
 .game-shell #intro .more-modes button{padding:2px;font-size:.8125rem}
 .game-shell #intro .primary.start-button{max-width:none;width:100%}
}
@media(orientation:landscape) and (max-height:410px){
 .game-shell #intro{padding-block:0}
 .game-shell #intro .intro-copy{grid-template-areas:"ready start" "title resume" "avatars modes" "links modes";grid-template-rows:auto auto auto auto}
 .game-shell #intro .intro-brand-row{grid-area:ready;margin:0}
 .game-shell #intro .intro-logo{width:24px}
 .game-shell #intro h1{grid-area:title;margin:0;font-size:clamp(1.45rem,5vw,2rem)}
 .game-shell #intro h1 br{display:none}
 .game-shell #intro h1>span:last-child::before{content:" "}
 .game-shell #intro .avatar-picker{grid-area:avatars;margin:0}
 .game-shell #intro .avatar-preview{height:30px}
 .game-shell #intro .title-actions{display:contents}
 .game-shell #intro .intro-links{grid-area:links;gap:4px;flex-wrap:nowrap}
 .game-shell #intro .intro-links button{padding-inline:1px}
 .game-shell #intro .primary.start-button{grid-area:start;margin:0;padding:2px 8px;gap:4px;font-size:1rem}
 .game-shell #intro .continue-button{grid-area:resume}
 .game-shell #intro .more-modes{grid-area:modes;align-self:start}
}
@media(min-width:761px) and (min-height:571px) and (max-height:820px){
 .game-shell #intro .intro-copy{width:min(490px,74%)}
 .game-shell #intro h1 br{display:none}
 .game-shell #intro h1>span:last-child::before{content:" "}
}
@media(orientation:portrait) and (max-height:540px){
 .game-shell #intro{padding-block:4px}
 .game-shell #intro .intro-brand-row .intro-logo{display:none}
 .game-shell #intro #avatars .avatar{flex-direction:row;justify-content:center}
 .game-shell #intro .avatar-preview{height:30px}
 .game-shell #intro .primary.start-button{font-size:1rem;gap:5px;padding-inline:8px}
}
.startup-screen{display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;padding:max(clamp(12px,4dvh,48px),env(safe-area-inset-top)) max(20px,5vw,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(20px,5vw,env(safe-area-inset-left))}
.startup-card{margin-block:auto}
.startup-card img{width:clamp(42px,10dvh,100px);margin-bottom:clamp(5px,2dvh,20px)}
.startup-card h1{font-size:clamp(40px,10dvh,92px);margin-bottom:clamp(5px,2dvh,20px)}
@media(max-width:760px){
 .startup-card{margin:auto auto 0}
 .startup-screen::before{height:57%;background-position:center top}
 .startup-screen::after{height:100%;background:linear-gradient(0deg,#032d61 35%,#032d61eb 54%,transparent 90%)}
 .startup-caption{display:none}
}
@media(max-height:570px){
 .startup-card{margin-block:auto}
 .startup-card .startup-eyebrow,.startup-card .startup-tagline,.startup-caption{display:none}
 .startup-card img,.startup-card h1,.startup-card a{margin-block:3px}
 .startup-status{padding-block:7px}
}

/* Give the loading message its own side of a short, wide phone or iframe. */
@media (orientation:landscape) and (max-height:570px) and (min-width:461px){
 .startup-card{width:54%;margin-inline:0}
 .startup-screen::before{inset:0 0 0 48%;height:auto;background-position:right center;background-size:contain}
 .startup-screen::after{inset:0;height:auto;background:linear-gradient(90deg,#032d61 40%,#032d6199 57%,transparent 75%)}
 .startup-card h1 br{display:none}
 .startup-card h1 span::before{content:" "}
}

/* Use the visual viewport even before the game scripts are available. The
   loading pane can still scroll if the player enlarges their text. */
body:has(#startup-screen:not([hidden])){padding:0;background:#032d61}
#startup-screen:not([hidden]) ~ #game{display:none}
.startup-screen{height:100%;height:100dvh;bottom:auto;overscroll-behavior:contain}
@media(max-height:400px){
 .startup-card{display:grid;grid-template-columns:auto minmax(0,1fr);align-items:center;gap:4px 8px;line-height:1.35}
 .startup-card h1{font-size:clamp(26px,6vw,38px);margin:0}
 .startup-card h1 br{display:none}
 .startup-card h1 span::before{content:" "}
 .startup-card .startup-status,.startup-card a,.startup-card noscript{grid-column:1 / -1}
 .startup-card a{justify-self:start}
 .startup-card noscript p{margin-block:2px}
}

/* Small split-screen and embedded views share the title already in the masthead. */
@media (max-width:460px) and (max-height:625px), (orientation:portrait) and (max-width:650px) and (max-height:650px), (max-width:540px) and (max-height:380px){
 .game-shell #intro{padding:0 max(8px,env(safe-area-inset-right)) 0 max(8px,env(safe-area-inset-left));justify-content:center}
 .game-shell #intro .intro-copy{display:block;width:100%}
 .game-shell #intro .intro-brand-row,.game-shell #intro h1{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);margin:0}
 .game-shell #intro .avatar-picker{margin:0 0 4px}
 .game-shell #intro .avatar-picker>span{margin:0}
 .game-shell #intro #avatars .avatar{flex-direction:row;justify-content:center;min-height:44px}
 .game-shell #intro .avatar-preview{height:28px}
 .game-shell #intro .title-actions{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:3px}
 .game-shell #intro .title-actions :is(.intro-links,.more-modes){display:contents}
 .game-shell #intro .intro-links>span{display:none}
 .game-shell #intro .primary.start-button{grid-area:auto;grid-column:1 / -1;width:100%;min-height:44px;margin:0;padding:4px 8px;font-size:1rem}
 .game-shell #intro .title-actions:has(.continue-button:not([hidden])) .start-button{grid-column:span 2}
 .game-shell #intro .continue-button{grid-area:auto;font-size:.8125rem;line-height:1.2}
 .game-shell #intro .title-actions button{min-width:0;overflow-wrap:break-word}
}

/* Keep the mode buttons within thumb reach when browser chrome shortens the frame. */
@media (orientation:portrait) and (min-width:651px) and (max-height:820px){
 .game-shell #intro .intro-summary{display:none}
}

@media (max-width:460px) and (max-height:360px), (max-width:540px) and (max-height:380px){
 .game-shell #intro .avatar-picker>span,.game-shell #intro .title-detail{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
 .game-shell #intro .title-actions{grid-template-columns:repeat(4,minmax(0,1fr))}
 .game-shell #intro .title-actions .continue-button{grid-column:span 2;text-align:center}
 .game-shell #intro .title-actions button{padding:2px;line-height:1.2}
}
@media (max-height:300px){
 .game-shell:has(#intro:not([hidden])) .masthead{min-height:46px;padding-block:max(0px,env(safe-area-inset-top)) 0;border-bottom-width:2px}
 .game-shell #intro .avatar-picker{margin-block:0}
}
@media (min-width:541px) and (max-height:340px){
 .game-shell #intro .intro-copy{display:grid;grid-template: "title actions" auto "avatars actions" auto / minmax(0,1fr) minmax(0,2fr);gap:4px 12px}
 .game-shell #intro .intro-brand-row{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
 .game-shell #intro .title-actions{grid-area:actions;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:3px}
 .game-shell #intro .title-actions :is(.intro-links,.more-modes){display:contents}
 .game-shell #intro .title-actions button{grid-area:auto;min-width:0;padding:3px;font-size:.8125rem;line-height:1.2}
 .game-shell #intro .title-actions .primary{grid-column:span 2;min-height:44px}
 .game-shell #intro .title-detail{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
 .game-shell #intro .title-actions .continue-button{grid-column:span 2;text-align:center}
}

/* Give the illustration the space left after the real loading message and
   retry action have been laid out. Browser bars, text wrapping and an error
   can all change that space while the player stays on the same screen. */
@media (max-width:760px) and (orientation:portrait){
 .startup-screen{
   display:grid;
   grid-template:"logo title" auto "art art" minmax(0,1fr) "status status" auto
                 "retry retry" auto "noscript noscript" auto / auto minmax(0,1fr);
   align-items:center;gap:clamp(2px,1dvh,10px) 12px;
   padding-top:max(clamp(6px,2.5dvh,24px),env(safe-area-inset-top));
   padding-bottom:max(clamp(6px,2dvh,20px),env(safe-area-inset-bottom));
 }
 .startup-screen::before{
   position:static;grid-area:art;align-self:stretch;height:auto;
   margin-inline:calc(-1 * max(20px,5vw));
   background-position:center;background-size:auto min(100%,125vw);
   mask-image:linear-gradient(to bottom,transparent,#000 8%,#000 90%,transparent);
 }
 .startup-screen::after{content:none}
 .startup-card{display:contents}
 .startup-card img{grid-area:logo;width:clamp(42px,9dvh,78px);margin:0}
 .startup-card h1{grid-area:title;font-size:clamp(1.75rem,9vw,3.75rem);margin:0}
 .startup-card h1 br{display:none}
 .startup-card h1 span::before{content:" "}
 .startup-card :is(.startup-eyebrow,.startup-tagline){display:none}
 .startup-card .startup-status{grid-area:status;width:100%;max-width:none}
 .startup-card a{grid-area:retry;justify-self:start;margin:0}
 .startup-card noscript{grid-area:noscript}
 .startup-card noscript p{margin:0}
}

/* A short tablet window can still be wide enough for the desktop artwork.
   Keep the logo beside the name so larger status text has room underneath. */
@media (min-width:761px) and (min-height:571px) and (max-height:720px){
 .startup-card{display:grid;grid-template-columns:auto minmax(0,1fr);align-items:center;gap:8px 16px;width:min(65%,42rem)}
 .startup-card img,.startup-card h1,.startup-card a{margin:0}
 .startup-card h1 br{display:none}
 .startup-card h1 span::before{content:" "}
 .startup-card :is(.startup-eyebrow,.startup-tagline),.startup-caption{display:none}
 .startup-card :is(.startup-status,a,noscript){grid-column:1 / -1}
 .startup-card .startup-status{max-width:none}
 .startup-card a{justify-self:start}
}

/* In a shallow inline frame the illustration yields to the actual message.
   Keep native overflow for unusually large fonts or longer fallback text. */
@media (orientation:landscape) and (max-height:275px) and (max-width:540px){
 .startup-screen{padding-block:max(4px,env(safe-area-inset-top)) max(4px,env(safe-area-inset-bottom));padding-inline:max(12px,env(safe-area-inset-left)) max(12px,env(safe-area-inset-right))}
 .startup-screen::before,.startup-screen::after{content:none}
 .startup-card{width:100%;gap:2px 10px}
 .startup-card img,.startup-card a{margin:0}
 .startup-card .startup-status{padding-block:4px}
}

/* Give the title controls a full fingertip of space on phone and tablet screens. */
@media screen {
 .game-shell:has(#intro:not([hidden])) :is(#brand-home, .toolbar button, .game-footer a, .game-footer button),
 .game-shell #intro #avatars .avatar,
 .game-shell #intro #start-button,
 .game-shell #intro :is(.intro-links button, .more-modes button, .continue-button) {
   min-height:48px;
   min-width:48px;
 }
}

/* Two short rows leave room for both the character picker and the footer. */
@media (max-width:540px) and (max-height:380px) {
 .game-shell #intro .title-actions { grid-template-columns:repeat(5,minmax(0,1fr)); }
 .game-shell #intro .title-actions #start-button { grid-column:span 2; }
 .game-shell #intro .title-actions #continue-button { grid-column:span 1; }
}
