body.playing .collection-header {
  display: none;
}
html,body {width:100%;height:100%;height:calc(100 * var(--funky-vh, 1dvh));overflow:hidden;overscroll-behavior:none;min-width:0}
.collection {height:calc(100 * var(--funky-vh, 1dvh));min-height:0;overflow:hidden}
.portrait {height:calc(100 * var(--funky-vh, 1dvh));min-height:0;max-width: min(520px,calc(100 * var(--funky-vh, 1dvh)));display:flex;flex-direction:column;justify-self:center}
#launcher {flex:1;min-height:0;display:flex;flex-direction:column}
#carousel {flex:1;min-height:0}
#track,.card-slide,.game-card {height:100%;min-height:0}
.game-card {padding:16px 20px}
.game-logo {flex-shrink:1;min-height:0;max-height:calc(18 * var(--funky-vh, 1dvh));margin:8px auto 0}
.card-symbols {min-height:0;flex:1;overflow:hidden}
.card-footer {flex-shrink:0}
.launcher-title {padding:12px 24px 10px}
.carousel-controls {flex-shrink:0}
.bottom-nav {flex-shrink:0}
#game-host {flex:1;min-height:0}
#frame-host {position:relative;overflow:hidden}
.side-panel {min-height:0;max-height:calc(100 * var(--funky-vh, 1dvh));overflow:hidden;padding-top:clamp(16px,calc(5 * var(--funky-vh, 1dvh)),50px)!important}
.side-brand {max-height:70px;object-fit:contain}
.side-panel h2 {font-size:24px}
.side-panel .panel-footer {margin-top:16px}
.modal-card {max-height:calc(calc(100 * var(--funky-vh, 1dvh)) - 20px);padding:24px;overflow:auto;overscroll-behavior:contain}
.rank-tabs,.rank-pages {display:flex;gap:8px;align-items:center;justify-content:center;margin:10px 0}
.rank-tabs button,.rank-pages button {border:1px solid #ffffff35;border-radius:12px;min-height:40px;padding:8px 12px}
.rank-tabs button[aria-pressed=true] {background:#f2d09524;color:var(--gold)}
.rank-summary {font-size:13px;color:var(--gold)}
.score-filter {display:flex;gap:6px;flex-wrap:wrap}
.score-filter select {min-width:0;max-width:100%;flex:1;padding:8px;font-size:12px}
@container funky-viewport (max-height:720px) {
 .collection-header {height:54px;padding-inline:16px}.collection-header img {height:44px}
 .launcher-title h1 {font-size:22px}.launcher-title .eyebrow {display:none}
 .game-card h2 {font-size:20px;margin:4px 0}.game-card p {margin:5px 0}
 .game-card:has(.game-logo) .card-footer h2 {display:none}
 .game-card p {display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
 .game-logo {max-height:calc(13 * var(--funky-vh, 1dvh))}.card-symbols {display:none}
 .card-top {margin-bottom:4px}.card-top img {height:24px}
 .record-line {padding:7px 0}.play-button {min-height:42px;padding:10px 14px}
 .browse-note {padding-block:6px}.bottom-nav {padding-block:8px}.carousel-controls {padding-block:6px}
 .side-panel>h2,.side-panel>.muted:not(#online-scores),.panel-footer {display:none}
 .side-panel .eyebrow {margin:6px 0}.journey-box {padding:12px}.side-panel .pb {font-size:36px}
 .modal-card {padding:18px}.modal-card h2 {font-size:24px;margin:6px 0 10px}
 .modal-card .eyebrow {margin-bottom:4px}.setting-row {padding:6px 0}
 .score-item {padding:8px 0}.pause-actions {gap:6px}.pause-actions button {min-height:40px;padding:8px}
 .achievement-row {padding:7px 0}.achievement-row p {margin:3px 0;font-size:12px}
}
#online-scores p {font-size:12px;line-height:1.5;margin:8px 0}
.score-item span {min-width:0;overflow-wrap:anywhere}
.score-item b {flex-shrink:0}
.modal-card [data-action="y8-login"] {min-height:40px;margin:4px 0 0;padding:8px 12px;font-size:12px}
@container funky-viewport (max-height:700px){.game-card p{display:none}}
@container funky-viewport (max-height:600px){.modal-card{padding:14px}.modal-card:has(#quality) #modal-content>p:last-child{display:none}.howto-tip{display:none}.modal-card:has(.howto) h2{font-size:21px}}
.card-slide { transition: transform .28s, opacity .28s; transform: scale(.97); opacity:.6; }
.card-slide[aria-hidden="false"] { transform:scale(1); opacity:1; }
.card-art { width:105%;left:-2.5%;transform:translateX(6px);transition:transform .28s; }
.card-slide[aria-hidden="false"] .card-art { transform:translateX(0); }
body.playing .game-header {
  height: calc(50px + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
}
body.playing #frame-host {
  height: calc(calc(100 * var(--funky-vh, 1dvh)) - 50px - env(safe-area-inset-top));
}
@container funky-viewport (max-height: 720px) {
  body.playing .game-header {
    height: calc(48px + env(safe-area-inset-top));
  }
  body.playing #frame-host {
    height: calc(calc(100 * var(--funky-vh, 1dvh)) - 48px - env(safe-area-inset-top));
  }
}

/* Illustrated first-launch language selection, sized to the available frame. */
.title-screen{position:fixed;inset:0;z-index:50;display:grid;place-items:center;background:#080d21;overflow:hidden;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left)}
.title-screen[hidden]{display:none}.title-poster{position:relative;height:100%;width:min(100%,calc(66.667 * var(--funky-vh, 1dvh)));max-width:600px;overflow:hidden;background:#080d21;box-shadow:0 0 100px #42237255}
.title-art{position:absolute;width:100%;height:auto;top:50%;left:0;transform:translateY(-50%);object-fit:contain;mask-image:linear-gradient(transparent,#000 10%,#000 88%,transparent)}.title-brand{position:absolute;left:7%;right:7%;top:4%;text-align:center;color:#fff0c8;text-shadow:0 3px 20px #000}
.title-brand>img{display:block;width:65%;max-height:calc(15 * var(--funky-vh, 1dvh));object-fit:contain;margin:auto}.title-brand h1{font-size:clamp(15px,calc(2.7 * var(--funky-vh, 1dvh)),25px);letter-spacing:.2em;margin:8px 0}.title-brand p{font-size:clamp(11px,calc(1.7 * var(--funky-vh, 1dvh)),16px);margin:6px 0;color:#e1d6f6}
.title-actions{position:absolute;bottom:5%;left:10%;right:10%;text-align:center;color:#eee2ff}.title-actions>p{font-size:clamp(12px,calc(1.8 * var(--funky-vh, 1dvh)),17px);margin:0 0 10px}.language-choice{display:flex;gap:10px;margin-bottom:12px}.language-choice button{flex:1;min-height:44px;padding:9px;border-radius:14px;border:1px solid #b6a4d77a;background:#0e132ce6;color:#efe7ff;font-size:clamp(13px,calc(2 * var(--funky-vh, 1dvh)),18px)}.language-choice button[aria-pressed="true"]{border-color:#ffdf9d;background:#65523177;color:#ffe8b5;box-shadow:0 0 18px #e2ba6633}.title-actions .play-button{min-height:44px;padding:12px 18px;font-size:clamp(14px,calc(2.2 * var(--funky-vh, 1dvh)),21px);letter-spacing:.12em}.title-actions button:focus-visible{outline:3px solid #a5edff;outline-offset:3px}
@container funky-viewport (max-width:360px){.title-poster{width:100%}.title-brand{top:3%}.title-actions{bottom:4%;left:8%;right:8%}}

/* Reserve real space for identity and gameplay art, including short portal frames. */
.game-card{display:grid;grid-template-rows:auto minmax(0,1fr) auto;gap:6px}
.card-top{min-height:24px;margin:0}.card-tag{line-height:1.2}
.card-feature{min-height:0;display:grid;grid-template-rows:minmax(64px,42%) minmax(30px,1fr);gap:6px;align-items:center;justify-items:center;padding:2px 0}
.card-feature:not(:has(.game-preview)){grid-template-rows:1fr}
.card-feature .game-logo{height:100%;width:100%;max-width:100%;max-height:160px;min-height:0;margin:0;object-fit:contain}
.card-feature:not(:has(.game-preview)) .game-logo{max-height:190px}
.game-preview{width:100%;height:100%;min-height:0;max-height:220px;position:relative;isolation:isolate}
.solitaire-preview:before{content:'';position:absolute;inset:20% 4% 0;border-radius:50%;background:radial-gradient(ellipse,#67d8cd30,transparent 70%);z-index:-1}
.solitaire-preview img{position:absolute;top:8%;left:calc(50% + var(--offset)*12%);height:82%;max-width:43%;object-fit:contain;transform:translateX(-50%) rotate(var(--angle));filter:drop-shadow(0 7px 8px #0006)}
.blockpop-preview{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));grid-template-rows:repeat(4,minmax(0,1fr));gap:2px;width:auto;max-width:100%;aspect-ratio:3/2;max-height:180px;filter:drop-shadow(0 8px 14px #0a0f34)}
.blockpop-preview img{width:100%;height:100%;min-width:0;min-height:0;object-fit:contain}
.game-card:has(.game-logo) .card-footer h2{display:none}
.card-footer{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:4px 8px;min-width:0;margin:0}
.card-footer>h2,.card-footer>p,.card-footer>.record-line,.card-footer>.shadow-card-progress{grid-column:1/-1}
.card-footer .play-button{grid-column:1;min-width:0;min-height:44px}
.card-footer .guide-button{grid-column:2;min-height:44px;max-width:110px;margin:0;padding:6px 3px;align-self:stretch;font-size:11px;line-height:1.3}
.card-footer .record-line{padding:6px 0;min-width:0;gap:5px}.record-line b{font-size:clamp(14px,calc(4 * var(--funky-vw, 1vw)),20px);white-space:nowrap}
.card-footer>p{margin:0 0 3px;font-size:11px}
@container funky-viewport (max-height:600px){
 .collection-header{height:44px;flex-shrink:0;padding:0 14px}.collection-header img{height:34px}.star-pill{min-height:34px}
 .launcher-title{padding:6px 16px}.launcher-title h1{font-size:20px;line-height:1.15}
 #carousel{padding-inline:14px}.game-card{padding:10px 14px;gap:4px;border-radius:22px}.card-top img{height:22px}.card-tag{padding:5px 8px;font-size:7px}
 .browse-note{display:none}.carousel-controls{padding:3px 12px;gap:6px;min-height:50px}.carousel-controls>button{width:44px;height:44px;flex-shrink:0}
 .bottom-nav{padding:2px 12px calc(2px + env(safe-area-inset-bottom))}.bottom-nav button{display:flex;align-items:center;justify-content:center;gap:6px;min-height:44px;font-size:8px;letter-spacing:.7px}
 .bottom-nav span{font-size:18px}.card-footer>.record-line{padding:4px 0}.card-footer .play-button{padding:7px 12px;font-size:12px}.card-footer .play-button span{font-size:20px}
}
@container funky-viewport (max-height:460px){.launcher-title{display:none}.game-card{padding:8px 12px}.card-feature{gap:4px}.collection-header{height:40px}.collection-header img{height:30px}.card-footer>.record-line{font-size:8px}.card-footer .record-line b{font-size:15px}}

/* Logical viewport makes mobile-only rotation independent of Y8's wide frame. */
#viewport-root{position:fixed;inset:0;width:100%;height:100%;overflow:hidden;container-type:size;container-name:funky-viewport}
body.mobile-portrait-rotated #viewport-root{inset:auto;width:var(--mobile-width);height:var(--mobile-height);left:var(--mobile-left);top:var(--mobile-top);transform:rotate(var(--mobile-rotation));transform-origin:0 0}
body.mobile-portrait .collection{display:flex;justify-content:center;padding:0;gap:0}
body.mobile-portrait .side-panel{display:none}
body.mobile-portrait .portrait{width:100%;max-width:520px}
body.mobile-portrait #carousel{touch-action:none}
