/* A shared tactical table. Ownership follows each piece, never its board row. */
.tb-playing{--ally:#69ceff;--enemy:#ff8a86;--ready:#b8f48c;--tb-table-edge:#bba477;grid-template-columns:minmax(0,1fr) 264px;gap:6px 14px}
.tb-playing .tb-layout{grid-template-columns:minmax(0,1fr) 264px;gap:14px}
.tb-playing .tb-arena-column{grid-template-rows:minmax(0,1fr) 18px clamp(88px,13dvh,112px);gap:4px}
.tb-playing .tb-arena{
 grid-template-rows:40px minmax(0,1fr) 40px;gap:5px;padding:6px 15px;
 border:2px solid #b19a6b;border-radius:24px;
 background:linear-gradient(90deg,#141c27db,#151b23a6 50%,#141c27db),url('/battlefield-citadel.png') center/cover;
 box-shadow:inset 0 0 0 3px #272d32,inset 0 0 0 5px #a68b5444,0 15px 40px #0007;
}
.tb-playing .tb-embers{opacity:.2}
.tb-commander{position:relative;z-index:2;min-height:0;display:grid;grid-template-columns:minmax(0,1fr) minmax(200px,280px) minmax(0,1fr);align-items:center;gap:10px}
.tb-commander-banner{display:flex;align-items:center;gap:7px;color:#b6e7ff;font-size:11px;font-weight:700;white-space:nowrap;text-shadow:0 2px 4px #000}
.tb-commander-banner .tb-icon{width:23px;height:23px}
.tb-commander-banner small{font:inherit}.tb-commander-banner small::before{content:' · '}
.is-enemy .tb-commander-banner{color:#ffb3aa}
.tb-playing .tb-commander .tb-castle{height:38px;min-height:0;border-width:2px;border-color:#69ceff;border-radius:12px 12px 22px 22px;background:linear-gradient(#1e455e,#112b42);padding:3px 13px;box-shadow:inset 0 0 0 2px #c2dcf218,0 3px 14px #0008;opacity:1}
.tb-playing .tb-commander .tb-castle.tb-side-1{border-color:#ff8a86;border-radius:22px 22px 12px 12px;background:linear-gradient(#713d3d,#3d232b)}
.tb-playing .tb-commander .tb-castle-label{font-size:12px;color:#eff8ff}
.tb-playing .tb-commander .tb-health{min-width:85px}
.tb-playing .tb-commander .tb-health-track{width:85px;height:4px;background:#050b1666}
.tb-playing .tb-commander .tb-health strong{font-size:23px;color:#fff4dd}
.tb-playing .tb-commander .tb-health-track i{background:#72d6ff}
.tb-playing .is-enemy .tb-health-track i{background:#ff8d86}
.tb-playing .tb-castle.tb-target{box-shadow:0 0 0 2px #ffe5a1,0 0 22px #f8b456aa!important;background:linear-gradient(#845249,#48252a)!important}
.tb-enemy-hand,.tb-command-crystals{justify-self:end;text-align:center;display:flex;align-items:center;gap:8px;color:#c9d8e9;min-width:0}
.tb-enemy-cardbacks{display:flex;align-items:center;justify-content:center;padding-left:14px;height:35px}
.tb-enemy-cardbacks i{display:block;width:23px;height:33px;margin-left:-10px;transform:rotate(var(--card-angle));transform-origin:50% 130%;border:1px solid #bd9d60;border-radius:3px;box-shadow:-2px 1px 4px #0008;background:#171929}
.tb-enemy-cardbacks img{display:block;width:100%;height:100%;border-radius:2px}
.tb-enemy-hand small,.tb-command-crystals small{font-size:10px;white-space:nowrap}
.tb-command-crystals>span{display:flex;gap:4px}
.tb-command-crystals i{width:14px;height:21px;clip-path:polygon(50% 0,100% 50%,50% 100%,0 50%);background:#48515e;box-shadow:inset 0 0 3px #fff6}
.tb-command-crystals i.is-full{background:linear-gradient(135deg,#ddfaff,#47b9f1 45%,#1b567f)}
.tb-battle-surface{
 z-index:2;min-height:0;display:grid;grid-template-columns:37px minmax(0,1fr);grid-template-rows:17px minmax(0,1fr);gap:3px 5px;
 padding:6px 10px 8px 5px;border:1px solid #d4bd89b3;border-radius:14px;
 background:radial-gradient(ellipse at 45% 50%,#b6aa8445,transparent 72%),linear-gradient(135deg,#4e5051f5,#373e47f5);
 box-shadow:inset 0 0 28px #080d1b77,inset 0 1px 0 #f5e5bb33,0 2px 6px #0008;
}
.tb-playing .tb-battle-surface .tb-lane-labels{grid-column:2;grid-row:1;color:#ded3bd;font-size:9px;letter-spacing:1.5px}
.tb-rank-labels{grid-column:1;grid-row:2;display:grid;grid-template-rows:repeat(3,1fr);min-height:0;pointer-events:none}
.tb-rank-labels>span{display:flex;align-items:center;justify-content:center;writing-mode:vertical-rl;font-size:10px;font-weight:700;letter-spacing:2px;margin:3px 0;border-radius:4px;color:#c9c8c0;background:#d7c89b12;border-left:2px solid #cbb78677}
.tb-rank-labels>.is-enemy{color:#ffc5b9;background:#972d3b30;border-color:#e58078}
.tb-rank-labels>.is-player{color:#b5e9ff;background:#15648a42;border-color:#6fc7ef}
.tb-playing .tb-board{grid-column:2;grid-row:2;min-height:0;gap:5px 12px;padding:0;margin:0;background:none;border:0;border-radius:0;box-shadow:none}
.tb-playing .tb-cell{border:1px solid #e3d7b529;border-radius:9px;background:#e7dabb08;box-shadow:inset 0 0 15px #10172622;isolation:isolate;overflow:visible}
.tb-playing .tb-cell[data-rank="0"]{background:linear-gradient(#a7514536,#7d3d3712);border-color:#d796832e}
.tb-playing .tb-cell[data-rank="2"]{background:linear-gradient(#386f8c1f,#317e9c38);border-color:#89b5c93b}
.tb-playing .tb-cell.tb-occupied{border-color:#d9c8a01a;background:#0712210d;box-shadow:none}
.tb-playing .tb-empty>small{font-size:9px;color:#dbd6c9;opacity:.72}
.tb-playing .tb-cell-sigil{opacity:.32;color:#e5dfcc;filter:none}
.tb-playing .tb-unit-owner{position:absolute;z-index:5;top:2px;left:50%;transform:translateX(-50%);display:flex;align-items:center;gap:4px;padding:1px 8px 2px;border:1px solid #90dcff;border-radius:3px 3px 8px 8px;background:#0e4b6a;color:#e4f8ff;font-size:9px;font-weight:750;line-height:1.2;white-space:nowrap;box-shadow:0 2px 5px #0007;pointer-events:none}
.tb-playing .tb-unit-owner .tb-icon{width:10px;height:10px;stroke-width:2.5}
.tb-playing .tb-side-1 .tb-unit-owner{background:#812b36;border-color:#ffa39b;color:#fff1e9;border-radius:8px 8px 3px 3px}
.tb-playing .tb-unit-card{
 width:clamp(74px,10dvh,108px);height:calc(100% - 18px);max-height:116px;min-height:33px;
 left:50%;top:calc(50% + 5px);transform:translate(-50%,-50%);
 overflow:visible;border:3px solid #6dcfff;border-radius:48% 48% 42% 42%;background:#17334c;
 box-shadow:0 3px 8px #000b,inset 0 0 0 2px #132c43,0 0 0 1px #071f30;
 pointer-events:none;
}
.tb-playing .tb-side-1>.tb-unit-card{border:3px solid #ff8b80;background:#58262d;box-shadow:0 3px 8px #000b,0 0 0 1px #4b1d24}
.tb-playing .tb-unit-card>img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:center 30%;border-radius:inherit;filter:saturate(1.12);opacity:1}
.tb-playing .tb-unit-shade{border-radius:inherit;background:linear-gradient(transparent 42%,#08111e99);box-shadow:inset 0 0 0 1px #ffe8b966}
.tb-playing .tb-unit-name{z-index:4;top:auto;bottom:0;left:50%;right:auto;transform:translateX(-50%);width:calc(100% - 6px);min-width:0;box-sizing:border-box;padding:1px 3px;border:1px solid #a6cad155;border-radius:4px;background:#172d42ef;font-size:10px;line-height:1.3;text-align:center;color:#eff9ff;text-shadow:0 1px 2px #000;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tb-playing .tb-side-1 .tb-unit-name{background:#48232aef;border-color:#e2a49d66;color:#fff0e4}
.tb-playing .tb-unit-stats{left:-15px;right:-15px;bottom:2px;z-index:5;display:flex;justify-content:space-between;gap:0}
.tb-playing .tb-unit-stats b{width:25px;height:25px;display:grid;place-items:center;border:2px solid #dfc381;background:linear-gradient(#aa7739,#68411d);border-radius:50%;font:700 17px/1 Georgia,serif;color:#fff9db;box-shadow:0 2px 4px #0008;text-shadow:0 1px 2px #000}
.tb-playing .tb-unit-stats b:nth-child(2){background:linear-gradient(#c3524d,#782834);border-color:#ffb0a1}
.tb-playing .tb-unit-stats small{right:-6px;bottom:28px;background:#193e59ed;border:1px solid #82c5e2;font-size:8px;color:#d6f2ff;padding:2px 4px;border-radius:5px}
.tb-playing .tb-unit-state{display:block;top:8px;right:-56px;font-size:8px;line-height:1.3;padding:3px 4px;border:1px solid #b8c6d333;border-radius:5px;background:#152233e8;color:#bcc8d5;white-space:nowrap;text-align:center}
.tb-playing .tb-side-1 .tb-unit-state{display:none}
.tb-playing .tb-can-act .tb-unit-state{color:#d6ffb9;border-color:#bbf69766;background:#244325ed}
.tb-playing .tb-side-0 .tb-unit-card:has(.tb-ready){border-color:#6dcfff;box-shadow:0 0 0 2px #b8ef8f,0 0 16px #98f37480,0 4px 8px #0009}
.tb-playing .tb-selected{outline:none;background:#f7d48419!important}
.tb-playing .tb-selected .tb-unit-card{outline:2px solid #ffdf91;outline-offset:4px;box-shadow:0 0 25px #fbd68b88}
.tb-playing .tb-target{border-style:solid;background:#ccdbad22!important;border-color:#c7eaaa!important;box-shadow:inset 0 0 15px #d1f4c033!important}
.tb-playing .tb-target[data-action="attack"]{background:#d3554b2e!important;border-color:#ffad8b!important}
.tb-playing .tb-target[data-action="spell"]{background:#a68bcb33!important;border-color:#dac0ff!important}
.tb-playing .tb-target-label,.tb-playing .tb-occupied .tb-target-label,.tb-playing .tb-empty .tb-target-label{z-index:6;left:auto;right:4px;top:50%;bottom:auto;transform:translateY(-50%);max-width:65px;padding:5px 7px;border:1px solid #d7f3bd;border-radius:5px;background:#283e29ed;color:#e9ffdc;font-size:10px;line-height:1.3;pointer-events:none}
.tb-playing [data-action="attack"] .tb-target-label{background:#762a25ed;border-color:#ffc6a3;color:#fff0dc}
.tb-playing [data-action="spell"] .tb-target-label{background:#3d2c5aed;border-color:#dfc7ff;color:#f5eaff}
.tb-playing .tb-hand-heading h2{color:#b9e8ff}.tb-playing .tb-hand-heading h2::before{content:'';display:inline-block;width:7px;height:7px;border-radius:50%;background:#6bcfff;margin-right:7px;box-shadow:0 0 8px #59bffb66}
.tb-playing .tb-hand{align-items:stretch;justify-content:safe center;gap:7px;padding:3px 6px 5px;background:linear-gradient(#0e213600,#11273dd9);border-bottom:1px solid #77c6eb66;border-radius:0 0 20px 20px}
.tb-playing .tb-hand-card{border:2px solid #78b9d4;border-radius:10px;box-shadow:0 3px 9px #0008}
.tb-playing .tb-hand-card.tb-magic{border-color:#c9a4f4}.tb-playing .tb-hand-card.tb-selected{outline:2px solid #f6d7a0;outline-offset:1px;box-shadow:0 0 16px #f7dd9d55}
.tb-playing .tb-command-dock{grid-column:1;grid-row:4;background:linear-gradient(90deg,#14374fed,#102539f5);border-color:#78bcd388}
.tb-playing .tb-command-dock>div{color:#d4f1ff}.tb-playing .tb-command-dock span{color:#b3cfdf}
.tb-playing .tb-command-dock .tb-end{min-width:150px;font-size:12px!important}
.tb-playing .tb-command-dock .tb-side-legend{display:flex;align-items:center;gap:10px;font-size:10px;color:#c9dbe5}
.tb-side-legend span{display:flex;align-items:center;gap:5px}.tb-side-legend i{display:block;width:7px;height:7px;border-radius:50%;background:#69ceff}.tb-side-legend span:nth-child(2) i{background:#ff8a86}.tb-side-legend span:nth-child(3) i{background:#b8f48c;box-shadow:0 0 5px #b8f48c66}
.tb-playing .tb-sidebar{background:linear-gradient(#182737f2,#121c2af5);border-color:#91acbc50;padding:10px;grid-template-rows:minmax(110px,1.2fr) minmax(0,1fr) 25px 24px}
.tb-playing .tb-combat-feed{background:#101a28c4;border-color:#889fb047}.tb-playing .tb-combat-feed .tb-enemy-event>b{background:#8d3641a6;color:#ffe3dd}.tb-playing .tb-combat-feed li:not(.tb-enemy-event)>b{background:#235a78b0;color:#d5f2ff}
.tb-playing .tb-thinking{inset:7px 20% auto;min-height:32px;border:1px solid #ffb49b80;border-radius:20px;background:#472c31f2;font-size:11px;gap:8px;padding:4px 12px;box-shadow:0 3px 12px #0006}.tb-playing .tb-thinking>span:first-child{font-size:16px}
.tb-playing .tb-tooltip{pointer-events:none;background:linear-gradient(135deg,#253b50,#111d2e)}
@media(min-width:761px) and (max-height:700px){
 .tb-playing .tb-arena{grid-template-rows:40px minmax(0,1fr) 40px;padding-block:5px;gap:4px}
 .tb-playing .tb-commander .tb-castle{height:38px}.tb-playing .tb-unit-card{height:calc(100% - 18px);min-height:26px}
 .tb-playing .tb-unit-owner{font-size:8px;top:0}.tb-playing .tb-unit-name{font-size:9px}
 .tb-playing .tb-unit-stats b{width:22px;height:22px;font-size:15px}
}
@media(max-width:1020px) and (min-width:761px){
 .tb-playing{grid-template-columns:minmax(0,1fr) 220px;gap:6px 10px;padding-inline:12px}.tb-playing .tb-layout{grid-template-columns:minmax(0,1fr) 220px;gap:10px}
 .tb-commander{grid-template-columns:minmax(0,1fr) minmax(180px,230px) minmax(0,1fr);gap:5px}
 .tb-commander-banner span{display:none}.tb-enemy-hand small{display:none}.tb-command-crystals{display:grid;gap:2px}
 .tb-playing .tb-unit-state{right:-47px;font-size:7px}
}
@media(max-width:760px){
 .tb-playing{grid-template-columns:minmax(0,1fr) auto;gap:5px 8px;padding:6px 8px}
 .tb-playing .tb-layout{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) 18px clamp(86px,13dvh,106px) 30px 56px;gap:4px}
 .tb-playing .tb-arena-column{display:contents}
 .tb-playing .tb-arena{grid-row:1;grid-template-rows:38px minmax(0,1fr) 38px;gap:4px;padding:5px 6px;border-radius:16px;border-width:1px}
 .tb-commander{grid-template-columns:minmax(0,1fr) minmax(152px,190px) minmax(0,1fr);gap:4px}
 .tb-commander-banner{justify-content:center;font-size:9px}.tb-commander-banner>.tb-icon{display:none}.tb-commander-banner>span{max-width:44px;white-space:normal;text-align:center;line-height:1.4}
 .tb-commander-banner small{display:none}.tb-commander-banner>span{white-space:nowrap;max-width:none}
 .tb-playing .tb-commander .tb-castle{height:36px;padding:3px 8px;gap:5px;border-radius:8px 8px 15px 15px}
 .tb-playing .tb-commander .tb-castle.tb-side-1{border-radius:15px 15px 8px 8px}
 .tb-playing .tb-commander .tb-castle>.tb-icon{width:17px;height:17px}.tb-playing .tb-commander .tb-castle-label{font-size:10px}
 .tb-playing .tb-commander .tb-health{min-width:54px}.tb-playing .tb-commander .tb-health-track{width:54px;height:3px}.tb-playing .tb-commander .tb-health strong{font-size:18px}.tb-health strong small{font-size:8px}
 .tb-enemy-hand{display:block;justify-self:center}.tb-enemy-cardbacks{height:24px;padding-left:9px}.tb-enemy-cardbacks i{width:14px;height:22px;margin-left:-8px}.tb-enemy-hand small{display:block;font-size:7px;line-height:1.2;margin-top:3px}
 .tb-command-crystals{display:grid;gap:3px;justify-self:center}.tb-command-crystals>span{justify-content:center;gap:2px}.tb-command-crystals i{width:9px;height:14px}.tb-command-crystals small{font-size:8px}
 .tb-battle-surface{grid-template-columns:20px minmax(0,1fr);grid-template-rows:12px minmax(0,1fr);gap:2px 3px;padding:3px 4px 4px 2px;border-radius:10px}
 .tb-playing .tb-battle-surface .tb-lane-labels{font-size:7px;letter-spacing:0}.tb-rank-labels>span{font-size:8px;letter-spacing:1px;border-left-width:1px;margin:2px 0}
 .tb-playing .tb-board{gap:4px 5px}.tb-playing .tb-cell{border-radius:6px}
 .tb-playing .tb-unit-owner{top:1px;font-size:7px;padding:1px 5px;gap:2px}.tb-playing .tb-unit-owner .tb-icon{width:8px;height:8px}
 .tb-playing .tb-unit-card{width:65%;max-width:78px;height:calc(100% - 18px);min-height:28px;border-width:2px}
 .tb-playing .tb-side-1>.tb-unit-card{border-width:2px}.tb-playing .tb-unit-name{font-size:8px;padding:1px 3px;bottom:0}
 .tb-playing .tb-unit-stats{left:-9px;right:-9px;bottom:0}.tb-playing .tb-unit-stats b{width:20px;height:20px;border-width:1px;font-size:14px}.tb-playing .tb-unit-stats small{bottom:22px;font-size:6px;right:-2px;padding:1px 2px}
 .tb-playing .tb-unit-state{display:none}.tb-playing .tb-empty>small{font-size:7px}.tb-playing .tb-cell-sigil .tb-icon{width:15px;height:15px}
 .tb-playing .tb-target-label,.tb-playing .tb-occupied .tb-target-label,.tb-playing .tb-empty .tb-target-label{right:1px;font-size:8px;padding:3px;max-width:none;white-space:nowrap}
 .tb-playing .tb-hand{grid-row:3;justify-content:flex-start;border-radius:0 0 12px 12px;gap:5px;padding:2px 3px 4px}.tb-playing .tb-hand-card{flex-basis:62px;border-width:1px;border-radius:6px}
 .tb-playing .tb-quick{background:#12273bd9;border-color:#84bbd34d;grid-row:4;padding:2px 6px}.tb-playing .tb-quick p{font-size:8px}
 .tb-playing .tb-sidebar{display:contents}.tb-playing .tb-combat-feed{grid-row:5;height:56px;grid-template-columns:65px minmax(0,1fr)}
 .tb-playing .tb-combat-feed li{font-size:8px}.tb-playing .tb-combat-feed header{padding:4px}.tb-playing .tb-combat-feed h2{font-size:9px}
 .tb-playing .tb-command-dock{grid-column:1/-1;grid-row:4;padding:4px 8px}.tb-playing .tb-command-dock>div{gap:6px}.tb-playing .tb-command-dock .tb-end{min-width:112px;font-size:10px!important}
 .tb-playing .tb-thinking{inset:7px 13% auto;font-size:10px;min-height:25px;padding:3px 8px}
 .tb-playing .tb-command-dock .tb-side-legend{display:none}
}
@media(prefers-reduced-motion:reduce){.tb-playing .tb-unit-card,.tb-playing .tb-cell{transition:none}}
