/* Square card previews retain their native ratio. */
#card-preview:has(canvas[data-layout="prism"]){max-width:1080px;margin-inline:auto;aspect-ratio:1}
/* Portrait cards keep a readable phone-sized width on large screens too. */
body #card-preview.is-mobile-card{width:100%;max-width:480px;margin-inline:auto;aspect-ratio:auto}
body .gallery-full-card.is-mobile-card{width:100%;max-width:480px;margin-inline:auto}
.card-art-drag-surface{position:absolute;z-index:1;touch-action:none;cursor:grab}
.card-art-drag-surface:active{cursor:grabbing}
.is-mobile-card .card-contribution-hint{max-width:calc(100% - 24px);font-size:11px;max-height:28%}
body #card-dialog.studio-mode{display:grid;grid-template-rows:minmax(0,1fr) auto;align-items:center;justify-items:center;justify-content:normal;padding:0}
body .studio-mode .studio-bar{position:static;grid-row:2;width:100%;padding-bottom:calc(9px + env(safe-area-inset-bottom))}
body .studio-mode #card-preview:has(canvas[data-layout="prism"]){width:min(100vw,calc(100dvh - 146px));aspect-ratio:1}
.admin-nav .ui-icon{width:19px;height:19px}
.art-tip-touch{display:none}

