* {
 -webkit-user-select: none;
 user-select: none;
 -webkit-touch-callout: none;
 -webkit-tap-highlight-color: transparent;
}
*::selection { background: transparent; color: inherit; }
input[type=search], input[type=text], textarea {
 -webkit-user-select: text;
 user-select: text;
}

*{box-sizing:border-box}html{color-scheme:dark;background:#07181c}body{margin:0;color:#fff3d6;font-family:Georgia,serif;background:linear-gradient(#031117c9,#031117dc),var(--vista) center/cover fixed}button{color:inherit;font:inherit;cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent}button:focus-visible{outline:3px solid #ffdc86;outline-offset:2px}button:disabled{cursor:default}
#game{--gold:#d9b678;--line:#977d4b;max-width:650px;margin:auto;height:100vh;height:100svh;min-height:580px;display:flex;flex-direction:column;position:relative;isolation:isolate;overflow:hidden;background:#0c1d21;box-shadow:0 0 70px #000a;padding-top:env(safe-area-inset-top)}
header{display:flex;align-items:center;justify-content:space-between;padding:9px 18px 11px;background:linear-gradient(105deg,#162e31,#08181e);border-bottom:1px solid var(--line)}h1{font-size:clamp(21px,3.5vh,33px);font-weight:normal;margin:4px 0 0;line-height:1.04}.kicker,small,.turnline,.handtop,#hint,.energy,.tag,.stat,.hp,.life,.cost,.sheet-label{font:600 12px/1.2 -apple-system,BlinkMacSystemFont,'Helvetica Neue',sans-serif;letter-spacing:.09em}.kicker{margin:0;color:#cfb78c;font-size:10px;letter-spacing:.22em}.kicker i{padding:0 5px;font-size:8px;color:#84e2ca}.menubtn{height:44px;width:44px;background:#15272a;border:1px solid #76684c;border-radius:50%;font-family:Arial;font-size:20px}
dialog{background:#13282c;color:#f9ebd1;border:1px solid #c6a671;border-radius:12px;padding:18px;box-shadow:0 18px 80px #000b;width:min(370px,94vw);max-height:92svh;overflow:auto;text-align:center}dialog::backdrop{background:#021015bd;backdrop-filter:blur(3px)}dialog h2{font-weight:normal;font-size:27px;margin:6px 0 13px}.close{float:right;border:0;border-radius:50%;font-size:23px;background:transparent;width:44px;height:44px}.sheet-label{margin:13px 0;color:#c7b180}.largecard{max-width:100%;height:min(48svh,390px);display:block;margin:auto}.sheet-actions{display:flex;justify-content:center;gap:8px;margin-top:13px}.secondary,.realmChoice{border:1px solid #817452;background:#1e3638;border-radius:5px;min-height:44px;padding:5px 12px}.realmChoice{width:100%;margin:4px 0;text-align:left;display:flex;align-items:center;gap:14px}.realmChoice img{width:60px;height:46px;object-fit:cover}.realmChoice span{flex:1}.sheetcopy{line-height:1.45}header{background:linear-gradient(90deg,#0b1d24ed, #0d2028a3),var(--vista) 50% 42%/cover;padding:8px 16px}
.arena{height:0;flex:1;min-height:0;display:grid;grid-template-rows:auto minmax(0,1fr) auto minmax(0,1fr) auto;position:relative;isolation:isolate;padding:0 12px;background:#194247 url('assets/mat.webp') center/100% 100%;box-shadow:inset 0 0 25px #04151688}
.seat{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);align-items:center;gap:12px;padding:3px 6px;min-height:57px}.identity{text-align:right}.identity small{color:#e0c990;font-size:9px;letter-spacing:.16em;display:block}.identity strong{font-weight:normal;font-size:clamp(15px,4vw,20px);display:block;text-shadow:0 1px 3px #000}.budget{font:600 12px system-ui;color:#b5f6e2}.medal{position:relative;width:clamp(51px,8.5svh,78px);aspect-ratio:1;border:3px ridge #c9a574;border-radius:50%;background:radial-gradient(ellipse at 48% 22%,#b99c71,#342b27 78%);box-shadow:0 3px 5px #030e13}.medal img{height:100%;width:100%;object-fit:cover;object-position:50% 8%;border-radius:50%}.life{position:absolute;right:-5px;bottom:-4px;border:1px solid #e3b5a5;background:#7b3341;color:#fff4df;border-radius:9px;padding:1px 5px;font:bold 13px system-ui;letter-spacing:0}.power{justify-self:start;min-height:44px;min-width:69px;border:0;background:transparent;display:grid;justify-items:center;padding:2px 4px;color:#f8e6bc}.power i{display:grid;place-items:center;font:25px Georgia;color:#b8ffea;background:radial-gradient(ellipse at 40% 24%,#347c76,#183e41 55%,#0c2024);border:2px ridge #dfbf84;border-radius:50%;width:34px;height:34px;box-shadow:0 2px 4px #0009}.other .power i{color:#ffd196;background:radial-gradient(ellipse at 38% 22%,#a76136,#512e2e 70%)}.power span{font:600 11px system-ui;text-shadow:0 1px 2px black}.power.spent i{filter:saturate(.25);opacity:.75}
.field{display:flex;gap:clamp(5px,2.3vw,15px);align-items:center;justify-content:center;min-height:0;container-type:size;perspective:700px}
.cardface{--tone:#194e50;position:relative;display:grid;grid-template-rows:minmax(0,1fr) auto auto;border:2px solid #a8905b;border-radius:6px;padding:3px;background:linear-gradient(120deg,#615137,#17282a 24%,#263839 75%,#897243);color:#fff6df;box-shadow:inset 0 0 0 1px #1d2623,1px 4px 0 #1f1914,1px 7px 9px #061718b3;overflow:hidden;min-width:0;isolation:isolate}.cardface .art{display:block;overflow:hidden;width:100%;height:100%;border:1px solid #ab915e;border-radius:2px;object-fit:cover}.cardface strong{font-size:clamp(12px,3.3vw,16px);font-weight:normal;background:var(--tone);padding:3px 1px;text-align:center;line-height:1.05;align-self:stretch}.cardface .foot{display:flex;align-items:center;justify-content:space-between;gap:1px;background:#ede0bd;color:#332b21;padding:1px 5px;font:bold 12px/1.2 system-ui}.foot i{font:600 8px system-ui;letter-spacing:.04em}.foot em{font-style:normal;color:#813644}.action .foot{justify-content:center}.cost{position:absolute;top:3px;left:4px;padding:2px 5px 3px;background:#153738;color:#ffe9ab;border:1px solid #d7b976;border-radius:2px 2px 6px 6px;font:bold 14px/1 system-ui;letter-spacing:0}.piece{height:min(90cqh,39cqw,190px);aspect-ratio:5/7;max-width:29%;transform:rotateX(5deg)}.piece.chosen,.piece.target{outline:2px solid #a0ffe0;outline-offset:2px}.piece.attacking{outline:2px solid #ffb17c;transform:translateY(4px)}.piece.exhausted{filter:saturate(.66)}.piece.chosen{transform:translateY(-4px)}.piece.landing{animation:land .32s ease-out}@keyframes land{from{opacity:.2;transform:translateY(28px) scale(1.08)}}
.turnline{display:flex;align-items:center;gap:6px;text-align:center;color:#ffe7b4;font:600 11px system-ui;letter-spacing:.09em}.turnline span{height:1px;flex:1;background:#c2a77599}.turnline b{background:#143238f5;box-shadow:0 2px 4px #0006;border:1px solid #a78955;border-radius:12px;padding:3px 11px}
.handarea{background:linear-gradient(125deg,#1b3335,#0c1d20 65%);border-top:2px ridge #9c8559;padding:3px 0 max(3px,env(safe-area-inset-bottom))}.handtop{display:flex;align-items:center;justify-content:space-between;padding:0 14px 2px;font:17px Georgia}.handtop small{color:#cdbe9c;font:12px system-ui}#end,.primary{border:1px solid #e5c78c;border-radius:5px;background:linear-gradient(#eed399,#c18d4f);color:#332516;min-height:44px;padding:0 16px;font:bold 15px Georgia;box-shadow:inset 0 0 0 2px #b39462}button:disabled{opacity:.56}#hand{display:flex;overflow-x:auto;gap:6px;padding:4px 10px 6px;scrollbar-width:thin;scrollbar-color:#6b694e transparent}.handcard{height:clamp(92px,14.4svh,145px);flex:0 0 clamp(78px,22.5%,110px)}.handcard strong{font-size:clamp(11px,3vw,14px)}.unpaid .cost{background:#523c3c}.unpaid{border-color:#83765b}#hint{min-height:28px;display:grid;place-items:center;color:#e2d8bd;text-align:center;font:12px/1.15 system-ui;letter-spacing:0;padding:2px 8px}.preview{height:210px;width:150px;margin:auto;pointer-events:none}.primary:disabled{filter:saturate(.25)}.sheetcopy{font:16px/1.45 system-ui}.turnline b.defend{background:#683c25}.powerDetail{font-size:36px;color:#f1c974}.powerDetail~h2{margin-top:4px}@media(prefers-reduced-motion:reduce){*{animation:none!important}}@media(min-width:700px){#game{max-width:630px;border-inline:2px solid #786848}#hand{justify-content:safe center}}@media(max-height:690px){.seat{min-height:48px;padding:2px}.medal{width:45px}.piece{height:min(92cqh,40cqw)}header{padding-block:5px}}
.foot b,.foot em{white-space:nowrap}.cardface .foot{padding-inline:3px}.foot i{font-size:7px;letter-spacing:0}.handcard .foot i{display:none}.handcard.action .foot i{display:inline}.handcard .foot{min-height:15px}
#rivalAvatar{padding:0;color:inherit}
#deckFamily.custom-deck-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#allies .cardface{touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
#hand .cardface{touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
.cardface img{pointer-events:none}
#allies:empty:before,#foes:empty:before{width:min(82%,360px);height:77%;display:grid;place-items:center;white-space:pre;color:#e2d6bbd9;font:500 12px system-ui;letter-spacing:.06em}
#allies:empty:before{content:"Your row"}#foes:empty:before{content:"Opponent’s row"}
.drag-ghost{position:fixed!important;transform:translate(-50%,-72%) rotate(-5deg);z-index:20;pointer-events:none;opacity:.9;box-shadow:0 14px 22px #0008}
.lifting{opacity:.35}

.arena{grid-template-rows:auto auto minmax(0,1fr) auto minmax(0,1fr) auto}
.rival-tray{position:relative;display:grid;place-items:center;height:clamp(31px,5.2svh,49px);margin:0 8px;isolation:isolate}
#rivalHand{display:flex;justify-content:center;align-items:center;width:67%;height:100%;padding:3px 9px}
.cardback{position:relative;display:inline-grid;place-items:center;height:100%;aspect-ratio:5/7;min-width:2px;flex:0 1 auto;box-sizing:border-box;border:2px ridge #bf9e69;border-radius:4px;background:repeating-linear-gradient(45deg,transparent 0 4px,#d0a35921 5px,transparent 6px),linear-gradient(130deg,#402f35,#683c39 45%,#2f2531);box-shadow:inset 0 0 0 2px #352b29,0 2px 3px #07161b;color:#f2d49d}
.cardback:before{content:"✧";font:normal 20px Georgia;display:grid;place-items:center;line-height:1;position:absolute;inset:3px;border:1px solid #d1af6466;border-radius:2px}
#rivalHand .cardback+.cardback{margin-left:-5px}#rivalDeck{position:absolute;right:8%;height:70%;transform:rotate(8deg);box-shadow:2px 2px 0 #ccad7a,4px 4px 0 #302829}
#motion{position:fixed;inset:0;z-index:18;pointer-events:none;overflow:hidden}
#motion .motion-copy{position:fixed;margin:0;max-width:none;max-height:none;min-width:0;min-height:0;pointer-events:none;transform:none;animation:none}
.tear-left{clip-path:polygon(0 0,52% 0,47% 18%,54% 32%,46% 48%,52% 60%,47% 78%,53% 100%,0 100%)}
.tear-right{clip-path:polygon(52% 0,100% 0,100% 100%,53% 100%,47% 78%,52% 60%,46% 48%,54% 32%,47% 18%)}

.header-actions{display:flex;align-items:center;gap:7px}#settings{font-size:22px}
.setting-row{display:flex;align-items:center;justify-content:space-between;gap:15px;margin:19px 0 6px;padding:12px;border:1px solid #89764e;border-radius:6px;background:#1a3234;text-align:left;font:600 16px system-ui}
.setting-row input{width:24px;height:24px;accent-color:#93d3bc}
#defenseSummary{display:none}
.planning .arena{grid-template-rows:auto auto minmax(0,2fr) auto minmax(0,.85fr) auto}
.planning #foes{align-items:stretch;gap:8px}.lane{position:relative;min-height:0;max-width:30%;width:115px;display:grid;justify-items:center;grid-template-rows:15px minmax(0,1.16fr) minmax(0,1fr);gap:3px;padding:3px 2px 5px}
.lane-label{font:bold 9px/15px system-ui;color:#ffe0b3;letter-spacing:.1em}.lane .piece{height:100%;max-width:100%;transform:none}.lane .threat{border-color:#eda276;box-shadow:0 0 8px #f4ac7750}.lane .intercept-slot{display:flex;justify-content:center;align-items:center;width:100%;min-height:0;position:relative}.intercept-slot .assigned{touch-action:none;user-select:none;transform:rotate(-2deg);border-color:#9ae3d0}.lane .cardface strong{font-size:clamp(10px,2.7vw,14px)}.lane .cardface .foot{font-size:10px}.empty-block{display:grid;place-items:center;width:92%;height:85%;font:11px system-ui;color:#f0dcba}
.planning #allies:empty:before{content:"Reserve · drop here to withdraw"}.planning #hand,.planning #handCount{display:none}.planning #defenseSummary{display:block;text-align:center;color:#ffdeb0;font:600 14px system-ui;padding:4px 8px}.planning .available,.planning .assigned{-webkit-touch-callout:none;touch-action:none}
@media(max-height:700px){.planning .medal{width:44px}.planning .seat{min-height:46px}.lane-label{line-height:12px}.lane{grid-template-rows:12px minmax(0,1fr) minmax(0,1fr)}}
/* A separate hero rail gives direct attacks a clear destination beside each row. */
.arena,.planning .arena{grid-template-columns:minmax(0,1fr) clamp(86px,23vw,122px);grid-template-rows:auto minmax(0,1fr) auto minmax(0,1fr);grid-template-areas:"tray tray" "foes rival" "round round" "allies hero";column-gap:8px;padding-inline:9px}
.rival-tray{grid-area:tray}.seat.other{grid-area:rival}.seat.own{grid-area:hero}#foes{grid-area:foes}#allies{grid-area:allies}.turnline{grid-area:round}
.seat{display:flex;flex-direction:column;align-items:center;justify-content:center;align-self:center;gap:3px;background:linear-gradient(90deg,transparent,#0e252a99);padding:4px 0;border-radius:10px}
.identity{text-align:center;order:1}.identity strong{font-size:clamp(12px,3.4vw,17px);line-height:1.05}.identity small{font-size:8px}.medal,.planning .medal{width:clamp(76px,20vw,101px);height:auto;order:0;border-width:3px;flex-shrink:0}.seat .life{font-size:14px;bottom:0;right:-2px}.seat .power{order:2;display:flex;align-items:center;justify-content:center;gap:3px;min-height:44px;padding:1px 4px}.power i{width:23px;height:23px;font-size:17px}.seat .budget{font-size:10px}
.field{gap:5px}.field .piece{height:min(89cqh,39cqw,170px);max-width:31%}
.planning .arena{grid-template-rows:auto minmax(0,1.6fr) auto minmax(0,1fr)}
.planning #foes{gap:4px}.lane{max-width:32%;padding:2px 1px;min-width:0}.field .lane .piece{height:100%;max-width:100%}.field .lane-label{font-size:8px}.lane .foot i{display:none}.lane .foot{font-size:10px}.planning #allies:empty:before{content:"Drop here to withdraw";white-space:normal;text-align:center}

@media(max-height:680px){.medal,.planning .medal{width:65px}.seat,.planning .seat{gap:0}.identity small{display:none}.seat .power{min-height:38px}}
/* A slot owns its available space. The printed card keeps its 5:7 trim size. */
.planning .lane{align-self:center;height:min(99%,370px);grid-template-rows:14px minmax(0,1fr) minmax(0,1fr)}
.threat-slot,.lane .intercept-slot{container-type:size;display:grid;place-items:center;width:100%;height:100%;min-height:0}
.field .lane .piece,.lane .empty-block{width:min(98cqw,70cqh);height:auto;max-width:none;min-height:0;aspect-ratio:5/7;transform:none}
.field>.piece{width:min(30cqw,61cqh,121px);height:auto;aspect-ratio:5/7;transform:none}
.card-status{position:absolute;z-index:1;left:2px;right:2px;top:36%;padding:3px 2px;font:700 clamp(9px,2.5vw,12px)/1.12 system-ui;text-align:center;color:#fff4df;background:#412d37f5;border-block:1px solid #b78480;pointer-events:none}
.card-status.queued{background:#224b44f2;border-color:#dac488;color:#fff4cd}
.unpaid .art{filter:saturate(.48) brightness(.72)}
.seat .budget{display:grid;justify-items:center;gap:2px;margin:4px auto 0}
.pearl-string{display:flex;flex-wrap:wrap;justify-content:center;gap:3px;max-width:96px;max-height:45px;overflow:auto;border:1px solid #76664f;background:#142524;border-radius:9px;padding:3px 5px}
.pearl{width:12px;height:12px;flex:none;border:1px solid #746f64;border-radius:100%;background:radial-gradient(circle at 34% 29%,#71756c,#3a4343 30%,#202b2c 72%,#75745c);box-shadow:0 1px 2px #000b}
.pearl.lit{border-color:#e6ecbd;background:radial-gradient(circle at 32% 24%,#fff 0 9%,#edffdf 17%,#b8f1d2 39%,#68b5ad 67%,#c7d7a0 92%);box-shadow:0 0 5px #90ffcf96,0 1px 2px #131d1a}
.pearl-count{color:#cee0d3;font:600 10px system-ui}
#attackLines{position:absolute;inset:0;display:block;width:100%;height:100%;pointer-events:none;z-index:3;fill:none;stroke-linecap:round;stroke-linejoin:round}
#orders:empty{display:none}#orders{display:grid;gap:2px;padding:2px 10px}.order-item{display:flex;align-items:center;gap:8px;padding-left:6px;background:#152e32;border:1px solid #536659;border-radius:5px;font:500 12px/1.1 system-ui}.order-item b{width:19px;height:19px;display:grid;place-items:center;border-radius:50%;color:#193332;background:var(--mark)}.order-item span{flex:1}.order-item i{color:#ead8a2}.order-item button{min-width:42px;height:32px;font-size:20px;border:0;background:transparent}
.ordering #hand{height:clamp(73px,11svh,95px)}.ordering .handcard{height:100%}
@media(max-height:700px){.pearl-string{gap:2px;padding:2px 4px}.pearl{width:9px;height:9px}}
.field.crowded{display:grid;grid-template-columns:repeat(var(--columns),minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr));align-items:center;justify-items:center;gap:3px}
.field.crowded>.piece{width:min(calc(94cqw / var(--columns)),29cqw,32cqh,100px);max-width:100%}
.field.crowded .cardface strong{font-size:clamp(9px,2.8vw,13px);padding:1px;line-height:1}
.field.crowded .foot i{display:none}.field.crowded .card-status{font-size:9px;top:28%}
.planning #foes.crowded .lane{max-width:100%;width:100%;height:100%;align-self:stretch;grid-template-rows:11px minmax(0,1fr) minmax(0,1fr);padding-block:0;gap:1px}
.planning #foes.crowded .lane-label{line-height:11px}
#orders{max-height:109px;overflow-y:auto}
.cardface{grid-template-columns:minmax(0,1fr)}
.field .cardface .foot i{display:none}.field .cardface strong{overflow-wrap:anywhere}
.planning #foes[data-count="1"] .lane{max-width:94%;width:100%;height:98%}
.planning #foes[data-count="2"] .lane{flex:var(--lane-columns) 1 0;max-width:none;height:98%}
.lane .intercept-slot.group-block{display:grid;grid-template-columns:repeat(var(--guard-cols),minmax(0,1fr));grid-template-rows:repeat(var(--guard-rows),minmax(0,1fr));gap:2px;justify-items:center}
.field .group-block .assigned{width:min(calc(94cqw / var(--guard-cols)),calc(68cqh / var(--guard-rows)));min-height:0}
.group-block .assigned .card-status{inset:2px 2px auto auto;width:auto;border-radius:2px;font-size:10px;padding:1px 3px}
.block-order{font:500 12px/1.25 system-ui;color:#e8ead8;padding-top:3px}
#defenseSummary{max-height:85px;overflow:auto}
.handcard.unaffordable{filter:grayscale(1) brightness(.68)}

/* Resolve the three-card size on the row before entering nested blocker slots. */
@property --field-cap{syntax:"<length>";inherits:true;initial-value:121px}
.field>.lane{--field-cap:min(30cqw,61cqh,121px)}
.field .lane .piece,.lane .empty-block{max-width:var(--field-cap)}
.art-window{position:relative;display:block;min-height:0;overflow:hidden}
.state-badge,.perk-badge{display:grid;place-items:center;color:#ffe6ac;background:#103638;border:1px solid #ceb06f;box-shadow:0 1px 3px #07161bcc;pointer-events:none}
.state-badge{position:absolute;z-index:2;top:2px;right:2px;min-width:17px;height:19px;border-radius:3px;padding:0 2px;font:800 11px/1 system-ui}
.state-badge img{width:17px;height:17px;object-fit:contain}
.perk-badge{position:absolute;left:1px;bottom:1px;width:16px;height:16px;border-radius:50%;border-color:#9dd1bf;background:#154740;color:#caf6df}
.perk-badge svg{width:11px;height:11px;fill:currentColor}
.forecast{display:block;white-space:normal;border:1px solid #eda771;border-radius:3px;background:#443022;color:#fff1d4;padding:2px 3px;font:750 11px/1 system-ui;text-align:center;max-width:100%;pointer-events:none}
.forecast.lethal{background:#781f2b;border-color:#ffa89b;color:#ffefdf}
.cardface:has(.forecast){grid-template-rows:minmax(0,1fr) auto auto auto}
.cardface:has(.forecast.lethal){border-color:#e3867c}

.arena,.planning .arena{grid-template-areas:"tray tray" "foes rival" "round round" "allies hero" "relic hero"}
.arena{grid-template-rows:auto minmax(0,1fr) auto minmax(0,1fr) auto}
.planning .arena{grid-template-rows:auto minmax(0,1.6fr) auto minmax(0,1fr) auto}
#artifactSlot{grid-area:relic;justify-self:center;display:flex;align-items:center;text-align:left;gap:8px;min-height:44px;max-width:95%;margin:0 0 6px;padding:3px 15px 3px 7px;background:transparent;border:0;border-radius:6px;color:#ede0b9;font:600 13px system-ui}
#artifactSlot i{font:27px Georgia;color:#c7ab75}
#artifactSlot.equipped{background:linear-gradient(110deg,#0e302ee6,#122628ee);border:1px solid #bda26a;box-shadow:inset 0 0 0 2px #31423a,0 2px 5px #071713}
#artifactSlot img{width:33px;height:38px;border-radius:3px;border:1px solid #aa9364;object-fit:cover}
#artifactSlot small{display:block;font:700 9px system-ui;letter-spacing:.13em;color:#9cd8c5}
#artifactSlot strong{font:600 15px Georgia;color:#ffe8b6}

.state-badge[title="Stunned"]{height:22px;min-width:22px;padding:0;border-color:#f4c177}
.state-badge[title="Stunned"] img{width:20px;height:20px}
/* Tilt only creatures that have spent an attack, including those in reserve. */
.arena .piece.has-attacked{rotate:8deg;scale:.94}
.piece .state-badge[title="Exhausted"]{width:22px;height:22px;padding:0;border:0;background:transparent}
.piece .state-badge[title="Exhausted"] img{width:100%;height:100%}
.field.crowded[data-count="5"]>:nth-child(4),.field.crowded[data-count="7"]>:nth-child(5){grid-column-start:2}
.stunned-lane .lane-label{color:#f6cc8a}.stunned-lane .threat{border-color:#b69a67}

@media(prefers-reduced-motion:reduce){.travel-arrow{display:none}}
#allyReserve:empty,#foeReserve:empty{display:none}
#game.planning .arena{
 grid-template-areas:"tray tray" "otherfoes rival" "foes rival" "round round" "allies hero" "reserve hero" "relic hero";
 grid-template-rows:auto auto minmax(0,1fr) auto minmax(0,1fr) auto auto;
}
#allyReserve{grid-area:reserve}
#foeReserve{grid-area:otherfoes}
#allyReserve,#foeReserve{display:flex;justify-content:safe center;gap:3px;overflow-x:auto;padding:3px 2px}
:is(#allyReserve,#foeReserve) .piece{flex:0 0 auto;height:clamp(52px,8svh,74px);width:auto;aspect-ratio:5/7;transform:none;max-width:none}
:is(#allyReserve,#foeReserve) .piece strong{font-size:9px;padding:1px}
:is(#allyReserve,#foeReserve) .piece .foot{font-size:9px}
:is(#allyReserve,#foeReserve) .foot i{display:none}
#allyReserve .ally-card{touch-action:none}
#game.planning :is(#allies,#foes){gap:4px}
#game.planning :is(#allies,#foes)>.lane{
 flex:var(--lane-columns) 1 0;width:100%;height:98%;max-width:none;align-self:center;grid-template-rows:minmax(0,1fr);
}
#game.outgoing #allies>.lane,#game.planning:not(.outgoing) #foes>.lane{grid-template-rows:auto minmax(0,1fr)}
.outgoing #hand{display:flex}.outgoing #defenseSummary{display:none}.outgoing #handCount{display:inline}
.outgoing #allies:empty:before{content:"Your row"}
.ordered-attacker{touch-action:none;user-select:none;-webkit-touch-callout:none}

.planning #foes:not(.crowded) .lane{row-gap:6px}

.outgoing .own{gap:1px;padding-block:0}.outgoing .own .medal{width:clamp(55px,8svh,73px)}.outgoing .own .budget{margin:1px auto}.outgoing .own .power{min-height:36px}
@media(max-height:730px){.outgoing .own .identity small{display:none}.outgoing .own .power span{font-size:10px}.outgoing #orders{max-height:65px}.outgoing #hand{height:60px}}

.outgoing .own{align-self:end;margin-bottom:3px}
.realmChoice span{text-align:left}.realmChoice small{display:block;font:500 12px/1.4 system-ui;color:#d3c4a5;letter-spacing:0;margin-top:3px}
.sheet-actions{flex-wrap:wrap}
.match-pick{display:flex;align-items:center;gap:12px;margin:10px 0;padding:8px;border:1px solid #887148;border-radius:6px;text-align:left;background:#173034}
.match-pick img{height:55px;width:59px;object-fit:cover;border-radius:3px;border:1px solid #a18b5e}
.match-pick span{flex:1;min-width:0;color:#d7be91;font:600 12px system-ui}
.match-pick select{display:block;width:100%;min-height:44px;border:0;color:#ffedc4;background:#173034;font:600 16px Georgia}
#rivalArtifact{position:absolute;left:3%;padding:1px;width:36px;height:95%;border:1px solid #b69a61;background:#203331;border-radius:3px}#rivalArtifact img{width:100%;height:100%;object-fit:cover}
.deck-switch{display:flex;margin:14px 0 0;background:#102327;border-radius:5px 5px 0 0;border:1px solid #796e50;overflow:hidden}
.deck-switch button{flex:1;min-height:44px;background:transparent;border:0;color:#cbd6cd;font:600 14px system-ui}
.deck-switch button[aria-pressed=true]{background:#294344;color:#ffe5a6;box-shadow:inset 0 -3px #cca367}
#deckList{max-height:clamp(170px,31svh,320px);overflow:auto;overscroll-behavior:contain;text-align:left;border:1px solid #796e50;border-top:0;border-radius:0 0 5px 5px;background:#102629;padding:0 7px 7px;margin:0 0 12px}
#deckList h4{font:650 12px system-ui;letter-spacing:.05em;color:#d1bd90;margin:10px 3px 5px}
.deck-entry{border-top:1px solid #425149}.deck-entry summary{display:flex;align-items:center;gap:8px;cursor:pointer;min-height:44px;list-style:none}
.deck-entry summary::-webkit-details-marker{display:none}.deck-entry img{width:39px;height:37px;object-fit:cover;border-radius:3px}
.deck-entry span{flex:1;color:#fff0d4;font:600 15px Georgia}.deck-entry small{display:block;color:#bbcdc5;font:12px system-ui}
.deck-entry b{min-width:24px;text-align:center;color:#baf4d7;border:1px solid #758875;border-radius:5px;background:#183932;font:700 14px/23px system-ui}
.deck-entry p{margin:2px 4px 8px 47px;font:14px/1.35 system-ui;color:#e9dfcb}

dialog.inspecting {
 width:100%;height:100%;max-width:none;max-height:none;margin:0;
 padding:max(12px,env(safe-area-inset-top)) 14px max(12px,env(safe-area-inset-bottom));
 background:transparent;border:0;border-radius:0;box-shadow:none;color:#fff3d6;
}
dialog.inspecting[open]{display:grid;place-items:safe center}
dialog.inspecting::backdrop{background:#021012df;backdrop-filter:blur(5px)}
.inspecting #sheet{
 width:min(100%,24rem,max(13rem,calc((100dvh - 9.5rem)*.7)));
 display:grid;gap:8px;align-content:center;
}
.inspecting .close{float:none;justify-self:end;background:#142928;color:#fff0ca;border:1px solid #a48b5d;line-height:1}
.inspected-card{
 width:100%;aspect-ratio:5/7;padding:6px;border-radius:10px;
 grid-template-rows:minmax(0,1fr) auto auto;box-shadow:0 12px 38px #0009,inset 0 0 0 1px #1d2623;
}
.inspected-card:has(.card-rules),.inspected-card:has(.forecast){grid-template-rows:minmax(0,1fr) repeat(3,auto)}
.inspected-card:has(.card-rules):has(.forecast){grid-template-rows:minmax(0,1fr) repeat(4,auto)}
.inspected-card strong{font-size:clamp(20px,5.8vw,30px);padding:7px 5px;line-height:1.08}
.card-rules{margin:0;padding:9px 12px;background:#f1e5c9;color:#342a20;font:clamp(14px,3.9vw,17px)/1.3 Georgia,serif;text-wrap:pretty}
.inspected-card .foot{min-height:32px;padding:0 4px;justify-content:space-between}
.inspected-card.action .foot{justify-content:center}
.inspected-card .foot i{font:700 10px/1 system-ui;letter-spacing:.14em}
.inspected-card button{pointer-events:auto;cursor:pointer}
.inspected-card .cost,.inspected-card .state-badge,.inspected-card .perk-badge{
 display:grid;place-items:center;min-width:44px;height:44px;padding:5px;font:700 20px/1 system-ui;
}
.inspected-card .cost{top:8px;left:8px}
.inspected-card .state-badge{top:8px;right:8px}
.inspected-card .perk-badge{bottom:6px;left:6px}
.inspected-card .state-badge img,.inspected-card .perk-badge svg{width:27px;height:27px}
.inspected-card .foot button{min-width:52px;min-height:44px;border:0;border-radius:4px;background:transparent;color:#392e21;font:700 20px/1 system-ui}
.inspected-card .foot button:last-child{color:#84374a}
.inspected-card .forecast{min-height:44px;font-size:15px}
.inspected-card button:is([aria-pressed=true],:focus-visible){outline:2px solid #fff0a7;outline-offset:-3px;box-shadow:inset 0 0 0 4px #966824}
.icon-note{position:fixed;z-index:5;width:max-content;max-width:min(216px,calc(100vw - 24px));padding:10px 13px;border:1px solid #c7a369;border-radius:8px;background:#142b2e;color:#fff0d5;box-shadow:0 5px 18px #0008;text-align:left;font:14px/1.4 system-ui}
.icon-note b{display:block;margin-bottom:3px;color:#ffdb95;font:700 16px/1.2 Georgia,serif}
.icon-note::before{content:"";position:absolute;width:9px;height:9px;background:#142b2e;border:solid #c7a369;border-width:1px 1px 0 0}
.icon-note[data-side="left"]::before{right:0;top:var(--tip);transform:translate(55%,-50%) rotate(45deg)}
.icon-note[data-side="right"]::before{left:0;top:var(--tip);transform:translate(-55%,-50%) rotate(-135deg)}
.icon-note[data-side="above"]::before{bottom:0;left:var(--tip);transform:translate(-50%,55%) rotate(135deg)}
.icon-note[data-side="below"]::before{top:0;left:var(--tip);transform:translate(-50%,-55%) rotate(-45deg)}

/* A declared attacker waits at the player's edge of the center line. */
#game.outgoing #allies:not(.crowded)>.lane .threat-slot{align-items:start}
#game.outgoing #foes:not(.crowded)>.lane .intercept-slot{align-items:end}
#effectOptions{display:flex;justify-content:center;flex-wrap:wrap;gap:8px;max-height:65svh;overflow:auto}
.gold-count{color:#ffe3a2;font:700 11px system-ui}

#game.planning:not(.outgoing) #foes:not(.crowded) .threat-slot{align-items:end}
#game.planning:not(.outgoing) #allies:not(.crowded) .intercept-slot{align-items:start}
.planning:not(.outgoing) #allyReserve:empty{display:grid;place-items:center;min-height:32px}
.planning:not(.outgoing) #allyReserve:empty::after{content:"Drop here to withdraw";font:11px system-ui;color:#e5dcc8}
.perk-strip{position:absolute;bottom:1px;left:1px;display:flex;gap:1px;max-width:100%}
.perk-strip .perk-badge{position:static;font:700 11px/1 system-ui}
.inspected-card .perk-strip{bottom:6px;left:6px;gap:4px}
#game.declaring #foes{align-items:center}

dialog:has(#cardOptions){
 width:min(94vw,46rem);padding:clamp(16px,4vw,32px) clamp(10px,2.8vw,24px);
 border:1px solid #ad935e;border-radius:14px;background:radial-gradient(ellipse at top,#22484a,#102628 74%);
}
dialog:has(#cardOptions) h2{margin:0;font:normal clamp(23px,5.5vw,34px)/1.12 Georgia,serif;color:#fff0cc}
.choice-hint{margin:6px 0 18px;font:14px/1.4 system-ui;color:#c4d4ca}
#cardOptions{display:flex;flex-wrap:wrap;align-items:start;justify-content:center;gap:clamp(5px,1.7vw,14px);padding:5px 2px 10px}
.choice-card{width:calc((100% - clamp(5px,1.7vw,14px)*2)/3);max-width:185px;aspect-ratio:5/7;cursor:zoom-in}
.choice-card strong{font-size:clamp(13px,3.2vw,20px);padding-block:4px}
.choice-card .foot{min-height:18px}
.choice-card.action .foot{justify-content:center}
.choice-card:focus-visible{outline:2px solid #ffe39c;outline-offset:3px}
@media(hover:hover){.choice-card:hover{transform:translateY(-3px);border-color:#ffe5aa}}
dialog:has(#cardOptions) :is(.sheet-actions,#effectOptions):empty{display:none}
dialog:has(#cardOptions) #effectOptions:not(:empty){margin-top:10px}
.inspecting #sheet:has(#confirmCardChoice){width:min(100%,24rem,max(13rem,calc((100dvh - 13rem)*.7)))}
.inspecting:has(#confirmCardChoice) .close{width:auto;padding:0 14px;font:600 14px system-ui;justify-self:start;border-radius:999px}
#confirmCardChoice{width:100%}
#actionCount:not([hidden]){display:block;margin:7px 0 0;padding:7px 0 1px;border-top:1px solid #baa474;color:#28534c;font:700 clamp(13px,3.7vw,16px)/1.3 system-ui;text-wrap:balance}

#allyReserve:has(.available,.attack-ready){padding:8px;gap:6px}
#allyReserve .available,#game:not(.choosing-entry-target) .arena .attack-ready{border-color:#b1e8cd;box-shadow:inset 0 0 0 1px #24443c,0 0 5px 1px #9ee8c7a6,0 0 10px #7fcba682}
.turnline #end{position:relative;z-index:4;min-width:54px;border-radius:22px}

/* Direct targets get a tight outline. Area spells also show their full footprint. */
.arena .effect-field{background:radial-gradient(ellipse closest-side,#9dd8b521,transparent)}
.arena .effect-target{outline:2px solid #b0e5c8;outline-offset:1px;filter:brightness(1.12)}
.arena .drag-target{outline:3px solid #ffdf95;outline-offset:2px;box-shadow:0 0 10px 3px #f6c878aa;filter:brightness(1.14)}

.drag-ghost.unusable{filter:grayscale(1) brightness(.72)}
#dragReason:not([hidden]){position:fixed;z-index:22;top:max(15px,env(safe-area-inset-top));left:50%;transform:translateX(-50%);width:max-content;max-width:calc(100vw - 32px);box-sizing:border-box;padding:9px 16px;border:1px solid #bea475;border-radius:12px;background:#17292cf7;box-shadow:0 3px 12px #08141699;color:#fff0d5;font:600 14px/1.3 system-ui;text-align:center;pointer-events:none}

.game-screen[hidden]{display:none!important}
#gameHome{
 position:relative;isolation:isolate;display:flex;align-items:flex-end;max-width:650px;min-height:100svh;margin:auto;
 padding:max(24px,env(safe-area-inset-top)) max(23px,env(safe-area-inset-right)) max(28px,env(safe-area-inset-bottom)) max(23px,env(safe-area-inset-left));
 background:linear-gradient(180deg,#101d2370 0%,transparent 28%,#07181d38 44%,#09191eeb 64%,#08191e 95%),url("assets/first-set/OW-030-art.webp") center 29%/cover;
 color:#f9ead2;box-shadow:0 0 70px #000a;
}
.home-content{width:min(100%,350px);margin:0 auto}
#gameHomeTitle{margin:0 0 24px;font:400 clamp(3.9rem,15vw,6rem)/.8 Georgia,serif;letter-spacing:-.055em;text-shadow:0 5px 29px #051314}
#gameHomeTitle span{display:block;margin-top:12px;color:#e5c089;font:600 .88rem/1.25 system-ui,sans-serif;letter-spacing:.34em;text-transform:uppercase}
.home-actions{display:grid;gap:8px}
.home-actions button,.skill-navigation button{min-height:48px;padding:8px 14px;border:1px solid #7b785b;border-radius:7px;background:#18302feb;color:#f9e7c6;font:600 1rem system-ui,sans-serif}
.home-actions button:hover,.skill-navigation button:hover{background:#264b41}
.home-actions #homePlay{min-height:57px;margin-bottom:2px;border-color:#efcb93;background:#ecc388;color:#271e14;font:700 1.12rem system-ui,sans-serif}
.home-actions #homePlay:hover{background:#ffdda4}
#gameSkills{
 display:flex;flex-direction:column;max-width:402px;height:100dvh;margin:auto;
 padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
 background:#231917;box-shadow:0 0 70px #000a;
}
.skill-navigation{flex:none;min-height:52px;padding:4px 9px;background:#251c18;border-bottom:1px solid #8d6d4f}
.skill-navigation button{min-height:44px;background:#362922}
.skill-navigation span{color:#edc392;font:600 .875rem system-ui,sans-serif}
#skillTreeFrame{display:block;flex:1;min-height:0;width:100%;border:0;background:#231917}
#fightHome{font-size:26px;flex:none}
@media(max-width:460px){#game>header{padding-inline:10px}#game .header-actions{gap:4px}}
