:root{color-scheme:dark;--bg:#0b121c;--panel:#131e2c;--line:#293748;--muted:#9aaabd;--gold:#e7c378;--blue:#6bbdff;--red:#ff8c91}*{box-sizing:border-box}body{margin:0;background:radial-gradient(ellipse at 30% 0,#1b2c40,transparent 65%),var(--bg);color:#f0f4fa;font:16px/1.6 system-ui,sans-serif}main{max-width:1220px;margin:auto;padding:24px 32px}header,.topline,.board-head{display:flex;align-items:center;justify-content:space-between;gap:12px}header{padding-bottom:22px;border-bottom:1px solid var(--line)}.brand{font-family:Georgia,serif;font-size:32px;letter-spacing:.15em;color:var(--gold)}.brand span{display:inline-block;font:12px system-ui;letter-spacing:.18em;color:var(--muted);margin-left:16px}.topline{margin:24px 0}.eyebrow{font-size:12px;letter-spacing:.16em;color:var(--gold)}h1{font-size:26px;margin:4px 0;font-weight:600}h2{font-size:15px;margin:0 0 14px}button,select{font:inherit}button{cursor:pointer;border:1px solid transparent;border-radius:7px;padding:10px 15px;background:var(--gold);color:#182030;font-weight:650;touch-action:manipulation}button:hover:not(:disabled){filter:brightness(1.13)}button:focus-visible{outline:3px solid white;outline-offset:3px}button:disabled{opacity:.4;cursor:default}.quiet{background:transparent;border-color:var(--line);color:#c9d4e2;font-size:14px}.workspace{display:grid;grid-template-columns:minmax(0,1fr) 330px;gap:26px}.arena{border:1px solid var(--line);border-radius:12px;background:#0d1723;padding:20px}.board-head{margin:0 0 10px;font-size:14px}.board-head strong{letter-spacing:.04em;font-size:16px}.p0{color:var(--blue)}.p1{color:var(--red)}.board-meta{color:var(--muted);font-size:13px}.board.active .board-head strong:before{content:'● ';font-size:10px}.rows{display:flex;flex-direction:column;gap:8px}.row{display:grid;grid-template-columns:30px repeat(3,minmax(0,1fr));gap:8px}.row-label{font-size:12px;color:var(--muted);display:flex;align-items:center;line-height:1.4}.cell{min-width:0;min-height:87px;padding:9px;background:#142130;border:1px solid #304052;color:#eaf1fc;border-radius:8px;text-align:left;position:relative}.cell.empty{background:#0f1a27;border:1px dashed #2b394a;display:flex;align-items:center;justify-content:center;color:#526277;font-size:13px}.cell.legal{border-color:var(--gold);box-shadow:inset 0 0 0 1px #e7c37833}.cell.selected{background:#314153;border-color:var(--gold)}.cell.blocked{opacity:.6}.cell .name{font-size:15px;font-weight:650;display:block}.cell .hp{font-size:13px;display:block;font-variant-numeric:tabular-nums;margin-top:4px;color:#c2cfde}.hpbar{height:3px;background:#344153;margin-top:6px;overflow:hidden;border-radius:4px}.hpbar i{height:100%;display:block;background:var(--blue)}.owner1 .hpbar i{background:var(--red)}.tag{font-size:11px;float:right;color:var(--muted)}.divider{display:flex;align-items:center;gap:14px;margin:16px 0;color:var(--muted);font-size:11px;letter-spacing:.2em}.divider:before,.divider:after{content:'';height:1px;flex:1;background:var(--line)}aside{display:flex;flex-direction:column;gap:16px}.panel{padding:20px;background:var(--panel);border:1px solid var(--line);border-radius:10px}#status{font-size:14px;color:var(--gold)}.hand-wrap{display:flex;gap:18px;align-items:center;margin:18px 0}.playing-card{width:86px;height:112px;flex-shrink:0;border-radius:8px;background:#f4efdf;color:#172333;padding:7px 12px;font:bold 42px Georgia;box-shadow:4px 5px 0 #0003;display:flex;flex-direction:column;justify-content:space-between}.playing-card.red{color:#be353e}.playing-card small{font:12px system-ui;align-self:flex-end}.hand-info strong{display:block;font-size:20px}.hand-info small{color:var(--muted);font-size:13px}#instruction{font-size:15px;min-height:48px;margin:12px 0}#actions{display:flex;flex-wrap:wrap;gap:8px}#actions button{flex:1;white-space:nowrap}#roster{display:grid;gap:10px}.roster-item{border-top:1px solid var(--line);padding-top:10px}.roster-item:first-child{border-top:0;padding:0}.roster-title{display:flex;justify-content:space-between;align-items:center;gap:8px}.roster-item p{color:var(--muted);font-size:13px;margin:5px 0}.roster-item button{padding:6px 10px;font-size:13px}.history{flex:1}#log{padding:0;margin:0;list-style:none;max-height:180px;overflow:auto;font-size:13px;color:var(--muted)}#log li{padding:6px 0;border-bottom:1px solid #273444}footer{color:var(--muted);font-size:12px;margin:20px 0}dialog{background:var(--panel);color:#eaf1fc;border:1px solid var(--line);border-radius:12px;padding:28px;max-width:600px;width:calc(100% - 32px);max-height:85vh}dialog::backdrop{background:#020711cc}dialog p{color:#c2cfde;font-size:14px}dialog h2{color:var(--gold);font-size:18px;margin-top:16px}.score{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin:16px 0}.score div{background:#0b1521;padding:12px;border-radius:8px}.score strong{display:block}.notice{color:var(--muted);font-size:13px}.pick{width:100%;text-align:left;background:#1b2b3e;color:#eaf1fc;border:1px solid #3a4b61;margin:5px 0}.pick.chosen{border-color:var(--gold);color:var(--gold)}@media(max-width:760px){main{padding:16px 12px}.workspace{grid-template-columns:1fr;gap:14px}.arena{padding:12px}.brand{font-size:26px}.brand span{display:none}h1{font-size:21px}.topline{margin:18px 0}.cell{min-height:76px;padding:7px}.cell .name{font-size:14px}.row{grid-template-columns:22px repeat(3,minmax(0,1fr));gap:6px}.rows{gap:6px}aside{display:grid;grid-template-columns:1fr}.control{grid-row:1}.workspace{display:flex;flex-direction:column}.arena{order:1}aside{display:contents}.control{order:0}.panel:not(.control){order:2}.history{order:3}#hand{float:left;margin-right:18px}.hand-wrap{margin:10px 0}.playing-card{width:64px;height:84px;font-size:30px}.hand-info{display:none}#instruction{min-height:45px}.control{padding:14px;min-height:158px}#actions{clear:both}.tag{display:none}.panel{padding:16px}}

.board-hint{position:sticky;bottom:10px;background:#25364a;border:1px solid var(--gold);border-radius:8px;padding:10px 12px;margin-top:14px;font-size:14px;z-index:2;box-shadow:0 3px 15px #0006}.board-hint[hidden]{display:none}.tap-label{display:block;color:var(--gold);font-size:12px;line-height:1.4;margin-bottom:3px}.cell.selected{box-shadow:inset 0 0 0 2px var(--gold)}.ult-description{color:var(--gold)!important}

.damage-pop{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;flex-direction:column;background:#330a16e8;border:2px solid #ff929a;border-radius:7px;color:#fff0ee;font-size:38px;font-weight:850;text-shadow:0 2px 8px #000;z-index:3;pointer-events:none;animation:damage-show 1.2s ease-out both}.damage-pop small{font-size:14px;color:#ffc2c6}.turn-overlay{position:fixed;inset:0;z-index:1000;background:#08111af5;display:grid;place-items:center;text-align:center;padding:24px;animation:turn-show .25s ease-out}.turn-overlay[hidden]{display:none}.turn-overlay span{display:block;letter-spacing:.3em;font-size:14px}.turn-overlay strong{display:block;font-size:clamp(36px,8vw,76px);margin:16px 0;line-height:1.3}.turn-overlay p{color:#b7c7da;font-size:18px}.turn-overlay>div{border-top:1px solid currentColor;border-bottom:1px solid currentColor;padding:32px 16px;width:min(640px,100%)}@keyframes damage-show{0%{opacity:0;transform:scale(.8)}18%{opacity:1;transform:scale(1.08)}35%,100%{opacity:1;transform:scale(1)}}@keyframes turn-show{from{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){.damage-pop,.turn-overlay{animation:none}}

.cell .name{white-space:normal;line-height:1.2}.card-sub{display:block;font-size:12px;color:var(--muted)}.effect-tag{position:absolute;right:4px;bottom:4px;font-size:11px;color:#ffda99}.owner0 .cell:not(.empty){border-left:3px solid var(--blue)}.owner1 .cell:not(.empty){border-left:3px solid var(--red)}.roster-item .skill-on{border-color:var(--gold);color:var(--gold)}

.setup-character{padding:8px 10px 12px;border:1px solid var(--line);border-radius:9px;background:#101b2a}.setup-character.chosen{border-color:var(--gold)}.setup-character .pick{margin:0;width:100%}.setup-character-detail p{margin:8px 2px 0;color:#c9d4e2;font-size:14px;line-height:1.5}.setup-character-detail strong{color:var(--gold)}.skill-cut-in{background:radial-gradient(circle at 50% 45%,#614825,#151020 70%);color:var(--gold)}.skill-cut-in strong{font-family:Georgia,'Noto Serif JP',serif;text-shadow:0 4px 20px #000;font-size:clamp(36px,9vw,80px)}.skill-cut-in>div{animation:skill-sweep .55s ease-out both}@keyframes skill-sweep{from{opacity:0;transform:translateX(-35px) scale(.9)}to{opacity:1;transform:none}}@media(prefers-reduced-motion:reduce){.skill-cut-in>div{animation:none}}

.setup-character{display:grid;grid-template-columns:78px minmax(0,1fr);gap:7px 13px;align-items:center}.setup-character .pick{grid-column:1/-1}.setup-art{width:78px;height:88px;object-fit:contain;grid-column:1}.setup-character-detail{grid-column:2}.setup-character:not(:has(.setup-art)) .setup-character-detail{grid-column:1/-1}.setup-character-detail p:first-child{margin-top:0}.unit-art{position:absolute;right:3px;top:16px;width:62%;height:68%;object-fit:contain;opacity:.75;pointer-events:none}.cell .name,.cell .hp,.cell .hpbar,.cell .tag,.cell .tap-label{position:relative;z-index:1;text-shadow:0 1px 5px #07101a,0 1px 2px #07101a}.cell .name{max-width:80%;font-size:14px}.cell .hp{font-weight:700}.roster-art{float:right;width:64px;height:72px;object-fit:contain;margin:0 0 4px 6px}.roster-item{min-height:82px}.upcoming{border-top:1px solid var(--line);padding-top:14px;margin-top:6px}.upcoming h3{font-size:14px;color:var(--gold);font-weight:600;margin:0 0 8px}.upcoming-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.upcoming-grid>div{display:flex;align-items:center;gap:6px;border:1px solid var(--line);border-radius:8px;padding:5px;color:var(--muted);font-size:13px}.upcoming-grid img{width:48px;height:54px;object-fit:contain}@media(max-width:760px){.unit-art{width:70%;height:65%;top:17px}.cell .name{font-size:12px;max-width:100%}.setup-character{grid-template-columns:72px minmax(0,1fr)}.setup-art{width:72px;height:80px}}

.cell.bomb{border-color:#ffae5b;box-shadow:inset 0 0 0 2px #ff9a4a70}.cell.bomb .tag{color:#ffd89c}.soul-actions{clear:both;border:1px solid #59466c;background:#251c31;border-radius:8px;padding:8px;margin-top:10px;display:flex;gap:7px;flex-wrap:wrap}.soul-label{width:100%;font-size:14px;font-weight:700;color:#deb9f5}.soul-actions button{font-size:13px;border-color:#795e8f;color:#ecd5ff}
.mode-select{display:flex;gap:8px;flex-wrap:wrap;margin:0 0 12px}.mode-select button{flex:1;min-width:100px;font-size:14px;padding:8px}.mode-select .chosen{box-shadow:inset 0 0 0 2px #fff4}
.online-panel{border:1px solid #365575;border-radius:9px;background:#142638;padding:12px;margin:0 0 14px}.online-panel[hidden]{display:none}.online-panel p{margin:5px 0 10px;color:#d5e3f4;font-size:14px}.online-panel button{font-size:14px;padding:8px 11px}.join-row{display:flex;gap:8px;margin-top:10px}.join-row input{width:100%;min-width:0;background:#0b1724;border:1px solid #53718f;border-radius:7px;color:#fff;padding:8px 10px;font:inherit;text-transform:uppercase}.room-code{color:var(--gold);font-weight:800;letter-spacing:.12em;margin-bottom:9px}.online-panel .online-error{color:#ffaaa9}.online-panel .online-status{margin:10px 0 0}

.cell .morale-tag{right:auto;left:5px;color:#f5d07b;background:#283454d9;border-radius:4px;padding:1px 4px}
.morale-status{display:inline-block;margin-top:5px;color:#f5d07b;font-size:13px;font-weight:700}

.playing-card.joker{background:linear-gradient(145deg,#ffe2a0,#d8ae70);color:#34203f;font-size:42px}.playing-card.joker small{font-weight:800;letter-spacing:.08em}

.skill-cut-in{overflow:hidden;background:radial-gradient(ellipse at 70% 45%,#574321,#0d1724 68%);isolation:isolate}.skill-cut-in:before,.skill-cut-in:after{content:'';position:absolute;inset:auto -30vw;width:160vw;height:3px;background:linear-gradient(90deg,transparent,#ffe4a0,transparent);box-shadow:0 0 22px #ffc354a8;transform:rotate(-16deg);animation:cutin-streak .65s ease-out both;z-index:-1}.skill-cut-in:before{top:27%}.skill-cut-in:after{bottom:22%;animation-delay:.12s}.skill-cut-in>.cutin-stage{position:relative;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);align-items:center;gap:0;width:min(850px,100%);min-height:min(370px,55vh);border:0;border-top:2px solid #f4cc78;border-bottom:2px solid #f4cc78;padding:12px 20px;text-align:left;animation:cutin-stage .35s ease-out both}.cutin-light{position:absolute;inset:0;background:linear-gradient(105deg,#a36c2528,transparent 55%,#e4a73b20);pointer-events:none}.cutin-art{grid-column:1;grid-row:1;width:100%;height:min(340px,48vh);object-fit:contain;filter:drop-shadow(0 14px 14px #000c) drop-shadow(0 0 24px #f6b84970);animation:cutin-hero .72s cubic-bezier(.17,.75,.27,1.2) both}.cutin-copy{position:relative;grid-column:2;grid-row:1;z-index:1;animation:cutin-title .6s .15s ease-out both}.cutin-copy span{color:#fff0bd;font-weight:800;text-shadow:0 0 14px #f6b849;letter-spacing:.24em}.cutin-copy strong{font-size:clamp(36px,7vw,76px);line-height:1.15;white-space:normal}.cutin-copy p{color:#f8dfaa;font-weight:700;letter-spacing:.12em;margin:0}.skill-cut-in.p1{background:radial-gradient(ellipse at 70% 45%,#6a3038,#111b2b 68%)}.skill-cut-in.p1>.cutin-stage{border-color:#ff9da4}.skill-cut-in.p1 .cutin-art{filter:drop-shadow(0 14px 14px #000c) drop-shadow(0 0 24px #ff777c80)}@keyframes cutin-stage{from{opacity:0;transform:skewX(-7deg) scale(1.05)}to{opacity:1;transform:none}}@keyframes cutin-hero{from{opacity:0;transform:translateX(-55%) rotate(-10deg) scale(1.25)}to{opacity:1;transform:none}}@keyframes cutin-title{from{opacity:0;transform:translateX(60px)}to{opacity:1;transform:none}}@keyframes cutin-streak{from{opacity:0;translate:-65vw 0}30%{opacity:1}to{opacity:.4;translate:65vw 0}}@media(max-width:600px){.skill-cut-in>.cutin-stage{grid-template-columns:44% 56%;min-height:245px;padding:10px 8px}.cutin-art{height:215px}.cutin-copy strong{font-size:clamp(30px,8vw,48px)}.cutin-copy span{font-size:11px;letter-spacing:.1em}.cutin-copy p{font-size:13px;letter-spacing:0}}@media(prefers-reduced-motion:reduce){.skill-cut-in:before,.skill-cut-in:after,.skill-cut-in>.cutin-stage,.cutin-art,.cutin-copy{animation:none}}
.match-row{display:flex;align-items:center;gap:6px;flex-wrap:wrap;border-top:1px solid #365575;padding:8px 0;font-size:13px}.match-row span{flex:1;min-width:120px}.match-row button{padding:5px 8px}.online-panel .matches-title{font-weight:700;color:#f0d28c;margin-top:16px}
.heal-pop{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;z-index:5;pointer-events:none;border:2px solid #82e4af;border-radius:7px;background:#0b392dcc;color:#f0fff5;font-size:clamp(17px,3vw,28px);font-weight:850;text-shadow:0 2px 8px #052317;animation:heal-rise 2.5s ease-out both}@keyframes heal-rise{0%{opacity:0;transform:translateY(16px) scale(.85)}12%,58%{opacity:1;transform:translateY(0) scale(1)}100%{opacity:0;transform:translateY(-18px)}}@media(prefers-reduced-motion:reduce){.heal-pop{animation:none}}

.drink-art{width:38px;height:44px;object-fit:contain;display:block;filter:drop-shadow(0 2px 7px #178bff75)}.drink-label{display:block;color:#95d7ff;font-size:12px;font-weight:700}.cell.empty:has(.drink-art){border-color:#3189bd;background:#102b43}.cell.empty:has(.drink-art).legal{border-color:var(--gold)}.cell .dash-tag{right:auto;left:5px;color:#9cdeff}.cell .guard-tag{color:#fbd69b}

.ultimate-cut-in,.ultimate-cut-in.p1{background:radial-gradient(circle at 50% 50%,#4d1e6b,#12132a 62%,#050a14 100%);color:#f7d8ff}.ultimate-cut-in:before,.ultimate-cut-in:after{height:8px;top:50%;background:linear-gradient(90deg,transparent,#f871e8,#87cfff,transparent);box-shadow:0 0 45px #da70ff;transform:rotate(25deg)}.ultimate-cut-in:after{top:70%;transform:rotate(-25deg)}.ultimate-cut-in>.cutin-stage,.ultimate-cut-in.p1>.cutin-stage{border:0;border-left:5px solid #f5a6ff;border-right:5px solid #8dd7ff;background:linear-gradient(125deg,#321251cc,#0e2146aa);box-shadow:0 0 80px #c458fc66, inset 0 0 55px #932ef53b;animation:ultimate-stage .65s cubic-bezier(.16,1,.3,1) both}.ultimate-cut-in .cutin-light{background:radial-gradient(circle at 38% 50%,#e371fb65,transparent 52%)}.ultimate-cut-in .cutin-art,.ultimate-cut-in.p1 .cutin-art{filter:drop-shadow(0 18px 14px #000b) drop-shadow(0 0 38px #ca83ff);animation:ultimate-art .75s cubic-bezier(.16,1,.3,1) both}.ultimate-cut-in .cutin-copy{animation:ultimate-copy .7s .08s ease-out both}.ultimate-cut-in .cutin-copy span{color:#91dcff;text-shadow:0 0 17px #5ad3ff;font-size:16px}.ultimate-cut-in .cutin-copy strong{color:#fff;text-shadow:0 0 18px #e44cfc,0 3px 20px #000}.ultimate-cut-in .cutin-copy p{color:#ebc2ff}@keyframes ultimate-stage{from{opacity:0;transform:scale(1.45) rotate(-4deg);filter:brightness(3)}to{opacity:1;transform:none;filter:none}}@keyframes ultimate-art{from{opacity:0;transform:translateX(70%) scale(.65) rotate(12deg)}to{opacity:1;transform:none}}@keyframes ultimate-copy{from{opacity:0;transform:translateY(45px) scale(1.2)}to{opacity:1;transform:none}}@media(max-width:600px){.ultimate-cut-in .cutin-copy span{font-size:12px}}@media(prefers-reduced-motion:reduce){.ultimate-cut-in>.cutin-stage,.ultimate-cut-in .cutin-art,.ultimate-cut-in .cutin-copy{animation:none}}
.header-actions{display:flex;gap:8px}.patch-entry{border-top:1px solid var(--line);padding:12px 0}.patch-entry h3{font-size:15px;color:var(--gold);margin:0 0 6px}.patch-entry ul{margin:0;padding-left:22px;color:#c2cfde;font-size:14px}.patch-entry li{margin:4px 0}
.tick-pop{position:absolute;left:50%;z-index:6;transform:translateX(-50%);white-space:nowrap;border-radius:14px;padding:2px 7px;font-size:12px;font-weight:850;line-height:1.35;pointer-events:none;box-shadow:0 2px 8px #0008}.tick-pop.heal{top:3px;background:#0b392d;color:#caffdf;border:1px solid #82e4af}.tick-pop.poison{bottom:3px;background:#46101c;color:#ffe2a8;border:1px solid #ff929a}
@media(max-width:760px){html,body{height:100%;overflow:hidden}main{height:100dvh;max-height:100dvh;overflow:hidden;display:flex;flex-direction:column;gap:5px;padding:7px}.brand{font-size:22px}header{flex:none;padding-bottom:5px}.header-actions{gap:4px}.header-actions button{padding:5px 8px}.topline{flex:none;margin:2px 0;min-height:36px}.topline h1{font-size:18px}.workspace{flex:1;min-height:0;overflow:hidden;display:grid;grid-template-columns:minmax(0,1.15fr) minmax(128px,.85fr);grid-template-rows:auto minmax(0,1fr) auto;gap:6px}.arena{grid-column:1;grid-row:2/4;min-height:0;overflow-y:auto;padding:6px}.workspace aside{display:contents}.control{grid-column:1;grid-row:1;min-height:0;padding:7px;overflow-y:auto}.roster-panel{grid-column:2;grid-row:1/3;min-height:0;overflow-y:auto;padding:8px}.history{grid-column:2;grid-row:3;display:block;min-height:0;overflow:hidden;padding:7px}#log{max-height:72px;font-size:11px}#log li{padding:3px 0}#roster{gap:5px}.roster-item{min-height:0;padding-top:6px}.roster-item p{font-size:11px;line-height:1.3;margin:3px 0}.roster-art{width:38px;height:44px}.roster-title strong{font-size:12px}.roster-title .notice{font-size:11px}.roster-item button{font-size:11px;padding:4px 6px}.setup-character{grid-template-columns:42px minmax(0,1fr);gap:3px 5px;padding:5px}.setup-character-detail{grid-column:1/-1}.setup-art{width:40px;height:44px}.setup-character-detail p{font-size:11px;line-height:1.3;margin:3px 0}.setup-character .pick{font-size:11px;padding:5px}.control #instruction{font-size:12px;line-height:1.3;min-height:0;margin:4px 0}.control #status{font-size:12px}.control #actions{gap:4px}.control #actions button,.control #modeSelect button{font-size:12px;padding:6px 7px}.hand-wrap{margin:4px 0;gap:8px}.playing-card{width:42px;height:56px;padding:4px 6px;font-size:22px}.playing-card small{font-size:9px}.arena .board-head{font-size:11px;margin-bottom:4px}.arena .board-head strong{font-size:12px}.board-meta{font-size:10px}.row{grid-template-columns:18px repeat(3,minmax(0,1fr));gap:4px}.rows{gap:4px}.cell{min-height:63px;padding:4px}.cell .name{font-size:10px;line-height:1.15}.cell .hp{font-size:10px;margin-top:2px}.hpbar{margin-top:3px}.cell .tag{display:none}.unit-art{opacity:.35;width:60%;height:60%;top:15px}.divider{margin:7px 0;font-size:9px}.arena .panel{padding:8px}footer{display:none}}
@media(max-width:760px) and (max-height:520px){main{gap:3px;padding:5px}.workspace{grid-template-rows:auto minmax(0,1fr) 64px}.arena{padding:4px}.cell{min-height:42px;padding:3px}.row,.rows{gap:3px}.divider{margin:3px 0}.arena .board-head{margin-bottom:2px}.control{padding:5px}.roster-panel{padding:5px}.roster-item p,.setup-character-detail p{font-size:10px;line-height:1.15}.roster-item{padding-top:3px}.setup-art{width:32px;height:36px}.setup-character{grid-template-columns:34px minmax(0,1fr);padding:3px}.history #log{max-height:42px}}
@media(max-width:760px){main{padding:4px;gap:3px}header{padding-bottom:2px;min-height:24px}.brand{font-size:17px;letter-spacing:.1em}.header-actions button{font-size:11px;padding:3px 6px}.topline{margin:0;min-height:24px}.topline h1{font-size:14px;line-height:1.15;margin:1px 0}.eyebrow{font-size:9px;line-height:1.1}.topline #reset{font-size:11px;padding:4px 7px}.workspace{grid-template-columns:minmax(0,1.55fr) minmax(120px,.85fr);grid-template-rows:auto minmax(0,1fr) 46px;gap:4px}.arena{overflow:hidden;padding:4px}.arena #boards{height:100%;min-height:0;display:flex;flex-direction:column}.arena #boards>.board{flex:1;min-height:0;display:flex;flex-direction:column}.arena #boards>.divider{flex:0 0 13px;margin:2px 0}.board-head{margin-bottom:2px}.board .rows{flex:1;min-height:0;gap:3px}.board .row{flex:1;min-height:0;grid-template-columns:12px repeat(3,minmax(0,1fr));gap:3px}.row-label{font-size:9px;justify-content:center}.cell{height:100%;min-height:0;padding:2px 3px;overflow:hidden}.cell .name{font-size:9px;line-height:1.1}.cell .hp{font-size:9px;margin-top:2px}.hpbar{height:2px;margin-top:2px}.cell .tap-label{display:none}.cell .tag{display:none}.unit-art{opacity:.14;width:45%;height:52%;top:21px}.effect-tag{position:absolute;top:2px;right:2px;bottom:auto;left:2px;z-index:2;display:block;max-width:calc(100% - 4px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:center;padding:1px 3px;border:1px solid #d6aa55;border-radius:4px;background:#111d2ceF;color:#ffe4a2;font-size:8px;line-height:1.15;text-shadow:none}.cell:has(.effect-tag) .name{margin-top:12px}.damage-pop{font-size:clamp(14px,4vw,20px);padding:3px;text-align:center;overflow-wrap:anywhere}.damage-pop small{font-size:10px}.tick-pop{font-size:9px;padding:1px 4px}.control{padding:4px}.control #instruction{font-size:10px;line-height:1.15;margin:2px 0}.control #status{font-size:10px;line-height:1.2}.hand-wrap{margin:2px 0;gap:5px}.playing-card{width:32px;height:42px;padding:3px 4px;font-size:17px}.playing-card small{font-size:8px}.control #actions,.control #modeSelect{gap:3px}.control #actions button,.control #modeSelect button{font-size:10px;padding:4px 5px;line-height:1.15}.roster-panel{padding:5px}.roster-panel h2,.history h2{font-size:12px;margin-bottom:4px}.roster-title strong{font-size:10px}.roster-title .notice{font-size:9px}.roster-item p{font-size:9px;line-height:1.18}.roster-art{width:30px;height:34px}.setup-character{grid-template-columns:34px minmax(0,1fr);gap:2px 4px;padding:3px}.setup-character-detail{grid-column:1/-1}.setup-art{width:32px;height:36px}.setup-character .pick{font-size:9px;padding:3px}.setup-character-detail p{font-size:9px;line-height:1.18;margin:2px 0}.history{padding:4px}#log{max-height:38px;font-size:9px}#log li{padding:1px 0}footer{display:none}}
@media(max-width:760px) and (max-height:520px){.workspace{grid-template-rows:auto minmax(0,1fr) 38px}.arena #boards>.divider{flex-basis:10px;margin:1px 0}.board .row{gap:2px}.cell .name,.cell .hp{font-size:8px}.roster-item p,.setup-character-detail p{font-size:8px;line-height:1.1}.effect-tag{font-size:7px}.cell:has(.effect-tag) .name{margin-top:10px}#log{max-height:28px}}

/* Damage labels stay on one line and may extend over neighboring cells. */
.cell:has(.damage-pop){overflow:visible!important;z-index:20}
.damage-pop{inset:auto;left:50%;top:50%;right:auto;bottom:auto;width:max-content;max-width:none;min-width:0;padding:5px 12px;display:block;white-space:nowrap;overflow:visible;flex-direction:row;transform:translate(-50%,-50%);font-size:clamp(18px,3.2vw,38px);line-height:1.15;text-align:center;z-index:50}
.damage-pop small{font-size:.55em}
@keyframes damage-show{0%{opacity:0;transform:translate(-50%,-50%) scale(.8)}18%{opacity:1;transform:translate(-50%,-50%) scale(1.08)}35%,100%{opacity:1;transform:translate(-50%,-50%) scale(1)}}
@media(max-width:760px){.arena{overflow:visible}.damage-pop{font-size:clamp(16px,4.5vw,24px);padding:3px 8px}}
.online-presence{margin:8px 0;padding:8px 10px;border:1px solid #77d8a4;border-radius:8px;background:#133627;color:#c8ffe0;font-weight:700}
.online-toggle{width:100%;text-align:left;font-weight:750;color:#f0d28c}.online-panel.collapsed{padding:3px 5px;margin-bottom:3px}.online-panel.collapsed>:not(.online-toggle):not(.online-presence):not(.online-error){display:none}.online-panel.collapsed .online-toggle{padding:4px 6px;font-size:12px;line-height:1.25;min-height:28px}.account-box{border-top:1px solid #365575;margin-top:14px;padding-top:10px}.account-box>strong{color:var(--gold)}.online-panel .account-box p{margin:5px 0;font-size:13px}.account-signin{display:inline-block;margin:4px 0;padding:7px 10px;border-radius:7px;background:var(--gold);color:#182030;font-weight:700;text-decoration:none}.account-box button{margin:4px 0}.online-panel .rating-message{color:#e9d399}.online-panel .rating-leaders{border-top:1px solid #365575;padding-top:7px;color:#bcd4ec}
@media(max-width:760px){.control:has(.online-panel:not([hidden])){max-height:40dvh;overflow-y:auto}.online-panel:not(.collapsed){max-height:29dvh;overflow-y:auto;padding:6px}.online-panel button{font-size:12px;padding:5px 7px}.online-panel .room-code{font-size:13px;letter-spacing:.04em}.online-panel .match-row{font-size:11px;padding:4px 0}}
@media(max-width:760px){.online-panel:not(.collapsed){max-height:none;overflow:visible}.account-signout{display:inline-block;margin-left:8px;color:#bcd4ec;font-size:12px}}

.team-board .row{grid-template-columns:30px repeat(4,minmax(0,1fr))}
.history h2{margin:0 0 7px}.history h2 button{width:100%;display:flex;align-items:center;justify-content:space-between;background:transparent;color:var(--gold);border:1px solid var(--line);padding:5px 8px;font-size:inherit;text-align:left}.history h2 button span{font-size:18px;line-height:1}
#battleLogDialog{width:min(700px,calc(100vw - 20px));max-width:700px;height:min(82dvh,720px);max-height:82dvh;padding:16px 18px;overflow:hidden}.expanded-log-head{display:flex;align-items:center;justify-content:space-between;gap:12px;border-bottom:1px solid var(--line);padding-bottom:10px}.expanded-log-head h2{margin:0}.expanded-log-head button{background:transparent;color:white;border:1px solid var(--line);font-size:26px;line-height:1;padding:2px 10px}#expandedLog{overflow-y:auto;max-height:calc(100% - 52px);padding:0 0 6px;margin:8px 0;list-style:none;font-size:clamp(15px,2.5vw,18px);line-height:1.55}#expandedLog li{padding:10px 2px;border-bottom:1px solid var(--line)}
@media(max-width:760px){#battleLogDialog{height:calc(100dvh - 32px);max-height:calc(100dvh - 32px);width:calc(100vw - 16px);max-width:none;padding:12px}#expandedLog{font-size:16px}}
@media(max-width:760px){.team-board .row{grid-template-columns:12px repeat(4,minmax(0,1fr));gap:2px}.team-board .cell{padding:2px}.team-board .cell .name{font-size:8px}.team-board .cell .hp{font-size:8px}}

.enemy-detail[hidden]{display:none}.enemy-detail{position:fixed;z-index:120;max-width:min(330px,calc(100vw - 16px));width:300px;max-height:min(60vh,420px);overflow:auto;padding:14px 18px;border:1px solid #e7c378;border-radius:12px;background:#172639;box-shadow:0 12px 32px #000b;color:#f0f4fa;font-size:13px;line-height:1.45}.enemy-detail strong{display:block;padding-right:30px;color:#e7c378;font-size:16px}.enemy-detail p{margin:9px 0 0}.enemy-detail b{color:#e7c378}.enemy-detail .detail-close{position:absolute;right:7px;top:5px;padding:2px 8px;background:transparent;color:white;font-size:20px}

.cell.area-hit{overflow:visible!important;border-color:#ffcc65!important;box-shadow:inset 0 0 0 3px #ffae48,0 0 16px #ffae48aa!important;z-index:18}.cell.area-hit:not(:has(.damage-pop)):after{content:"命中範囲";position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);white-space:nowrap;padding:2px 5px;border-radius:4px;background:#683215;color:#fff0cf;font-size:12px;font-weight:800;z-index:5;pointer-events:none}.tick-pop.damage{top:3px;background:#5a2020;color:#fff0d0;border:1px solid #ffae7a}
.seat-legend{display:flex;gap:5px;flex-wrap:wrap;margin-bottom:5px;font-size:11px;font-weight:750}.seat-legend span{padding:1px 7px;border-radius:5px;border:1px solid currentColor}.seat-legend .seat-self,.cell.seat-self{--seat-color:#69d5ff}.seat-legend .seat-ally,.cell.seat-ally{--seat-color:#93e39a}.seat-legend .seat-enemy-one,.cell.seat-enemy-one{--seat-color:#ffa365}.seat-legend .seat-enemy-two,.cell.seat-enemy-two{--seat-color:#caa0ff}.cell.seat-fixed-0{--seat-color:#69d5ff}.cell.seat-fixed-1{--seat-color:#ffa365}.cell.seat-fixed-2{--seat-color:#93e39a}.cell.seat-fixed-3{--seat-color:#caa0ff}.seat-legend span{color:var(--seat-color)}.team-board .cell[class*="seat-"]{border-color:var(--seat-color);box-shadow:inset 3px 0 var(--seat-color)}.team-board .cell[class*="seat-"].legal{box-shadow:inset 3px 0 var(--seat-color),inset 0 0 0 1px var(--gold)}.seat-badge{display:inline-block;padding:0 4px;border-radius:3px;background:var(--seat-color);color:#14202c;font-size:10px;font-weight:850;line-height:1.35}.team-board .cell .seat-badge{position:relative;z-index:2}.team-board .cell .name{display:block}
@media(max-width:760px){.seat-legend{font-size:9px;gap:3px;margin-bottom:2px}.seat-legend span{padding:0 4px}.seat-badge{font-size:8px}.arena #boards>.seat-legend{flex:0 0 auto}}
.bot-picker{margin-top:8px;padding:8px;border:1px solid #425a73;border-radius:8px}.bot-picker>strong{display:block;font-size:13px}.bot-picker p{margin:5px 0;font-size:12px}.bot-picker-seats,.bot-picker-grid{display:flex;flex-wrap:wrap;gap:4px;margin-top:6px}.bot-picker-grid{max-height:125px;overflow:auto}.bot-picker button{padding:4px 7px;font-size:12px;min-height:28px}.bot-picker-grid button.chosen{border-color:#e7c378;color:#e7c378}
.bot-picker{margin:0 0 6px;padding:4px;display:flex;align-items:center;gap:4px;flex-wrap:wrap}.bot-picker select{min-width:0;flex:1 1 100%;padding:4px;border:1px solid #627a90;border-radius:5px;background:#15293d;color:#f2f4f7;font:inherit;font-size:12px}.bot-picker span{font-size:11px}.bot-picker button{min-height:0;padding:2px 6px;font-size:11px}
/* Compact four-seat markers and a stage-first mobile layout. */
.roster-panel h2{display:flex;align-items:center;justify-content:space-between;gap:4px}.roster-panel h2 button{padding:1px 8px;min-width:28px;line-height:1.2}.seat-badge{width:8px;height:8px;border-radius:50%;padding:0;box-shadow:0 0 0 1px #101d29}.team-board .cell .seat-badge{position:absolute;right:3px;top:3px;z-index:2}.team-board .cell .name{padding-right:7px}.roster-collapsed .roster-panel #roster{display:none}.roster-collapsed .roster-panel h2{font-size:0}.roster-collapsed .roster-panel h2 button{font-size:18px}
@media(max-width:760px){.workspace.roster-collapsed{grid-template-columns:minmax(0,1fr) 32px}.workspace.roster-collapsed .roster-panel{padding:2px}.workspace.roster-collapsed .roster-panel h2{margin:0}.workspace.roster-collapsed .roster-panel h2 button{width:100%;padding:3px 0}.workspace.roster-collapsed .history{padding:2px}.workspace.roster-collapsed .history h2 button{font-size:0;padding:4px 0}.workspace.roster-collapsed .history h2 button span{font-size:16px}.workspace.roster-collapsed .history #log{display:none}.seat-legend{margin-bottom:1px}.seat-legend span{padding:0 4px;font-size:8px}.team-board .cell .seat-badge{width:6px;height:6px;right:2px;top:2px}.team-board .cell .name{padding-right:0}.control:has(.online-panel:not([hidden])){max-height:22dvh;overflow-y:auto}.online-panel:not(.collapsed){max-height:13dvh;overflow-y:auto}.roster-panel h2 button{font-size:13px}}
/* Battle controls */
.workspace.battle-view{grid-template-columns:minmax(0,1fr) minmax(150px,240px)}
.workspace.battle-view .roster-panel{display:none}
.cell.skill-ready{border-color:#ffe08a!important;background:#29374a;box-shadow:inset 0 0 0 2px #ffd778,inset 0 0 20px #e9ae4540!important;z-index:1;animation:skill-ready-glow 1.15s ease-in-out infinite}.cell.skill-ready .unit-art{opacity:1;animation:skill-ready-hop 1.15s ease-in-out infinite;transform-origin:center bottom}
@keyframes skill-ready-glow{0%,100%{filter:brightness(1)}40%{filter:brightness(1.45)}}@keyframes skill-ready-hop{0%,100%{transform:translateY(0);filter:drop-shadow(0 0 4px #ffd778)}40%{transform:translateY(-6px);filter:drop-shadow(0 0 11px #ffe299)}65%{transform:translateY(-2px);filter:drop-shadow(0 0 6px #ffd778)}}
@media(max-width:760px){.workspace.battle-view{grid-template-columns:minmax(0,1fr) 34px}.workspace.battle-view .history{padding:3px}.workspace.battle-view .history h2 button{font-size:0;padding:4px 0}.workspace.battle-view .history h2 button span{font-size:16px}.workspace.battle-view .history #log{display:none}}
@media(prefers-reduced-motion:reduce){.cell.skill-ready,.cell.skill-ready .unit-art{animation:none}.cell.skill-ready .unit-art{filter:drop-shadow(0 0 7px #ffe299)}}
.action-menu[hidden]{display:none}.action-menu{position:fixed;z-index:130;display:grid;gap:7px;width:min(245px,calc(100vw - 16px));padding:12px;border:1px solid var(--gold);border-radius:12px;background:#172639;box-shadow:0 12px 32px #000c}.action-menu strong{color:var(--gold);font-size:14px}.action-menu button{padding:8px 10px;text-align:left;font-size:14px}.action-menu button:last-child{background:transparent;border:1px solid #53657b;color:#d9e4f2}
.rules-dialog section{border-top:1px solid var(--line);padding:10px 0}.rules-dialog section h3{margin:0;color:var(--gold);font-size:16px}.rules-dialog section p{margin:6px 0 9px;line-height:1.55}.rules-dialog details{border:1px solid var(--line);border-radius:8px;margin:6px 0;padding:8px 10px}.rules-dialog summary{cursor:pointer;font-weight:700}.rules-dialog details p{padding-left:8px}
.workspace.battle-view .history{align-self:start}.workspace.battle-view .history h2 button{font-size:14px}.workspace.battle-view .history #log{max-height:180px}
@media(max-width:760px){.workspace.battle-view{grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr)}.workspace.battle-view .arena{grid-column:1}.workspace.battle-view .history{position:fixed;right:10px;bottom:18px;z-index:45;background:#172639;border:1px solid var(--gold);border-radius:10px;padding:3px!important;width:auto;min-width:102px;box-shadow:0 6px 20px #000b}.workspace.battle-view .history h2{margin:0}.workspace.battle-view .history h2 button{font-size:12px!important;padding:7px!important;color:var(--gold)}.workspace.battle-view .history h2 button span{margin-left:6px}.workspace.battle-view .history #log{display:none}.workspace.battle-view .arena #boards{height:100%}.action-menu button{font-size:13px}}
.workspace.battle-view .history #log li.log-turn,#expandedLog li.log-turn{color:var(--gold);font-weight:750;border-top:1px solid #6c5b3a;padding-top:10px;margin-top:6px}.expanded-log-head small{font-size:12px;color:var(--muted);font-weight:400}#expandedLog{line-height:1.5}#expandedLog li{padding:8px 2px;border-bottom:1px solid #293748}
@media(max-width:760px){.workspace.battle-view{display:block}.workspace.battle-view .arena{width:100%}}
/* Give the battlefield the remaining phone height after the turn controls. */
@media(max-width:760px){.workspace.battle-view{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) auto;min-height:0}.workspace.battle-view .arena{grid-column:1;grid-row:1;min-height:0;height:100%;width:100%;overflow:hidden}.workspace.battle-view .control{grid-column:1;grid-row:2;min-height:0;max-height:min(32dvh,250px);overflow-y:auto}.workspace.battle-view .arena #boards{height:100%;min-height:0;display:flex;flex-direction:column}.workspace.battle-view .arena #boards>.board{flex:1;min-height:0}.workspace.battle-view .history{grid-column:auto;grid-row:auto}}
/* Reserve a separate row for the battle log control, clear of action buttons. */
@media(max-width:760px){.workspace.battle-view{grid-template-rows:minmax(0,1fr) auto auto}.workspace.battle-view .history{position:static;grid-column:1;grid-row:3;width:100%;min-width:0;min-height:0;margin:0;padding:0!important;background:transparent;border:0;box-shadow:none}.workspace.battle-view .history h2{margin:0}.workspace.battle-view .history h2 button{justify-content:center;width:100%;min-height:32px;padding:4px 8px!important;font-size:12px!important;border-color:var(--line);border-radius:7px;background:#172639}.workspace.battle-view .history #log{display:none}}
/* Pick mode uses the battlefield as a draft table. */
.workspace:has(.draft-stage){grid-template-columns:minmax(0,1fr) 230px;align-items:start}
.workspace:has(.draft-stage) .arena{padding:0;overflow:hidden;border-color:#5c5471;background:radial-gradient(circle at 50% 5%,#263149,#101b2b 55%,#0a1522)}
.workspace:has(.draft-stage) .roster-panel{display:none}
.workspace:has(.draft-stage) .history{display:none}
.draft-stage{padding:18px;min-width:0}
.draft-stage-head{display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid #596076;padding-bottom:8px;color:#e7c378;font-size:12px;letter-spacing:.19em;font-weight:750}
.draft-stage-head strong{font:700 35px Georgia,serif;color:#fff;line-height:1}.draft-stage-head strong small{font:14px system-ui;color:#9daac0}
.draft-matchup{display:grid;grid-template-columns:minmax(0,1fr) 34px minmax(0,1fr);gap:10px;align-items:center;padding:16px 0}
.draft-side>span{display:block;font-size:12px;letter-spacing:.1em;color:#a9c1dd;margin:0 0 5px}.draft-rival>span{color:#ffabb0}.draft-slots{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px}
.draft-slot{height:82px;position:relative;overflow:hidden;border:1px dashed #52627a;border-radius:8px;background:linear-gradient(155deg,#1a283a,#101b29);display:flex;flex-direction:column;justify-content:flex-end;align-items:center;padding:4px}
.draft-slot.current{border-color:#e7c378;box-shadow:inset 0 0 0 1px #e7c37855}.draft-slot.filled{border-style:solid;border-color:#73a9ce}.draft-rival .draft-slot.filled{border-color:#d98792}
.draft-slot img{position:absolute;inset:1px;width:100%;height:75%;object-fit:contain;opacity:.9}.draft-slot small{position:absolute;top:2px;left:5px;color:#e7c378;font-size:10px}.draft-slot strong{font-size:11px;line-height:1.1;text-align:center;position:relative;text-shadow:0 2px 3px #000,0 0 8px #000;padding:2px 0}.draft-versus{text-align:center;color:#e7c378;font:italic bold 17px Georgia,serif;letter-spacing:.08em}
.draft-gallery-head{display:flex;align-items:baseline;justify-content:space-between;gap:8px;border-top:1px solid #46536a;padding:13px 0 8px}.draft-gallery-head strong{color:#f2e1b6;font-size:16px}.draft-gallery-head small{color:#a7b6c9;font-size:11px}
.draft-gallery{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}.draft-card{display:flex;flex-direction:column;position:relative;min-width:0;height:144px;padding:5px;border:1px solid #49637c;border-radius:10px;background:linear-gradient(150deg,#22374b,#152338 65%,#0d192a);color:#f1f4fa;box-shadow:0 4px 10px #0004;text-align:left;overflow:hidden;transition:transform .16s,border-color .16s,box-shadow .16s}
.draft-card:hover:not(:disabled),.draft-card.preview{transform:translateY(-3px);border-color:#f0cb80;box-shadow:0 0 0 2px #e7c37866,0 9px 18px #0008}.draft-card img{height:96px;max-width:100%;object-fit:contain;align-self:center;filter:drop-shadow(0 3px 4px #0009)}.draft-card-info{display:block;margin-top:auto;width:100%;padding:2px 3px;background:#0e1924bc;border-radius:4px}.draft-card strong,.draft-card small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.draft-card strong{font-size:13px}.draft-card small{font-size:10px;color:#bccddd}.draft-card:disabled{opacity:.38}.draft-card em{position:absolute;top:6px;right:4px;padding:1px 4px;border-radius:3px;background:#111e2de0;color:#f4d994;font-size:10px;font-style:normal}
.draft-detail{display:flex;align-items:center;gap:15px;min-height:60px;margin-bottom:9px;padding:9px 12px;border:1px solid #756344;border-radius:9px;background:linear-gradient(110deg,#322b24,#182536 60%)}.draft-detail:has(img){min-height:143px}.draft-detail>img{width:105px;height:119px;object-fit:contain;flex:none;filter:drop-shadow(0 7px 7px #0009)}.draft-detail-copy{min-width:0}.draft-detail-copy>strong{display:block;font-size:17px;color:#ffe1a2}.draft-detail-copy>strong small{font-size:12px;color:#c8d4e3}.draft-detail-copy p{font-size:11px;line-height:1.35;margin:3px 0;color:#d0dce9}.draft-detail-copy b{color:#f1ca85}.draft-detail-copy button{font-size:13px;padding:5px 13px;margin-top:4px}.draft-detail-hint{color:#c9ba9c;font-size:13px}
@media(max-width:760px){.workspace:has(.draft-stage){display:flex;flex-direction:column;gap:8px}.workspace:has(.draft-stage) .arena{order:1;width:100%}.workspace:has(.draft-stage) .control{order:0;max-height:none;overflow:visible;min-height:0;padding:9px 11px}.workspace:has(.draft-stage) #instruction{min-height:0;margin:4px 0;font-size:12px}.workspace:has(.draft-stage) .online-panel:not(.collapsed){max-height:25dvh}.draft-stage{padding:9px}.draft-stage-head strong{font-size:24px}.draft-matchup{gap:3px;grid-template-columns:minmax(0,1fr) 22px minmax(0,1fr);padding:9px 0}.draft-versus{font-size:12px}.draft-slot{height:60px;padding:2px}.draft-slot img{height:72%}.draft-slot strong{font-size:9px}.draft-gallery{grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}.draft-card{height:123px;padding:3px}.draft-card img{height:78px}.draft-card strong{font-size:11px}.draft-card small{font-size:9px}.draft-detail{padding:6px 8px;gap:7px;min-height:42px}.draft-detail:has(img){min-height:126px}.draft-detail>img{width:72px;height:99px}.draft-detail-copy>strong{font-size:14px}.draft-detail-copy p{font-size:10px}.draft-gallery-head{padding:8px 0 5px}.draft-gallery-head strong{font-size:14px}.draft-gallery-head small{font-size:10px}}
@media(prefers-reduced-motion:reduce){.draft-card{transition:none}.draft-card:hover:not(:disabled),.draft-card.preview{transform:none}}

/* Keep the draft summary fixed and scroll only the character gallery on phones. */
@media(max-width:760px){
 .workspace:has(.draft-stage){align-items:stretch}
 .workspace:has(.draft-stage) .control{flex:0 0 auto;max-height:28dvh;overflow-y:auto}
 .workspace:has(.draft-stage) .arena{flex:1 1 0;min-height:0;height:auto;overflow:hidden}
 .workspace:has(.draft-stage) #boards{height:100%;min-height:0}
 .draft-stage{display:flex;flex-direction:column;flex:1 1 0;min-height:0;height:100%;overflow:hidden}
 .draft-stage-head,.draft-matchup,.draft-gallery-head{flex:0 0 auto}
 .draft-detail{flex:0 1 auto;min-height:0;max-height:40%;overflow-y:auto}
 .draft-detail:has(img){min-height:0}
 .draft-gallery{flex:1 1 0;min-height:0;overflow-y:auto;overflow-x:hidden;align-content:start;grid-auto-rows:123px;padding:4px 3px 12px;overscroll-behavior-y:contain;-webkit-overflow-scrolling:touch;touch-action:pan-y;scrollbar-width:thin;scrollbar-color:var(--gold) #142130}
 .draft-gallery .draft-card{touch-action:pan-y}
}
.cell .effect-tag{top:auto;left:auto;bottom:5px;right:5px;max-width:calc(100% - 10px);font-size:clamp(10px,1.6vw,13px);text-align:right;white-space:normal;line-height:1.15}.cell:has(.effect-tag) .name{margin-top:0}.effect-details{padding:10px;border:1px solid #c7a15b;border-radius:8px;background:#142235;line-height:1.6}
.rules-dialog table{width:100%;border-collapse:collapse;table-layout:fixed;margin:12px 0;font-size:14px;line-height:1.6}.rules-dialog th,.rules-dialog td{padding:9px 10px;border-bottom:1px solid #354459;text-align:left;vertical-align:top;overflow-wrap:anywhere}.rules-dialog th{color:var(--gold);background:#162436}.rules-dialog th:first-child{width:33%}.rules-dialog section{margin:18px 0}.rules-dialog li{margin:5px 0}

.cell .ingredient-gauge{display:block;position:relative;z-index:3;align-self:flex-start;padding:1px 6px;background:#473723;border:1px solid #e5be6b;border-radius:5px;color:#ffe4a4;font-size:12px;line-height:1.2}.cell:has(.ingredient-gauge) .tag{display:none}
/* The room summary stays compact while the draft gallery keeps its own height. */
.ranked-panel{margin:6px 0;border:1px solid #81663b;border-radius:9px;background:#192736;padding:6px 10px}.rank-account summary{cursor:pointer;color:var(--gold);font-weight:700;font-size:14px}.rank-account .account-box{margin:6px 0 0;padding:4px 0;border:0}.rank-account button{margin-right:5px}.damage-type-tag{display:inline-block;font-size:12px;padding:1px 6px;margin-right:5px;border:1px solid #e5a278;border-radius:5px;color:#ffc092;background:#432a24;white-space:nowrap}.battle-clocks{display:flex;justify-content:space-between;align-items:center;gap:7px;margin:0 0 8px;padding:7px 10px;background:#101d2c;border:1px solid #354b64;border-radius:9px;font-size:13px;font-variant-numeric:tabular-nums}.clock-bank,.clock-action{display:flex;gap:5px;align-items:center}.clock-bank.thinking{color:var(--gold)}.clock-low{color:#ff8b91}.battle-clocks[hidden],.match-presentation[hidden],.ranked-panel[hidden]{display:none!important}
.match-presentation{position:fixed;inset:0;z-index:1400;display:flex;align-items:center;justify-content:center;padding:20px;background:#07121eef;backdrop-filter:blur(9px)}.match-intro-stage{width:min(850px,100%);text-align:center;animation:match-enter .4s ease-out}.match-kicker{font-size:14px;letter-spacing:.2em;color:#e7c378;font-weight:800}.intro-team{padding:15px;border-radius:15px;background:linear-gradient(115deg,#112c49,#172334);border-left:5px solid #78bbfa}.intro-team.p1{background:linear-gradient(115deg,#442330,#192234);border-color:#ee929a}.intro-team h2{font-size:18px;margin:0 0 10px}.intro-lineup{display:flex;justify-content:center;gap:18px}.intro-character{flex:1;max-width:180px;min-width:0}.intro-character img{display:block;width:100%;height:145px;object-fit:contain;filter:drop-shadow(0 8px 6px #0009);animation:character-enter .55s ease-out both}.intro-character:nth-child(2) img{animation-delay:.08s}.intro-character:nth-child(3) img{animation-delay:.16s}.intro-character strong,.intro-character small{display:block;line-height:1.3}.intro-character strong{font-size:16px}.intro-character small{font-size:13px;color:#c2d1e0}.intro-vs{font:italic 900 54px Georgia;color:#ffe3a0;text-shadow:0 4px 0 #5b3a24;line-height:1.2}.match-result{background:radial-gradient(ellipse at center,#153a5ce8,#060f1bf5)}.match-result.defeat{background:radial-gradient(ellipse at center,#512430eb,#090d16f5)}.match-result-stage{text-align:center;width:min(600px,100%);animation:match-enter .5s ease-out}.match-result-stage h2{font:900 clamp(45px,10vw,90px) Georgia,serif;color:#ffe3a0;text-shadow:0 6px 0 #74502f;margin:10px 0}.match-result.defeat h2{color:#fba1ae;text-shadow:0 6px 0 #652539}.match-result .result-ja{font-size:26px;font-weight:800;margin:0 0 15px}.result-rating{padding:13px;border:1px solid #9c8156;border-radius:10px;background:#101b2b;color:#f2d797;font-variant-numeric:tabular-nums;margin:15px 0}.result-rating span,.result-rating strong{display:block}.result-rating strong{font-size:22px;margin-top:6px}.match-result button{margin-top:15px;padding:12px 28px}
@keyframes match-enter{from{opacity:0;transform:scale(.85)}to{opacity:1;transform:scale(1)}}@keyframes character-enter{from{opacity:0;transform:translateX(-40px)}to{opacity:1;transform:translateX(0)}}
@media(max-width:760px){.workspace:has(.draft-stage) .control{max-height:20dvh;padding:5px 8px}.workspace:has(.draft-stage) .draft-gallery{min-height:160px}.draft-detail{max-height:26dvh}.draft-detail-copy p{font-size:12px;line-height:1.4}.online-panel.collapsed .online-toggle{font-size:14px}.draft-stage:has(.draft-detail img) .draft-gallery-head{padding-top:5px}.match-presentation{padding:14px}.intro-team{padding:10px}.intro-character img{height:120px}.intro-lineup{gap:7px}.intro-character strong{font-size:14px}.intro-vs{font-size:40px}.match-kicker{font-size:12px}.battle-clocks{font-size:12px;padding:5px 7px;gap:4px}.clock-bank,.clock-action{gap:3px}.result-rating strong{font-size:19px}}
@media(prefers-reduced-motion:reduce){.match-intro-stage,.match-result-stage,.intro-character img{animation:none}}
.damage-type-tag.piercing-tag{border-color:#83b9df;color:#a4d8ff;background:#18374c}

/* Keep the description's scroll area inside the flex item, not clipped by its parent. */
.draft-detail-copy{flex:1 1 0;min-width:0;overflow-wrap:anywhere}.draft-ability-scroll{min-width:0}.draft-scroll-hint{display:none}
@media(max-width:760px){
 .draft-detail:has(img){flex:0 0 auto;height:clamp(155px,28dvh,215px);min-height:155px;max-height:none;overflow:hidden;align-items:stretch}
 .draft-detail>img{align-self:center;width:64px;height:90px}
 .draft-detail-copy{display:flex;flex-direction:column;min-height:0;overflow:hidden}
 .draft-detail-copy>strong,.draft-detail-copy>button,.draft-scroll-hint{flex:0 0 auto}
 .draft-detail-copy>strong{font-size:14px;line-height:1.3}
 .draft-ability-scroll{flex:1 1 0;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;touch-action:pan-y;-webkit-overflow-scrolling:touch;scrollbar-width:thin;scrollbar-color:var(--gold) #142130;padding:3px 6px 8px 0}
 .draft-ability-scroll p{font-size:13px;line-height:1.5;white-space:normal;overflow:visible;margin:4px 0 8px}
 .draft-scroll-hint{display:block;font-size:12px;color:#bac8da;padding-top:3px}
 .draft-detail-copy>button{align-self:flex-start;min-height:34px;font-size:14px;margin-top:3px;padding:5px 12px}
 .workspace:has(.draft-stage) .draft-gallery{min-height:123px}
}
@media(max-width:760px) and (max-height:620px){.draft-matchup{padding:4px 0}.draft-slot{height:42px}.draft-detail:has(img){height:150px;min-height:150px}.draft-stage-head{padding-bottom:4px}.workspace:has(.draft-stage) .control{max-height:18dvh}.draft-gallery-head small{display:none}}

.draft-detail-actions{display:flex;gap:6px;flex-wrap:wrap;flex:0 0 auto;padding-top:4px}.draft-detail-actions button{font-size:13px;margin:0;padding:6px 9px}.draft-ability-dialog{width:min(560px,calc(100vw - 24px));max-height:85dvh;padding:0;border:1px solid #c4a56c;border-radius:13px;background:#142336;color:#e7edf6;overflow:auto}.draft-dialog-heading{position:sticky;top:0;display:flex;align-items:center;justify-content:space-between;gap:10px;padding:12px 16px;background:#142336;border-bottom:1px solid #41536b;z-index:1}.draft-dialog-heading h2{margin:0;color:var(--gold);font-size:20px}.draft-dialog-heading small{font-size:14px}.draft-dialog-body{padding:14px 18px;overflow-wrap:anywhere}.draft-dialog-body>img{width:110px;height:120px;object-fit:contain;display:block;margin:0 auto 12px}.draft-dialog-body h3{font-size:16px;color:var(--gold);margin:14px 0 6px}.draft-dialog-body p{font-size:16px;line-height:1.7;margin:0 0 12px;white-space:normal}.draft-dialog-actions{position:sticky;bottom:0;display:flex;gap:8px;flex-wrap:wrap;padding:12px 16px;background:#142336;border-top:1px solid #41536b}.draft-ability-dialog::backdrop{background:#060c18d9}
@media(max-width:760px){.draft-detail-actions{flex-wrap:nowrap;gap:4px}.draft-detail-actions button{font-size:12px;min-height:32px;padding:5px 6px}.draft-scroll-hint{font-size:12px}.draft-ability-scroll{padding-bottom:12px}}

.cell.skill-ready.necro-summon-ready{border-color:#c59aff!important;background:#302246;box-shadow:inset 0 0 0 2px #a96df7,inset 0 0 24px #9a50e95c,0 0 12px #9c57e850!important}.cell.necro-summon-ready .unit-art{animation:necro-summon-hop 1.15s ease-in-out infinite;filter:drop-shadow(0 0 6px #b88aff)}
@keyframes necro-summon-hop{0%,100%{transform:translateY(0);filter:drop-shadow(0 0 5px #a369ef)}40%{transform:translateY(-6px);filter:drop-shadow(0 0 13px #d0a0ff)}65%{transform:translateY(-2px);filter:drop-shadow(0 0 7px #a369ef)}}
@media(prefers-reduced-motion:reduce){.cell.necro-summon-ready .unit-art{animation:none;filter:drop-shadow(0 0 7px #b88aff)}}
.pumpkin-gauge{position:absolute;right:5px;top:4px;font-size:12px;color:#ffe29d;background:#673a0d;padding:2px 5px;border-radius:6px;z-index:2}.pumpkin-pickup{position:absolute;width:34px;height:34px;object-fit:contain;right:5px;bottom:9px;z-index:1}.rank-title{color:var(--gold);font-weight:700}.rank-forfeit{border-color:#b96372;color:#ffc6cc}.rank-info{font-size:14px;line-height:1.65}

/* The clock and boards share the arena height; controls never cover a row. */
@media(max-width:760px){
 .workspace.battle-view .arena{display:flex;flex-direction:column;gap:4px}
 .workspace.battle-view .arena .battle-clocks{flex:0 0 auto;margin:0}
 .workspace.battle-view .arena .battle-clocks[hidden]{display:none}
 .workspace.battle-view .arena #boards{flex:1 1 0;height:auto;min-height:0;overflow-y:auto;overscroll-behavior:contain}
 .workspace.battle-view .control{max-height:24dvh}
 .workspace.battle-view .online-panel.collapsed{padding:0;margin:3px 0;border:0}
 .workspace.battle-view .online-panel.collapsed .online-toggle{font-size:11px;padding:3px 6px}
 .workspace.battle-view .board .row{min-height:44px}
 main{padding-bottom:max(4px,env(safe-area-inset-bottom))}
}
/* Clear ability hierarchy and compact cooldown metadata. */
.ability-copy{line-height:1.65;margin:12px 0}.ability-copy>b{display:inline-block;margin-bottom:4px}.damage-type-tag{font-size:12px!important;padding:2px 7px!important;line-height:1.4!important;margin:5px 0!important}.cooldown-box{padding:8px 10px;border:1px solid #647692;border-radius:8px;background:#16263a;font-size:14px;line-height:1.5}.cooldown-box span{display:block;color:#cbd6e8}.crack-overlay{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;pointer-events:none;opacity:.7;z-index:0}.cell .name,.cell .hp,.cell .hpbar{position:relative;z-index:2}
/* TRI X ranked lobby */
.crack-overlay{transform:scale(1.2);transform-origin:center}
.rank-hub-screen[hidden]{display:none!important}body.rank-hub-view{height:auto;min-height:100dvh;overflow:auto}body.rank-hub-view main{height:auto;max-height:none}body.rank-hub-view .workspace,body.rank-hub-view .topline,body.rank-hub-view main>footer{display:none!important}.rank-hub-screen{padding:18px 0 38px;max-width:1100px;margin:auto}.hub-heading{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-bottom:22px}.hub-heading h1{font-size:32px;margin:8px 0;color:#f0d594}.hub-heading p,.hub-season,.hub-help,.hub-ranking>p{color:#a9bbcf;line-height:1.7}.hub-kicker{font-size:12px;letter-spacing:.15em;color:#d7b877}.hub-profile{display:grid;grid-template-columns:1.5fr 1fr 1fr;gap:24px;padding:24px;border:1px solid #526987;border-radius:16px;background:linear-gradient(120deg,#25394f,#152235)}.hub-profile h2{margin:5px 0 12px;font-size:24px}.hub-profile span,.hub-rate small{display:block;color:#b7c7da}.hub-rate strong{display:block;color:#f0d594;font-size:44px;line-height:1.3}.hub-play{display:flex;flex-direction:column;justify-content:center;gap:10px}.hub-tabs{display:flex;gap:10px;margin:20px 0}.hub-tabs button{padding:12px 18px}.hub-tabs button:last-child{margin-left:auto}.achievement-tier-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px;align-items:start}.achievement-tier{border:1px solid #3f536e;border-radius:14px;background:#152337;overflow:hidden}.achievement-tier.earned{border-color:#a28b56}.achievement-tier header{padding:18px;display:flex;justify-content:space-between;align-items:center;background:#20334a}.achievement-tier header span{color:#b2c1d4;font-size:12px}.achievement-tier h2{margin:6px 0 0;color:#f0d594;font-size:24px}.achievement-tier h2 small{font-size:12px;color:#b4c1d3}.achievement-tier header>strong{font-size:26px;white-space:nowrap}.achievement-tier header>strong small{font-size:13px;margin-left:3px}.achievement-item{width:100%;display:grid;grid-template-columns:22px 1fr auto;align-items:center;text-align:left;gap:10px;background:transparent;color:#dbe7f5;border:0;border-bottom:1px solid #2c4058;border-radius:0;padding:15px;min-width:0}.achievement-item:hover{background:#25394f}.achievement-item h3{font-size:15px;margin:0 0 6px}.achievement-item p{font-size:12px;line-height:1.6;color:#a5b8cd;margin:0 0 8px}.achievement-item strong{font-size:19px;white-space:nowrap}.achievement-item strong small{font-size:12px;color:#a5b8cd}.achievement-check{font-size:20px;color:#859ab2}.completed .achievement-check,.achievement-stage.completed>strong{color:#c8e0a3}progress{display:block;width:100%;height:5px;accent-color:#dbbe78}.achievement-dialog{width:min(540px,92vw);max-height:85dvh;overflow:auto;border:1px solid #647a98;border-radius:16px;padding:24px;color:#e6eef8;background:#152337}.dialog-close{float:right}.achievement-stage-list{display:grid;gap:12px}.achievement-stage{padding:15px;border:1px solid #3f536e;border-radius:10px}.achievement-stage>span{font-size:12px;color:#aebfd2}.achievement-stage h3{margin:6px 0}.achievement-stage p{font-size:14px;line-height:1.6;color:#b9c8d9}.achievement-stage strong{display:block;font-size:22px;margin-bottom:10px}.hub-ranking{padding:20px;background:#152337;border:1px solid #3f536e;border-radius:14px}.ranking-scroll{overflow-x:auto}.hub-ranking table{width:100%;border-collapse:collapse}.hub-ranking th,.hub-ranking td{padding:15px 10px;border-bottom:1px solid #334b65;text-align:left;white-space:nowrap}.hub-ranking th{font-size:12px;color:#b9c8d9}.hub-error{color:#ffb5b5}.hub-loading,.ranking-empty{padding:28px;text-align:center}.opponent-tier{color:#e6d6ac;font-size:22px}
@media(max-width:760px){body.rank-hub-view main{padding:10px;overflow:visible}.rank-hub-screen{padding-top:12px}.hub-heading h1{font-size:25px}.hub-heading>button{font-size:12px;padding:9px}.hub-profile{grid-template-columns:1fr 1fr;padding:18px;gap:15px}.hub-profile h2{font-size:19px}.hub-play{grid-column:1/-1;flex-direction:row}.hub-play>*{flex:1}.hub-rate strong{font-size:36px}.hub-tabs{gap:7px}.hub-tabs button{font-size:13px;padding:10px}.achievement-tier-grid{grid-template-columns:1fr}.achievement-item{padding:14px 12px}.hub-season,.hub-help{font-size:12px}.achievement-dialog{padding:18px}.hub-ranking{padding:14px}}
body.rank-hub-view main{display:block;overflow:visible}

html.rank-hub-view{height:auto;overflow:auto}
.tutorial-dialog{width:min(680px,calc(100vw - 24px));max-height:90dvh;overflow:auto;font-size:16px;line-height:1.65}.tutorial-head,.tutorial-nav{display:flex;justify-content:space-between;align-items:center;gap:8px}.tutorial-steps{display:flex;gap:6px;margin-top:12px}.tutorial-steps i{height:4px;background:#44536a;flex:1}.tutorial-steps i.active{background:#e7c378}.tutorial-row{display:grid;grid-template-columns:44px repeat(3,1fr);gap:5px;margin:5px 0}.tutorial-board{display:block;max-width:430px;margin:12px auto}.tutorial-cell{position:relative;min-height:64px;padding:4px;font-size:14px;display:flex;flex-direction:column;align-items:center}.tutorial-cell img{height:40px;max-width:55px;object-fit:contain}.tutorial-cell small{font-size:12px}.tutorial-target{border:2px solid #e7c378!important}.tutorial-front{text-align:center;font-size:12px;color:#b9c8d9}.tutorial-roster{display:flex;gap:8px}.tutorial-roster img{height:40px}.tutorial-task,.tutorial-feedback{padding:10px;border:1px solid #536780;border-radius:6px}.tutorial-feedback.success{color:#e7c378}.tutorial-card{display:flex;gap:14px;align-items:center}.tutorial-card b{font-size:28px}.tutorial-nav{margin-top:16px}.tutorial-nav button{font-size:14px}.header-actions{flex-wrap:wrap}.tutorial-rear,.tutorial-confirm{font-size:12px}
/* Guided practice */
.tutorial-dialog{width:min(640px,96vw);max-height:94dvh;overflow:auto;padding:24px;border:1px solid #657b96;border-radius:16px;background:#152337;color:#edf3fc;overscroll-behavior:contain}.tutorial-dialog::backdrop{background:#050c17d9}.tutorial-head{display:flex;justify-content:space-between;align-items:center;padding:0;border:0;gap:12px}.tutorial-head>span{color:#d9bc7b;font-size:14px}.tutorial-head button{padding:4px 12px;font-size:22px}.tutorial-steps{display:flex;gap:6px;margin:14px 0 18px}.tutorial-steps i{height:4px;flex:1;border-radius:3px;background:#364b67}.tutorial-steps i.active{background:#e7c378}.tutorial-dialog h2{font-size:24px;margin:8px 0 10px}.tutorial-copy{font-size:16px;line-height:1.7;margin:0 0 14px;color:#c9d7e8}.tutorial-task{font-size:16px;padding:12px;background:#253b55;border-radius:9px;line-height:1.6;margin:12px 0}.tutorial-roster{display:flex;gap:8px;margin:12px 0}.tutorial-roster button{flex:1;font-size:14px;padding:8px;display:flex;align-items:center;justify-content:center;gap:6px}.tutorial-roster img{width:26px;height:34px;object-fit:contain}.tutorial-card{display:flex;align-items:center;gap:12px;margin:12px 0}.tutorial-card b{display:flex;align-items:center;justify-content:center;width:36px;height:46px;border-radius:6px;background:#f3eedc;color:#b33a40;font-size:28px}.tutorial-card span{font-size:14px;color:#d5dfed}.tutorial-practice{padding:12px;border:1px solid #3a526e;border-radius:12px;background:#0c1929}.tutorial-board>strong{font-size:14px;display:block;margin-bottom:6px;color:#8cc6f3}.tutorial-board:first-child>strong{color:#f3a1a7}.tutorial-rows{display:grid;gap:5px}.tutorial-row{display:grid;grid-template-columns:32px repeat(3,minmax(0,1fr));gap:5px;align-items:stretch}.tutorial-row>span{font-size:12px;color:#a7b9ce;align-self:center}.tutorial-cell{height:60px;position:relative;overflow:hidden;background:#182b41;color:#dfe9f7;border:1px dashed #3e5773;border-radius:7px;padding:4px;text-align:left}.tutorial-cell>span,.tutorial-cell>small{display:block;position:relative;z-index:1}.tutorial-cell>span{font-size:14px}.tutorial-cell>small{font-size:12px;color:#c5d3e3}.tutorial-cell img{position:absolute;right:5px;bottom:2px;width:44px;height:52px;object-fit:contain;opacity:.45}.tutorial-cell.enemy{border-left:3px solid #cf7c88}.tutorial-cell.ally{border-left:3px solid #66abe4}.tutorial-cell.tutorial-target{border:2px solid #d7b872;box-shadow:0 0 0 1px #bd9d4930}.tutorial-cell.selected{background:#3f4760;border-color:#f4d791}.tutorial-cell:disabled{opacity:1;cursor:default}.tutorial-rear{position:absolute;right:4px;top:2px;font-size:12px;color:#edd3ab}.tutorial-confirm{position:absolute;right:3px;bottom:2px;font-size:12px;background:#e7c378;color:#152337;padding:1px 4px;border-radius:4px}.tutorial-front{text-align:center;color:#8399b5;font-size:12px;letter-spacing:.15em;margin:8px}.tutorial-ability{display:flex;justify-content:center;padding-top:12px}.tutorial-feedback{min-height:48px;font-size:14px;line-height:1.6;margin:12px 0;color:#d7c6a1}.tutorial-feedback.success{color:#c5e3ab}.tutorial-nav{display:flex;justify-content:space-between;gap:8px;padding:12px 0 0;border-top:1px solid #3b526e;position:sticky;bottom:-24px;background:#152337;margin-top:10px}.tutorial-nav button{font-size:14px;padding:10px 14px}.tutorial-summary{display:grid;gap:10px;margin:20px 0}.tutorial-summary p{font-size:16px;line-height:1.7;border:1px solid #3f5878;padding:16px;border-radius:10px;margin:0}.tutorial-summary b{color:#ebce88}.tutorial-tip{font-size:16px;line-height:1.7;color:#c9d7e8}
@media(max-width:760px){header{flex-wrap:wrap}.header-actions{flex-wrap:wrap;gap:5px}.header-actions #tutorialButton{font-size:12px;padding:5px 7px}.tutorial-dialog{padding:16px;max-height:94dvh}.tutorial-dialog h2{font-size:22px}.tutorial-head>span{font-size:12px}.tutorial-copy,.tutorial-task{font-size:14px}.tutorial-practice{padding:8px}.tutorial-cell{height:54px;padding:3px}.tutorial-cell>span{font-size:13px}.tutorial-cell img{width:33px;height:42px;opacity:.3}.tutorial-roster button{font-size:13px;padding:6px 4px}.tutorial-roster img{width:22px;height:28px}.tutorial-nav{bottom:-16px;padding-bottom:3px}.tutorial-nav button{font-size:13px;padding:9px 11px}.tutorial-feedback{font-size:14px}}

.rank-icon{width:30px;height:30px;object-fit:cover;vertical-align:middle;border-radius:7px;margin-right:7px;flex-shrink:0}.achievement-tier h2 .rank-icon,.hub-profile h2 .rank-icon{width:46px;height:46px}.draft-card.banned{opacity:.4}.draft-ban-slots{display:flex;gap:8px;flex-wrap:wrap;margin:10px 0}.draft-ban-slots img{width:42px;height:42px;object-fit:contain}.draft-countdown{color:#e7c378;font-weight:bold}.draft-countdown.clock-low{color:#ff8d8d}

/* v1.01: the gallery owns the available height, with a compact fixed summary. */
body.draft-view{height:100dvh;overflow:hidden}
body.draft-view main{height:100dvh;max-height:100dvh;display:flex;flex-direction:column;gap:6px;padding:10px 14px;overflow:hidden}
body.draft-view main>header{flex:none;min-height:32px;padding:0 0 5px;justify-content:flex-end}
body.draft-view .brand,body.draft-view .topline,body.draft-view main>footer,body.draft-view #tutorialButton{display:none}
body.draft-view .header-actions button{font-size:14px;padding:5px 9px}
body.draft-view .workspace:has(.draft-stage){flex:1 1 0;min-height:0;display:flex;flex-direction:column;overflow:hidden}
body.draft-view .workspace aside,body.draft-view .workspace .control,body.draft-view .workspace .roster-panel,body.draft-view .workspace .history{display:none}
body.draft-view .workspace:has(.draft-stage) .arena{display:flex;flex-direction:column;flex:1 1 0;height:auto;min-height:0;width:100%;overflow:hidden;padding:0}
body.draft-view .workspace:has(.draft-stage) #boards{flex:1 1 0;height:auto;min-height:0;display:flex;flex-direction:column}
body.draft-view .draft-stage{flex:1 1 0;height:auto;min-height:0;width:100%;display:flex;flex-direction:column;padding:8px 10px;overflow:hidden}
body.draft-view .draft-stage-head{flex:none;font-size:12px;padding-bottom:4px;gap:6px}
body.draft-view .draft-stage-head strong{font-size:22px}
body.draft-view .draft-stage-head button{font-size:12px;padding:3px 7px}
body.draft-view .draft-matchup{flex:none;padding:5px 0;gap:8px}
body.draft-view .draft-side>span{font-size:12px;margin:0 0 3px}
body.draft-view .draft-slot{height:46px;min-height:0;padding:2px;flex-direction:row;gap:4px;justify-content:center}
body.draft-view .draft-slot img{position:static;width:34px;height:38px;object-fit:contain}
body.draft-view .draft-slot strong{font-size:12px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
body.draft-view .draft-slot small{display:none}
body.draft-view .draft-gallery-head{flex:none;padding:4px 0 5px;align-items:center;min-height:35px}
body.draft-view .draft-gallery-head strong{font-size:14px}
body.draft-view .draft-gallery-head small{font-size:14px;white-space:nowrap}
body.draft-view .draft-gallery{flex:1 1 0;min-height:0!important;overflow-y:auto;overflow-x:hidden;align-content:start;grid-template-columns:repeat(6,minmax(0,1fr));grid-auto-rows:130px;gap:7px;padding:4px 3px 10px;overscroll-behavior:contain;touch-action:pan-y}
body.draft-view .draft-card{height:130px;min-height:0}
body.draft-view .draft-card img{height:85px}
body.draft-view .draft-card strong{font-size:14px}
body.draft-view .draft-card small{font-size:12px}
body.draft-view .draft-detail,body.draft-view .draft-detail:has(img){flex:0 0 auto;min-height:32px;height:auto;max-height:80px;margin:6px 0 0;padding:6px 8px;gap:8px;overflow:hidden;align-items:center}
body.draft-view .draft-detail>img{width:44px;height:48px;align-self:center}
body.draft-view .draft-detail-copy{display:block;flex:1;min-width:0;overflow:hidden}
body.draft-view .draft-detail-copy>strong{font-size:15px;line-height:1.3}
body.draft-view .draft-detail-copy>strong small{font-size:12px}
body.draft-view .draft-skill-name{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#bac8da;font-size:12px}
body.draft-view .draft-detail-actions{flex:none;display:flex;flex-wrap:nowrap;padding:0;gap:5px}
body.draft-view .draft-detail-actions button{font-size:14px;min-height:36px;padding:5px 9px}
body.draft-view .draft-detail-hint{font-size:12px}
.draft-ban-summary{position:relative;flex:none;font-size:12px;line-height:1.5;min-height:23px;color:#b7c7da}
.draft-ban-summary summary{cursor:pointer;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:2px 0}
.draft-ban-summary summary span{color:#9ab2a0}
.draft-ban-summary>div{position:absolute;top:100%;left:0;right:0;z-index:15;background:#182b41;border:1px solid #536780;border-radius:8px;box-shadow:0 6px 20px #0008;padding:8px 12px}
.draft-ban-summary p{margin:4px 0;font-size:14px}
.draft-countdown,.clock-action{display:inline-block;min-width:100px;transform-origin:right center;font-variant-numeric:tabular-nums;transition:transform .2s ease,color .2s ease}
.draft-countdown.clock-low,.clock-action.clock-low{transform:scale(1.12);color:#ffacac}
.setup-countdown{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:7px 10px;margin:5px 0;border:1px solid #596a82;border-radius:8px;font-size:14px}
@media(max-width:760px){
 body.draft-view main{padding:4px 5px max(5px,env(safe-area-inset-bottom));gap:3px}
 body.draft-view main>header{min-height:30px;padding-bottom:2px}
 body.draft-view .draft-stage{padding:5px 6px}
 body.draft-view .draft-matchup{gap:4px;grid-template-columns:minmax(0,1fr) 20px minmax(0,1fr)}
 body.draft-view .draft-slot{height:38px;flex-direction:column;padding:1px}
 body.draft-view .draft-slot img{width:26px;height:27px}
 body.draft-view .draft-slot strong{font-size:10px;line-height:1;max-width:100%;padding:0}
 body.draft-view .draft-gallery{grid-template-columns:repeat(3,minmax(0,1fr));grid-auto-rows:112px;gap:5px}
 body.draft-view .draft-card{height:112px;padding:3px}
 body.draft-view .draft-card img{height:66px}
 body.draft-view .draft-card strong{font-size:13px}
 body.draft-view .draft-card small{font-size:11px}
 body.draft-view .draft-detail-actions button{font-size:12px;padding:5px 7px}
 body.draft-view .draft-detail-copy>strong{font-size:13px}
 .draft-ban-summary summary span{display:none}
}
@media(max-height:500px){body.draft-view .draft-matchup{display:none}body.draft-view .draft-stage-head{padding:0}body.draft-view .draft-detail,body.draft-view .draft-detail:has(img){max-height:56px;margin-top:3px;padding:3px 6px}}
#patchNotes{position:fixed;inset:12px auto auto 50%;transform:translateX(-50%);margin:0;width:min(720px,calc(100vw - 24px));max-width:720px;max-height:calc(100dvh - 24px);overflow-y:auto;overscroll-behavior:contain;padding:0 20px 20px;animation:patch-open .18s ease-out;font-size:16px;line-height:1.75}
.patch-heading{position:sticky;top:0;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:14px 0;background:var(--panel);z-index:1;border-bottom:1px solid var(--line)}
#patchNotes .patch-heading h2{margin:0;font-size:21px}
#patchNotes .patch-entry{padding:14px 0;border-bottom:1px solid var(--line)}
#patchNotes .patch-entry h3{font-size:18px;line-height:1.4;margin:0 0 10px;color:var(--gold)}
#patchNotes p,#patchNotes li{font-size:15px;line-height:1.75;color:#d3dfec}
#patchNotes ul{padding-left:22px;margin:8px 0}
#patchNotes li{margin:7px 0}
#patchNotes .patch-old{padding:12px 0;border-bottom:1px solid var(--line)}
#patchNotes .patch-old summary{font-size:16px;font-weight:650;color:#e7c378;cursor:pointer}
#patchNotes .patch-old ul{padding-top:5px}
@keyframes patch-open{from{opacity:0;translate:0 -12px}to{opacity:1;translate:0 0}}
@media(prefers-reduced-motion:reduce){#patchNotes{animation:none}.draft-countdown,.clock-action{transition:none}}
/* v1.05 — Draft adventure */
#adventureScreen[hidden],#adventureBattle[hidden]{display:none!important}.adventure-map-open{overflow:hidden}#adventureScreen{position:fixed;inset:0;z-index:180;background:#0c1726;color:#ecf1f7;overflow:auto;font-size:16px}.adventure-shell{max-width:1160px;margin:auto;padding:28px 28px 40px}.adventure-header{display:flex;justify-content:space-between;align-items:center;gap:16px;border-bottom:1px solid #344053;padding-bottom:20px}.adventure-header h1{font-size:30px;margin:5px 0}.adventure-kicker{display:block;color:#e7c378;font-size:13px;letter-spacing:.12em}.adventure-progress{display:flex;justify-content:space-between;gap:20px;align-items:center;margin-top:24px}.adventure-progress strong{font-size:20px}.adventure-progress p,.adventure-save-note{color:#bdc9d9;font-size:14px;line-height:1.7}.adventure-total{color:#f3cd79;font-size:32px;white-space:nowrap}.adventure-total small{font-size:16px;color:#aab9cd}.adventure-progressbar{width:100%;height:7px;accent-color:#e7c378}.adventure-map-layout{display:grid;grid-template-columns:minmax(0,1.2fr) minmax(310px,1fr);gap:28px;margin-top:24px}.adventure-stages{display:grid;grid-template-columns:1fr 1fr;gap:12px;align-content:start}.adventure-stage{position:relative;display:grid;grid-template-columns:32px 50px 1fr;align-items:center;gap:10px;padding:14px;text-align:left;background:#182639;border:1px solid #35455d;border-radius:12px;min-height:100px;color:#eaf1fb}.adventure-stage img{width:48px;height:58px;object-fit:contain}.adventure-stage .stage-number{font-size:20px;color:#9eaec5;font-variant-numeric:tabular-nums}.adventure-stage .stage-title{font-size:15px;line-height:1.5}.adventure-stage .adventure-stars{grid-column:3;font-size:17px;letter-spacing:3px;color:#8090a5}.adventure-stars .earned,.adventure-result-stars .earned{color:#f4ca72}.adventure-stage.selected{border-color:#f0c66f;box-shadow:inset 0 0 0 1px #f0c66f;background:#263144}.adventure-stage.boss{grid-column:1/-1;background:#342831;border-color:#98714e}.adventure-stage:disabled{opacity:.42;cursor:not-allowed}.adventure-detail{background:#152235;border:1px solid #34455c;border-radius:16px;padding:25px;align-self:start;position:sticky;top:20px}.adventure-detail h2{font-size:25px;margin:12px 0}.adventure-focus{display:flex;align-items:center;gap:20px;margin:16px 0}.adventure-focus img{width:84px;height:90px;object-fit:contain}.adventure-focus h3{font-size:20px;margin:5px 0}.adventure-focus small{font-size:14px;color:#acbcd0}.adventure-objectives{list-style:none;padding:0;margin:18px 0}.adventure-objectives li{display:flex;align-items:flex-start;gap:10px;line-height:1.65;padding:10px 0;border-bottom:1px solid #344155;font-size:15px}.adventure-objectives li>span{font-size:22px;color:#91a0b3;flex:none}.adventure-objectives li.complete>span{color:#f4ca72}.adventure-tip{font-size:14px;line-height:1.8;color:#c1cfdf}.adventure-enemies{display:flex;flex-wrap:wrap;gap:8px;margin:18px 0}.adventure-enemies small{flex-basis:100%;color:#afbed1;font-size:14px}.adventure-enemies span{border:1px solid #48546a;padding:6px 8px;border-radius:6px;font-size:13px}.adventure-detail>button{width:100%;margin-top:10px;padding:14px}.adventure-footer{margin-top:28px;color:#afbed1;font-size:14px;line-height:1.6}.adventure-save-note a{color:#f3ce84}.adventure-error{background:#542b38;padding:14px;border-radius:8px}.adventure-draft{margin-top:25px}.adventure-draft>.adventure-kicker{margin-top:20px}.adventure-draft h2{font-size:26px}.adventure-draft h2 small{color:#c3a76b;font-size:18px}.adventure-party{display:flex;gap:20px;margin:18px 0}.adventure-party span{display:flex;gap:8px;align-items:center;font-size:15px}.adventure-party img{width:44px;height:48px;object-fit:contain}.adventure-offers{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px}.adventure-offers article{display:flex;flex-direction:column;background:#18273c;border:1px solid #3c4e67;padding:22px;border-radius:14px}.adventure-character-art{height:130px;width:100%;object-fit:contain}.adventure-offers h3{font-size:20px;line-height:1.5}.adventure-offers h3 small{display:block;font-size:14px;color:#c5d2e3}.adventure-offers p{font-size:15px;line-height:1.7}.adventure-offers details{margin-bottom:20px;font-size:14px}.adventure-offers button{margin-top:auto;padding:13px}.adventure-entry{border-color:#e7c378!important}#adventureBattle{margin:8px 0 14px;background:#19283b;border:1px solid #665539;border-radius:10px;padding:12px 16px;font-size:14px}.adventure-battle-title{display:flex;align-items:center;justify-content:space-between;gap:8px}.adventure-battle-title strong{color:#f0ce8a;font-size:16px}.adventure-battle-title button{font-size:13px}#adventureBattle details{margin-top:8px}#adventureBattle summary{cursor:pointer;min-height:28px}.adventure-warning{margin:10px 0;padding:9px 12px;border-left:3px solid #ffae71;background:#392d2c;color:#ffd5b4;font-size:14px}.adventure-danger{box-shadow:inset 0 0 0 2px #fba16e!important}.adventure-result-stars{text-align:center;font-size:38px;letter-spacing:10px;margin:20px}.adventure-result-actions{display:flex;gap:12px;flex-wrap:wrap}.adventure-playing #reset{display:none}.adventure-star-badge{font-size:13px;color:#f4ca72;white-space:nowrap;margin-left:5px}.adventure-playing .topline{margin-top:8px}.adventure-playing #adventureBattle details[open]{max-height:200px;overflow:auto}
@media(max-width:760px){.adventure-shell{padding:18px 14px 30px}.adventure-header h1{font-size:24px}.adventure-header button{font-size:13px;padding:9px}.adventure-progress{margin-top:18px}.adventure-progress strong{font-size:17px}.adventure-total{font-size:27px}.adventure-map-layout{display:flex;flex-direction:column;gap:18px;margin-top:16px}.adventure-stages{grid-template-columns:repeat(5,minmax(0,1fr));gap:7px}.adventure-stage{display:flex;flex-direction:column;gap:4px;min-height:90px;padding:7px 3px}.adventure-stage img{width:34px;height:36px}.adventure-stage .stage-number{font-size:15px}.adventure-stage .stage-title{display:none}.adventure-stage .adventure-stars{font-size:13px;letter-spacing:0}.adventure-stage.boss{grid-column:auto}.adventure-detail{position:static;padding:18px}.adventure-detail h2{font-size:22px}.adventure-focus{margin:8px 0}.adventure-focus img{height:65px;width:70px}.adventure-offers{grid-template-columns:1fr;gap:12px}.adventure-offers article{display:grid;grid-template-columns:70px 1fr;column-gap:15px;padding:16px}.adventure-character-art{height:85px;grid-row:1/3}.adventure-offers h3{margin:0}.adventure-offers article>p{grid-column:2;margin:7px 0}.adventure-offers details{grid-column:1/-1;margin:10px 0}.adventure-offers button{grid-column:1/-1}.adventure-playing main{height:auto;min-height:100dvh;overflow:visible}.adventure-playing .workspace{height:auto!important;min-height:650px;overflow:visible}.adventure-playing .boards{height:auto!important}.adventure-playing{overflow:auto!important}.adventure-playing .board{min-height:280px}.adventure-playing .cell{min-height:75px}.adventure-playing #adventureBattle{margin:5px 0 8px;padding:10px}.adventure-playing .header-actions{flex-wrap:wrap}.adventure-playing .workspace.battle-view{display:grid;grid-template-columns:1fr}.adventure-playing .battle-view aside{max-height:none;overflow:visible}}
.adventure-setup-team{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.adventure-setup-team>div{min-width:0}.adventure-setup-team button{display:flex;flex-direction:column;align-items:center;width:100%;height:145px;padding:8px;background:#1d2e43;color:#edf3ff;border:1px solid #43556f}.adventure-setup-team button.chosen{border:2px solid #e7c378}.adventure-setup-team img{width:100%;height:75px;object-fit:contain}.adventure-setup-team strong{font-size:14px;line-height:1.4;overflow-wrap:anywhere}.adventure-setup-team small{font-size:12px}.adventure-setup-team details{font-size:14px;margin-top:6px}.adventure-setup-team details[open]{grid-column:1/-1}.adventure-setup-team .ability-copy{font-size:14px!important;line-height:1.6!important}
@media(max-width:760px){.adventure-playing main{max-height:none}.adventure-playing .workspace:not(.battle-view){display:flex;flex-direction:column;min-height:0}.adventure-playing .workspace:not(.battle-view) .roster-panel{order:1;overflow:visible}.adventure-playing .workspace:not(.battle-view) .arena{order:2;overflow:visible}.adventure-playing .workspace:not(.battle-view) .control{order:3;overflow:visible}.adventure-playing .workspace:not(.battle-view) .history{order:4}.adventure-playing .workspace aside{display:contents}.adventure-playing .workspace.battle-view{grid-template-rows:auto auto auto;min-height:0}.adventure-playing .arena{height:auto!important;overflow:visible!important}.adventure-playing #boards{height:auto!important;min-height:580px!important}.adventure-playing .workspace.battle-view .control{max-height:none;overflow:visible}.adventure-playing .cell .name,.adventure-playing .cell .hp{font-size:13px;line-height:1.3}.adventure-playing .board-head strong{font-size:13px}.adventure-playing #instruction{font-size:14px;line-height:1.6}.adventure-playing .control #actions button{font-size:14px;padding:10px}.adventure-playing .effect-tag{font-size:10px}.adventure-playing .cell:has(.effect-tag) .name{margin-top:16px}}

/* Adventure entrance and enemy formation, v1.06 */
#adventureLauncher{flex:none;width:100%;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:14px 20px;border:1px solid #ca9d53;background:linear-gradient(110deg,#302615,#151b26);color:#f9dfaa;text-align:left;margin:8px 0;border-radius:12px;cursor:pointer}
#adventureLauncher[hidden]{display:none}#adventureLauncher strong{font-size:20px;margin-left:12px}#adventureEntry{background:#775421;color:#fff0c7;border:1px solid #c99b50;white-space:nowrap;font-weight:700}
.adventure-nine{display:grid;grid-template-columns:repeat(3,1fr);gap:5px;margin:10px 0}.adventure-nine>span{min-height:78px;border:1px solid #526078;border-radius:7px;background:#18202e;display:flex;flex-direction:column;align-items:center;justify-content:center;font-size:12px;text-align:center}.adventure-nine img{width:46px;height:46px;object-fit:contain}.adventure-nine .empty{color:#64748b}.adventure-enemy-preview>small{color:#b8c3d3}
@media(max-width:650px){#adventureLauncher{padding:10px;flex-direction:column;align-items:flex-start;gap:4px}#adventureLauncher strong{font-size:17px}#adventureEntry{font-size:12px;padding:7px 9px}}
/* Story companions: dark camp surfaces, gold star currency. */
.story-map-actions{display:flex;justify-content:flex-end;margin:10px 0}.story-wallet{display:flex;flex-wrap:wrap;gap:12px;align-items:center;padding:18px;background:#25251f;border:1px solid #9d8248;border-radius:12px;color:#f3d996;margin:18px 0}.story-wallet strong{font-size:24px}.story-wallet span{font-size:14px;color:#d2cab4}.story-recruit{display:grid;grid-template-columns:220px 1fr;gap:28px;align-items:start}.story-portrait{position:sticky;top:12px;text-align:center;padding:22px;background:radial-gradient(ellipse at center,#41495a,#141c29 70%);border-radius:14px}.story-portrait img{width:100%;height:300px;object-fit:contain}.story-portrait h2{font-size:28px;margin:14px 0 4px}.story-training{min-width:0}.story-training>p,.story-choice>p{font-size:16px;line-height:1.7}.story-upgrade{display:flex;justify-content:space-between;gap:14px;align-items:center;padding:18px 0;border-bottom:1px solid #334155}.story-upgrade>div{flex:1;min-width:0}.story-upgrade h3{margin:0 0 8px;font-size:18px}.story-upgrade p{margin:6px 0;font-size:16px}.story-upgrade strong{font-size:23px;color:#f7d89e}.story-upgrade small{font-size:14px;color:#bdc6d4}.story-upgrade progress{display:block;width:100%;height:7px;margin:12px 0;accent-color:#ddb76f}.story-upgrade button{min-width:110px;padding:12px}.story-training details{margin:20px 0}.story-muted{color:#abb8cc;font-size:14px;line-height:1.7}.story-choice-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,360px));gap:18px;margin:24px 0}.story-choice-cards article{padding:20px;border:1px solid #5c6577;border-radius:12px;background:#172232}.story-choice-cards img{display:block;width:100%;height:210px;object-fit:contain}.story-choice-cards button{width:100%;margin-top:12px}.story-dialog{width:min(760px,calc(100% - 24px));max-height:90dvh;overflow:auto;padding:22px;background:#121c2b;color:#eef1f8;border:1px solid #b29965;border-radius:16px}.story-dialog::backdrop{background:#030811cf}.story-scene-head{display:flex;align-items:center;justify-content:space-between;gap:16px;color:#e3c68d;font-size:14px}.story-scene{display:grid;grid-template-columns:180px 1fr;gap:22px;align-items:center;min-height:330px}.story-scene>img{width:100%;height:300px;object-fit:contain}.story-speech{padding:24px;border-left:2px solid #9f8c69;background:#1c2838;border-radius:0 10px 10px 0}.story-speech>strong{font-size:17px;color:#edcf97}.story-speech p{font-size:18px;line-height:1.9;margin:14px 0}.story-scene-controls{display:flex;align-items:center;justify-content:flex-end;gap:14px}.story-scene-controls small{margin-right:auto;font-size:14px;color:#aebdd1}.story-scene-controls button{min-width:90px}
@media(max-width:650px){.story-recruit{grid-template-columns:1fr;gap:12px}.story-portrait{position:static;padding:16px}.story-portrait img{height:190px}.story-portrait h2{margin-top:6px}.story-upgrade{padding:16px 0;gap:10px}.story-upgrade button{min-width:94px;font-size:14px;padding:10px 8px}.story-scene{grid-template-columns:1fr;gap:8px;min-height:0}.story-scene>img{height:185px}.story-speech{padding:16px;min-height:150px}.story-speech p{font-size:17px;margin:8px 0}.story-dialog{padding:16px}.story-scene-controls{margin-top:18px}.story-wallet strong{font-size:22px}}
/* Battle dialogue stays over the board. Native modal makes the rest inert. */
.battle-dialogue{position:fixed;inset:auto 12px max(18px,env(safe-area-inset-bottom));margin:0 auto;width:min(640px,calc(100% - 24px));max-height:48dvh;overflow:auto;background:#fffdf5;border:3px solid #403c48;border-radius:22px;box-shadow:0 12px 48px #0005;padding:18px;color:#292633;z-index:10000}
.battle-dialogue::backdrop{background:#15122238}.battle-speech{display:flex;gap:16px;align-items:center}.battle-speech img{width:90px;height:120px;object-fit:contain;flex-shrink:0}.battle-speech p{font-size:17px;line-height:1.8;margin:8px 0;white-space:pre-line}.battle-speech strong{color:#795133}.battle-speech small{color:#766e79}.battle-dialogue>button{display:block;margin:12px 0 0 auto;min-width:110px}.battle-dialogue:before{content:'';position:absolute;top:-13px;left:48px;width:22px;height:22px;background:#fffdf5;transform:rotate(45deg);border-left:3px solid #403c48;border-top:3px solid #403c48}
.demon-nine{display:grid;grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(3,minmax(72px,1fr));position:relative;min-height:280px;background:radial-gradient(ellipse,#463149,#191422);border-radius:12px;overflow:hidden}.demon-nine>img{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;pointer-events:none}.demon-nine .giant-cell{z-index:1;background:transparent!important;border:1px solid #ffffff1c!important;box-shadow:none!important;min-height:80px;border-radius:0}.demon-nine .giant-cell:hover,.demon-nine .giant-cell.selected{background:#eec25624!important}.demon-health{position:absolute;bottom:4px;left:8px;right:8px;text-align:center;color:white;background:#231627d9;font-weight:800;padding:6px;z-index:2;pointer-events:none}.demon-health i{display:block;background:#da656e;height:5px;margin-top:4px}.story-form{display:flex;flex-wrap:wrap;gap:8px;border:1px solid #cfc8dc;border-radius:12px;margin-top:14px}.story-form button[aria-pressed=true]{background:#6e528d;color:white}
@media(max-width:600px){.battle-dialogue{padding:12px;max-height:45dvh}.battle-speech{gap:8px}.battle-speech img{width:58px;height:90px}.battle-speech p{font-size:15px;line-height:1.65}.demon-nine{min-height:230px;grid-template-rows:repeat(3,minmax(62px,1fr))}.demon-nine .giant-cell{min-height:65px}}
.chapter-cinema{position:fixed;inset:0;z-index:8500;pointer-events:auto;overflow:hidden;color:#fff;display:grid;place-items:center}.chapter-cinema[hidden]{display:none}.cinema-field{position:absolute;inset:0;overflow:hidden}.cinema-cutin{position:absolute;inset:20% 0 24%;display:flex;justify-content:center;align-items:center;gap:24px;background:linear-gradient(90deg,transparent,#151626ef 25%,#151626ef 75%,transparent);border-block:2px solid #c6b48280;animation:cinema-enter .55s ease-out both}.cinema-cutin img{width:min(36vw,220px);height:100%;object-fit:contain;filter:drop-shadow(0 0 18px #ffffff66)}.cinema-cutin>div{display:flex;flex-direction:column;gap:10px}.cinema-cutin strong{font-size:clamp(30px,7vw,58px);letter-spacing:.12em;text-shadow:0 0 25px #ffeac0}.cinema-cutin small{font-size:16px;letter-spacing:.3em}.cinema-cutin span{color:#e4d9c9}.cinema-line{position:absolute;bottom:22%;left:0;right:0;text-align:center;font-size:clamp(24px,5vw,40px);text-shadow:0 0 18px #fff;letter-spacing:.18em}.cinema-wind,.cinema-gather,.cinema-fatal{background:linear-gradient(#0e071bb0,transparent,#2a164367)}.cinema-fatal{background:#101321}.nightwind-push .owner0 .unit-art{animation:blown-back 1.3s cubic-bezier(.12,.7,.25,1) both}.cinema-awaken{background:radial-gradient(ellipse at 50% 65%,#fff4bf8a,transparent 60%)}.cinema-awaken .cinema-cutin{background:transparent;border:0;animation:hero-emerge 2.1s ease-out both}.cinema-awaken .cinema-cutin img{width:min(55vw,320px);filter:drop-shadow(0 0 24px #fff9c9)}.cinema-awaken .cinema-cutin>div{display:none}.hero-awakening .owner0 .unit-art[src*="first-hero"]{filter:drop-shadow(0 0 20px #fff3a3)}.cinema-skill .cinema-cutin{background:linear-gradient(90deg,transparent,#35433df0 20%,#293b32f0 80%,transparent);border-color:#e7d898}.cinema-shield{background:linear-gradient(transparent 25%,#e8cd6725)}.cinema-shield .cinema-line{color:#fff7c9}
@keyframes cinema-enter{from{transform:translateX(-12%);opacity:0}to{transform:none;opacity:1}}@keyframes blown-back{0%{transform:translateY(-100px) rotate(-12deg);opacity:.65}65%{transform:translateY(12px) rotate(8deg)}100%{transform:none;opacity:1}}@keyframes hero-emerge{0%{opacity:0;transform:translateY(50px);filter:brightness(3)}60%{opacity:1;filter:brightness(1.2)}100%{transform:none;opacity:1;filter:brightness(1)}}
@media(prefers-reduced-motion:reduce){.nightwind-push .unit-art,.cinema-cutin,.story-actor{animation:none!important}}
dialog.chapter-cinema{border:0;margin:0;padding:0;width:100vw;height:100dvh;max-width:none;max-height:none;background:transparent}.chapter-cinema::backdrop{background:transparent}.chapter-cinema:focus{outline:none}

/* Blocking story dialogue: explicit dark surfaces and inherited readable text. */
#battleDialogue.battle-dialogue{background:#101014;color:#fff;border-color:#655e72;box-shadow:0 12px 48px #000b}#battleDialogue.battle-dialogue:before{background:#101014;border-color:#655e72}#battleDialogue .battle-speech p{color:#fff}#battleDialogue .battle-speech strong{color:#f1cd86}#battleDialogue .battle-speech small{color:#c0bac8}#battleDialogue::backdrop{background:#0007}.lamp-marker{position:absolute;width:32px;height:38px;object-fit:contain;right:4px;bottom:5px;z-index:4;pointer-events:none}.cell.empty .lamp-marker{width:55%;height:65%;right:22%;bottom:18%}

.story-companion-tabs{display:flex;gap:10px;margin:12px 0 20px;flex-wrap:wrap}.story-companion-tabs [aria-pressed="true"]{border-color:var(--gold,#e7c378);color:#e7c378}.cinema-soulBreak::backdrop{background:#000e}.cinema-soulBreak .cinema-field{background:radial-gradient(ellipse,#9ac5cf20,transparent 60%);animation:hero-arrival 1.6s ease-out}.cinema-soulBreak .cinema-line{color:#fff}

.adventure-chapters{display:flex;gap:10px;flex-wrap:wrap;margin:18px 0}.adventure-chapters button{flex:1;min-width:140px;text-align:left}.adventure-chapters small{display:block;margin-top:4px}.adventure-chapters button[aria-pressed="true"]{background:#e8c574;color:#17202d;border-color:#e8c574}

.story-scene:has(>.story-speech:only-child){grid-template-columns:1fr}.cinema-soulUnseal,.cinema-selfStrike,.cinema-soulBreak{background:#080812e6}.cinema-selfStrike .cinema-line,.cinema-soulBreak .cinema-line,.cinema-soulUnseal .cinema-line{bottom:12%;padding:0 16px;font-size:clamp(18px,4.5vw,28px);letter-spacing:.04em}

/* Turn counts are secondary information in character descriptions. */
.cooldown-box,#enemyDetail .cooldown-box,.draft-dialog-body .cooldown-box,.setup-character-detail .cooldown-box,.roster-item .cooldown-box{font-size:.75rem;line-height:1.45;padding:6px 8px}.cooldown-box b,.cooldown-box span{font-size:inherit}.enemy-detail .effect-details,.roster-item .effect-details{font-size:.75rem;line-height:1.45}

#adventureMenu{flex:none;width:100%;margin:8px 0;border:1px solid #665539;border-radius:10px;background:#151b26;color:#f9dfaa}#adventureMenu[hidden]{display:none!important}#adventureMenu>summary{padding:9px 14px;cursor:pointer;font-size:14px;font-weight:600}#adventureMenu>#adventureLauncher{width:calc(100% - 16px);margin:0 8px 8px}

.hub-logout{display:block;text-align:center;text-decoration:none;border:1px solid #43536a;border-radius:8px;padding:10px 14px;color:#c7d3e4;font-size:14px}.hub-logout:hover{color:#fff;border-color:#a6b8d1}.hub-logout[aria-disabled="true"]{opacity:.5;cursor:wait}.hub-logout:focus-visible{outline:2px solid #e7c378;outline-offset:3px}@media(max-width:760px){.hub-play{flex-wrap:wrap}.hub-play>.hub-logout{flex-basis:100%}}

/* A single bounded status row; HP and name keep their own space below. */
.cell .effect-tag{position:absolute;inset:4px 4px auto 4px;display:flex;align-items:center;justify-content:flex-end;gap:2px;height:15px;max-width:none;padding:0;border:0;background:none;white-space:nowrap;font-size:9px;line-height:1.2;overflow:hidden;pointer-events:none;text-shadow:none;z-index:3}
.cell .status-badge,.cell .status-more{display:block;min-width:0;max-width:55%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border:1px solid #8b734a;border-radius:4px;background:#132033ed;color:#ffe2a1;padding:1px 3px;font-size:inherit;line-height:1.2}
.cell .status-more{flex:none;max-width:none;color:#cbd6e5;border-color:#53647b}
.cell:has(.effect-tag){padding-top:23px;min-height:90px}
.cell:has(.effect-tag) .name,.adventure-playing .cell:has(.effect-tag) .name{margin-top:0}
@media(max-width:760px){.cell .effect-tag{inset:3px 3px auto;height:14px;font-size:8px}.cell:has(.effect-tag){padding-top:21px;min-height:80px}.cell .status-badge,.cell .status-more{padding:1px 2px}}

.story-setting {
  position: relative;
  overflow: hidden;
  margin: .55rem 0 .85rem;
  border-radius: .65rem;
  background: #172235;
  color: #fff7e6;
}
.story-setting img {
  display: block;
  width: 100%;
  height: clamp(96px, 21dvh, 190px);
  object-fit: cover;
  object-position: center 54%;
}
.story-setting figcaption {
  padding: .5rem .7rem .6rem;
  background: #172235;
  font-size: .875rem;
  line-height: 1.45;
}
.story-dialog:has(.story-setting) .story-scene { min-height: 0; }
.story-dialog:has(.story-setting) .story-speaker-art { max-height: 165px; }
#battleDialogue:has(.story-setting) { max-height: 68dvh; }

.cinema-lantern {
  background: linear-gradient(#10172860, #101728cc), url("art/story-causeway.jpg") center 75% / cover;
}
.cinema-lantern .cinema-cutin {
  border-color: #edbb7180;
  background: linear-gradient(90deg,transparent,#251910ed 23%,#251910ed 77%,transparent);
}
.cinema-lantern .cinema-cutin strong { font-size: clamp(24px, 5.5vw, 50px); }

.cinema-lanternStep .cinema-line {
  bottom: 19%;
  padding: .7rem;
  background: #111927df;
  letter-spacing: .06em;
}

@media (prefers-reduced-motion: reduce) {
  .cinema-lantern .cinema-cutin { animation: none; }
}

.cinema-shadowThreat .cinema-field,.cinema-shadowResolve .cinema-field,.cinema-gateBreak .cinema-field{background:linear-gradient(0deg,#0e1325dd,transparent),url(art/story-checkpoint.jpg) center/cover}
.cinema-shadowBlink .cinema-field,.cinema-shadowAwaken .cinema-field{background:linear-gradient(165deg,transparent 38%,#c9aeff 43%,#342455db 46%,#101021d9 75%),url(art/story-lock-gate.jpg) center/cover}
.cinema-shadowAwaken .cinema-cutin strong{color:#ffdc8f;text-shadow:0 2px 8px #161022}
.ambush-cut-in .cutin-stage{background:repeating-linear-gradient(165deg,#251a41 0 15%,#805caa 16%,#1b132b 18% 30%);border-block:3px solid #e5b9ff}

.story-picture{position:relative}
.story-setting .story-landscape{width:100%;object-fit:cover}
.story-picture:has(.story-cast) .story-landscape{height:clamp(124px,25dvh,208px);filter:brightness(.73)}
.story-cast{position:absolute;inset:0;background:linear-gradient(transparent 52%,#101523ad)}
.story-actor{position:absolute;left:var(--position);bottom:7%;width:24%;height:80%;translate:-50% 0;display:flex;flex-direction:column;align-items:center;justify-content:end}
.story-setting .story-actor img{height:85%;width:100%;min-height:0;object-fit:contain;filter:drop-shadow(0 3px 5px #090914)}
.story-actor span{white-space:nowrap;background:#111725ee;color:#fff4d9;border-radius:.25rem;padding:.1rem .35rem;font-size:clamp(.72rem,3vw,.9rem);line-height:1.3}
.story-actor-vanish{opacity:0;animation:story-vanish .65s .22s both}
.story-actor-appear{animation:story-appear .55s both}
.story-actor-startled{animation:story-recoil .5s .22s both}
.story-actor-step{animation:story-step .56s ease-out both}
.story-actor-recoil{animation:story-recoil .48s .35s both}
.cinema-story-picture{background:#101623;display:grid;align-content:center;padding:1rem}
.cinema-story-picture .story-setting{width:min(100%,850px);margin:0 auto}
.cinema-story-picture .story-picture .story-landscape{height:min(48dvh,420px)}
.cinema-story-picture .cinema-line{position:static;margin-top:1rem;letter-spacing:normal;font-size:clamp(1rem,4vw,1.65rem);text-shadow:none}
.bridge-boss-warning{margin:.35rem 0;padding:.3rem .55rem;background:#392930;color:#fff4df;font-size:.875rem;border-radius:.35rem}
@keyframes story-vanish{from{opacity:1}to{opacity:0;scale:.72 1.08}}
@keyframes story-appear{from{opacity:0;transform:translateX(22%) skewX(-18deg)}to{opacity:1;transform:none}}
@keyframes story-step{from{transform:translateX(-56%)}to{transform:none}}
@keyframes story-recoil{from{transform:translateX(-18%) rotate(-8deg)}to{transform:none}}
img[src*="watarite"]:is(.unit-art,.story-speaker-art),.battle-speech img[src*="watarite"],.cinema-cutin img[src*="watarite"]{scale:1.24}
.story-actor-warp{animation:rescue-warp .47s both}
@keyframes rescue-warp{0%,18%{opacity:0}19%{opacity:1;filter:brightness(4) drop-shadow(0 0 10px #d9bcff)}100%{filter:none}}

.cinema-shadowAwaken .cinema-cutin img[src*="watarite"]{width:min(65vw,460px);max-width:none;object-position:left center}

.story-cast{container-type:size}
.story-cast .story-actor{bottom:16%;height:calc(var(--cm)*.32%);height:min(calc(var(--cm)*.32cqh),calc(var(--cm)*.165cqw));width:auto;justify-content:flex-end}
.story-setting .story-cast .story-actor img{height:100%;width:auto;max-width:none;flex:none}
.story-cast .story-actor span{position:absolute;top:100%;left:50%;translate:-50% 0}
.story-cast .story-actor img[src*="watarite"]{translate:17% 0}

.enemy-detail.hover-detail { pointer-events: none; }
.bot-watch-config { width: min(680px, calc(100vw - 24px)); }
.bot-watch-teams { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 12px; }
.bot-watch-teams fieldset { min-width: 0; }
.bot-watch-slot { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 8em); gap: 5px; margin: 6px 0; }

.cinema-backdrop {position:absolute;inset:0;width:100%;height:100%;object-fit:contain;background:#101623}
.cinema-backdrop + .cinema-line {
 bottom:8%;padding:.65rem 1rem;background:#121827eb;color:#fff4db;
 font-size:clamp(17px,4vw,31px);letter-spacing:.02em;text-shadow:none;
}
.cinema-story-picture .story-setting {width:min(100%,560px)}
.cinema-story-picture .story-picture .story-landscape {object-fit:contain}
.story-cast .story-actor {pointer-events:none}

/* Character and carried-item effects use the original cast artwork. */
.story-actor-warp::before{content:"";position:absolute;inset:20% 5% 12%;border:3px solid #bfaeff;border-radius:50%;opacity:0;animation:rescue-ring .55s both}
@keyframes rescue-thrust{from{translate:46% 0}to{translate:0}}
@keyframes rescue-ring{0%{opacity:0;scale:.35}25%{opacity:1}100%{opacity:0;scale:1.24}}
@keyframes rescue-parry{0%,25%{rotate:0deg}43%{rotate:42deg}100%{rotate:36deg}}
@keyframes arrow-pass{from{left:70%}to{left:-34%}}
@keyframes light-pass{to{left:76%}}
@keyframes prop-fall{from{transform:translateY(-160%) rotate(-20deg)}}
@keyframes key-given{from{left:27%;rotate:-22deg}}
.story-scene:has(>.story-speech:only-child){grid-template-columns:1fr}.soul-body-scene{position:absolute;inset:10% 5% 27%;display:flex;align-items:center;justify-content:center}.soul-host{position:relative;width:min(48vw,290px);height:100%;object-fit:contain}.soul-mage{position:absolute;width:min(40vw,250px);height:85%;object-fit:contain;opacity:.55;filter:drop-shadow(0 0 15px #ddd8ff);transform:translate(20%,-10%)}.cinema-soulUnseal,.cinema-selfStrike,.cinema-soulBreak{background:#080812e6}.cinema-soulUnseal .soul-host{animation:soul-unseal 1.4s ease-in-out both}.cinema-selfStrike .soul-host{animation:soul-self-strike 2.3s ease-out both}.cinema-selfStrike .soul-mage{opacity:.15}.cinema-soulBreak .soul-host{opacity:.2;filter:grayscale(1);transform:translateY(45px) rotate(-8deg)}.cinema-soulBreak .soul-mage{animation:soul-farewell 1.9s ease-out both}.cinema-selfStrike .cinema-line,.cinema-soulBreak .cinema-line,.cinema-soulUnseal .cinema-line{bottom:12%;padding:0 16px;font-size:clamp(18px,4.5vw,28px);letter-spacing:.04em}.soul-body-scene img{pointer-events:none}@keyframes soul-unseal{0%{filter:drop-shadow(0 0 30px #e6ddff)}100%{filter:none}}@keyframes soul-self-strike{0%{filter:none;transform:none}15%{filter:brightness(5);transform:translateX(-6px)}22%{transform:translateX(6px)}35%{filter:brightness(1);transform:none}100%{opacity:.2;filter:grayscale(1);transform:translateY(45px) rotate(-8deg)}}@keyframes soul-farewell{from{opacity:.55;transform:translate(20%,-10%)}to{opacity:0;transform:translate(20%,-35%)}}@media(prefers-reduced-motion:reduce){.soul-host,.soul-mage{animation:none!important}.cinema-selfStrike .soul-host{opacity:.2;filter:grayscale(1)}.cinema-soulBreak .soul-mage{opacity:0}}
.hero-barrier{position:absolute;left:8%;right:8%;top:48%;height:34%;border:4px solid #fff8c4;border-radius:50% 50% 18% 18%;box-shadow:0 0 30px #ffea9d,inset 0 0 60px #ffe6a760;animation:shield-bloom 1.5s ease-out both}
.legend-sword-fx{position:fixed;inset:0;z-index:7900;pointer-events:none;overflow:hidden}
.legend-slash{position:absolute;left:12%;top:32%;width:76%;height:8px;background:#fffde3;box-shadow:0 0 12px #fff,0 0 35px #ffdc69;transform:rotate(-30deg);animation:legend-slash .65s ease-out both}
.legend-spark{position:absolute;left:50%;top:32%;height:7px;width:7px;border-radius:50%;background:#fff7ae;box-shadow:0 0 9px #ffc557;--angle:calc(var(--i)*15deg);animation:legend-sparks 1s ease-out both;animation-delay:calc(var(--i)*.006s)}
@keyframes shield-bloom{0%{opacity:0;transform:scale(.4)}35%{opacity:1;transform:scale(1.08)}100%{opacity:.8;transform:scale(1)}}
@keyframes legend-slash{0%{opacity:0;transform:rotate(-30deg) scaleX(0)}30%{opacity:1;transform:rotate(-30deg) scaleX(1)}100%{opacity:0;transform:rotate(-30deg) scaleX(1.1)}}
@keyframes legend-sparks{0%{opacity:1;transform:rotate(var(--angle)) translateX(0)}100%{opacity:0;transform:rotate(var(--angle)) translateX(min(42vw,320px))}}
.lantern-fissure {
  position: absolute;
  bottom: -3%;
  left: 35%;
  width: 39%;
  height: 82%;
  background: linear-gradient(0deg,#ffb64a,#fff2bd 45%,#fff0c080);
  clip-path: polygon(0 100%, 42% 62%, 34% 53%, 64% 30%, 60% 25%, 92% 0, 73% 29%, 78% 32%, 52% 56%, 61% 65%, 19% 100%);
  transform-origin: bottom left;
  animation: lantern-fissure-rise .8s ease-out both;
}
@keyframes lantern-fissure-rise {
  from { transform: scale(.35); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.legend-sword-fx[hidden]{display:none}
@media(prefers-reduced-motion:reduce){.hero-barrier,.lantern-fissure,.legend-slash,.legend-spark,.story-prop,.story-actor-warp::before{animation:none}}


/* The prop sprites share the cast layer but keep their own aspect ratio. */
.story-setting .story-prop {
 position:absolute;z-index:2;height:auto;object-fit:contain;pointer-events:none;
 filter:drop-shadow(0 2px 3px #05071088);
}
.story-setting .story-prop-spear {left:28%;top:51%;width:39%;transform-origin:90% 55%}
.story-cast-thrust .story-prop-spear {animation:rescue-thrust .95s both}
.story-cast-deflect .story-prop-spear {rotate:36deg;animation:rescue-parry .75s both}
.story-setting .story-prop-arrow {left:72%;top:35%;width:23%;animation:arrow-pass .65s ease-in 2 both}
.story-prop-arrow + .story-prop-arrow {top:44%;animation-delay:.13s}
.story-setting .story-prop-lantern {
 top:50%;left:27%;width:clamp(19px,7%,49px);
 animation:light-pass 1.6s ease-in-out both;
}
.story-cast-restoreLight .story-prop-lantern {animation-direction:reverse}
.story-cast-relayLight .story-prop-lantern {animation-timing-function:steps(4,end)}
.story-setting .story-prop-name-tag {left:54%;top:58%;width:clamp(15px,5%,32px);animation:prop-fall .85s both}
.story-setting .story-prop-key {left:59%;top:49%;width:clamp(22px,8%,58px);animation:key-given .9s both}
@media(prefers-reduced-motion:reduce){.story-setting .story-prop{animation:none}}

.friend-room-info{display:flex;align-items:center;flex-wrap:wrap;gap:6px 12px;margin:0 0 8px;padding:8px 10px;border:1px solid #365575;border-radius:8px;background:#142638;color:#e7eff8;font-size:14px;overflow-wrap:anywhere}
.friend-room-info[hidden],.friend-join-notice[hidden]{display:none}
.friend-room-info strong{color:#ffdc94}
.friend-room-info button{min-height:36px;padding:4px 9px}
.friend-join-notice{position:fixed;z-index:10000;top:max(10px,env(safe-area-inset-top));left:50%;transform:translateX(-50%);width:max-content;max-width:calc(100vw - 24px);display:flex;align-items:center;gap:14px;padding:6px 8px 6px 14px;border:1px solid #77d8a4;border-radius:10px;background:#133627;color:#e2ffee;box-shadow:0 6px 22px #0008;font-weight:700}
.friend-join-notice button{min-width:44px;min-height:44px;padding:0;color:inherit}

.friend-dialog{width:min(700px,calc(100vw - 20px));max-height:86dvh;box-sizing:border-box;padding:16px 18px}
.friend-dialog::backdrop{background:#081018c9}
#friendSettingsDialog{overflow:auto;overscroll-behavior:contain}
.friend-settings-body #onlinePanel{max-height:none;overflow:visible;margin:12px 0 0}
.friend-settings-body #onlinePanel button{min-height:40px}
.friend-room-error,#friendChatStatus{color:#ffb7b4;font-size:14px}
#friendChatDialog[open]{display:flex;flex-direction:column;overflow:hidden;height:min(70dvh,560px)}
.friend-chat-body{display:flex;flex-direction:column;flex:1;min-height:0}
#friendChatLog{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;list-style:none;margin:0;padding:6px 0}
#friendChatLog li{padding:8px 2px;border-bottom:1px solid #3b5268;overflow-wrap:anywhere}
#friendChatForm{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;padding-top:8px}
#friendChatForm label{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
#friendChatInput{min-width:0;padding:8px 10px;border:1px solid #5d778d;border-radius:8px;font-size:16px}
#friendChatStatus{margin:4px 0 0}
.workspace .arena{position:relative}
.friend-chat-overlay{position:absolute;inset:0;overflow:hidden;pointer-events:none;z-index:5}
.friend-chat-float{position:absolute;top:var(--chat-lane);left:100%;width:max-content;white-space:nowrap;color:white;font-size:clamp(15px,3.5vw,23px);font-weight:750;text-shadow:0 1px 2px black,1px 0 2px black,-1px 0 2px black,0 -1px 2px black;animation:friend-chat-across 6s linear both}
@keyframes friend-chat-across{to{left:0;transform:translateX(-100%)}}
body:not(.battle-screen):not(.setup-view):not(.draft-view) .friend-chat-overlay{display:none}
@media(prefers-reduced-motion:reduce){
 .friend-chat-float{left:8px;width:calc(100% - 16px);overflow:hidden;text-overflow:ellipsis;animation:none}
}

/* Consistent descriptions in character detail, roster, catalog and draft screens. */
.ability-copy{box-sizing:border-box;max-width:100%;margin:9px 0;padding:10px 12px;border:1px solid #b9c3b6;border-radius:9px;background:#fffaf0;color:#293c33;line-height:1.65;overflow-wrap:anywhere;white-space:normal}
.ability-copy>b{display:block;margin:0 0 5px;font-size:1em;font-weight:800;line-height:1.4;color:#775000}
.ability-copy-body{display:block;line-height:1.65}
.ability-copy-body b{font-weight:750}
.ability-copy.ult-description{border-left:4px solid #bb9340;color:#293c33!important}
.trix-catalog .ability-copy-body,.trix-catalog .ability-copy{color:#fff1ce}
.draft-ability-scroll .ability-copy{padding:8px 10px;margin:7px 0}
@media(max-width:760px){.ability-copy{padding:8px 10px;margin:7px 0;line-height:1.6}.ability-copy>b{font-size:.95em;margin-bottom:4px}.ability-copy-body{line-height:1.6}}

/* Attack characteristics: the damage mechanic and target scope can appear together. */
.damage-type-tags{display:flex;flex-wrap:wrap;align-items:center;gap:5px;max-width:100%;margin:5px 0 7px}
.damage-type-tags>.damage-type-tag{box-sizing:border-box;display:inline-flex;align-items:center;gap:4px;width:max-content;max-width:100%;margin:0!important;padding:3px 8px!important;border:1px solid;border-radius:6px;font-size:12px!important;font-weight:800;line-height:1.4!important;white-space:nowrap}
.damage-type-icon{display:inline-block;min-width:1em;font-size:12px;line-height:1;text-align:center}
@media(max-width:400px){.damage-type-tags{gap:4px}.damage-type-tags>.damage-type-tag{padding:3px 6px!important;font-size:11px!important}}


/* Chapter 2, stage 38: show the actual soul-jar art breaking against the
   existing ghost hall backdrop, rather than a placeholder rectangle. */
.cinema-soulChain .cinema-field {
 background:linear-gradient(180deg,#09152166 0%,#0b1628bc 100%),url("art/story-ghost-hall.jpg") center / cover no-repeat;
}
.cinema-soulChain .story-soul-chain {
 position:absolute;inset:8% 0 23%;display:flex;justify-content:center;align-items:flex-end;gap:clamp(14px,5vw,65px);
 pointer-events:none;
}
.cinema-soulChain .soul-chain-echo {
 max-width:44vw;width:clamp(100px,30vw,270px);height:100%;object-fit:contain;object-position:bottom;
 filter:drop-shadow(0 0 16px #80b0cc55);opacity:.8;
}
.cinema-soulChain .soul-chain-jar {
 max-width:34vw;width:clamp(85px,19vw,170px);max-height:85%;object-fit:contain;object-position:bottom;
 animation:trix-soul-jar-crack 1.15s ease-in both;
}
.cinema-soulChain .cinema-line {
 bottom:8%;padding:0 1rem;font-size:clamp(17px,4vw,31px);letter-spacing:.06em;
 color:#e4f2ff;text-shadow:0 2px 12px #030d1d,0 0 10px #80b8d6;
}
@keyframes trix-soul-jar-crack {
 0%{opacity:1;transform:rotate(-2deg) scale(1);filter:drop-shadow(0 0 6px #b9dce4)}
 45%{transform:rotate(8deg) scale(1.08);filter:drop-shadow(0 0 23px #b7efff)}
 100%{opacity:.16;transform:rotate(14deg) scale(.83);filter:drop-shadow(0 0 7px #7696a8)}
}
@media(prefers-reduced-motion:reduce) {
 .cinema-soulChain .soul-chain-jar{animation:none;opacity:.35}
}


/* Second chapter dialogue staging: actual in-game portraits and props.
   Use cool colors; do not apply global yellow/sepia tint. */
.story-cast-lanternGuard,.story-cast-soulJar,.story-cast-soulBound{
 background:linear-gradient(180deg,#0d1b2b33 0%,#0a1728be 100%);
}
.story-cast-lanternGuard .story-prop-lantern{
 left:27%;top:44%;width:clamp(20px,7%,48px);animation:none;
}
.story-setting .story-cast-lanternGuard .story-prop-monga{
 left:72%;top:43%;width:clamp(53px,22%,128px);z-index:3;transform:translateX(-30%);
 filter:drop-shadow(0 3px 5px #07121d90);
}
.story-setting .story-cast-soulJar .story-prop-soul-jar{
 left:58%;top:15%;width:clamp(54px,24%,160px);
 filter:drop-shadow(0 0 10px #9fc3d088);
}
.story-setting .story-cast-soulBound .story-prop-soul-jar{
 top:18%;left:11%;width:clamp(47px,19%,133px);
 filter:drop-shadow(0 0 11px #9fc3d0a0);
}
.story-setting .story-cast-soulBound .story-prop-soul-jar + .story-prop-soul-jar{left:72%}
.story-cast-soulBound .story-actor{z-index:3}


/* Long animated chapter sequences remain optional without skipping story
   state transitions or the dialogues that follow the animation. */
.chapter-cinema .chapter-cinema-skip{
 position:absolute;z-index:30;top:max(12px,env(safe-area-inset-top));
 right:max(12px,env(safe-area-inset-right));
 min-height:44px;padding:9px 14px;border-radius:9px;
 border:1px solid #aab9ca;background:#111d30ed;color:#f7fafc;
 font:600 clamp(12px,2.7vw,15px)/1.3 system-ui,sans-serif;
 letter-spacing:normal;box-shadow:0 3px 14px #020913aa;cursor:pointer;
}
.chapter-cinema .chapter-cinema-skip:focus-visible{
 outline:3px solid #8cd8e8;outline-offset:3px;
}


/* Beginner combat help: keep HP, names and hit effects unobstructed. */
.battle-guide {
  margin:8px 0 10px;
  padding:9px 11px;
  background:#10263b;
  border:1px solid #3b739a;
  border-radius:9px;
  color:#e8f4ff;
  font-size:13px;
  line-height:1.45;
  overflow-wrap:anywhere;
}
.battle-guide[hidden] {display:none!important}
.battle-guide .guide-head {
  display:flex;align-items:center;justify-content:space-between;gap:8px;
  min-width:0;
}
.battle-guide .guide-head strong {font-size:13px;letter-spacing:.01em}
.battle-guide .guide-toggle {
  flex:none;min-height:34px;padding:5px 9px;
  background:#182e43;border-color:#6485a3;color:#f2f8ff;
  font-size:12px;font-weight:700;
}
.battle-guide p {margin:5px 0 0;line-height:1.45}
.battle-guide small {display:block;margin-top:4px;color:#bad6ef;font-size:12px;line-height:1.45}
#boards .cell.guide-target {
  outline:3px solid #6bbdff!important;
  outline-offset:-3px;
  box-shadow:inset 0 0 0 2px #6bbdff66,0 0 13px #68c8ff60;
}
#boards .cell.guide-blocked:not(.guide-target) {
  outline:2px dashed #65778b;
  outline-offset:-3px;
}
@media(max-width:760px) {
 .battle-guide {padding:7px 9px;margin:6px 0 8px;font-size:12px}
 .battle-guide .guide-toggle {min-height:32px;padding:4px 7px;font-size:11px}
 #boards .cell.guide-target {outline-width:2px;outline-offset:-2px}
}
@media(prefers-reduced-motion:reduce) {
 #boards .cell.guide-target {transition:none}
}


/* Unavailable actions are softly desaturated, never blacked out.
   Preserve character silhouettes and readable health/text during targeting. */
#boards .cell.action-unavailable:not(.selected):not(.skill-ready){
 background:#3a4655;
 border-color:#6d7b8b;
 color:#d4dbe4;
 opacity:1;
 box-shadow:inset 0 0 0 1px #b0bcc444;
}
#boards .cell.action-unavailable:not(.selected) .unit-art{
 filter:grayscale(1) brightness(1.2) contrast(.8);
 opacity:.78;
 animation:none;
}
#boards .cell.action-unavailable:not(.selected) .name,
#boards .cell.action-unavailable:not(.selected) .hp,
#boards .cell.action-unavailable:not(.selected) .tag{
 color:#d4dbe4;
}
#boards .cell.action-unavailable:not(.selected) .hpbar{opacity:.8}
#boards .cell.action-unavailable:not(.selected):focus-visible{
 outline:2px solid #d0d9e5;
 outline-offset:1px;
}
.action-menu button:disabled{
 background:#263140;
 border-color:#3b495a;
 color:#8e9ba9;
 opacity:.58;
 cursor:not-allowed;
}


/* Slimy-led practice lessons share the existing tutorial dialog and story battle speech. */
.slimy-lesson-header{display:flex;align-items:center;gap:14px;margin:14px 0}
.slimy-lesson-header img{height:94px;width:94px;object-fit:contain;flex-shrink:0;filter:drop-shadow(0 4px 8px #0002)}
.slimy-lesson-header h2{margin:4px 0 0;line-height:1.3}
.slimy-lesson-header small{color:var(--muted);font-size:12px}
.slimy-tutorial-options{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin:18px 0}
.slimy-tutorial-option{display:flex;flex-direction:column;text-align:left;gap:9px;padding:17px;min-height:137px;border:1px solid var(--gold);border-radius:12px;background:#1b2b3e;color:#eaf2ff;white-space:normal}
.slimy-tutorial-option strong{font-size:18px;color:#ffe2a6}
.slimy-tutorial-option span{font-size:13px;line-height:1.6;color:#d4dfeb}
.slimy-tutorial-option:hover,.slimy-tutorial-option:focus-visible{background:#293d54;outline:2px solid #f4cf84;outline-offset:1px}
.slimy-lesson-card{padding:17px;border-radius:12px;background:#17283a;border:1px solid #51647c}
.slimy-lesson-card>b{font-size:17px;color:#ffe2a6}
.slimy-lesson-card p{font-size:15px;line-height:1.75;margin:12px 0}
.slimy-side-comment{border-left:3px solid #f1cc80;padding:8px 12px;background:#253449;color:#dce9f5;line-height:1.6}
.battle-dialogue .battle-speech img[src*="slimy.png"]{object-fit:contain}
@media(max-width:650px){
 .slimy-tutorial-options{grid-template-columns:1fr}
 .slimy-tutorial-option{min-height:0;padding:13px}
 .slimy-lesson-header img{width:72px;height:72px}
 .slimy-lesson-card{padding:12px}
}


/* Companion reactions appear during real training actions without blocking play. */
.slimy-practice-reaction{
 display:flex;
 align-items:center;
 gap:12px;
 margin:10px 0 0;
 padding:10px 14px;
 border:1px solid #7494aa;
 border-left:4px solid #6e9db3;
 border-radius:12px;
 background:linear-gradient(125deg,#e6f3f9,#fffefa);
 color:#243444;
 box-shadow:0 4px 12px #00000016;
 pointer-events:none;
}
.slimy-practice-reaction[hidden]{display:none!important}
.slimy-practice-reaction img{
 width:62px;
 height:70px;
 object-fit:contain;
 flex:none;
}
.slimy-practice-reaction strong{
 display:block;
 margin-bottom:3px;
 color:#255777;
 font-size:13px;
}
.slimy-practice-reaction p{
 margin:0;
 font-size:14px;
 line-height:1.55;
 font-weight:500;
}
@media(max-width:600px){
 .slimy-practice-reaction{padding:8px 10px;gap:8px}
 .slimy-practice-reaction img{width:44px;height:52px}
 .slimy-practice-reaction p{font-size:12px;line-height:1.5}
}
