
:root{--cyan:#5de9fc;--gold:#c99c59;--bg:#111419;--ink:#f5eee0;--red:#ed666c}
*{box-sizing:border-box}
html,body{margin:0;background:#080b10;color:var(--ink);height:100%;font-family:'Hiragino Mincho ProN','Yu Mincho','Noto Serif JP',serif}
button{font:inherit;cursor:pointer;color:inherit;touch-action:manipulation}
#app{position:relative;max-width:520px;height:100dvh;margin:auto;overflow:hidden;display:flex;flex-direction:column;isolation:isolate;background:linear-gradient(180deg,#262638,#0d111a 30%,#18252b 53%,#16141b 85%)}
#app:before{content:"";position:absolute;inset:0;z-index:-2;background:url('assets/background_blur.jpg') center/100% 100% no-repeat}
#app:after{content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;background:linear-gradient(180deg,rgba(2,4,9,.04),rgba(3,6,10,.25) 42%,rgba(4,10,15,.2) 65%,rgba(0,0,0,.3))}
.zone{position:relative;min-height:0;flex-shrink:0}
.enemy-head{height:12%;overflow:hidden;border-bottom:1px solid #ac7d4a;background:linear-gradient(90deg,#171821b0,#10121cc9)}
.leader-img{position:absolute;pointer-events:none;object-fit:cover;filter:drop-shadow(0 6px 10px #000)}
.enemy-head .leader-img{height:130%;width:57%;object-position:45% 30%;left:1%;top:-15%;mask-image:linear-gradient(90deg,#000 78%,transparent)}
.head-info{position:absolute;right:2.5%;top:8%;width:55%;height:85%;display:flex;flex-direction:column;align-items:flex-end;justify-content:space-between;text-shadow:0 2px 5px #000}
.nameplate{font-size:clamp(11px,3.5vw,16px);font-weight:bold;letter-spacing:1px}
.statline{display:flex;align-items:center;gap:7px}
.hpnumber{font-size:clamp(15px,4.5vw,22px);font-weight:bold}
.bar{height:8px;background:#202932;border:1px solid #cc9c5a;width:100%;border-radius:5px;overflow:hidden;box-shadow:0 0 9px #000}
.bar>i{display:block;height:100%;background:linear-gradient(90deg,#8f1e2b,#f2655f);transition:width .4s}
.mini{font-family:system-ui,sans-serif;font-size:10px;color:#e7d5b8}
button.icon{background:#1e2028cc;border:1px solid #856b4d;border-radius:9px;padding:4px 8px;min-height:29px}
button.icon:active{background:#40545b}
.permanents{height:6%;display:flex;justify-content:center;align-items:center;gap:8px;border-bottom:1px solid #755b3b60}
.perm{width:20%;height:90%;display:flex;align-items:center;justify-content:center;background:#151c27b9;border:1px solid #7f715d;border-radius:8px;padding:0;position:relative;overflow:hidden}
.perm img{height:145%;max-width:100%;object-fit:contain}
.perm small{position:absolute;bottom:0;right:2px;background:#05080cbb;font-size:9px;padding:1px 3px}
.row{height:15.4%;display:flex;justify-content:space-around;align-items:center;gap:3px;padding:4px 6px}
.unit-slot{height:min(100%,146px);width:19.4%;position:relative;min-width:0;border-radius:8px;border:1px solid #645746;background:#0e1822c8;display:flex;flex-direction:column;overflow:visible;box-shadow:inset 0 0 0 1px #21170e}
.unit-slot:empty:after{content:'+';margin:auto;color:#947957;font-size:24px;opacity:.25}
.unit{position:relative;width:100%;height:100%;display:flex;flex-direction:column;overflow:hidden;border-radius:7px;background:#121619;border:1px solid #bb925a;box-shadow:0 3px 10px #000a;transition:transform .12s,filter .2s}
.unit .art{flex:1;min-height:0;width:100%;object-fit:cover}
.unit .label{height:18%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:clamp(8px,2.25vw,12px);background:#141822ed;text-align:center;padding:1px}
.unit .numbers{height:23%;display:flex;align-items:center;justify-content:space-evenly;font-family:system-ui,sans-serif;font-weight:900;font-size:clamp(11px,3vw,17px);background:linear-gradient(#302621,#0b1118);border-top:1px solid #a47e48}
.numbers .sword{color:#e4e7e7}
.numbers .heart{color:#fb8589}
.crystal{position:absolute;top:-5px;left:-4px;width:27px;height:32px;clip-path:polygon(50% 0%,100% 29%,86% 83%,50% 100%,12% 83%,0 29%);background:linear-gradient(130deg,#d0faff,#28a9e8 42%,#193771 65%,#8bf9ff);display:grid;place-items:center;font:900 14px system-ui,sans-serif;text-shadow:1px 2px #123;color:white;z-index:2;border:0;filter:drop-shadow(0 1px 3px cyan)}
.unit.ready{box-shadow:0 0 9px #36d7fa8a, inset 0 0 10px #9ef9f822}
.unit.exhausted{filter:grayscale(.8) brightness(.65)}
.unit.selected{outline:3px solid #fae39d;transform:translateY(-5px);z-index:4}
.unit.target{animation:targetblink .7s infinite alternate}
.unit.dead{animation:death .4s forwards}
@keyframes targetblink{to{box-shadow:0 0 18px #f74c4c}
}
@keyframes death{to{opacity:0;transform:scale(.65)}
}
.arena{height:6.4%;display:flex;align-items:center;justify-content:center;position:relative;border-top:1px solid #6ed9fa60;border-bottom:1px solid #6ed9fa60;background:linear-gradient(90deg,transparent,#16272bdb,transparent)}
.arena .sigil{font-size:clamp(14px,4.5vw,22px);letter-spacing:3px;color:#cfb17f;text-shadow:0 0 16px #58ecff}
.arena .status{position:absolute;bottom:1px;right:7px;color:#a6e8eb;font:10px system-ui,sans-serif}
.hero-perms{border-top:1px solid #705c35a0}
.hero-head{height:11.2%;display:flex;position:relative;overflow:hidden;border-top:1px solid #aa8547;background:#141821a8}
.hero-head .leader-img{height:145%;width:50%;left:-7%;bottom:-47%;object-fit:cover;object-position:50%;mask-image:linear-gradient(90deg,#000 65%,transparent)}
.hero-stats{position:absolute;right:2%;width:60%;top:8%;height:85%;display:flex;flex-direction:column;justify-content:space-around;align-items:stretch;text-shadow:0 1px 4px black}
.hptitle{display:flex;justify-content:space-between;font-size:clamp(12px,3.2vw,17px)}
.mana{display:flex;align-items:center;justify-content:flex-end;gap:2px;font:700 12px system-ui,sans-serif}
.gem{display:inline-block;width:clamp(10px,2.9vw,15px);height:clamp(14px,3.8vw,20px);clip-path:polygon(50% 0,100% 30%,85% 83%,50% 100%,15% 83%,0 30%);background:linear-gradient(130deg,#eaffff,#53eeff 37%,#096ab0 60%,#58d8ff)}
.gem.off{opacity:.25;filter:grayscale(1)}
.bottom{flex:1;min-height:0;border-top:2px solid #997444;background:#0a111bd9;display:flex;flex-direction:column}
.hand-label{height:23px;flex-shrink:0;display:flex;align-items:center;justify-content:space-between;padding:1px 8px;font:11px system-ui,sans-serif;color:#d4c6aa}
.hand-scroll{flex:1;min-height:0;display:flex;gap:7px;overflow-x:auto;overflow-y:hidden;align-items:stretch;padding:2px 10px 7px;scroll-snap-type:x proximity;scrollbar-width:none}
.hand-scroll::-webkit-scrollbar{display:none}
.handcard{height:100%;width:clamp(95px,25vw,128px);flex-shrink:0;scroll-snap-align:center;position:relative;display:flex;flex-direction:column;border:1px solid #b18c61;border-radius:7px;background:#1c1a1a;overflow:visible;padding:0;box-shadow:0 4px 7px #000a}
.handcard .art{width:100%;height:66%;object-fit:cover;border-radius:5px 5px 0 0}
.handcard .cardname{font-weight:bold;background:#201b1be8;font-size:clamp(10px,2.7vw,13px);padding:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.handcard .effect{flex:1;font:10px system-ui,sans-serif;color:#e4d5b8;text-align:left;padding:4px;overflow:hidden}
.handcard:not(.affordable){filter:grayscale(.6) brightness(.6)}
.handcard.active{outline:2px solid var(--cyan);transform:translateY(-2px)}
.handcard .crystal{top:-3px;left:-4px}
.footer{height:49px;flex-shrink:0;display:flex;align-items:center;gap:7px;padding:4px 8px;background:#0c1118e8;border-top:1px solid #72582e}
.primary{background:linear-gradient(135deg,#235568,#0b253b);border:1px solid #5bdff4;border-radius:8px;padding:9px 12px;font-weight:bold;box-shadow:0 0 10px #3bd3ee44;white-space:nowrap}
.primary:disabled{opacity:.4}
.primary.parry-glow{border-color:#ffd968;box-shadow:0 0 14px #ffcf4dcc,0 0 30px #ffcf4d55;animation:parryGlow 1.1s ease-in-out infinite}
@keyframes parryGlow{0%,100%{box-shadow:0 0 10px #ffcf4d88,0 0 22px #ffcf4d33}50%{box-shadow:0 0 18px #ffcf4dee,0 0 38px #ffcf4d77}}
@media (prefers-reduced-motion:reduce){.primary.parry-glow{animation:none;box-shadow:0 0 16px #ffcf4dcc}}
.secondary{background:#252426;border:1px solid #8e734b;border-radius:7px;padding:8px}
.footer .note{font:10px system-ui,sans-serif;color:#ddd4bb;flex:1;min-width:0}
.overlay{position:absolute;inset:0;z-index:20;background:#05070abf;display:flex;align-items:center;justify-content:center;padding:18px}
.overlay.hidden{display:none}
.dialog{width:100%;max-width:420px;border:1px solid #bda373;background:linear-gradient(150deg,#222a31,#11141e);border-radius:12px;padding:18px 16px;text-align:center;box-shadow:0 12px 45px #000}
.dialog h2{margin:3px 0 12px;font-size:21px}
.dialog p{font:13px/1.8 system-ui,sans-serif}
.actions{display:flex;flex-wrap:wrap;justify-content:center;gap:8px;margin-top:14px}
.log{position:absolute;top:46%;left:3%;right:3%;z-index:8;pointer-events:none;text-align:center}
.toast{display:inline-block;background:#0c1524e8;border:1px solid #8f805f;padding:7px 11px;border-radius:5px;box-shadow:0 3px 9px #000;font-size:12px;animation:toastfade 2.1s forwards}
@keyframes toastfade{0%{opacity:0;transform:translateY(10px)}
14%,78%{opacity:1;transform:none}
100%{opacity:0;transform:translateY(-7px)}
}
.parry-area{height:100%;display:flex;flex-direction:column;position:relative;background:linear-gradient(160deg,#24151a,#111b28)}
.parry-head{padding:5px 10px;font:700 12px system-ui,sans-serif;display:flex;justify-content:space-between;align-items:center;color:#fff0d5}
.parry-warning{color:#ffcc9c}
.parry-buttons{flex:1;display:flex;gap:4px;padding:4px 9px 8px;min-height:0}
.parry-btn{flex:1;border:1px solid #4ad0ec;border-radius:9px;background:linear-gradient(140deg,#183b51,#11283bbf);font-size:clamp(14px,4vw,20px);font-weight:bold;text-shadow:0 2px 6px #000;display:grid;place-items:center}
.parry-btn:active{background:#358ca7}
.flash{position:absolute;inset:0;pointer-events:none;z-index:50;animation:flash .4s forwards;background:#9bf6ffb8}
@keyframes flash{to{opacity:0}
}
.hide{display:none!important}
.help{font:12px/1.8 system-ui,sans-serif;text-align:left}
#fx{position:absolute;inset:0;pointer-events:none;z-index:11}
 @media(min-width:520px){#app{border-left:1px solid #7b694c;border-right:1px solid #7b694c}
}
@media(max-height:690px){.enemy-head{height:11%}
.permanents{height:5%}
.row{height:14%}
.arena{height:5%}
.hero-head{height:10%}
.hand-label{height:19px}
.footer{height:42px}
}