@media(max-width:760px){
 html{scroll-padding-top:124px}body{min-width:0}body main{width:100%;max-width:100%;padding:20px 14px 42px}
 body .topbar{position:sticky;top:0;display:grid;grid-template-columns:minmax(0,1fr) 36px 48px auto;gap:7px 10px;height:auto;min-height:104px;padding:10px 12px 6px;z-index:30}
 body .topbar .brand{min-width:0;gap:7px;font-size:12px;overflow:hidden}.topbar .brand-light{font-size:10px}body .topbar .brand-mark{width:25px;height:25px;flex:none}
 body .topbar .appearance-trigger{margin:0;width:36px;height:36px;min-width:36px;padding:5px;justify-content:center}.topbar .appearance-swatch{width:6px;height:6px}body .topbar .appearance-trigger [data-nav-icon]{display:inline-flex}
 body .topbar .language-label{margin:0;min-width:0;width:48px;display:flex;justify-content:center}.topbar .language-label>span{display:none}body .topbar #lang-select{font-size:12px;width:48px;padding:7px 3px;border:0}
 body .topbar .account-slot{display:flex;gap:3px;margin:0}body .topbar .account-slot .icon-nav{width:35px;min-width:35px;height:36px;margin:0}
 body .topbar nav{grid-column:1/-1;grid-row:2;display:flex;flex-wrap:nowrap;gap:3px;overflow-x:auto;overscroll-behavior-x:contain;justify-content:flex-start;align-self:stretch;width:100%;max-width:100%;padding:0 1px 3px;scrollbar-width:none;min-width:0}
 body .topbar nav .nav.icon-nav{width:41px;min-width:41px;height:40px;flex:1 0 41px;border-radius:9px}.topbar nav .ui-icon{width:19px;height:19px}
 body .page,body .hub-page,body .left-column,body .right-column{min-width:0;max-width:100%}body .page-heading{align-items:flex-start;gap:12px;flex-wrap:wrap}body .page-heading h1{font-size:28px;letter-spacing:-.8px}
 body .catalog-toolbar{padding:12px}.catalog-toolbar .search-row{display:grid;grid-template-columns:1fr 1fr;gap:8px}.catalog-toolbar .search-row>.search{grid-column:1/-1;min-width:0}.catalog-toolbar .search-row>select{width:100%;min-width:0}.catalog-toolbar .filter-row{gap:8px;flex-wrap:wrap}.filter-row .chips{max-width:100%;gap:5px;flex-wrap:wrap}.filter-row .chip{min-height:34px}
 body .character-grid{grid-template-columns:repeat(auto-fill,minmax(102px,1fr));gap:10px}.character-card .card-art{height:145px}.character-card .card-info{padding:9px}.character-card .card-info h3{font-size:12px}
 body .hub-home-top{margin:0;grid-template-columns:minmax(0,1fr);gap:10px}body .hub-hero{padding:23px 18px 16px;border-radius:17px;min-height:0;grid-template-columns:minmax(0,1fr);gap:12px}body .hub-hero h1{font-size:clamp(32px,9vw,43px);letter-spacing:-1px}body .hub-hero-copy>p{font-size:13px;line-height:1.7;margin:17px 0 20px;max-width:none}body .hub-hero-counts{gap:12px;margin-top:20px}.hub-actions .button{font-size:12px;padding:12px 15px}.hub-hero-caption{max-width:90%;right:13px;bottom:13px}body .hub-hero-picker{padding:5px}.hub-picker-list{overscroll-behavior-x:contain}body .hub-launch-grid{gap:10px}.hub-launch{min-width:0}.hub-launch p{font-size:11px}
 /* Give the portrait a definite frame. Percentage height inside an auto grid
    row previously left a small portrait anchored to the bottom-right corner. */
 body .hub-hero-visual{position:relative;inset:auto;align-self:stretch;width:100%;height:clamp(200px,55vw,280px);min-height:0;min-width:0;overflow:hidden;margin:0}
 body .hub-hero-visual .hub-hero-art{position:absolute;inset:0;width:100%;height:100%;max-width:100%;max-height:100%;margin:0;object-fit:cover;object-position:50% 22%;transform:none}
 body .hub-hero-visual::before{background:none}body .hub-hero-visual::after{height:22%}
 body .build-title-row{flex-direction:column;align-items:stretch;gap:11px}.build-name-label{display:flex;align-items:center;gap:12px}body .build-name-label input{width:100%;min-width:0}body .builder-toolbar .toolbar-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px}.toolbar-actions #autosave-status{grid-column:1/-1}.toolbar-actions #save-build{grid-column:1/-1}.toolbar-actions>.button{min-height:40px}.build-tabs{max-width:100%;overflow:auto;overscroll-behavior-x:contain}.build-tabs .build-tab{flex:none;width:41px;height:41px}
 body .toolbar-actions #export-png{grid-column:1/-1;font-weight:600}body .toolbar-actions #save-build{grid-column:auto}
 body #page-builder .card-teaser{display:block;padding:14px;background:var(--panel)}body .card-teaser .eyebrow{display:none}body .card-teaser h2{font-size:15px;margin:0 0 7px}body .card-teaser p{font-size:12px;line-height:1.6;margin-bottom:12px}body .card-teaser .button{min-height:42px}
 .art-tip-desktop{display:none}.art-tip-touch{display:inline}
 body .compact-design input:not([type=range]):not([type=checkbox]):not([type=color]):not([type=file]),body .compact-design select{font-size:16px;min-height:38px}
 body .compact-design>summary,body .design-effects>summary{padding:8px 0;min-height:34px;font-size:12px}
 body .build-layout{display:flex;flex-direction:column;gap:12px}body .left-column{position:static;width:100%;display:grid;grid-template-columns:minmax(0,1fr);gap:10px}body .right-column{width:100%;gap:12px}body .portrait-card{height:270px!important;min-height:0}.portrait-caption{padding:16px}.portrait-caption h2{font-size:25px}.skin-selector{display:flex;overflow:auto;gap:8px}.skin-button{flex:none;min-width:83px;min-height:42px}
 body .top-settings{display:flex;flex-direction:column;gap:12px}body #page-builder .character-settings,body #page-builder .weapon-panel{min-width:0;width:100%}body #page-builder .character-settings{display:block}body .chain-panel .chain-buttons{display:flex;flex-wrap:nowrap;justify-content:space-between;gap:4px}body .chain-panel .chain-button{width:42px;height:42px;min-width:0}.chain-panel .chain-button img{width:29px;height:29px}body #page-builder .panel{padding:14px;border-radius:12px}body .main-stats{grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}.main-stat strong{font-size:18px}.main-stat span{font-size:10px}body #secondary-stats{grid-template-columns:repeat(2,minmax(0,1fr))}
 body .skill-tree{grid-template-columns:repeat(5,minmax(78px,1fr));overflow-x:auto;overscroll-behavior-x:contain;padding:7px 3px 12px;gap:7px}.skill-col{min-width:0}.skill-col .skill-label{font-size:10px}.skill-counter{justify-content:center}.skill-counter button{width:25px;height:28px;flex:none}.skill-counter input{width:25px;min-width:0;padding:2px!important}
 body .echo-slots{grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}body .echo-slot{min-width:0;min-height:192px;padding:10px 8px}.echo-slot>img{width:70px;height:70px}.echo-slot b{font-size:11px}.echo-presets{display:flex;flex-wrap:wrap;gap:7px}.echo-presets>input,.echo-presets>.visual-select,.echo-presets>select{width:100%;min-width:0}.echo-presets>button{flex:1;font-size:11px;min-height:36px}.sonata-effects{min-width:0}.description{overflow-wrap:anywhere}
 body dialog:not(.studio-mode){width:calc(100vw - 16px);max-width:calc(100vw - 16px);max-height:calc(100dvh - 16px);margin:auto;padding:16px;border-radius:15px;overscroll-behavior:contain}body dialog .dialog-header{gap:12px;align-items:center}body dialog .dialog-header h2{font-size:19px}body .close-dialog,body [data-close]{width:36px;height:36px;flex:none}body .dialog-actions{gap:8px;flex-wrap:wrap}.dialog-actions>.button{flex:1;min-height:42px}
 body #picker-dialog .picker-filters{display:grid;grid-template-columns:minmax(0,1fr);gap:8px}body .picker-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;min-height:0;max-height:none}.picker-card{min-width:0;padding:10px 5px}.picker-card img{max-width:100%;width:65px;height:65px}.picker-card b{font-size:11px}body .echo-picker-tabs{width:100%}.echo-picker-tabs button{font-size:11px;min-height:38px;gap:4px}.substat-row{grid-template-columns:minmax(0,1fr) 98px;gap:7px}.visual-select{min-width:0;max-width:100%}.choice-trigger{max-width:100%;min-width:0;min-height:38px}.choice-menu{max-width:calc(100vw - 24px);max-height:45dvh}.searchable-popup{max-width:calc(100vw - 20px)}body .account-dialog{max-width:430px}.account-form input{min-height:44px}.account-form .button{min-height:44px}
 body #card-dialog:not(.studio-mode){width:calc(100vw - 12px);max-width:calc(100vw - 12px);padding:12px}.compact-design .design-primary{display:grid;grid-template-columns:1fr 1fr;gap:9px}.design-primary>.design-inline{grid-column:1/-1}.compact-design .design-primary input:not([type=checkbox]):not([type=file]){width:100%;min-width:0}.compact-design .design-primary select{flex:1;min-width:0}.compact-design .design-primary>.art-upload{justify-content:center;min-height:38px}.compact-design .effect-group{display:flex;flex-wrap:wrap;gap:9px;width:100%}.effect-group>.design-inline{flex:1;min-width:0}.effect-group .design-inline select{min-width:0;max-width:100%;flex:1}.compact-design .palette-controls{flex-wrap:wrap;gap:7px;width:100%}.palette-controls input[type=color]{width:34px;height:34px}.compact-design .design-tip{font-size:11px;line-height:1.5}body #card-preview{border-radius:9px}.card-contribution-hint{max-width:65%;font-size:10px}.compact-design .effect-rows{gap:12px}
 body .studio-mode .studio-bar{justify-content:flex-start;flex-wrap:nowrap;gap:9px;overflow-x:auto;overscroll-behavior-x:contain;min-height:67px;padding:10px 10px calc(10px + env(safe-area-inset-bottom));scrollbar-width:thin}.studio-bar>button,.studio-bar>label{flex:none}.studio-bar button,.studio-bar select{min-height:36px!important}.studio-bar [data-action=save]{position:sticky;right:0;box-shadow:-9px 0 15px #101520}.studio-bar [data-action=exit]{position:sticky;left:0;z-index:2;background:#1b2332;box-shadow:9px 0 15px #101520}body .studio-mode #card-preview{width:min(100vw,calc((100dvh - 80px)*1920/820))}body .studio-mode #card-preview:has(canvas[data-layout="the-best"]){width:min(100vw,calc((100dvh - 80px)*2520/1080))}body .studio-mode #card-preview:has(canvas[data-layout="prism"]){width:min(100vw,calc(100dvh - 80px));aspect-ratio:1}.studio-art-tools{max-width:45%;opacity:1}.studio-art-tools button{min-height:32px;font-size:10px}
 body.profile-open main{padding:17px 12px 40px}.profile-panel{min-width:0}.profile-hero .profile-identity{left:8px;gap:10px}.profile-hero .profile-identity .profile-avatar{width:100px}.profile-identity h1{font-size:24px;overflow-wrap:anywhere}.profile-tools{max-width:100%;gap:6px}.profile-tools .button{font-size:10px;padding:8px 10px}.profile-build-filters{flex-wrap:wrap}.profile-build-filters label{min-width:0;flex:1}.profile-build-filters .searchable-select{min-width:0}.profile-build-actions{flex-wrap:wrap}.profile-gallery{min-width:0}.gallery-card-footer{gap:7px;flex-wrap:wrap}.gallery-card-footer .button{font-size:10px;min-height:36px}.collection-panel{min-width:0}.collection-tabs{overflow:auto;overscroll-behavior-x:contain}
 body .ranking-grid,body .community-grid{grid-template-columns:minmax(0,1fr)}.community-toolbar{flex-wrap:wrap;gap:8px}.community-toolbar>label{min-width:0;flex:1 1 140px}.wiki-detail{min-width:0}.wiki-detail-grid{grid-template-columns:1fr}.wiki-calculator .two-fields{grid-template-columns:1fr 1fr}
 body .back-to-top{width:42px;height:42px;right:14px;bottom:calc(14px + env(safe-area-inset-bottom))}body .site-footer .footer-main{gap:25px;padding-top:28px}.site-footer .footer-bottom{flex-wrap:wrap;gap:8px}input[type=text],input[type=email],input[type=password],input[type=search],textarea{font-size:16px}body .saved-grid{grid-template-columns:minmax(0,1fr)}
}
/* Dense, readable catalogs rather than two oversized tiles on a phone. */
@media(max-width:760px){
 body #page-wiki .wiki-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
 body #page-wiki .wiki-tile{padding:9px 7px;gap:6px;border-radius:10px}
 body #page-wiki .wiki-tile>img{height:74px;max-width:100%}
 body #page-wiki .wiki-tile>strong{font-size:11px;line-height:1.35;min-height:30px;overflow-wrap:anywhere}
 body #page-wiki .wiki-tile>small{font-size:9px;line-height:1.3}
 body #page-wiki .wiki-tile-meta{font-size:8px;align-items:center;gap:3px}
 body #page-wiki .wiki-tile-meta .wiki-rarity-badge{font-size:8px;padding:2px 4px}
 body #page-wiki .wiki-heading{gap:12px;align-items:flex-start}body #page-wiki .wiki-heading h1{font-size:28px}
 body #page-wiki .wiki-tabs{gap:6px;max-width:100%;overscroll-behavior-x:contain}body #page-wiki .wiki-tabs button{padding:9px 11px;font-size:11px}
 body #page-wiki .wiki-filters{gap:8px}body #page-wiki .wiki-filters>.button{min-height:40px}

 /* Header content participates in the grid instead of overlapping the art. */
 body .profile-top-grid>.profile-hero{display:grid;grid-template-columns:clamp(88px,23vw,120px) minmax(0,1fr);grid-template-rows:minmax(100px,1fr) auto;column-gap:12px;row-gap:6px;padding:0 14px 0 0;min-height:250px;height:auto;border-radius:16px}
 body .profile-top-grid .profile-hero>.profile-cover{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;z-index:0}body .profile-top-grid .profile-hero>.profile-hero-shade{z-index:1}
 body .profile-top-grid .profile-hero>.profile-identity{display:contents}
 body .profile-top-grid .profile-hero .profile-identity .profile-avatar{grid-column:1;grid-row:1/-1;width:100%;height:100%;max-width:none;align-self:stretch;z-index:2}
 body .profile-top-grid .profile-hero .profile-identity>div:last-child{position:relative;z-index:3;grid-column:2;grid-row:1;min-width:0;max-width:100%;margin:0;padding:17px 0 5px;align-self:end}
 body .profile-top-grid .profile-identity h1{font-size:clamp(23px,4.5vw,29px);line-height:1.2;margin:6px 0;overflow-wrap:anywhere}
 body .profile-top-grid .profile-identity p{font-size:12px;line-height:1.5;margin:5px 0}
 body .profile-top-grid .profile-identity .eyebrow{font-size:9px;letter-spacing:1px;overflow-wrap:anywhere}
 body .profile-top-grid .profile-elements{display:flex;flex-wrap:wrap;gap:7px;margin-top:9px}body .profile-top-grid .profile-elements img{width:23px;height:23px;flex:none}
 body .profile-top-grid .profile-hero .profile-tools{grid-column:2;grid-row:2;position:static;inset:auto;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;width:100%;max-width:none;margin:0;padding:0 0 15px;background:transparent;border:0;align-self:start}
 body .profile-top-grid .profile-hero .profile-tools>.button{width:100%;min-width:0;min-height:38px;padding:8px 7px;font-size:11px;line-height:1.4;white-space:normal;backdrop-filter:none}
 body .profile-top-grid .profile-hero .profile-tools>.button:first-child{grid-column:1/-1}
 body .profile-top-grid .profile-hero .profile-tools:empty{display:none}body .profile-top-grid>.profile-hero:has(.profile-tools:empty){grid-template-rows:1fr;min-height:220px}body .profile-top-grid .profile-hero:has(.profile-tools:empty) .profile-identity>div:last-child{align-self:center}
 body .profile-overview{display:grid;grid-template-columns:1fr;gap:12px;min-width:0;padding:14px;margin-bottom:12px}body .profile-overview-intro{min-width:0}body .profile-overview-intro h2{font-size:18px}body .profile-overview-intro p{font-size:12px;line-height:1.6}
 body .profile-overview-metrics{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;max-width:none;width:100%}body .profile-overview-metrics>div{padding:10px 12px}body .profile-overview-metrics strong{font-size:23px}body .profile-overview-metrics span{font-size:11px;line-height:1.4}
 body .profile-panel{padding:14px;border-radius:13px}body .profile-section-heading{gap:8px;flex-wrap:wrap}body .profile-section-heading h2{font-size:16px}body .profile-section-heading>span{font-size:11px;line-height:1.5}
 body .profile-builds-row>.profile-panel{padding:14px}body .profile-builds-row .profile-build-grid{grid-template-columns:minmax(0,1fr);max-height:440px}body .profile-builds-row .profile-build-top h3{font-size:13px}body .profile-builds-row .profile-build-actions .button{min-height:36px;font-size:11px}
 body .profile-builds-row .profile-build-actions label{min-height:28px;font-size:11px}body .profile-builds-row .profile-build-actions input{width:16px;height:16px}
 body .profile-favorite-characters .profile-characters{display:flex;gap:8px;flex-wrap:wrap}body .profile-favorite-characters .profile-characters button{flex:0 0 50px;width:50px;height:50px;padding:5px}body .profile-favorite-characters .profile-characters button img{width:39px;height:39px}
 body .profile-showcase .gallery-card-footer{padding-right:0;gap:8px}body .profile-showcase .gallery-card-footer>strong{font-size:13px;overflow-wrap:anywhere}body .profile-showcase .gallery-card-footer .button{min-height:36px;font-size:11px}
 body .profile-gallery .full-build-stage>.gallery-pagination{position:static;inset:auto;display:flex;justify-content:center;width:max-content;max-width:100%;margin:8px auto 0;padding:4px 8px;gap:8px;background:var(--panel-2);backdrop-filter:none}
 body .profile-gallery .full-build-stage>.gallery-pagination button{width:36px;height:36px}
 body #card-dialog>.dialog-actions{position:sticky;bottom:-12px;z-index:6;background:var(--panel);padding:12px 0;margin-bottom:0;border-top:1px solid var(--line)}
}
@media(min-width:480px) and (max-width:760px){body #page-wiki .wiki-grid{grid-template-columns:repeat(4,minmax(0,1fr))}body .profile-overview-metrics{grid-template-columns:repeat(4,minmax(0,1fr))}}
@media(min-width:650px) and (max-width:760px){body #page-wiki .wiki-grid{grid-template-columns:repeat(5,minmax(0,1fr))}}
@media(min-width:560px) and (max-width:760px){body .profile-top-grid>.profile-hero{min-height:240px;grid-template-columns:120px minmax(0,1fr)}body .profile-top-grid .profile-hero .profile-tools{display:flex;flex-wrap:wrap}body .profile-top-grid .profile-hero .profile-tools>.button{width:auto;min-height:40px;padding:9px 12px;font-size:12px}}
@media(max-width:300px){body #page-wiki .wiki-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(hover:none) and (pointer:coarse){body .hover-hint{display:none!important}}
@media(min-width:560px) and (max-width:1100px){
 body .hub-hero{grid-template-columns:minmax(0,1.2fr) minmax(0,.8fr);gap:10px;padding:24px 18px;min-height:350px;align-items:center}
 body .hub-hero-copy{grid-column:1;grid-row:1;padding-right:0;min-width:0}body .hub-hero h1{font-size:clamp(32px,5.7vw,41px)}
 body .hub-hero-visual{position:relative;inset:auto;grid-column:2;grid-row:1;width:100%;height:clamp(290px,38vw,360px);min-height:0;align-self:center;overflow:hidden;margin:0}body .hub-hero-visual .hub-hero-art{position:absolute;inset:0;width:100%;height:100%;max-width:100%;max-height:100%;margin:0;object-fit:cover;object-position:50% 18%;transform:none}
 body .hub-hero-visual::before{background:none}body .hub-hero-visual::after{height:22%}
 body .hub-hero-copy>p{font-size:12px;margin:15px 0 17px}body .hub-actions{gap:8px}body .hub-actions .button{padding:10px 12px;font-size:11px}body .hub-hero-counts{gap:10px;flex-wrap:wrap;margin-top:17px;font-size:10px}
}
@media(max-width:360px){body .topbar{gap:7px}.topbar .brand-light{display:none}body .picker-grid{grid-template-columns:repeat(2,minmax(0,1fr))}body .main-stats{grid-template-columns:repeat(2,minmax(0,1fr))}.hub-launch-grid{grid-template-columns:1fr}.substat-row{grid-template-columns:minmax(0,1fr) 88px}.compact-design .design-primary{grid-template-columns:1fr}.design-primary>*{grid-column:1/-1}.showcase-info h1{font-size:20px}}
@media(prefers-reduced-motion:reduce){body .studio-hit,body .admin-nav{transition:none}}
