/* One frame owns size; funnel content never changes its outer dimensions. */
:root{--frame-height:min(820px,calc(100dvh - 96px));--frame-width:calc(var(--frame-height)*.5625);--brand-height:76px}
.page{padding:24px 28px 12px;max-width:1060px}
.layout{grid-template-columns:var(--frame-width) minmax(260px,1fr);gap:36px}
body .experience{position:relative;inset:auto;width:var(--frame-width);height:var(--frame-height);min-height:0;max-width:none;aspect-ratio:9/16;display:flex;flex-direction:column;container-type:size;padding:0;background:var(--cream) url('background.webp') center/cover no-repeat;overflow:hidden}
body[data-screen=cover] .experience{background:var(--pine) url('cover.webp') center/cover no-repeat}
body .brandbar,body[data-screen=play] .brandbar,body[data-screen=cover] .brandbar{top:0;inset:0 0 auto;height:var(--brand-height);padding:19px 12px 8px}
body .brand,body[data-screen=play] .brand{font:italic 800 clamp(23px,6.2cqw,29px)/1 Georgia,serif;padding-top:13px}
.header-actions{top:8px;right:8px}.brand:before{top:-8px;font-size:23px}
body .screens,body[data-screen=play] .screens{position:relative;display:block;flex:1;min-height:0;padding:0;margin-top:var(--brand-height);background:none;overflow:hidden}
body[data-screen=cover] .screens{margin-top:0}
body .screen,body #instructions,body .play,body .result,body .claim-screen{position:relative;box-sizing:border-box;width:100%;height:100%;min-height:0;max-height:100%;margin:0;padding:12px 20px 20px;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:#baad87 transparent;scroll-behavior:auto}
body .game-footer,body[data-screen=play] .game-footer{flex:0 0 auto;min-height:30px!important;height:30px;padding:7px 10px!important;background:#fff9e8ed;font-size:10px;z-index:5}
.sidebar{margin-top:0}.page-footer{margin-top:20px;padding-top:0}
/* Cover stays inside the same frame. The illustration is cropped, never stretched. */
body .cover,html:not([lang=zh-Hans]) body .cover{background:none;height:100%;min-height:0;margin:0;padding:0;overflow:hidden}
.cover-heading{position:absolute;inset:0;display:block;padding:0;text-align:center;pointer-events:none}
body .cover h1{position:absolute;top:13%;left:8%;right:8%;margin:0;font-size:clamp(25px,10cqw,45px);line-height:1.08}
html:not([lang=zh-Hans]) body .cover h1{font-size:clamp(20px,6.7cqw,31px);line-height:1.04}
.cover-heading>.eyebrow{position:absolute;top:23%;left:50%;right:auto;transform:translateX(-50%);max-width:90%;white-space:nowrap;font-size:clamp(9px,2.6cqw,12px);padding:4px 10px}
body .cover .dates{position:absolute;top:29%;left:10%;right:10%;margin:0;padding:4px 2px;font-size:clamp(9px,2.6cqw,12px)!important;line-height:1.3;white-space:normal;border-radius:20px;background:none}
body .cover-bottom{position:absolute;top:auto;bottom:0;left:0;right:0;padding:14px 7% 5px;background:linear-gradient(#fff9e800,#fff9e8 20%);text-align:center}
body .cover-bottom h2{font-size:clamp(17px,5cqw,23px);margin:5px 0 10px;line-height:1.2}
body .cover-bottom .eyebrow{font-size:10px;line-height:1.4;letter-spacing:.02em;color:#69521f}
body .cover-bottom .small{font-size:10px;line-height:1.3;margin:8px 0 2px}
body .cover-bottom .primary{min-height:44px;padding:10px;font-size:16px}
body .cover-bottom .text-button{padding:5px;font-size:11px;min-height:32px}
/* Instructions fit vertically; longer translated content can still scroll. */
body #instructions{display:flex;flex-direction:column;gap:10px;padding:10px 24px 12px}
.section-heading h1{font-size:clamp(23px,6.7cqw,31px);margin:5px 0;text-align:center}
.instruction-pair{flex:1;min-height:90px;max-height:220px;display:flex;align-items:center;justify-content:center;margin:8px auto 12px;gap:12px;width:100%}
.instruction-pair .mini-card{width:min(35cqw,135px);height:min(24cqh,170px);min-height:80px;flex:none}
.steps{flex:none;margin:0}.steps li{min-height:34px;padding:2px 0 8px 40px;margin:0 0 8px;font-size:clamp(14px,3.8cqw,17px)}
.steps li:before{width:28px;height:28px;font-size:19px;top:0}#backCover{margin:0;min-height:30px;padding:4px}
#start{flex:none;min-height:44px;padding:10px;font-size:16px}
/* Gameplay uses remaining space rather than its own fixed height. */
body .play,body[data-screen=play] .play{display:flex;flex-direction:column;padding:6px 12px 0;overflow:hidden;gap:0}
.hud{flex:none;padding:9px 13px}.hud strong{font-size:22px}.time-track{flex:none;margin:8px 0 0}.play-status{flex:none;min-height:28px;padding:6px 0;font-size:11px}
.board{flex:1;min-height:0;width:100%;height:auto;max-height:none;margin:0;grid-template-columns:repeat(4,minmax(0,1fr));grid-template-rows:repeat(4,minmax(0,1fr));gap:7px}
.card{min-height:0;min-width:0}.card.flipped .sprite{width:min(100%,18cqw);height:100%;max-height:100%;aspect-ratio:1}
.play-tools{flex:none;padding:7px 0;gap:10px}.play-tools .text-button{min-height:34px;padding:6px 16px;font-size:11px}
/* Results and forms scroll inside the fixed screen; the frame/footer stays put. */
body .result,body .claim-screen{padding:10px 18px 16px}
.celebration{width:clamp(65px,12cqh,100px)}.result h1{font-size:clamp(25px,7cqw,33px);margin:4px 0}.result-score{font-size:30px;margin:7px 0 2px}.result-heading #resultStats{padding-bottom:4px}
.reward{grid-template-columns:90px 1fr;padding:30px 12px 12px;gap:3px 7px;margin:18px 0 10px}.reward-art{width:90px}.reward h2{font-size:clamp(18px,4.7cqw,22px)}.reward>.primary{min-height:44px;padding:10px;font-size:16px}.reward .eyebrow{font-size:13px}
.result-actions .secondary{min-height:42px}.result>.text-button{margin-top:8px}.result-detail summary{min-height:42px;padding:11px 0}
.back-result{position:static;display:block;min-height:32px;padding:4px 0;margin:0;font-size:12px}.claim-screen h1{font-size:clamp(23px,6.4cqw,29px);margin:8px 0 15px}.claim-summary{margin-bottom:12px}.claim-summary>.sprite{width:80px}.claim-summary h2{font-size:20px}
/* Every mobile stage occupies the viewport, not only gameplay. */
@media(max-width:840px),(max-height:540px) and (orientation:landscape){
 html,body{height:100%;overflow:hidden;overscroll-behavior:none}
 body .page,body[data-screen=play] .page{padding:0;margin:0;max-width:none}
 body .layout{display:block}
 body .experience,body[data-screen=play] .experience{position:fixed;inset:0;width:100%;height:100vh;height:100dvh;min-height:0;max-height:none;border:0;border-radius:0;aspect-ratio:auto;padding:env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);background-size:cover}
 body .brandbar,body[data-screen=play] .brandbar,body[data-screen=cover] .brandbar{top:env(safe-area-inset-top)}
 body .game-footer,body[data-screen=play] .game-footer{height:calc(30px + env(safe-area-inset-bottom));padding-bottom:calc(7px + env(safe-area-inset-bottom))!important}
 body .page-footer,body .sidebar{display:none}
 #mobileRanking{display:block}
}
@media(max-height:650px){
 :root{--brand-height:64px}
 body .brandbar,body[data-screen=play] .brandbar,body[data-screen=cover] .brandbar{padding-top:12px}
 .instruction-pair{margin:0 auto 4px}.section-heading h1{margin:0}.steps li{margin-bottom:3px;font-size:14px}
 body #instructions{gap:6px}.hud{padding:7px 12px}.hud strong{font-size:20px}.round{width:34px;height:34px}
 body .cover-bottom{padding-top:10px}body .cover-bottom h2{font-size:18px}body .cover-bottom .eyebrow{font-size:9px}body .cover-bottom .small{font-size:9px}
}
@media(max-height:540px) and (orientation:landscape){
 :root{--brand-height:42px}
 body .brandbar,body[data-screen=play] .brandbar,body[data-screen=cover] .brandbar{padding:8px}
 body .brand,body[data-screen=play] .brand{font-size:23px;padding:0}.brand:before{display:none}
 body .play,body[data-screen=play] .play{display:grid;grid-template-columns:180px minmax(0,1fr);grid-template-rows:auto 4px 1fr auto;gap:4px 16px}
 .board{grid-column:2;grid-row:1/5;height:100%;width:min(100%,370px);justify-self:center;margin:0;gap:5px}
 .hud{grid-column:1;grid-row:1}.time-track{grid-column:1;grid-row:2;margin:0}.play-status{grid-column:1;grid-row:3}.play-tools{grid-column:1;grid-row:4;padding:4px 0}
 body .cover h1{top:15%;left:5%;right:52%;font-size:30px}.cover-heading>.eyebrow{top:42%;left:25%}body .cover .dates{top:57%;left:5%;right:55%}
 body .cover-bottom{left:51%;bottom:0;top:0;padding:45px 5% 5px;background:#fff9e8e8;display:flex;flex-direction:column;justify-content:center}
 body #instructions{display:grid;grid-template-columns:1fr 1fr;grid-template-rows:auto 1fr auto auto;gap:8px 20px}.section-heading{grid-column:1;grid-row:1}.instruction-pair{grid-column:1;grid-row:2/5;height:100%;max-height:none}.instruction-pair .mini-card{height:150px;width:110px}.steps{grid-column:2;grid-row:1/3;align-self:center}#start{grid-column:2;grid-row:3}#backCover{grid-column:2;grid-row:4}
}

/* Card-art fix: centred viewport, independent of card aspect ratio. */
.board .card.flipped .sprite{position:absolute;inset:8px;width:auto;height:auto;max-width:none;max-height:none;aspect-ratio:auto;padding:0;margin:0;overflow:hidden}
.board .card.flipped .sprite>svg,.board .card.flipped .sprite>img{display:block;width:100%;height:100%;object-fit:contain;object-position:center}
