
/* One viewport: artwork reaches the edges; controls stay in the safe rectangle. */
:root{--safe-top:env(safe-area-inset-top,0px);--safe-bottom:env(safe-area-inset-bottom,0px);--safe-height:calc(100dvh - var(--safe-top) - var(--safe-bottom));--selected-home-background:url('assets/fondo-principal-sin-plantas.png')}
html{height:100%;overflow:hidden;background:#502915}
html body{height:100dvh;min-height:0;margin:0;padding:0!important;overflow:hidden;background:var(--selected-home-background) center/cover no-repeat fixed!important;isolation:isolate}
body::before{content:'';position:fixed;inset:-20px;z-index:-1;background:var(--selected-home-background) center/cover no-repeat;filter:blur(10px);pointer-events:none}
html body #app{position:fixed;inset:var(--safe-top) env(safe-area-inset-right,0px) var(--safe-bottom) env(safe-area-inset-left,0px);height:auto!important;min-height:0;display:flex!important;align-items:center;justify-content:center;padding:0!important;isolation:isolate}
html body #app::before{display:none!important}
html body #app>.home-screen,html body #app>.separated-shop,html body #app>.friends-shell{position:relative;width:min(100%,calc(var(--safe-height)*736/1426));height:min(var(--safe-height),calc(100vw*1426/736));min-height:0;max-height:var(--safe-height);margin:0;flex:none}
html body #app>.home-screen{padding:0;overflow:hidden}
html body #app>.account-art,html body #app>.profile-screen{width:min(100%,calc(var(--safe-height)*900/1746));height:auto;min-height:0;max-height:var(--safe-height);margin:0;aspect-ratio:900/1746}
html body #app>.play.match-stage{width:min(100%,calc(var(--safe-height)*900/1746));height:auto;min-height:0;max-height:var(--safe-height);margin:0;aspect-ratio:900/1746;align-self:center}
html body #app>.separated-shop,html body #app>.friends-shell{background:transparent;isolation:auto}
html body #app>.separated-shop::before,html body #app>.friends-shell::before{display:none}
html body #app>:is(.home-screen,.separated-shop,.friends-shell){
 --stage-height:min(var(--safe-height),calc(100vw * 1426 / 736));
 --dock-drop:clamp(0px,calc((var(--safe-height) - var(--stage-height)) / 2 + max(0px,var(--safe-bottom) - 12px) - 4px),24px);
}
html body #app>:is(.separated-shop,.friends-shell){padding-bottom:max(0px,calc(var(--stage-height)*.101 - var(--dock-drop) + 6px))}
html body #app>.screen.mode-screen,html body #app>.screen.online-screen,html body #app>.screen.players-screen{width:min(100vw,calc(var(--safe-height)*736/1426));height:var(--fitted-form-height,var(--safe-height))!important;max-height:none;min-height:0;margin:0;padding:8px 16px 12px!important;overflow:visible;transform:scale(var(--form-scale,1));transform-origin:center center;align-self:center;flex:none}
/* Dialogs also respect the clock and the home indicator. */
html body dialog:not(.ranking-screen-dialog){max-height:calc(var(--safe-height) - 24px);margin-top:auto;margin-bottom:auto;top:var(--safe-top);bottom:var(--safe-bottom)}
html body dialog:has(.help-guide){padding:18px;overflow:auto}
.help-guide .help-goal{margin-bottom:10px;font-size:14px}
.help-guide .help-steps{gap:7px}
.help-guide .help-steps li{padding:9px 10px;gap:9px}
.help-guide .help-steps h3{font-size:15px;margin-bottom:3px}
.help-guide .help-steps p{font-size:12px;line-height:1.35}
.help-guide .help-bonus{margin:10px 0;padding:8px 10px;font-size:13px}
.help-guide>button{width:100%;min-height:42px;padding:10px;margin:0}
html body .ranking-screen-dialog{inset:0;height:100dvh}
/* The loading art fills the screen without exposing a debug action. */
#game-loading .loading-scene{width:100%;height:100dvh;max-width:none;background-size:cover}
.loading-dev-replay{display:none!important}

