/* Navegación y archivo de la demo. La arena conserva su pantalla completa. */
body:not(:has(#battle:not([hidden]))){display:grid;grid-template-columns:196px minmax(0,1fr);align-items:start;min-height:100vh;background:#09111d}
body:not(:has(#battle:not([hidden])))>header{position:sticky;top:0;height:100vh;display:flex;flex-direction:column;align-items:stretch;justify-content:flex-start;gap:26px;padding:27px 13px 16px;background:linear-gradient(180deg,#142537,#0a1421 72%);border-right:1px solid #886b3c;border-bottom:0;z-index:4}
.demo-brand{padding:0 9px}.demo-brand .eyebrow{font-size:10px;color:#d2ae6d;letter-spacing:.14em}.demo-brand h1{font:24px/1.05 Georgia;color:#f2dfb6;margin:8px 0}.demo-brand p{font-size:10px;color:#89a5b1;letter-spacing:.13em;margin:0;text-transform:uppercase}
@media(min-width:761px){body:not(:has(#battle:not([hidden])))>header,body:has(#battle:not([hidden]))>header{gap:12px;padding-top:18px}.demo-brand h1,body:has(#collection:not([hidden])) .demo-brand h1{margin:0;font:18px/1.2 Georgia;color:#f2dfb6}.demo-brand h1 span{color:#d6b777;font-size:15px}}
header .demo-nav{display:grid;gap:6px;align-content:start}.demo-nav button{display:flex;gap:11px;align-items:center;text-align:left;width:100%;padding:11px 10px;border:1px solid transparent;background:transparent;color:#a9becb;border-radius:4px;font-size:13px}.demo-nav button .nav-icon{width:21px;text-align:center;font-size:18px;color:#c2a369}.demo-nav button:hover,.demo-nav button.active{border-color:#8b713f;color:#fff2cf;background:linear-gradient(90deg,#77572e88,#192d3b99)}.demo-nav button.active .nav-icon{color:#ffe2a1}
.audio-widget{margin-top:auto;border-top:1px solid #64583f;padding:12px 7px 0}.audio-top{display:flex;gap:4px;align-items:center}.audio-toggle{padding:7px 9px;font-size:12px;background:#233545;border:1px solid #6c654c;color:#e1d3b4;white-space:nowrap}.audio-details{position:relative}.audio-details summary{cursor:pointer;list-style:none;color:#d3c49b;padding:5px}.audio-details summary::-webkit-details-marker{display:none}.audio-panel{position:absolute;bottom:calc(100% + 8px);left:0;z-index:20;width:205px;padding:14px;border:1px solid #9b7a43;background:#132332;box-shadow:0 8px 30px #000a}.audio-panel label{display:block;color:#cbd9df;font-size:12px;margin:6px 0}.audio-panel input{width:100%;accent-color:#d4a856}.audio-panel p{color:#93aab3;font-size:10px;line-height:1.35;margin:5px 0}
body:not(:has(#battle:not([hidden])))>main{grid-column:2;min-width:0;width:100%;max-width:none;padding:24px clamp(18px,3vw,48px) 50px;margin:0}
body:not(:has(#battle:not([hidden]))) main:has(#collection:not([hidden])){padding:16px 20px 22px}.collection-layout{height:calc(100vh - 145px)!important}
body:has(#battle:not([hidden])){display:block}.battle-audio{position:relative;margin-left:7px}.battle-audio .audio-widget{padding:0;border:0;margin:0}.battle-audio .audio-panel{top:calc(100% + 8px);bottom:auto;left:auto;right:0}
.library-heading{max-width:800px;margin:8px 0 25px}.library-kicker,.library-section-label{font-size:10px;font-weight:750;letter-spacing:.19em;color:#d5b475}.library-heading h2{font:clamp(30px,3vw,46px)/1.1 Georgia;margin:8px 0;color:#f4e5c4}.library-heading p{margin:0;color:#9fb4c1}.guide-layout{display:grid;grid-template-columns:minmax(155px,190px) minmax(270px,1fr) minmax(280px,360px);gap:13px;align-items:start}.guide-roster,.guide-identity,.guide-skills,.lib-group{background:#132330;border:1px solid #5e655a;padding:13px}.guide-roster{display:grid;gap:7px}.guide-hero{display:flex;align-items:center;gap:9px;min-width:0;text-align:left;padding:5px;background:#142532;border:1px solid #465665;color:#d9e5e7}.guide-hero.selected{border-color:#e0bb6b;background:#2d3b3e;box-shadow:inset 3px 0 #e2c377}.guide-hero img{width:46px;height:52px;object-fit:cover;object-position:top;border:1px solid #6993ae}.guide-hero.rarity-vespera img{border-color:#e3b856}.guide-hero.rarity-acolyte img{border-color:#5bb971}.guide-hero.rarity-raider img{border-color:#aab5b7}.guide-hero span,.lib-skill span,.state-card span,.equipment-card span{display:grid;min-width:0}.guide-hero small,.lib-skill small,.state-card small,.equipment-card small{color:#9cb2bc;font-size:11px;margin-top:3px}
.guide-identity{padding:0;overflow:hidden}.guide-image{height:260px;background-size:cover;background-position:center 28%}.guide-caption{padding:14px 20px 4px}.guide-caption span{font-size:10px;color:#e8c576;letter-spacing:.15em}.guide-caption h3{font:30px Georgia;margin:4px 0}.guide-caption p{color:#9fb6c0;margin:0}.guide-stats{padding:10px 20px 20px}.guide-stats h4{font:18px Georgia;color:#e7d3a7;margin:6px 0 12px}.guide-stats>div{display:grid;grid-template-columns:repeat(2,1fr);gap:7px 14px}.guide-stats>div span{display:flex;justify-content:space-between;padding-bottom:4px;border-bottom:1px solid #354a55}.guide-stats small{color:#a7bbc4}.guide-stats p,.guide-skills>p{font-size:11px;color:#91a8b2}.guide-skills h3{font:23px Georgia;color:#ead8b4}.guide-skills>p{margin-bottom:12px}
.lib-skill{display:flex;align-items:center;gap:10px;width:100%;padding:8px;margin-top:7px;text-align:left;background:#182e3c;border:1px solid #425867;color:#edf0ec}.lib-skill:hover,.state-card:hover,.equipment-card:hover{border-color:#d2b071;background:#223b49}.lib-skill img{width:45px;height:45px;object-fit:cover;border-radius:50%;border:1px solid #b39357}.lib-skill strong{font:15px Georgia;color:#ebdbb8}.lib-skill>b,.state-card>b,.equipment-card>b{margin-left:auto;color:#b99a64}.library-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:14px}.lib-group-head{display:flex;gap:10px;align-items:center;margin-bottom:12px}.lib-group-head img{width:51px;height:57px;object-fit:cover;object-position:top;border:1px solid #aa925d}.lib-group-head span{font-size:10px;color:#c6a96a;text-transform:uppercase;letter-spacing:.1em}.lib-group-head h3{font:21px Georgia;margin:3px 0}
.library-subheading{font:24px Georgia;color:#e8d3a8;margin:24px 0 12px}.state-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:9px}.state-card,.equipment-card{display:flex;align-items:center;gap:12px;text-align:left;padding:13px;background:#152735;border:1px solid #405563;color:#e7edef}.state-card .status-icon{width:42px;height:42px;min-width:42px;pointer-events:none}.state-card svg{width:26px;height:26px}.library-note{color:#9db1bb;font-size:12px;line-height:1.5;margin-top:20px}.library-highlight{color:#89df9a;font-weight:650}
.equipment-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:10px}.equipment-card{padding:8px}.equipment-art{display:block!important;width:65px;height:65px;flex:0 0 65px;background-image:url('assets/ligero/equipo.webp');background-size:var(--gear-width) var(--gear-height);background-position:var(--gear-x) var(--gear-y);border:1px solid #697986}.set-note{display:flex;gap:14px;margin-top:20px;padding:18px;border:1px solid #71623f;background:#1a2832}.set-note>span{color:#e5c276;font-size:26px}.set-note h3{font:21px Georgia;margin:0;color:#e4d4b4}.set-note p{margin:5px 0 0;color:#afbec3;font-size:13px}
@media(max-width:1050px){.guide-layout{grid-template-columns:150px minmax(230px,1fr)}.guide-skills{grid-column:2}.guide-image{height:240px}}
@media(max-width:760px){body:not(:has(#battle:not([hidden]))){display:block}body:not(:has(#battle:not([hidden])))>header{position:relative;height:auto;gap:12px;padding:12px 14px;border-right:0;border-bottom:1px solid #886b3c}.demo-brand{display:flex;justify-content:space-between;align-items:center;gap:8px}.demo-brand h1{font-size:20px;margin:0}.demo-brand p{display:none}.demo-nav{grid-template-columns:repeat(3,minmax(0,1fr))}.demo-nav button{padding:8px 5px;gap:4px;font-size:11px;justify-content:center}.demo-nav button .nav-icon{font-size:14px}.audio-widget{margin-top:0;padding:8px 0 0}.audio-panel{bottom:auto;top:100%}body:not(:has(#battle:not([hidden])))>main{padding:18px 12px 35px}.collection-layout{height:auto!important}.guide-layout{grid-template-columns:1fr}.guide-roster{display:flex;overflow-x:auto}.guide-roster .library-section-label{display:none}.guide-hero{min-width:135px}.guide-skills{grid-column:auto}.guide-image{height:230px}.state-grid,.equipment-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.state-card{padding:8px}.state-card .status-icon{width:35px;height:35px;min-width:35px}.equipment-card{padding:6px}.equipment-art{width:48px;height:48px;flex-basis:48px}}

/* Turno centrado, separado de los controles y de los campeones. */
.battle-heading{position:absolute;top:6px;left:50%;transform:translateX(-50%);text-align:center;min-width:130px;max-width:38%;pointer-events:none}.battle-heading .battle-kicker{display:none}.battle-actions{margin-left:auto}@media(max-width:760px){.battle-heading{top:5px;left:50%;max-width:32%;min-width:0}.battle-heading h2{font-size:13px}}

.site-footer{padding:14px 16px;text-align:center;color:#a9b9bd;font-size:12px;letter-spacing:.04em;background:#09111d;border-top:1px solid #715b373d}
.site-footer span{color:#c5a366;margin:0 7px}

/* El menú también permanece disponible durante el combate. */
@media(min-width:761px){
 body:has(#battle:not([hidden])){display:grid;grid-template-columns:196px minmax(0,1fr);align-items:start}
 body:has(#battle:not([hidden]))>header{display:flex;position:sticky;top:0;height:100vh;flex-direction:column;align-items:stretch;justify-content:flex-start;gap:26px;padding:27px 13px 16px;background:linear-gradient(180deg,#142537,#0a1421 72%);border-right:1px solid #886b3c;border-bottom:0;z-index:8}
 body:has(#battle:not([hidden]))>main{grid-column:2;min-width:0;width:100%;margin:0}
 body:has(#battle:not([hidden]))>header{gap:12px;padding-top:18px}
 body>header .demo-nav{min-height:0;overflow-y:auto;scrollbar-width:thin;scrollbar-color:#8d754e transparent}
}
.options-page{max-width:720px}.options-page h2{margin:8px 0;color:#f4e5c4}.options-card{max-width:480px;margin-top:25px;padding:24px;border:1px solid #796640;background:#132330}.options-card h3{margin:0 0 18px;color:#ead8b4}.options-card label{display:block;margin-top:20px;color:#d8e1df}.options-card input[type=range]{display:block;width:100%;margin-top:10px;accent-color:#d4a856}
.menu-settings{display:flex;align-items:center;gap:5px;flex-shrink:0}.menu-settings .audio-toggle,.menu-options{flex:1;min-width:0;padding:8px 5px;text-align:center;font-size:12px;white-space:nowrap}.menu-options{color:#e1d3b4;background:#233545;border:1px solid #6c654c}.menu-options.active{color:#fff2cf;border-color:#8b713f;background:#564629}
.frame-controls{display:flex;align-items:center;flex-wrap:wrap;gap:6px;margin-top:12px}.frame-controls button{padding:6px 9px;font-size:12px}.frame-controls span{min-width:95px;text-align:center;color:#b9cbd1;font-size:11px}
dialog#battle-options-dialog{width:min(440px,90vw);padding:0;border:1px solid #ad8950;background:#132330;color:#e9e3d2}dialog#battle-options-dialog::backdrop{background:#050b14b8}#battle-options-dialog .options-card{margin:0;border:0}#battle-options-dialog h2{font-size:25px;color:#f4e5c4}#battle-options-close{margin-top:20px}
@media(max-width:760px){
 body>header,body:has(#battle:not([hidden]))>header,body:not(:has(#battle:not([hidden])))>header{display:flex;position:sticky;top:0;z-index:20;height:auto;gap:4px;padding:6px 8px;background:#101f2eeF;border-bottom:1px solid #886b3c}
 body>header .demo-brand,body>header>.audio-widget{display:none}
 body>header .demo-nav{display:flex;flex-wrap:nowrap;gap:3px;overflow-x:auto;width:100%;scrollbar-width:thin}
 body>header .demo-nav button{width:auto;flex:0 0 auto;white-space:nowrap;padding:8px;font-size:11px}
 body>header .demo-nav button[data-page=options]{position:sticky;right:0;z-index:1;background:#263747;border-color:#8b713f;box-shadow:-5px 0 12px #101f2e}
 body:has(#battle:not([hidden])){display:block}
 .battle-screen{height:calc(100dvh - 43px)}
}
@media(max-width:760px){
 body>header,body:has(#battle:not([hidden]))>header,body:not(:has(#battle:not([hidden])))>header{flex-direction:row;align-items:center}
 body>header>.menu-settings{display:flex;flex:0 0 auto;margin:0;padding:0 0 0 6px;border:0;border-left:1px solid #64583f}
 body>header .demo-nav{flex:1 1 auto;min-width:0;width:auto}
 .menu-settings .audio-toggle,.menu-options{font-size:11px;padding:7px 6px}
}

/* El combate ocupa toda la pantalla; sus propios controles abren opciones. */
body:has(#battle:not([hidden])){display:block}
body:has(#battle:not([hidden]))>header{display:none}
body:has(#battle:not([hidden]))>main{width:100%;min-width:0;margin:0}
body:has(#battle:not([hidden])) .battle-screen{height:100dvh}

.hero-loading{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);padding:10px 14px;background:#0b1929dc;border:1px solid #aa8c5a;color:#f2e2bd;z-index:2;pointer-events:none}.hero-loading[hidden]{display:none}
.ability-edit-list{display:flex;flex-wrap:wrap;gap:.35rem;margin-top:.8rem;padding-top:.7rem;border-top:1px solid #d6b66c55}
.ability-edit-list button{font-size:.78rem;padding:.42rem .65rem;background:#10283d;color:#d7d1b8;border:1px solid #967b46;border-radius:.3rem;cursor:pointer}
.ability-edit-list button:hover,.ability-edit-list button:focus-visible{color:#fff;border-color:#75d8e7}
#edit-ability-form input{box-sizing:border-box;padding:.5rem;background:#101d2e;color:#f5ecd7;border:1px solid #698292;border-radius:.25rem}
#edit-ability-error{color:#ffb1a1}
.edit-status{font-size:.76rem;margin:.35rem 0 .7rem;padding:.35rem .6rem;background:#10283d;color:#d7d1b8;border:1px solid #967b46;border-radius:.3rem;cursor:pointer}
.edit-status:hover,.edit-status:focus-visible{color:#fff;border-color:#75d8e7}
#edit-status-form input{box-sizing:border-box;padding:.5rem;background:#101d2e;color:#f5ecd7;border:1px solid #698292;border-radius:.25rem}
#edit-status-error{color:#ffb1a1}
.backup-page{max-width:960px;margin:0 auto;padding:2rem 1rem 4rem}.backup-page>p{color:#c5ccce;line-height:1.6}.backup-card{margin:1.5rem 0;padding:1.4rem;border:1px solid #8b774a;border-radius:8px;background:#101f30}.backup-card h3{margin:0 0 .6rem;color:#f1ddb0}.backup-card p{line-height:1.5;color:#cbd1cf}.backup-card label{display:block;margin:1rem 0}.backup-card input{display:block;margin-top:.6rem;max-width:100%}.backup-card button:not(.primary){padding:.65rem 1rem;border:1px solid #b5985e;background:#18384a;color:#f4e5bc;cursor:pointer}.backup-card button:disabled{opacity:.5;cursor:not-allowed}#backup-message{color:#ffe098}

.library-card-row{position:relative;min-width:0}.library-card-row .lib-skill,.library-card-row .state-card{width:100%;padding-right:52px}.card-edit{position:absolute;right:5px;top:50%;transform:translateY(-50%);display:grid;place-items:center;width:40px;height:40px;padding:9px;background:transparent;border:1px solid transparent;border-radius:4px;color:#d9bd80;cursor:pointer}.card-edit:hover,.card-edit:focus-visible{border-color:#d2b071;background:#304653;color:#fff}.card-edit svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}

.state-grid{grid-template-columns:repeat(auto-fit,minmax(235px,1fr))}.library-card-row .state-card>b,.library-card-row .lib-skill>b{flex-shrink:0}@media(max-width:600px){.state-grid{grid-template-columns:1fr}}
.audio-details .audio-panel,.battle-audio .audio-panel{position:fixed;inset:auto;box-sizing:border-box;max-width:calc(100vw - 20px);max-height:calc(100vh - 20px);overflow:auto;z-index:10000}


.prototype-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:14px}.prototype-card{display:flex;gap:14px;background:#132330;border:1px solid #5e655a;padding:14px;min-width:0}.prototype-card img{width:84px;height:105px;object-fit:cover;object-position:top;border:1px solid #987f55;flex:none}.prototype-mino{border-color:#9ec8df}.prototype-mino img{border-color:#c5edff}.prototype-rarity{font-size:10px;letter-spacing:.1em;color:#dabd80}.prototype-card h3{font:23px Georgia;color:#f0dfbe;margin:6px 0}.prototype-card p{font-size:13px;line-height:1.45;color:#b7c8d0}.prototype-card a,.prototype-card button{display:inline-block;color:#f5d596;background:none;border:0;padding:0;font:inherit;font-size:13px;text-decoration:none;cursor:pointer}.prototype-card a:hover,.prototype-card button:hover{text-decoration:underline}

#view-loading-dialog{width:min(440px,90vw);box-sizing:border-box;padding:0;border:1px solid #ad8950;background:#132330;color:#e9e3d2}
#view-loading-dialog::backdrop{background:#09131fa8}
#view-loading-dialog progress{width:100%;accent-color:#c4a15d}
main>section[data-view-pending]:not(#collection) img,
#collection[data-view-pending] .ability-icon{visibility:hidden}

@media(min-width:761px){
 body:not(:has(#battle:not([hidden]), #battle-loading:not([hidden]))){grid-template-rows:minmax(0,1fr) auto}
 body:not(:has(#battle:not([hidden]), #battle-loading:not([hidden])))>header{grid-row:1 / 3}
 body:not(:has(#battle:not([hidden]), #battle-loading:not([hidden])))>.site-footer{grid-column:2;grid-row:2}
}
@media(max-width:760px){
 body:not(:has(#battle:not([hidden]), #battle-loading:not([hidden]))){display:flex;flex-direction:column;min-height:100dvh}
 body:not(:has(#battle:not([hidden]), #battle-loading:not([hidden])))>main{flex:1 0 auto}
}
body:has(#battle-loading:not([hidden])){display:block}
body:has(#battle-loading:not([hidden]))>header{display:none}
body:has(#battle-loading:not([hidden]))>main{margin:0;padding:0;max-width:none}
#battle-loading{
 position:relative;isolation:isolate;display:grid;align-items:end;min-height:calc(100dvh - 45px);
 background:radial-gradient(ellipse at 50% 26%,#33203b,#0a0d1b 66%);
}
#battle-loading[hidden]{display:none}
.battle-loading-art{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:center 37%;z-index:-2}
#battle-loading::before{
 content:"";position:absolute;inset:0;z-index:-1;
 background:linear-gradient(180deg,transparent 36%,#0a0d1b70 57%,#0a0d1b 94%);
}
.battle-loading-content{
 width:min(720px,100%);margin-inline:auto;padding:clamp(20px,4vh,42px) clamp(20px,5vw,46px);text-align:center;
}
.battle-loading-content h2{margin:0 0 13px;color:#f7dfaa;font:clamp(25px,4vw,42px)/1.1 Georgia,serif;text-shadow:0 2px 18px #06070f}
.battle-loading-meter{display:flex;align-items:baseline;justify-content:space-between;gap:12px;color:#e9d8b7;font-size:clamp(11px,2.5vw,13px);text-align:start}
.battle-loading-meter p{margin:0 0 7px}
.battle-loading-meter span{font-variant-numeric:tabular-nums;white-space:nowrap}
.battle-loading-content progress{display:block;width:100%;height:8px;border:0;border-radius:10px;overflow:hidden;background:#322c39;color:#dfb363;accent-color:#dfb363}
.battle-loading-content progress::-webkit-progress-bar{background:#322c39}
.battle-loading-content progress::-webkit-progress-value{background:linear-gradient(90deg,#ac7940,#f2d38c);transition:width .18s ease}
.battle-loading-content progress::-moz-progress-bar{background:linear-gradient(90deg,#ac7940,#f2d38c)}
.battle-tip{min-height:3.5em;margin:14px 0 8px;color:#dadddf;line-height:1.45;font-size:clamp(12px,2.5vw,14px)}
.battle-tip strong{color:#e7c381}
.battle-tip strong::after{content:" · "}
#cancel-battle-loading{padding:6px 12px;background:#111722a8;border:1px solid #887048;color:#ead9b4;font-size:12px}
@media(max-aspect-ratio:1/1){
 .battle-loading-art{top:8dvh;height:60%;object-fit:contain;object-position:center}
 #battle-loading::before{background:linear-gradient(180deg,transparent 39%,#0a0d1b 77%)}
}
@media(prefers-reduced-motion:reduce){.battle-loading-content progress::-webkit-progress-value{transition:none}}
