/* Copyright (c) 2026 Brinis Interactive. All rights reserved.
   Only the authorized Brimind Team may edit/build/publish on behalf of Brinis Interactive.
   Copying/modification/redistribution requires written permission except as allowed by law.
   info@brinisinteractive.com | https://brinisinteractive.com */
/* One stage coordinate system, with proportional art and reserved UI lanes. */
.screen:not(.active){visibility:hidden;}
.screen.active{visibility:visible;}
.menu-screen{position:absolute;inset:0;background:radial-gradient(ellipse at 50% 40%,#211746 0%,#0b081b 72%);}
.menu-titleblock{position:absolute;left:50%;top:100px;width:600px;text-align:center;transform:translateX(-50%);}
.menu-titleblock .title-main{font-size:64px;line-height:.96;}
.menu-titleblock .title-sub{font-size:13px;letter-spacing:.22em;margin:10px 0;}
.menu-titleblock .title-tag{font-size:17px;margin:0;}
.menu-crest{position:absolute;top:-48px;left:0;right:0;font-size:30px;color:var(--gold-bright);}
#screen-title .menu-grid{position:absolute;inset:auto!important;left:50%!important;top:265px!important;transform:translateX(-50%);width:1390px!important;height:575px!important;display:grid;grid-template-columns:356px 578px 356px;grid-template-rows:180px 180px 180px;gap:15px 50px;align-items:center;}
#screen-title .menu-grid>.mcard{position:relative!important;inset:auto!important;width:100%!important;height:auto!important;min-width:0;min-height:0!important;aspect-ratio:var(--art-ratio);border:0!important;padding:0;border-radius:14px;cursor:pointer;background:transparent!important;box-shadow:none!important;overflow:visible;transition:filter .15s,transform .15s;}
#screen-title .menu-grid>.mcard:hover{filter:brightness(1.12);}
#screen-title .menu-grid>.mcard:focus-visible{outline:3px solid var(--gold-bright);outline-offset:5px;}
#screen-title .mcard-art{display:block;width:100%;height:100%;object-fit:contain!important;border-radius:14px;}
.mcard-label,.mcard-scrim{display:none;}
.noart .mcard-label{display:block;color:var(--gold-bright);font-size:28px;}
#deck{grid-column:1;grid-row:1;--art-ratio:605/283;}
#tutBtn{grid-column:1;grid-row:2;--art-ratio:288/296;max-width:169px;justify-self:start;}
#tutPortal{grid-column:1;grid-row:2;--art-ratio:290/296;max-width:169px;justify-self:end;}
#achBtn{grid-column:1;grid-row:3;--art-ratio:605/306;}
#pvp{grid-column:2;grid-row:1/span 2;--art-ratio:929/460;}
#play{grid-column:3;grid-row:1/span 2;--art-ratio:607/670;}
#shop{grid-column:3;grid-row:3;--art-ratio:605/330;}
#bpBtn{grid-column:2;grid-row:3;--art-ratio:3/1;}
#screen-title .bp-menu .mcard-art{position:absolute;inset:0;object-fit:cover!important;}
.bpm-overlay{position:absolute;inset:0;display:flex;align-items:center;gap:22px;padding:18px 24px;background:linear-gradient(90deg,rgba(10,6,28,.45),transparent);border:1px solid var(--gold-deep);border-radius:14px;}
.bpm-title{font-size:23px;color:var(--gold-bright);font-weight:bold;max-width:130px;line-height:1.1;text-align:left;}
.bpm-title small{display:block;font-size:10px;margin-top:7px;}
.bpm-prog{flex:1;min-width:0;padding-right:12px;}
.bpm-bar{height:7px;background:#130c26;border-radius:8px;position:relative;border:1px solid #665077;}
.bpm-fill{height:100%;background:var(--gold);}
.bpm-node{position:absolute;top:50%;transform:translate(-50%,-50%);}
.bpm-node-dot{width:23px;height:23px;border-radius:50%;display:grid;place-items:center;background:#271c40;border:2px solid #86779a;}
.bpm-ic img{width:14px;height:14px;object-fit:contain;}.bpm-tier{text-align:center;margin-top:20px;font-size:13px;}
.reward-pip,.new-pip{position:absolute;right:6px;top:6px;border-radius:50%;background:#d6a137;color:#1c1021;font:bold 14px Georgia;padding:3px 7px;z-index:4;}
.menu-hud{position:absolute;top:18px;right:22px;display:flex;align-items:center;gap:8px;z-index:10;padding:0!important;}
.hud-chip{display:flex;gap:6px;align-items:center;min-height:42px;padding:6px 10px;border:1px solid #594575;border-radius:14px;background:#211738;white-space:nowrap;font-size:18px;}
.hud-chip small{font-size:12px;}.hud-chip svg{width:16px;height:16px;}.hud-card-ic{width:18px;height:30px;object-fit:contain;}.hud-ic{width:24px;height:24px;object-fit:contain;}
.hud-plus{height:26px;width:26px;border:1px solid #5fe0a8;border-radius:50%;background:#153a35;color:#9fffcf;font-size:21px;cursor:pointer;}
.rank-plate{position:absolute;top:18px;left:22px;display:flex;align-items:center;gap:12px;z-index:9;max-width:470px;}
.rp-emblem{position:relative;width:76px;height:76px;flex:none;}.rp-emblem-core{position:absolute;inset:5px;border-radius:50%;overflow:hidden;background:#171221;border:2px solid #ac8545;}.rp-vid{width:100%;height:100%;object-fit:contain;}.rp-ring{position:absolute;inset:0;width:100%;height:100%;fill:none;stroke:#5c4c70;stroke-width:3px;}.rp-ring-arc{stroke:var(--rc,#c49350);stroke-dasharray:calc(var(--frac,0)*289) 289;}.rp-div{position:absolute;bottom:-2px;left:28px;background:#c79f51;color:#21162b;border-radius:50%;width:22px;text-align:center;}
.rp-info{min-width:120px;max-width:215px;}.rp-name{white-space:nowrap;text-overflow:ellipsis;overflow:hidden;font-weight:700;font-size:18px;cursor:pointer;}.rp-tier{color:var(--rc,#c49350);letter-spacing:.14em;font-size:14px;}.rp-tro{display:flex;align-items:center;gap:4px;font-size:12px;}.rp-tro svg{width:14px;height:14px;}.rp-tro span{font-size:10px;}
.rp-icon{width:62px;height:62px;border-radius:12px;border:2px solid var(--rc,#c49350);position:relative;cursor:pointer;}.rp-icon>img{width:100%;height:100%;object-fit:cover;border-radius:10px;}
.menu-corner{position:absolute;bottom:20px;left:24px;min-width:48px;min-height:48px;padding:8px 12px;border-radius:12px;border:1px solid var(--gold-deep);background:#211738;color:var(--gold-bright);display:flex;gap:8px;align-items:center;cursor:pointer;}.menu-corner.right{left:auto;right:24px;}.corner-ic{width:28px;height:28px;object-fit:contain;}.menu-continue{position:absolute;bottom:30px;left:50%;transform:translateX(-50%);font-size:15px;color:var(--gold);}
/* Board lanes: every field card, pile label/count and hand stays inside the stage. */
#screen-duel .player-bar{height:100px;padding:0 26px;}
#screen-duel .player-bar.foe{top:14px;}#screen-duel .player-bar.you{bottom:14px;}
#screen-duel .bar-piles{padding:0;gap:12px;}.pile .lb{font-size:12px;letter-spacing:.09em;}.pile .mini{width:38px;height:68px;background-size:contain;background-repeat:no-repeat;}.pile .ct{font-size:14px;margin-top:0;}
#screen-duel .field-row.foe{top:150px;}#screen-duel .field-row.you{top:450px;}
#screen-duel .field-row{gap:20px;}
#screen-duel .zone,#screen-duel .cardm{width:112px;height:200px;background-size:contain;background-repeat:no-repeat;}
#screen-duel .center-band,#screen-duel .directzone{top:354px;height:86px;}
#screen-duel .logbox{left:22px;top:265px;width:200px;height:300px;overflow:auto;font-size:14px;}
#screen-duel .hand-dock{left:max(270px,calc(50% - 410px));right:max(240px,calc(50% - 410px));bottom:22px;height:0;}
#screen-duel .hand{width:100%;}
#screen-duel .handcard{width:100px;height:179px;bottom:0;}
#screen-duel .handcard:hover,#screen-duel .handcard.chosen{bottom:14px;}
#screen-duel .hint,#screen-duel #cancelAction{bottom:207px;max-width:65%;}
#screen-duel .corner-quit{top:398px;right:24px;}
#screen-duel .foe-hand{top:116px;}.foe-hand .fd{width:28px;height:50px;background-size:contain;}
#ellie-vid video{max-width:60%!important;max-height:56%!important;object-fit:contain!important;}
body.touch #bsel-root .battle-select{transform:none;}
#bsel-root,#rps-root{box-sizing:border-box;padding:12px;overflow:auto;}
.character-theme .battle-select{max-height:calc(var(--ec-vh,100dvh) - 24px)!important;max-width:calc(var(--ec-vw,100vw) - 24px)!important;overflow:auto;}
@media(max-height:500px) and (orientation:landscape){.character-theme .bsel-inner{padding:14px!important;}.character-theme .bsel-brief{margin:6px 0!important;}.character-theme .bsel-title{font-size:22px!important;}.character-theme .bsel-avatar img{height:60px!important;width:52px!important;}}
/* Portrait keeps the same five board lanes, with larger readable card previews. */
body.ec-portrait #screen-title .menu-grid{width:780px!important;top:365px!important;height:1000px!important;grid-template-columns:370px 370px;grid-template-rows:175px 210px 190px 190px 170px;gap:20px 40px;}
body.ec-portrait #screen-title #deck{grid-column:1;grid-row:1;}body.ec-portrait #screen-title #pvp{grid-column:1;grid-row:2;}
body.ec-portrait #screen-title #play{grid-column:2;grid-row:1/span 2;max-width:340px;justify-self:center;}
body.ec-portrait #screen-title #tutBtn{grid-column:1;grid-row:3;max-width:180px;justify-self:center;}
body.ec-portrait #screen-title #tutPortal{grid-column:2;grid-row:3;max-width:180px;justify-self:center;}
body.ec-portrait #screen-title #achBtn{grid-column:1;grid-row:4;}body.ec-portrait #screen-title #shop{grid-column:2;grid-row:4;}
body.ec-portrait #screen-title #bpBtn{grid-column:1/span 2;grid-row:5;max-width:700px;justify-self:center;}
body.ec-portrait .menu-titleblock{top:175px!important;}
body.ec-portrait .menu-hud{top:110px!important;}.menu-hud .hud-chip{flex-shrink:0;}
body.ec-portrait #screen-duel .player-bar{height:110px;padding:0 20px;}.bar-info{min-width:0;}
body.ec-portrait #screen-duel .bar-info{flex:1;}.bar-name small{display:inline-block;}
body.ec-portrait #screen-duel .field-row.foe{top:230px;}body.ec-portrait #screen-duel .field-row.you{top:650px;}
body.ec-portrait #screen-duel .zone,body.ec-portrait #screen-duel .cardm{width:136px;height:243px;}
body.ec-portrait #screen-duel .center-band,body.ec-portrait #screen-duel .directzone{top:500px;height:116px;}
body.ec-portrait #screen-duel .hand-dock{left:60px;right:60px;bottom:230px;}
body.ec-portrait #screen-duel .handcard{width:125px;height:224px;}
body.ec-portrait #screen-duel .logbox{top:1370px;left:24px;right:220px;width:auto;height:155px;font-size:21px;}
body.ec-portrait #screen-duel .player-bar.you{bottom:420px;}
body.ec-portrait #screen-duel .foe-hand{top:153px;}
body.ec-portrait #screen-duel .hint,body.ec-portrait #screen-duel #cancelAction{bottom:650px;}
body.ec-portrait #screen-duel .corner-quit{top:1440px;right:20px;min-height:80px;}
body.ec-portrait .bar-piles{gap:6px;}.bar-name{overflow-wrap:anywhere;}
@media(prefers-reduced-motion:reduce){.mcard{transition:none!important;}}

/* Challenge dialog uses viewport-relative card height, without scaling its text. */
@media(max-height:540px) and (orientation:landscape){
 #bsel-root .battle-select{width:min(720px,96vw);overflow:hidden!important;}
 #bsel-root .bsel-inner{padding:10px 18px!important;}
 #bsel-root .bsel-title{font-size:20px!important;margin:0!important;}
 #bsel-root .bsel-sub{font-size:12px;margin-bottom:4px;}
 #bsel-root .bsel-brief{display:none;}
 #bsel-root .bsel-prompt{margin:3px 0 5px;font-size:12px;}
 #bsel-root .bsel-card{width:auto;height:clamp(140px,calc(var(--ec-vh,100dvh) - 180px),290px);max-width:45%;aspect-ratio:240/300;}
 #bsel-root .bsel-card-art{width:100%;height:100%;object-fit:contain;}
 #bsel-root .bsel-card-name{font-size:16px!important;}
 #bsel-root .bsel-card-desc{font-size:11px!important;}
 #bsel-root .bsel-reward{gap:6px;}
 #bsel-root .bsel-back{margin-top:0;min-height:40px;}
 #bsel-root .bsel-back img{width:110px;max-height:42px;object-fit:contain;}
}
body.ec-portrait #screen-map .map-head{margin-top:110px;flex-wrap:wrap;}
body.ec-portrait #screen-map .map-tools{flex-wrap:wrap;justify-content:center;}
body.ec-portrait #trialRow{flex-wrap:wrap!important;justify-content:center;gap:20px!important;}
body.ec-portrait #trialRow .trial-card{height:310px!important;flex:0 0 240px!important;}
body.ec-portrait #screen-map{padding:20px;}

.history-toggle{display:none;}
body.ec-compact #screen-duel .bar-name{font-size:max(18px,calc(11px / var(--ec-stage-scale,1)));}
body.ec-compact #screen-duel .bar-name small{font-size:max(12px,calc(9px / var(--ec-stage-scale,1)));}
body.ec-compact #screen-duel .hpnum{font-size:max(13px,calc(10px / var(--ec-stage-scale,1)));}
body.ec-compact #screen-duel .hpwrap{height:max(20px,calc(14px / var(--ec-stage-scale,1)));}
body.ec-compact #screen-duel .avatar{width:80px;height:80px;}
body.ec-compact #screen-duel .bar-info{flex:0 1 400px;}
body.ec-compact #screen-duel .pile .ct,body.ec-compact #screen-duel .pile .lb{font-size:max(14px,calc(9px / var(--ec-stage-scale,1)));}
@media(max-width:1024px) and (orientation:landscape){
 body.ec-compact #screen-duel .logbox{display:none;}
 body.ec-compact #screen-duel .history-toggle{display:block;position:absolute;left:22px;top:330px;z-index:25;}
 body.ec-compact #screen-duel.show-history .logbox{display:block;top:445px;left:22px;width:calc(240px / var(--ec-stage-scale,1));height:330px;font-size:calc(12px / var(--ec-stage-scale,1));z-index:26;background:#100b21;}
}
body.ec-portrait #screen-duel .bar-name small{display:none;}
body.ec-portrait #screen-duel .bar-info{flex:1;max-width:450px;}
body.ec-portrait #screen-duel .logbox{font-size:24px;}

/* Alpha video fallback mask avoids black corner blocks in browsers without VP9 alpha. */
#ellie-vid video:not(.opaque){clip-path:ellipse(49% 49% at 50% 50%);}

body.ec-compact .menu-hud .hud-chip{min-height:calc(34px / var(--ec-stage-scale,1));font-size:calc(12px / var(--ec-stage-scale,1));gap:8px;}
body.ec-compact .menu-hud .hud-chip small{font-size:calc(10px / var(--ec-stage-scale,1));}
body.ec-compact .menu-hud .hud-plus{width:calc(28px / var(--ec-stage-scale,1))!important;height:calc(28px / var(--ec-stage-scale,1))!important;font-size:calc(20px / var(--ec-stage-scale,1));}
body.ec-compact .menu-hud .hud-ic{width:calc(18px / var(--ec-stage-scale,1));height:calc(18px / var(--ec-stage-scale,1));}
body.ec-compact #screen-duel .pile{width:72px;}
body.ec-compact #screen-duel .pile .lb{letter-spacing:0;}
body.ec-compact #screen-duel .turnflag .big{font-size:max(18px,calc(12px / var(--ec-stage-scale,1)));}
body.ec-compact #screen-duel .turnflag .sm{font-size:max(12px,calc(9px / var(--ec-stage-scale,1)));}
body.ec-portrait .menu-titleblock{top:225px!important;}
body.ec-portrait #screen-title .menu-grid{top:415px!important;}

/* The collection remains scrollable while complete cards fit in both panes. */
body.ec-compact:not(.ec-portrait) #screen-deck .deck-main{grid-template-columns:minmax(480px,.8fr) minmax(650px,1.4fr)!important;grid-template-rows:minmax(0,1fr)!important;}
body.ec-compact:not(.ec-portrait) #screen-deck .deck-pane{max-height:none!important;}
body.ec-compact:not(.ec-portrait) #screen-deck .slot-grid{grid-template-columns:repeat(4,minmax(0,1fr))!important;}
body.ec-compact:not(.ec-portrait) #screen-deck .trunk-grid{grid-template-columns:repeat(6,minmax(0,1fr))!important;}
body.ec-portrait #screen-deck .deck-main{grid-template-rows:550px minmax(650px,1fr)!important;}
#screen-deck .deck-header,#screen-deck .deck-namebar,#screen-deck .filter-bar{flex-shrink:0;}
#screen-deck .trunk-card,#screen-deck .slot{background-size:contain;background-repeat:no-repeat;}

/* Opaque H.264 compatibility copies use an intentional framed matte. */
#ellie-vid video.ec-compatible-video{clip-path:none;border-radius:18px;box-shadow:0 0 0 1px rgba(215,181,106,.6),0 8px 30px #0008;}

/* Portrait play: all primary screens scroll vertically, never sideways.
   Original images retain their proportions; no independent X/Y stretching. */
#rotate-prompt{display:none!important;}
body.ec-portrait #stage{--portrait-text:max(28px,calc(15px / var(--ec-stage-scale,1)));}
body.ec-portrait #screen-deck,body.ec-portrait #screen-shop,body.ec-portrait #screen-map,body.ec-portrait #screen-world,body.ec-portrait #screen-online,body.ec-portrait #screen-login{overflow-x:hidden!important;overflow-y:auto!important;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;scrollbar-gutter:stable;}
body.ec-portrait #screen-title .menu-hud{gap:8px;max-width:850px;}
body.ec-portrait #screen-title .menu-titleblock{max-width:800px;}
body.ec-portrait #screen-title .menu-corner{font-size:28px;min-height:100px;bottom:18px!important;}
body.ec-portrait #screen-title .corner-ic{width:48px;height:48px;}
body.ec-portrait .menu-continue{display:none;}
/* Portrait trials use two columns, with the top toolbar separated from the profile. */
body.ec-portrait #screen-map .map-head{margin-top:120px;display:flex;justify-content:center!important;}
body.ec-portrait #screen-map .map-tools{gap:14px;flex-wrap:wrap;max-width:100%;}
body.ec-portrait #screen-map .map-tools .tool-div{display:none;}
body.ec-portrait #screen-map .nav-btn{min-height:96px;min-width:180px;font-size:26px;}
body.ec-portrait #screen-map .bal-chip{font-size:30px;height:82px;padding:10px 18px;}
body.ec-portrait #screen-map .map-titlebar{position:relative;inset:auto;margin:24px 0;}
body.ec-portrait #screen-map .map-title{font-size:44px;}
body.ec-portrait #screen-map .map-title small{font-size:24px;letter-spacing:.12em;}
body.ec-portrait #screen-map .trials-body{position:relative;inset:auto;display:block;flex:none;}
body.ec-portrait #screen-map #trialRow{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));height:auto;gap:32px 16px!important;padding:10px 26px 26px;}
body.ec-portrait #screen-map #trialRow .trial-card{width:100%!important;max-width:none!important;height:420px!important;min-width:0!important;justify-self:center;}
body.ec-portrait #screen-map .trial-name{font-size:30px;}.trial-flag{max-width:100%;}
body.ec-portrait #screen-map .trial-flag{font-size:23px;padding:7px 12px;}
body.ec-portrait #screen-map .map-foot{font-size:26px;min-height:70px;}
/* Deck Forge: complete cards in separate independently scrollable panes. */
body.ec-portrait #screen-deck{padding:26px;gap:20px;}
body.ec-portrait #screen-deck .deck-header{gap:20px;flex-wrap:wrap;align-items:center;margin:0;}
body.ec-portrait #screen-deck .deck-h-title{font-size:44px!important;width:100%;}
body.ec-portrait #screen-deck .deck-h-title small{font-size:24px;letter-spacing:.08em;}
body.ec-portrait #screen-deck .deck-tabs{order:3;flex:1 1 100%;gap:12px;justify-content:flex-start;overflow-x:auto;flex-wrap:nowrap;padding:10px 0;}
body.ec-portrait #screen-deck .deck-tab{flex:0 0 140px;min-width:140px;min-height:112px!important;}
body.ec-portrait #screen-deck .dt-name{font-size:28px;}
body.ec-portrait #screen-deck .dt-meta{font-size:23px;}
body.ec-portrait #screen-deck .dt-live{font-size:18px;}
body.ec-portrait #screen-deck #deckBack{margin-left:auto;}
body.ec-portrait #screen-deck .deck-main{flex:none;grid-template-columns:minmax(0,1fr)!important;grid-template-rows:720px 1100px!important;gap:24px;}
body.ec-portrait #screen-deck .deck-pane{min-width:0;max-height:none!important;padding:20px;}
body.ec-portrait #screen-deck .deck-namebar,body.ec-portrait #screen-deck .deck-meta{flex-wrap:wrap;gap:16px;}
body.ec-portrait #screen-deck .deck-name{font-size:34px;max-width:500px;}
body.ec-portrait #screen-deck .deck-hint{font-size:24px;line-height:1.4;padding-top:12px;}
body.ec-portrait #screen-deck .active-badge{font-size:24px;}
body.ec-portrait #screen-deck .slot-grid{grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:16px!important;min-height:340px;}
body.ec-portrait #screen-deck .trunk-pane{min-width:0;}
body.ec-portrait #screen-deck .trunk-grid{grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:18px!important;min-height:500px;}
body.ec-portrait #screen-deck .filter-bar{gap:16px;flex-wrap:wrap;padding:16px 0;}
body.ec-portrait #screen-deck .coll-stats{font-size:26px;flex-wrap:wrap;gap:14px;}
body.ec-portrait #screen-deck .qty-badge,body.ec-portrait #screen-deck .star-badge{font-size:24px;}
body.ec-portrait #screen-deck .card-view-btn{min-width:70px;min-height:70px;}
body.ec-portrait #screen-deck .pager{flex-wrap:wrap;gap:20px;font-size:28px;padding:16px 0;}
/* Shop: readable offers, two cards per row and a persistent way back. */
body.ec-portrait #screen-shop .shop-wrap{padding:24px 26px 60px;overflow-x:hidden!important;}
body.ec-portrait #screen-shop .shop-head{display:flex;flex-wrap:wrap;gap:20px;align-items:center;}
body.ec-portrait #screen-shop .shop-title{font-size:44px;width:100%;}
body.ec-portrait #screen-shop .shop-title small{font-size:25px;letter-spacing:.06em;}
body.ec-portrait #screen-shop .shop-bal{display:flex;flex-wrap:wrap;gap:14px;flex:1;}
body.ec-portrait #screen-shop .bal-chip{font-size:30px;padding:12px;}
body.ec-portrait #screen-shop #shopDev{display:none;}
body.ec-portrait #screen-shop #shopBack{position:sticky;top:12px;z-index:35;}
body.ec-portrait #screen-shop .shop-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:24px;}
body.ec-portrait #screen-shop .pack-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:24px;}
body.ec-portrait #screen-shop .shop-sec-title{font-size:32px;flex-wrap:wrap;gap:10px;}
body.ec-portrait #screen-shop .shop-sec-title .refresh{font-size:24px;}
body.ec-portrait #screen-shop .pack-name,body.ec-portrait #screen-shop .pack-price{font-size:30px;padding:20px;}
body.ec-portrait #screen-shop .pack-amt .paid,body.ec-portrait #screen-shop .pack-amt .bonus-total{font-size:40px;}
body.ec-portrait #screen-shop .pack-amt .free,body.ec-portrait #screen-shop .pack-note{font-size:27px;}
body.ec-portrait #screen-shop .pack-amt .was,body.ec-portrait #screen-shop .pack-amt .bonus-pct{font-size:25px;}
body.ec-portrait #screen-shop .pack-ribbon{position:relative;top:auto;font-size:22px;align-self:stretch;text-align:center;}
body.ec-portrait #screen-shop .pack-img{width:180px!important;height:180px!important;object-fit:contain!important;}
body.ec-portrait #screen-shop .wk-card,body.ec-portrait #screen-shop .flash-card{flex-wrap:wrap;padding:34px 24px 24px;gap:20px;}
body.ec-portrait #screen-shop .wk-main,body.ec-portrait #screen-shop .flash-main{flex:1 1 100%;}
body.ec-portrait #screen-shop .wk-side,body.ec-portrait #screen-shop .flash-side{flex:1 1 100%;display:flex;justify-content:space-between;align-items:center;gap:20px;}
body.ec-portrait #screen-shop .wk-name,body.ec-portrait #screen-shop .flash-name{font-size:36px;}
body.ec-portrait #screen-shop .wk-blurb,body.ec-portrait #screen-shop .flash-blurb{font-size:27px;}
body.ec-portrait #screen-shop .wk-rewards,body.ec-portrait #screen-shop .flash-rewards{font-size:32px;}
body.ec-portrait #screen-shop .wk-timer,body.ec-portrait #screen-shop .flash-timer{font-size:27px;}
body.ec-portrait #screen-shop .wk-buy,body.ec-portrait #screen-shop .flash-buy{min-height:100px;font-size:32px;}
body.ec-portrait #screen-shop .wk-badge,body.ec-portrait #screen-shop .flash-badge{font-size:23px;}
/* Account and online screens scale their text in the design coordinate system. */
body.ec-portrait #screen-login.active{display:flex;align-items:flex-start;padding:40px 0;}
body.ec-portrait #screen-login .login-panel{width:820px;max-width:92%;padding:40px;margin:20px auto;max-height:none;transform:none!important;}
body.ec-portrait #screen-login .login-brand{font-size:70px;}
body.ec-portrait #screen-login .login-tag,body.ec-portrait #screen-login .login-switch,body.ec-portrait #screen-login .login-guest-note{font-size:30px;}
body.ec-portrait #screen-login .login-field{font-size:36px;padding:24px;min-height:104px;}
body.ec-portrait #screen-login button{font-size:32px;min-height:104px;}
body.ec-portrait #screen-login .login-or{font-size:28px;}
body.ec-portrait #screen-login a{font-size:28px;display:inline-block;padding:16px 4px;}
body.ec-portrait #screen-world .wd-wrap,body.ec-portrait #screen-online .online-wrap{max-width:100%;padding:30px 24px 70px;}
body.ec-portrait .online-head{flex-wrap:wrap;gap:20px;}
body.ec-portrait .online-head h2{font-size:44px;}
body.ec-portrait .wd-grid,body.ec-portrait .ol-grid{grid-template-columns:minmax(0,1fr);}
body.ec-portrait .wd-big-t{font-size:36px;}
body.ec-portrait .wd-big-d,body.ec-portrait .wd-id,body.ec-portrait .wd-fr-head{font-size:28px;}
body.ec-portrait .wd-big{min-height:150px;padding:24px 28px 24px 90px;}
body.ec-portrait .wd-wrap input,body.ec-portrait .online-wrap input{font-size:34px;min-height:100px;}
/* External dialogs use real device pixels, not the scaled stage. */
@media(orientation:portrait){
 #bsel-root .battle-select{width:min(94vw,680px)!important;max-width:94vw!important;max-height:calc(var(--ec-vh,100dvh) - 24px)!important;overflow-x:hidden!important;overflow-y:auto!important;}
 #bsel-root .bsel-inner{padding:22px 14px 16px!important;}
 #bsel-root .bsel-title{font-size:clamp(20px,5vw,30px)!important;}
 #bsel-root .bsel-brief{gap:10px;margin:10px 0;}
 #bsel-root .bsel-brief p{font-size:14px;line-height:1.35;}
 #bsel-root .bsel-avatar img{width:60px!important;height:75px!important;}
 #bsel-root .bsel-cards{gap:12px;}
 #bsel-root .bsel-card{width:46%;max-width:46%;}
 #bsel-root .bsel-card-name{font-size:clamp(13px,3.6vw,22px)!important;}
 #bsel-root .bsel-card-desc{font-size:clamp(10px,2.7vw,15px)!important;}
 #bsel-root .bsel-rw{font-size:clamp(12px,3.4vw,18px)!important;gap:2px;}
 #bsel-root .bsel-reward{gap:7px;}
 #bsel-root .bsel-rw img{width:15px;height:15px;}
 #bsel-root .bsel-prompt{font-size:13px;letter-spacing:.08em;}
 #bsel-root .bsel-back{margin-top:0;min-height:48px;}
 #bsel-root .bsel-back img{width:130px;max-height:60px;object-fit:contain;}
 #rps-root .rps-slot{max-height:calc(var(--ec-vh,100dvh) - 24px);overflow-y:auto;}
 #rps-root .rps-slot-in{padding:18px 12px;}
 #rps-root .rps-choices{gap:10px;}
 #rps-root .rps-btn{flex:1;min-width:0;min-height:80px;}
 #rps-root .rps-btn .rps-ic{width:42px;height:42px;}
 #overlay .modal-actions{flex-wrap:wrap;gap:12px;}
 #overlay .modal-actions .btn{min-height:44px;font-size:15px;}
 #overlay>.modal{max-width:100%!important;padding:20px 16px;}
 #overlay>.bpx{height:100%!important;min-height:0;--bpc-h:clamp(90px,calc((var(--ec-vh,100dvh) - 230px)/2.7),180px)!important;--bpc-w:calc(var(--bpc-h)*.68);padding:12px!important;}
 #overlay .bpx-head,#overlay .bpx-foot{flex-wrap:wrap;gap:10px!important;}
 #overlay .bpx-head{padding:0 0 10px!important;}
 #overlay .bpx-title{font-size:24px!important;}
 #overlay .bpx-headspace{display:none;}
 #overlay .bpx-foot-btns{flex-wrap:wrap;gap:8px;}
 #overlay .bpx-body{min-height:170px;}
 #overlay .bpx-buybtn{min-height:44px!important;font-size:13px!important;}
 #overlay .bpx-buybtn i{font-size:12px!important;}
 #ellie-vid video{max-width:90%!important;max-height:48%!important;}
}
/* Ensure touch controls stay usable after orientation changes. */
body.ec-portrait #screen-duel .corner-quit{font-size:28px;}
body.ec-portrait #screen-duel .hand-dock{bottom:240px;}
body.ec-portrait #screen-duel .handcard{width:140px;height:250px;}
body.ec-portrait #screen-duel .logbox{top:1370px;height:150px;overflow:auto;}
body.ec-portrait #screen-duel .hint{font-size:28px;max-width:86%;}
body.ec-portrait #screen-duel .turnflag{min-width:300px;padding:15px;}
body.ec-portrait #screen-duel .endbtn{min-width:200px;}

.pp-claim{font-size:0;}
@media(orientation:portrait){
 .pp-veil{padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);}
 .pp-panel{width:min(92vw,680px);height:auto!important;max-height:90dvh!important;aspect-ratio:1200/896;}
 .pp-veil .pp-amount{font-size:clamp(22px,6vw,44px);}
 .pp-panel .pp-claim{position:relative;inset:auto;display:block;width:80%;min-height:48px;height:auto;margin:8px auto 0;background:linear-gradient(#ffe9b0,#c99d45);font:700 17px Cinzel,serif;color:#241a08;border:1px solid #e5c47a;border-radius:12px;}
}

/* Fixed viewport panels: navigation changes pages, never the whole screen. */
html,body,#app,#stage-host{overflow:hidden!important;overscroll-behavior:none;}
[data-ec-hidden],.ec-ui-nav[hidden]{display:none!important;}
body #stage .screen{overflow:hidden!important;}
.ec-ui-nav{flex:none;display:flex;align-items:center;justify-content:center;gap:16px;padding:10px 0;color:var(--gold-bright);}
.ec-ui-nav button{min-width:48px;min-height:44px;background:#211738;color:var(--gold-bright);border:1px solid var(--gold-deep);border-radius:12px;font-size:24px;cursor:pointer;}
.ec-ui-nav button:disabled{opacity:.35;cursor:default;}
#stage .ec-ui-nav{font-size:max(24px,calc(13px / var(--ec-stage-scale,1)));}
#stage .ec-ui-nav button,#stage .ec-shop-sections,#stage .ec-deck-view{min-height:calc(44px / var(--ec-stage-scale,1));font-size:max(24px,calc(14px / var(--ec-stage-scale,1)));}
.ec-shop-sections,.ec-deck-view{background:#211738;color:var(--gold-bright);border:1px solid var(--gold-deep);border-radius:12px;padding:8px 16px;flex:none;max-width:100%;}
#screen-shop .shop-wrap{display:flex;flex-direction:column;overflow:hidden!important;gap:12px;height:100%;padding-bottom:18px!important;}
#screen-shop .shop-head{flex:none;margin-bottom:0;}
#screen-shop .shop-title small{display:none;}
#screen-shop #shopDev{display:none!important;}
#screen-shop .gem-hero,#screen-shop .shop-wrap>.pack-note{display:none!important;}
#screen-shop .ec-shop-page{display:flex;flex:1;flex-direction:column;min-height:0;overflow:hidden;gap:10px;}
#screen-shop .ec-shop-page>.shop-sec-title{flex:none;margin:0!important;}
#screen-shop .ec-shop-page>.shop-grid,#screen-shop .ec-shop-page>.pack-grid{flex:1;min-height:0;grid-template-columns:repeat(4,minmax(0,1fr))!important;grid-template-rows:minmax(0,1fr);align-items:stretch;overflow:hidden;}
#screen-shop .ec-shop-page .shop-card{display:flex;flex-direction:column;min-height:0;max-height:100%;}
#screen-shop .ec-shop-page .shop-card .art{min-height:0;flex:1;aspect-ratio:auto;background-size:contain!important;background-repeat:no-repeat;background-position:center;}
#screen-shop .ec-shop-page .pack-card{min-height:0;justify-content:space-evenly;}
#screen-shop .ec-shop-page .pack-img{height:auto!important;min-height:0;max-height:32%;max-width:70%;object-fit:contain;}
#screen-shop .ec-shop-page .wk-wrap,#screen-shop .ec-shop-page .flash-wrap{min-height:0;overflow:hidden;}
#screen-deck .deck-main{min-height:0!important;flex:1!important;}
#screen-deck .deck-pane,#screen-deck .trunk-pane{min-height:0!important;overflow:hidden!important;display:flex;flex-direction:column;}
#screen-deck .slot-grid,#screen-deck .trunk-grid{flex:1;min-height:0!important;overflow:hidden!important;grid-template-rows:repeat(2,minmax(0,1fr));align-items:stretch;}
#screen-deck .slot,#screen-deck .trunk-card{height:100%!important;min-height:0!important;max-height:100%;aspect-ratio:auto!important;background-size:contain!important;background-position:center;background-repeat:no-repeat;}
#screen-deck .deck-tabs{overflow:hidden!important;flex-wrap:wrap!important;}
#screen-deck .deck-tab{flex:1;min-width:0!important;}
#screen-deck .deck-hint{flex:none;}
.ec-deck-view{display:none;}
#screen-map #trialRow{min-height:0;}
#overlay{overflow:hidden!important;}
#overlay>.modal{overflow:hidden!important;box-sizing:border-box;}
#overlay .modal-actions{flex:none;position:relative;z-index:3;gap:8px;margin-top:12px;}
#overlay .modal-actions .btn{min-height:44px;white-space:normal;}
#overlay .ec-settings-options>div{margin:8px 0!important;min-height:44px;}
#overlay .settings-modal{padding:18px 22px;}
#overlay .settings-modal h2{margin-bottom:10px;font-size:26px;}
#overlay .settings-modal .ec-ui-nav{padding:0;}
#overlay .settings-modal .modal-actions{margin-top:8px!important;}
#overlay .settings-modal input[type=range]{min-width:80px;max-width:45%!important;}
#overlay .result{width:min(94vw,760px)!important;padding:18px 22px;}
#overlay .result-big{font-size:clamp(28px,7vmin,60px);line-height:1.05;}
#overlay .result>p{margin:8px 0;font-size:16px;}
#overlay .spoils{margin:4px 0 10px;}
#overlay .spoils-sub{margin:0 0 10px;}
#overlay .spoils-cards,#overlay .nm-spoils{flex-wrap:nowrap;gap:12px;margin:8px 0;}
#overlay .spoil-card{width:min(26vw,150px);min-width:0;}
#overlay .spoil-flip{width:100%;height:auto;aspect-ratio:150/269;}
#overlay .spoil-front,#overlay .spoil-back{background-size:contain!important;background-repeat:no-repeat;}
#overlay .nm-card{width:min(26vw,130px);height:auto;aspect-ratio:150/269;background-size:contain!important;background-repeat:no-repeat;}
#overlay .spoil-name{font-size:13px;margin-top:6px;}
#preview{overflow:hidden!important;}
#preview img{object-fit:contain!important;flex-shrink:1;min-height:0;}
#preview .pv-text{overflow:hidden!important;font-size:clamp(14px,2vmin,18px);}
#preview .pv-text p{line-height:1.25;}
/* Video bounds preserve the full source frame in either orientation. */
#ellie-vid video,.summon-cine video,.vfx-video{object-fit:contain!important;aspect-ratio:auto;}
@media(orientation:landscape) and (max-height:540px){
 #overlay .result{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:4px 18px;align-items:center;padding:14px 20px;}
 #overlay .result>.celebrate{grid-area:1/1/-1/-1;}
 #overlay .result>.spoils,#overlay .result>.nm-spoils{grid-column:2;grid-row:1/span 5;margin:0;}
 #overlay .result>.modal-actions,#overlay .result>.nm-replay-wrap{grid-column:1/-1;}
 #overlay .spoil-card{width:auto;max-width:95px;flex:1;}
 #overlay .nm-card{width:auto;max-width:85px;flex:1;max-height:48vh;}
 #overlay .spoil-flip{max-height:43vh;}
 #overlay .spoils-title{font-size:16px;}
 #overlay .spoils-sub,#overlay .spoil-name{font-size:12px;}
 #overlay .result-big{font-size:32px;}
 #overlay .result>p{font-size:14px;margin:2px 0;}
 #overlay .modal-actions{flex-wrap:wrap;}
 #ellie-vid video{max-height:72%!important;max-width:70%!important;}
}
body.ec-portrait #screen-deck .deck-header{gap:10px;}
body.ec-portrait #screen-deck .deck-h-title{font-size:36px!important;width:auto;flex:1;}
body.ec-portrait #screen-deck .deck-h-title small{display:none;}
body.ec-portrait #screen-deck .deck-tabs{flex-basis:100%;padding:0;gap:8px;}
body.ec-portrait #screen-deck .deck-tab{min-height:80px!important;}
body.ec-portrait #screen-deck .dt-meta,body.ec-portrait #screen-deck .dt-live{display:none;}
body.ec-portrait #screen-deck .ec-deck-view{display:block;width:100%;}
body.ec-portrait #screen-deck .deck-main{display:flex!important;flex-direction:column;grid-template-rows:none!important;gap:0;}
body.ec-portrait #screen-deck .deck-main>section{flex:1;}
body.ec-portrait #screen-deck[data-workspace=collection] .deck-pane,body.ec-portrait #screen-deck[data-workspace=deck] .trunk-pane{display:none!important;}
body.ec-portrait #screen-deck .trunk-grid,body.ec-portrait #screen-deck .slot-grid{grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:12px!important;}
body.ec-portrait #screen-deck .deck-hint{font-size:23px;}
body.ec-portrait #screen-deck .collection-stats{max-height:110px;overflow:hidden;}
body.ec-portrait #screen-deck .filter-bar{gap:8px;padding:6px 0;}
body.ec-portrait #screen-deck .pager{padding:6px;gap:12px;}
body.ec-portrait #screen-shop .ec-shop-page>.shop-grid,body.ec-portrait #screen-shop .ec-shop-page>.pack-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;}
body.ec-portrait #screen-shop .shop-head{gap:10px;}
body.ec-portrait #screen-shop .shop-title{font-size:36px;width:auto;flex:1;}
body.ec-portrait #screen-shop .shop-bal{order:3;flex-basis:100%;}
body.ec-portrait #screen-shop #shopBack{position:static;}
body.ec-portrait #screen-map .map-head{margin-top:110px;}
body.ec-portrait #screen-map .map-titlebar{margin:12px 0;}
body.ec-portrait #screen-map .trials-body{flex:1;min-height:0;display:flex;flex-direction:column;}
body.ec-portrait #screen-map #trialRow{flex:1;height:auto;grid-template-rows:repeat(2,minmax(0,1fr));gap:20px!important;padding-bottom:10px;}
body.ec-portrait #screen-map #trialRow .trial-card{height:100%!important;max-height:390px;}
body.ec-portrait #screen-map .map-foot{min-height:40px;font-size:22px;}
body.ec-portrait #screen-login .login-panel{padding:24px;margin:0 auto;}
body.ec-portrait #screen-login .login-brand{font-size:56px;}
body.ec-portrait #screen-login .login-field{min-height:90px;padding:14px;}
body.ec-portrait #screen-login button{min-height:96px;}
body.ec-portrait #screen-login a{padding:8px 4px;}
body.ec-portrait #screen-world .wd-wrap,body.ec-portrait #screen-online .online-wrap{height:100%;overflow:hidden;padding:24px;display:flex;flex-direction:column;}
body.ec-portrait .wd-grid{flex:1;min-height:0;grid-template-rows:1fr 1fr;gap:16px;}
body.ec-portrait .wd-actions{display:grid;grid-template-columns:1fr 1fr;gap:12px;}
body.ec-portrait .wd-big{min-height:0;padding:16px;font-size:28px;}
body.ec-portrait .wd-big-ic{display:none;}
body.ec-portrait .wd-big-t{font-size:30px;}
body.ec-portrait .wd-big-d{font-size:24px;}
@media(orientation:portrait){
 #preview{gap:10px!important;}
 #preview img{max-height:54%!important;max-width:80%!important;height:auto!important;}
 #preview .pv-text{max-height:40%!important;max-width:94%!important;font-size:14px!important;}
 #preview .pv-text h3{font-size:20px!important;}
 #preview .pv-text p{font-size:14px!important;margin-top:8px!important;}
 #overlay .result .modal-actions{display:grid;grid-template-columns:1fr 1fr;}
 #ellie-vid video{max-height:54%!important;max-width:92%!important;}
}

body.ec-portrait #screen-map .map-titlebar{position:relative!important;inset:auto!important;flex:none;}
body.ec-portrait #screen-map .trials-body{position:relative!important;inset:auto!important;align-items:stretch!important;justify-content:flex-start!important;}
body.ec-portrait #screen-map #trialRow{width:100%;align-items:stretch!important;}
body.ec-portrait #screen-map .map-foot{position:relative!important;inset:auto!important;flex:none;margin-top:6px;}
body.ec-portrait .wd-friends{min-height:0;overflow:hidden;display:flex;flex-direction:column;}
.wd-fr-list{overflow:hidden!important;min-height:0;}

body.ec-portrait #screen-deck .deck-main{flex:1!important;min-height:0!important;}
body.ec-portrait #screen-deck .slot-grid,body.ec-portrait #screen-deck .trunk-grid{min-height:0!important;}

#screen-shop .ec-shop-page>#flashWrap{flex:1;display:flex;min-height:0;}
#screen-shop #flashWrap>.flash-card{flex:1;min-height:0;max-height:100%;}
#bsel-root,#rps-root{overflow:hidden!important;}
#screen-shop .shop-card button{min-height:calc(44px / var(--ec-stage-scale,1));}
#screen-deck .slot-grid+.ec-ui-nav{flex:none;}

/* Reserve a separate status lane above the portrait hand. */
body.ec-portrait #screen-duel .player-bar.you{bottom:500px;}
#screen-duel .logbox{overflow:hidden!important;scrollbar-width:none;}
body.ec-portrait #screen-shop .ec-shop-page>.pack-grid{max-height:800px;flex:0 1 800px;}
body.ec-portrait #screen-shop .ec-shop-page>.pack-grid .pack-card{justify-content:space-around;}

#overlay .bpx-scroll{overflow:hidden!important;scrollbar-width:none;min-width:0;}
#overlay .bpx-band{justify-content:center;}
#overlay .bpx>.ec-ui-nav{padding:4px 0;}
#overlay .bpx>.ec-ui-nav button{min-height:44px;}
@media(orientation:portrait){#overlay .bpx-foot{padding-top:6px!important;}#overlay .bpx-hint{font-size:11px!important;}}

@media(orientation:portrait){
 #overlay .bpx-ownwrap{width:100%;min-width:0;display:flex;gap:8px!important;}
 #overlay .bpx-ownwrap .bpx-buybtn{min-width:0!important;width:0!important;flex:1!important;max-width:100%;padding:8px!important;font-size:11px!important;white-space:normal!important;gap:4px!important;}
 #overlay .bpx-ownwrap .bpx-buybtn i{font-size:11px!important;}
}