/* Keep a single continuous image behind the home and the match. */
html body #app>.home-screen{background-image:none!important;background-color:transparent}
body:has(#app>.home-screen)::before{filter:none;inset:0}
body:has(#app>.match-stage)::before{filter:none;inset:0}
html body #app>.play.match-stage{background:none}

/* Shared theme canvas: no second image behind the setup panels. */
:root{--selected-secondary-background:url('assets/fondo.png')}
html body{background-image:var(--selected-secondary-background)!important}
body::before{background-image:var(--selected-secondary-background);filter:none;inset:0}
html body:has(#app>.home-screen){background-image:var(--selected-home-background)!important}
body:has(#app>.home-screen)::before{background-image:var(--selected-home-background)}
html body #app>.screen.mode-screen,html body #app>.screen.online-screen,html body #app>.screen.players-screen{background:none!important;box-shadow:none!important}
html body #app>.screen.mode-screen::before,html body #app>.screen.online-screen::before,html body #app>.screen.players-screen::before{display:none!important}
html body .ranking-screen-dialog{background:var(--selected-secondary-background) center/cover no-repeat}
html body .ranking-screen-dialog>iframe{position:absolute;top:var(--safe-top);height:var(--safe-height);background:transparent}
/* Move the bars towards the safe rectangle's edges. */
html body .home-screen .home-top.approved-home-top{top:-.6%}
html body #app>:is(.home-screen,.separated-shop,.friends-shell) .illustrated-main-nav.exact-main-nav{bottom:calc(0px - var(--dock-drop))}
html body #app>:is(.separated-shop,.friends-shell){overflow:visible}
/* Explicit square size prevents portrait containers from stretching into ovals. */
html body .play.match-stage .match-avatar .match-avatar-art{width:16.8cqw;height:16.8cqw;min-height:16.8cqw;aspect-ratio:1/1;box-sizing:border-box;border:3px solid #f5c447;border-radius:50%;padding:0;overflow:hidden;background:#fff4dc;flex:0 0 auto;box-shadow:0 0 0 1px #a96713,0 3px 5px #3d1c1266}
html body .play.match-stage .match-avatar-art>svg:not(.season-champion-medal),html body .play.match-stage .match-avatar-art>img{display:block;width:100%;height:100%;max-width:none;object-fit:cover;border-radius:50%;padding:0;margin:0}
html body .play.match-stage .match-avatar-art>img{transform:scale(1.15)}
html body .play.match-stage .match-avatar.current .match-avatar-art{outline:2px solid #71efff;outline-offset:2px}
html body .play.match-stage .match-gems{min-width:29%;width:auto;max-width:43%;padding-left:1.5cqw;padding-right:1.5cqw;gap:1cqw}
html body .play.match-stage .match-gems b{min-width:6ch;white-space:nowrap;font-variant-numeric:tabular-nums}
html body .play.match-stage .quick-guide{top:96%;margin:0}
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
body{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
input,textarea,[contenteditable=true]{-webkit-user-select:text;user-select:text;-webkit-touch-callout:default}
html body input:not([type=hidden]),html body textarea,html body select{font-size:max(16px,var(--safe-input-font,16px))!important}
button,a,.pawn{touch-action:manipulation}
.coins-notice{max-width:370px;text-align:center;border:3px solid #e7b644;border-radius:24px;background:linear-gradient(#fff9e9,#f4dfb5);color:#582a13;padding:24px}
.coins-notice h2{font-size:24px}.coins-notice p{font-size:16px;line-height:1.5}.coins-notice button{width:100%;margin-top:12px}

.ranking-screen-dialog::backdrop{background:var(--selected-secondary-background) center/cover no-repeat}
html body .play.match-stage .match-avatar .match-avatar-art{overflow:visible}
html body .play.match-stage .match-avatar-art>img,html body .play.match-stage .match-avatar-art>svg:not(.season-champion-medal){clip-path:circle(50%)}

/* Crop the portrait margin inside its gold ring while leaving the medal free. */
html body .play.match-stage .match-avatar-art>img{clip-path:circle(43.47826% at 50% 50%)}

/* Lift the complete HUD and side shortcuts by the same safe distance. */
html body #app>.home-screen{overflow:visible}
html body .home-screen .home-top.approved-home-top,html body .home-screen .home-themes-button,html body .home-screen #account-settings{margin-top:calc(0px - var(--home-rise,0px))}

/* Keep the classic secondary artwork softly blurred across the entire viewport. */
html[data-home-theme="classic"] body:has(#app>.separated-shop,#app>.friends-shell)::before{filter:blur(10px);inset:-24px}

:root{--home-rise:10px}
html body .home-screen .home-themes-button:not(.home-ranking-button):not(.home-ad-button){margin-top:-18px}

html body:has(#app>.approved-lobby)::before{inset:-24px;filter:blur(10px);background-image:var(--selected-secondary-background)}
