:root{color-scheme:dark;font-family:system-ui,sans-serif;background:#101b22;color:#e7eef1}*{box-sizing:border-box}body{margin:0}header{padding:22px 4vw;border-bottom:1px solid #35505d;display:flex;justify-content:space-between;align-items:center}small{letter-spacing:.22em;color:#83c4c6}h1{margin:5px 0;font-size:25px}h2{font-size:19px}main{padding:20px 3vw}section{background:#1a2a34;padding:22px;border:1px solid #35505d;border-radius:14px;margin-bottom:18px}button,input,select{font:inherit;border:1px solid #45616f;border-radius:7px;padding:10px;background:#233b49;color:inherit;margin:4px}button{cursor:pointer}button:hover{background:#366074}button:disabled{opacity:.5;cursor:wait}label{display:inline-block}#create,#join{background:#ad7342}#error{color:#ffbba5;white-space:pre-wrap}#base,#invite{width:min(100%,650px)}.layout{display:grid;grid-template-columns:minmax(0,1fr) 330px;gap:18px}.player{background:#17313b;border:1px solid #3a6570;border-radius:12px;padding:14px;margin:12px 0}.player.enemy{background:#282d36}.zone{padding:8px;border-top:1px solid #40505a}.cards{display:flex;gap:6px;flex-wrap:wrap}.card{width:86px;min-height:118px;font-size:11px;padding:3px;margin:0;text-align:left;background:#233943}.card img{width:78px;border-radius:4px}.card.sleep{opacity:.65;outline:2px solid #e2b46b}.card.rest{outline:2px solid #729fc9}.back{background:repeating-linear-gradient(45deg,#293e4c,#293e4c 6px,#334c5a 6px,#334c5a 12px);display:grid;place-items:center;width:52px;min-height:75px;font-size:11px;border-radius:5px}.summary{display:flex;gap:10px;align-items:center;flex-wrap:wrap}aside{background:#182731;padding:15px;border-radius:12px;align-self:start;position:sticky;top:10px}#actions{max-height:430px;overflow:auto}#actions button{display:block;width:98%;text-align:left;font-size:13px}#logs{max-height:240px;overflow:auto;font-size:12px;white-space:pre-wrap;color:#b9cbd2}#status{padding:14px;background:#294954;border-radius:8px}dialog{max-width:620px;width:90%;border:1px solid #7097a1;border-radius:12px;background:#182731;color:#eee}dialog img{width:210px;float:left;margin:10px}dialog p{white-space:pre-wrap;line-height:1.7}#connection{color:#a5d1bd;font-size:13px}@media(max-width:900px){.layout{grid-template-columns:1fr}aside{position:static}.card{width:70px}.card img{width:62px}main{padding:10px}.player{padding:8px}dialog img{float:none;width:160px}}
:root{--mat-line:#46758b}
.playmat{display:grid;grid-template-columns:110px minmax(340px,1fr) 110px;grid-template-areas:'case field deck' 'evidence partner discard' 'evidence file discard' 'hand hand hand';gap:8px;background:#111f30;border:3px solid var(--mat-line);border-radius:10px;padding:10px}
.playmat .zone{margin:0;min-width:0;border:1px solid #426275;border-radius:7px;background:#192c3d;padding:7px}
.zone h3{font-size:12px;letter-spacing:.05em;color:#b5d1dd;margin:0 0 7px}
.zone-case{grid-area:case}.zone-field{grid-area:field;min-height:155px}.zone-deck{grid-area:deck}.zone-evidence{grid-area:evidence}.zone-partner{grid-area:partner;min-height:130px}.zone-discard{grid-area:discard;max-height:295px;overflow:auto}.zone-file{grid-area:file;min-height:100px}.zone-hand{grid-area:hand}.zone-transit{grid-column:1/-1}
.zone-field .cards{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));align-items:start}.zone-partner .cards{justify-content:center}.zone-file .cards,.zone-hand .cards{flex-wrap:nowrap;overflow-x:auto;padding-bottom:5px}.slot{height:110px;border:1px dashed #527285;border-radius:5px;display:grid;place-items:center;color:#678495;font-size:12px}.zone-evidence .cards{max-height:265px;overflow:auto}.zone-file .card,.zone-hand .card{flex-shrink:0}.enemy .playmat{grid-template-areas:'hand hand hand' 'discard file evidence' 'discard partner evidence' 'deck field case'}.player h2{font-size:14px}.playmat .card{max-width:100%}.playmat .card img{max-width:100%;height:auto}.playmat .back{height:95px;min-height:75px}.zone-file .back{flex:0 0 45px}.zone-evidence .back{height:60px;min-height:60px}.zone-hand .back{height:75px;flex:0 0 45px}.zone-case .card{width:95px;min-height:85px}.zone-case .card img{width:89px}.zone-partner:has(.cards:empty):after{content:'アシスト中 → FILE';font-size:12px;color:#91aeba}.layout{grid-template-columns:minmax(610px,1fr) 300px}.player{padding:10px}#board{min-width:0}#connection{max-width:240px}.enemy{--mat-line:#775b5b}
@media(max-width:1100px){.layout{grid-template-columns:1fr}aside{position:static}#actions{max-height:300px}}
@media(max-width:640px){#board{overflow-x:auto}.player{min-width:590px}.playmat{grid-template-columns:95px minmax(330px,1fr) 95px;padding:6px;gap:5px}.playmat .card{width:66px}.playmat .card img{width:60px}.slot{height:90px}.zone h3{font-size:11px}}

.card-menu{position:fixed;z-index:1000;width:260px;padding:7px;background:#12232e;border:1px solid #83c4c6;box-shadow:0 10px 40px #0009;border-radius:10px;max-height:85vh;overflow:auto}.card-menu button{display:block;width:calc(100% - 8px);text-align:left}.card.selected,.back.selected{outline:3px solid #f1c75c;transform:translateY(-7px)}.card.targetable{outline:3px solid #71e2c2;box-shadow:0 0 15px #71e2c255}.card[draggable=true]{cursor:grab}.card[draggable=true]:active{cursor:grabbing}.cards{padding-top:8px}.back{color:#dae6f0}.card:focus-visible,.back:focus-visible{outline:3px solid #fff}

/* Compact match table: only individual areas and the log scroll. */
body.playing{height:100dvh;overflow:hidden}body.playing header{height:48px;padding:5px 16px}body.playing header h1{font-size:17px;margin:0}body.playing header small{font-size:9px}body.playing main{height:calc(100dvh - 48px);padding:5px 10px;display:flex;flex-direction:column}body.playing #inviteBox{padding:3px 8px;margin:0;font-size:11px;flex:none}body.playing #inviteBox p,body.playing #inviteBox strong{display:none}body.playing #inviteBox input{padding:3px;width:45%;font-size:10px}body.playing #inviteBox button{padding:4px;font-size:11px}body.playing #error{margin:0;font-size:12px}#match{min-height:0;flex:1;display:flex;flex-direction:column}#match[hidden]{display:none}body.playing #status{padding:5px 10px;font-size:12px;flex:none}body.playing .layout{display:grid;grid-template-columns:minmax(0,1fr) 260px;gap:8px;flex:1;min-height:0}#table{display:grid;grid-template-rows:minmax(0,1fr) 42px minmax(0,1fr);min-height:0}#board{display:contents}#board .enemy{grid-row:1}#board .own{grid-row:3}#processing{grid-row:2;display:flex;gap:10px;align-items:center;overflow:auto;border:1px solid #b59e70;border-radius:7px;font-size:11px;padding:2px 9px;background:#353025}#processing .card{width:35px;min-height:0;flex-shrink:0}#processing .card img{height:28px;width:auto}#processing .card div{display:none}
body.playing .player{min-width:0;min-height:0;margin:2px 0;padding:3px;display:flex;flex-direction:column}body.playing .player h2{font-size:10px;margin:2px 4px;flex:none}body.playing .playmat{flex:1;min-height:0;padding:3px;gap:3px;grid-template-columns:70px minmax(0,1fr) 70px;grid-template-rows:1fr 1fr .65fr .7fr}body.playing .enemy .playmat{grid-template-rows:.7fr .65fr 1fr 1fr}body.playing .zone{min-height:0;max-height:none;padding:2px 4px;overflow:hidden;display:flex;flex-direction:column}body.playing .zone h3{font-size:9px;margin:0;flex:none}body.playing .cards{min-height:0;flex:1;padding:0;gap:3px;overflow:auto;flex-wrap:nowrap}body.playing .zone-field .cards{display:flex;justify-content:space-evenly}body.playing .card{width:48px;min-height:0;height:100%;padding:1px;flex-shrink:0;font-size:8px;display:flex;flex-direction:column;align-items:center}body.playing .card img{max-height:calc(100% - 10px);min-height:0;object-fit:contain;width:100%}body.playing .card div{max-width:100%;overflow:hidden;white-space:nowrap;line-height:10px}body.playing .card div:last-child{display:none}body.playing .back{min-height:0;height:100%;width:32px;flex:0 0 32px;font-size:8px}body.playing .slot{height:100%;width:45px;font-size:8px}body.playing .zone-evidence .cards{max-height:none;flex-wrap:wrap}body.playing .zone-evidence .back{height:25px;width:20px;flex-basis:20px}body.playing aside{position:static;min-height:0;padding:8px;display:flex;flex-direction:column}body.playing aside h2{font-size:12px;margin:5px 0}body.playing #choiceInfo{font-size:11px;margin:4px 0}body.playing #actions{max-height:35%;flex-shrink:0}body.playing #actions button{font-size:11px;padding:6px}body.playing #logs{max-height:none;flex:1;min-height:0;font-size:10px}#logs>div{border-bottom:1px solid #32414b;padding:4px}#logs button{padding:2px;font-size:10px}.discard-pile{position:relative;width:100%;height:100%;margin:0;padding:0;background:repeating-linear-gradient(45deg,#324655,#324655 5px,#1d303c 5px,#1d303c 10px);min-height:0}.discard-pile img{width:100%;height:100%;object-fit:contain}.discard-pile span{position:absolute;bottom:0;right:0;background:#14222c;padding:2px}.modal-cards{display:flex;flex-wrap:wrap;gap:12px;max-height:65vh;overflow:auto;padding:12px}.modal-cards .card,body.playing .modal-cards .card{height:180px;width:120px;min-height:150px}.modal-cards .card img,body.playing .modal-cards .card img{width:110px;height:150px;max-height:150px;float:none;margin:0}.modal-cards .card div,body.playing .modal-cards .card div{display:block;line-height:14px;font-size:11px}#zoneDialog,#privateDialog{max-width:850px}body.playing .modal-cards .card.selected{transform:none}
@media(max-width:800px){body.playing .layout{grid-template-columns:minmax(0,1fr) 180px}body.playing .playmat{grid-template-columns:52px minmax(0,1fr) 52px}body.playing .card{width:36px}body.playing .zone h3{font-size:8px}}

body.playing .own .zone-partner{display:grid;grid-template-columns:minmax(0,1fr) 108px;grid-template-rows:12px minmax(0,1fr)}body.playing .own .zone-partner h3{grid-column:1}body.playing .own .zone-partner .cards{grid-column:1;grid-row:2}#quickControls{grid-column:2;grid-row:1/3;display:flex;flex-direction:column;justify-content:center;min-height:0;gap:2px}#quickControls button{margin:0;padding:2px;font-size:10px;line-height:13px;min-height:0}body.playing .own .zone-partner:after{display:none}

/* Online layout: prioritize cards over physical piles. */
body.playing #table{grid-template-rows:minmax(0,.8fr) 38px minmax(0,1.2fr)}
body.playing .player h2{font-size:12px;line-height:17px}
body.playing .own .playmat{grid-template-columns:86px minmax(0,1fr) 112px;grid-template-rows:minmax(0,1fr) minmax(0,1fr) 27px;grid-template-areas:'case field partner' 'evidence hand hand' 'evidence counters counters';overflow:visible}
body.playing .enemy .playmat{grid-template-columns:86px minmax(0,1fr) 86px;grid-template-rows:26px 28px minmax(0,1fr);grid-template-areas:'partner counters counters' 'partner hand evidence' 'partner field case';overflow:visible}
body.playing .zone-field{overflow:visible;background:#1b3444}body.playing .zone-field .cards{overflow:visible;align-items:center;justify-content:space-evenly;gap:5px}
body.playing .zone-field .card{width:auto;max-width:19%;height:100%;aspect-ratio: .71;flex:0 1 auto;border:1px solid #67828c;position:relative}
body.playing .zone-field .card img{width:100%;height:calc(100% - 14px);max-height:none;object-fit:contain}body.playing .zone-field .card div{font-size:10px;line-height:13px}body.playing .zone-field .card:hover{z-index:8;transform:scale(1.08)}
body.playing .zone-hand{overflow:visible;background:transparent;border:0;position:relative;padding-top:13px}
body.playing .zone-hand h3{position:absolute;top:0;left:0;font-size:11px}
body.playing .own .zone-hand .hand-fan{--hand-width:clamp(78px,10vw,125px);display:block;position:relative;overflow:visible;width:min(100%,calc(var(--hand-count) * 80px + 50px));margin:0 auto;height:100%;padding-top:4px}
body.playing .own .hand-fan .card{position:absolute;bottom:0;left:calc(var(--hand-index) * (100% - var(--hand-width)) / max(1,var(--hand-count) - 1));width:var(--hand-width);max-width:none;height:100%;padding:0;z-index:var(--hand-index);border:2px solid #526a77;border-radius:6px;background:#132431;transform-origin:bottom center;transition:transform .14s ease,box-shadow .14s ease;box-shadow:-3px 0 6px #0007}
body.playing .own .hand-fan .card img{height:100%;max-height:100%;width:100%;object-fit:contain}body.playing .own .hand-fan .card div{display:none}
body.playing .own .hand-fan .card:hover,body.playing .own .hand-fan .card:focus-visible{z-index:100;transform:translateY(-14px) scale(1.12);box-shadow:0 5px 20px #000a}
body.playing .own .hand-fan .card.selected{transform:translateY(-10px);outline:3px solid #f1c75c}body.playing .own .hand-fan .card.selected:hover{transform:translateY(-18px) scale(1.12)}
.zone-counters{grid-area:counters;display:flex;align-items:center;justify-content:flex-end;gap:4px;min-width:0;white-space:nowrap}.zone-counters button{font-size:11px;padding:3px 7px;margin:0;line-height:17px}.zone-counters button:last-child{background:#345261}
body.playing .enemy .zone-hand{padding:0}body.playing .enemy .zone-hand h3{display:none}body.playing .enemy .zone-hand .cards{justify-content:center;overflow:visible}.enemy-hand-count{display:flex;align-items:center;gap:7px;font-size:12px}.enemy-hand-count img{height:25px;width:18px;object-fit:cover}
body.playing .own .zone-partner{display:flex;flex-direction:column;padding:2px}body.playing .zone-partner .cards{flex:1;min-height:0;justify-content:center;flex-wrap:nowrap}body.playing .zone-partner .card,body.playing .zone-partner .back{height:100%;width:48px;max-width:48px}body.playing #quickControls{display:flex;flex-direction:column;gap:2px;flex:none;margin-top:3px}body.playing #quickControls button{font-size:10px;padding:1px}
body.playing .back{background:transparent;border:0;padding:0;display:flex;justify-content:center;align-items:center;overflow:hidden}body.playing .back img{height:100%;width:100%;object-fit:contain}body.playing .zone-case .back{width:100%;height:100%;flex:1}body.playing .zone-case .card{width:100%;max-width:100%;height:100%}body.playing .zone-case .card img{max-height:100%;height:100%}body.playing .zone-case .card div{display:none}
body.playing .zone-evidence .cards{align-content:flex-start}body.playing .zone-evidence .back{height:45px;width:30px;flex-basis:30px}body.playing .zone-evidence .card{height:65px;width:43px}
@media(max-width:850px){body.playing .layout{grid-template-columns:minmax(0,1fr) 170px}body.playing .own .playmat{grid-template-columns:58px minmax(0,1fr) 94px}body.playing .enemy .playmat{grid-template-columns:58px minmax(0,1fr) 58px}.zone-counters button{font-size:9px;padding:2px 3px}body.playing .own .zone-hand .hand-fan{--hand-width:80px}}

/* Compact board: scrolling belongs to logs and dialogs only. */
body.playing{--field-card-width:clamp(48px,6.4vw,96px)}
body.playing header{gap:12px;justify-content:flex-start}body.playing header #connection{margin-left:auto}
body.playing header #inviteBox:not([hidden]){display:flex;align-items:center;gap:4px;margin:0;padding:0;border:0;background:none}
body.playing header #inviteBox strong,body.playing header #inviteBox p,body.playing header #invite{display:none}
body.playing header #inviteBox input{width:140px}body.playing header #inviteBox button{font-size:11px;padding:5px;margin:0}
body.playing #table{grid-template-rows:minmax(0,1fr) 38px minmax(0,1.15fr)}
body.playing .player .playmat{grid-template-columns:calc(var(--field-card-width)*1.45) minmax(0,1fr) calc(var(--field-card-width)*2);gap:5px;overflow:visible}
body.playing .own .playmat{grid-template-rows:minmax(0,1fr) minmax(0,.85fr) 25px;grid-template-areas:'case field partner' 'evidence hand hand' 'evidence counters counters'}
body.playing .enemy .playmat{grid-template-rows:25px minmax(0,.65fr) minmax(0,1fr);grid-template-areas:'counters counters counters' 'evidence hand partner' 'case field partner'}
body.playing .playmat .zone,body.playing .playmat .cards{overflow:visible;min-height:0;max-height:none}
body.playing #board,body.playing #actions,body.playing #processing{overflow:hidden}
body.playing .zone-field{border:0;background:transparent;padding:0}
body.playing .zone-field h3{display:none}
body.playing .zone-field .cards{height:100%;display:flex;flex-wrap:nowrap;gap:3px;justify-content:center;padding:0}
body.playing .zone-field .card{width:var(--field-card-width);max-width:19%;height:min(100%,calc(var(--field-card-width)*1.42));flex:0 1 var(--field-card-width);min-height:0}
body.playing .zone-partner{display:flex;flex-direction:column;padding:2px}
body.playing .zone-partner h3{font-size:10px;margin:0 0 2px;letter-spacing:0}
body.playing .zone-partner .cards{display:flex;flex:1;align-items:center;justify-content:center;gap:3px;padding:0}
body.playing .zone-partner .card,body.playing .zone-partner .back{width:calc(var(--field-card-width) - 8px);max-width:calc(50% - 3px);height:min(100%,calc(var(--field-card-width)*1.35));min-height:0;flex:0 1 auto}
body.playing .zone-partner .card img{height:100%;max-height:100%;object-fit:contain}body.playing .zone-partner .card div{display:none}
body.playing .zone-partner .assisting{transform:rotate(90deg) scale(.72);filter:brightness(.45);opacity:1;cursor:default;outline:none;pointer-events:none}
body.playing #quickControls{display:grid;grid-template-columns:1fr 1fr;gap:2px}body.playing #quickControls button{margin:0;font-size:10px;padding:3px 0}
body.playing .zone-case{display:flex;flex-direction:column;align-items:center;padding:2px}
body.playing .zone-case .cards{width:100%;height:100%;max-height:calc(var(--field-card-width)*.92);padding:0;justify-content:center}
body.playing .zone-case .card,body.playing .zone-case .back{width:100%;height:100%;min-height:0;margin:0;padding:0}
body.playing .zone-case img{object-fit:contain}
body.playing .zone-evidence{padding:3px;position:relative;z-index:2}
body.playing .zone-evidence h3{font-size:10px;letter-spacing:0;margin-bottom:2px}
body.playing .zone-evidence .evidence-fan{--evidence-width:clamp(32px,4vw,60px);display:block;position:relative;height:calc(100% - 23px);padding:0}
body.playing .zone-evidence .evidence-fan>button{position:absolute;left:calc(var(--index)*(100% - var(--evidence-width))/max(1,var(--count) - 1));bottom:0;width:var(--evidence-width);max-width:none;height:min(100%,calc(var(--evidence-width)*1.42));min-height:0;margin:0;padding:0;border:1px solid #7695a3;z-index:calc(var(--count) - var(--index));background:#182b38;transition:transform .12s;transform-origin:bottom center;overflow:visible;box-shadow:-2px 0 3px #0008}
body.playing .zone-evidence .evidence-fan img{height:100%;width:100%;max-height:100%;object-fit:contain}
body.playing .zone-evidence .evidence-fan .card div{display:none}
body.playing .zone-evidence .evidence-fan>button:hover{z-index:100;transform:translateY(-5px) scale(1.1)}
.evidence-number{position:absolute;left:0;top:0;background:#182b38;color:white;border-radius:3px;padding:0 2px;font-size:10px;line-height:13px}
body.playing .enemy .zone-hand .hand-fan{--hand-width:clamp(22px,3vw,40px);display:block;position:relative;width:min(100%,calc(var(--hand-count)*23px + 20px));height:100%;margin:auto;padding:0}
body.playing .enemy .hand-fan .back{position:absolute;bottom:0;left:calc(var(--hand-index)*(100% - var(--hand-width))/max(1,var(--hand-count) - 1));width:var(--hand-width);height:min(100%,calc(var(--hand-width)*1.42));min-height:0;margin:0;z-index:var(--hand-index);opacity:1;pointer-events:none;transform:none;border:1px solid #65808b;border-radius:3px}
body.playing .enemy .hand-fan .back:hover{transform:none}

/* Field-first layout and turn feedback. */
body.playing .own .playmat{grid-template-rows:minmax(0,1.5fr) minmax(0,.65fr) 25px}
body.playing .enemy .playmat{grid-template-rows:25px minmax(0,.45fr) minmax(0,1.5fr)}
body.playing .zone-field,body.playing .zone-hand{border:1px solid #668391;border-radius:7px;background:#192f3b;padding:3px;position:relative}
body.playing .zone-hand{padding-top:14px}
body.playing .zone-field .cards{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));grid-template-rows:minmax(0,1fr);gap:6px;align-items:stretch}
body.playing .zone-field .card,body.playing .zone-field .field-slot{position:relative;width:100%;max-width:100%;height:100%;min-width:0;min-height:0;border:1px dashed #637885;border-radius:6px;background:#53616b33;aspect-ratio:auto}
body.playing .zone-field .field-slot:after{content:'';position:absolute;left:30%;top:36%;width:40%;height:28%;border:1px solid #9cb3be33;transform:rotate(45deg)}
body.playing .zone-field .card{justify-content:center;padding:2px;border-style:solid}
body.playing .zone-field .card img{height:calc(100% - 14px);width:100%;object-fit:contain}
body.playing .zone-field .card.sleep img{transform:rotate(90deg) scale(.72)}
body.playing .zone-field .card div{display:block;font-size:10px;line-height:13px}
body.playing .zone-field .card div:last-child{display:none}
#turnBanner{position:fixed;z-index:1100;left:50%;top:45%;transform:translate(-50%,-50%);padding:20px 60px;border:1px solid #dfc899;border-radius:10px;background:#142c3bf2;color:#fff1d4;font-size:clamp(22px,4vw,42px);box-shadow:0 12px 60px #0009;pointer-events:none;text-align:center;max-width:90vw;overflow-wrap:anywhere}
#turnBanner[hidden]{display:none}#playerName{font-size:11px;padding:4px;white-space:nowrap}body:not(.playing) #playerName{display:none}
body.playing #processing strong{color:#ffe0a0;flex-shrink:0}

/* All decisions remain beside the board, not in the log column. */
body.playing #table{grid-template-rows:minmax(0,1fr) minmax(80px,auto) minmax(0,1.15fr)}
body.playing #processing{flex-wrap:wrap;gap:4px 10px;align-content:center;overflow:visible;max-height:150px}
body.playing #processing h2{font-size:12px;margin:0}
body.playing #processing #choiceInfo{margin:0;font-size:11px}
body.playing #processing #actions{display:flex;flex-wrap:wrap;gap:4px;max-height:none;overflow:visible}
body.playing #processing #actions button{width:auto;margin:0;padding:5px 10px;font-size:12px}
body.playing .own .playmat{grid-template-areas:'case field partner' 'evidence hand controls' 'evidence counters counters'}
body.playing .enemy .playmat{grid-template-areas:'counters counters evidence' 'case hand evidence' 'case field partner'}
body.playing #quickControls{grid-area:controls;display:flex;flex-direction:column;justify-content:center;gap:4px;margin:0}
body.playing #quickControls button{font-size:13px;padding:5px;min-height:27px;flex:1;margin:0}
body.playing .zone-partner{position:relative}
body.playing .zone-partner .card.sleep:not(.assisting) img{transform:rotate(90deg) scale(.72)}
body.playing .zone-partner:has(.assisting){padding-top:23px}
.assist-label{position:absolute;top:2px;left:0;width:100%;text-align:center;font-size:17px;color:#ffd187;z-index:3;pointer-events:none}
body.playing .zone-evidence .evidence-fan{--evidence-width:clamp(60px,7vw,100px);--evidence-height:calc(var(--evidence-width)*.7);height:100%;min-height:0}
body.playing .zone-evidence .evidence-fan>button{left:50%;top:calc(var(--index)*(100% - var(--evidence-height))/max(1,var(--count) - 1));bottom:auto;width:var(--evidence-width);height:var(--evidence-height);transform:translateX(-50%);transform-origin:center;overflow:hidden}
body.playing .zone-evidence .evidence-fan>button img{position:absolute;width:var(--evidence-height);height:var(--evidence-width);max-height:none;left:50%;top:50%;transform:translate(-50%,-50%) rotate(90deg);object-fit:contain}
body.playing .zone-evidence .evidence-fan>button:hover{transform:translateX(-50%) scale(1.1);z-index:100}
body.playing .enemy .zone-evidence .evidence-fan>button{top:auto;bottom:calc(var(--index)*(100% - var(--evidence-height))/max(1,var(--count) - 1))}
#resignControls button{width:100%;margin:0;padding:6px}
/* Hand fan restored; only its surrounding border is new. */
body.playing .own .zone-hand .hand-fan{--hand-width:clamp(78px,10vw,125px);width:min(100%,calc(var(--hand-count)*80px + 50px));height:100%;margin:0 auto;overflow:visible}
body.playing .own .hand-fan .card{border:2px solid #526a77;border-radius:6px;transform-origin:bottom center}
.partner-actions{display:flex;gap:5px;flex:none;justify-content:center}.partner-actions button{flex:1;margin:2px 0;padding:4px;font-size:12px}
body.playing .zone-partner:has(.assisting){padding-top:2px}
body.playing .zone-partner .assisting{transform:none;filter:none;position:relative;overflow:visible}
body.playing .zone-partner .assisting img{transform:rotate(90deg) scale(.72);filter:brightness(.45)}
body.playing .zone-partner .assisting .assist-label{top:50%;left:50%;width:max-content;max-width:180%;transform:translate(-50%,-50%);font-size:18px;text-shadow:0 2px 5px #000;background:#142431b8;border-radius:4px;padding:3px}
body.playing .zone-field .combat-stats{display:block;position:absolute;right:1px;bottom:1px;background:#10202de8;color:#ffda82;font-size:11px;line-height:15px;padding:1px 3px;z-index:2;white-space:nowrap}
body.playing .zone-evidence .evidence-fan>button{left:calc(50% + 5px)}
body.playing .zone-evidence .evidence-fan>button:nth-child(even){left:calc(50% - 5px)}
body.playing #processing{min-height:110px;max-height:none;align-items:center;position:relative}
body.playing #processing>.card{height:95px;width:67px;flex:0 0 67px}body.playing #processing>.card img{height:100%;width:100%;max-height:100%;object-fit:contain}
.effect-description{max-width:420px;font-size:11px}.effect-description p{margin:2px 0;line-height:1.4}.effect-description mark{background:#ebc877;color:#142431}
.attack-description{font-size:13px;color:#ffd999}
#attackArrow{position:fixed;inset:0;width:100vw;height:100vh;pointer-events:none;z-index:30;filter:drop-shadow(0 2px 3px #000)}
#mulliganDialog{max-width:950px}#mulliganDialog .modal-cards{justify-content:center}#mulliganDialog .selected{outline:4px solid #ffd46a}
#noticeDialog{text-align:center;max-width:430px}#noticeDialog img.notice-card{float:none;width:150px;height:210px;object-fit:contain;display:block;margin:12px auto}#noticeDialog .reveal{animation:card-reveal .5s ease}#noticeDialog h2{font-size:24px}@keyframes card-reveal{from{transform:rotateY(90deg)}to{transform:rotateY(0)}}
body.playing .own .playmat{grid-template-rows:minmax(0,1fr) minmax(0,.85fr) 25px}
body.playing .own .zone-hand{overflow:visible;background:transparent;border:1px solid #668391;padding-top:14px}
body.playing .own .zone-hand .hand-fan .card{height:100%;padding:0}
body.playing #processing .card div{display:none}
#mulliganDialog .invite-copy-status{display:inline-block;margin:8px;color:#a5e3c0;font-size:14px}
#mulliganDialog .invite-copy-fallback{display:block;width:calc(100% - 8px);margin-top:10px}
/* Compact, overlapping hand like the reference; hovered card rises above its neighbors. */
body.playing .own .zone-hand .hand-fan{--hand-width:clamp(65px,8vw,105px);width:min(100%,calc(var(--hand-count)*var(--hand-width)*.73 + var(--hand-width)*.27));height:100%;padding:0;display:block;position:relative}
body.playing .own .zone-hand .hand-fan .card{width:var(--hand-width);height:min(100%,calc(var(--hand-width)*1.4));position:absolute;bottom:0;left:calc(var(--hand-index)*(100% - var(--hand-width))/max(1,var(--hand-count) - 1));border:1px solid #827756;background:#142633;z-index:var(--hand-index);transform:none;transition:transform .14s ease;overflow:visible;box-shadow:-2px 0 4px #0008}
body.playing .own .zone-hand .hand-fan .card img{height:100%;width:100%;max-height:100%;object-fit:contain;border-radius:4px}
body.playing .own .zone-hand .hand-fan .card:hover,body.playing .own .zone-hand .hand-fan .card:focus-visible{transform:translateY(-12px) scale(1.1);z-index:100}
#soundControl{display:flex;align-items:center;white-space:nowrap;font-size:11px;gap:3px}#soundControl input{width:70px;padding:0;margin:0}#soundControl span{min-width:30px}
.card,.back{position:relative}.card-detail-button{position:absolute;top:2px;right:2px;z-index:120;font-size:10px;background:#123548e8;color:white;padding:2px 4px;border-radius:4px;cursor:pointer;line-height:14px}
body.playing .zone-partner .assisting{pointer-events:auto}
body.playing .card.selected,body.playing .back.selected{outline:4px solid #ffce45;box-shadow:0 0 0 6px #ffce4544}
.card.selected:after,.back.selected:after{content:'✓ 選択中';position:absolute;bottom:20px;left:0;right:0;text-align:center;background:#ffd259;color:#152630;font-size:13px;font-weight:bold;z-index:110;pointer-events:none}
body.playing #processing #actions button:has(img){display:flex;align-items:center;gap:5px;max-width:240px}#processing #actions button img{height:72px;width:51px;object-fit:contain}
.pending-effect{display:flex;align-items:center;gap:5px;font-size:10px;max-width:230px}body.playing #processing .pending-effect .card{height:80px;width:57px;flex:0 0 57px}.pending-effect span{overflow-wrap:anywhere}
.hover-card-detail{position:fixed;inset:auto;margin:0;padding:12px;border:1px solid #91b2bf;border-radius:12px;background:#142633f7;color:#edf6ff;box-shadow:0 12px 50px #000b;z-index:3000;pointer-events:none;display:flex;flex-direction:column;gap:8px;overflow:hidden}
.hover-card-detail::backdrop{background:transparent;pointer-events:none}
.hover-card-detail>img{width:100%;height:55%;min-height:0;object-fit:contain;float:none;margin:0}
.hover-card-text{min-height:0;flex:1;font-size:13px;line-height:1.55;white-space:pre-wrap}.hover-card-text h2{font-size:18px;margin:0 0 6px}.hover-card-text p{margin:5px 0}

.attachment-button{position:absolute;left:3px;bottom:26px;z-index:5;background:#192b46;color:white;border:1px solid #aac5eb;border-radius:4px;padding:3px 6px;font-size:12px;cursor:pointer}.attachment-button:focus{outline:2px solid #ffd24d}

.account-entry-actions{display:flex;gap:12px;flex-wrap:wrap}.entry-button{display:inline-block;padding:12px 28px;border:1px solid #7097a1;border-radius:8px;background:#233b49;color:#fff;text-decoration:none;font-weight:700}.entry-primary{background:#ad7342;border-color:#d59b65}.entry-button:hover{filter:brightness(1.15)}.entry-button:focus-visible{outline:3px solid #8cd6df;outline-offset:3px}#accountEntry p{max-width:760px;line-height:1.7}@media(max-width:600px){.account-entry-actions{flex-direction:column}.entry-button{text-align:center}}

#deckPicker{width:90vw;max-width:1000px}#roomDeckGrid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.room-deck-tile{padding:16px;border:1px solid #577182;border-radius:10px}.room-deck-thumbs{display:flex;justify-content:center;gap:8px}.room-deck-thumbs img{width:42%;height:180px;object-fit:contain}#roomDeckPreview{width:95vw;max-width:1500px}#roomPreviewBody{overflow-x:auto}.room-preview-top{display:flex;justify-content:center;gap:16px;min-width:800px}.room-preview-top figure{width:140px}.room-preview-main{display:grid;grid-template-columns:repeat(10,minmax(0,1fr));min-width:800px;gap:8px}.room-preview-main figure,.room-preview-top figure{margin:0}.room-preview-main img,.room-preview-top img{width:100%;aspect-ratio:0.7;object-fit:contain}.room-preview-main figcaption,.room-preview-top figcaption{font-size:11px;overflow-wrap:anywhere}@media(max-width:600px){#roomDeckGrid{grid-template-columns:1fr}}

body.playing #spectatorControls{flex:none;padding:4px 12px;margin:0 0 4px;max-height:150px;overflow:auto}#spectatorStatus{font-size:12px;margin:2px}#spectatorViewed{display:flex;gap:6px;overflow:auto}#spectatorViewed img{max-height:85px;width:auto;cursor:pointer}

.relogin-button{display:block;width:fit-content;margin:8px 0 16px;padding:10px 24px;border:1px solid #91d2eb;border-radius:7px;background:#294954;color:#fff;text-decoration:none;font-weight:bold}.relogin-button[hidden]{display:none}

.mulligan-turn-order{font-size:20px;font-weight:700;color:#ffcf87}

#logPanel{display:flex;flex-direction:column;min-height:0;flex:1}#logPanel[hidden]{display:none!important}#toggleLogs{flex:none;min-height:40px}
@media(max-width:800px){
 body.playing{height:auto;min-height:100dvh;overflow:auto}
 body.playing header{height:auto;min-height:48px;flex-wrap:wrap;gap:6px}
 body.playing main{height:auto;min-height:calc(100dvh - 48px);display:block;padding:5px}
 body.playing .layout{display:flex;flex-direction:column;gap:8px}
 body.playing #table{width:100%;height:760px;min-height:650px;grid-template-rows:minmax(0,1fr) 48px minmax(0,1fr)}
 body.playing .layout>aside{width:100%;position:static;display:flex;padding:10px}
 body.playing #logPanel{flex:none}
 body.playing #logs{max-height:300px;overflow:auto;font-size:13px}
 body.playing #actions{max-height:none}
 body.playing #actions button{font-size:14px;min-height:44px}
 body.playing #toggleLogs{align-self:flex-start;min-height:44px}
}

/* Phone boards: reserve the whole row for the field, never shrink five cards to fit side zones. */
@media(max-width:800px){
 body.playing #table{height:auto;min-height:0;grid-template-rows:auto minmax(80px,auto) auto}
 body.playing .player .playmat{flex:none;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;padding:4px;min-width:0}
 body.playing .own .playmat{
  grid-template-areas:'field field field' 'case evidence partner' 'hand hand hand' 'controls controls controls' 'counters counters counters';
  grid-template-rows:164px 116px 132px auto auto;
 }
 body.playing .enemy .playmat{
  grid-template-areas:'counters counters counters' 'case evidence partner' 'hand hand hand' 'field field field';
  grid-template-rows:auto 116px 90px 164px;
 }
 body.playing .zone-field{min-width:0;overflow:hidden}
 body.playing .zone-field .cards{
  display:grid;grid-template-columns:repeat(5,minmax(78px,1fr));grid-auto-columns:minmax(78px,1fr);
  grid-template-rows:148px;grid-auto-flow:column;justify-content:start;
  gap:5px;overflow-x:auto;overflow-y:hidden;max-width:100%;padding:2px 0 8px;
  overscroll-behavior-x:contain;
 }
 body.playing .zone-field .card,body.playing .zone-field .field-slot{width:100%;min-width:78px;max-width:none;height:148px;flex:none}
 body.playing .zone-field .card img{height:130px;max-height:130px}
 body.playing .own .zone-partner{display:flex;flex-direction:column}
 body.playing .zone-case .card,body.playing .zone-partner .card{width:70px;max-width:100%;margin:auto}
 body.playing #quickControls{flex-direction:row;flex-wrap:wrap;min-height:44px}
 body.playing #quickControls button{min-height:44px;flex:1}
 body.playing .zone-counters{flex-wrap:wrap;min-height:36px}
 body.playing .zone-counters button{font-size:12px;min-height:34px}
}

/* Keep effect selection guidance visible independently of the battle log. */
body.playing #processing #choiceInfo.selection-guide{display:flex;align-items:center;gap:12px;flex:0 1 auto;width:fit-content;max-width:100%;padding:8px;border:2px solid #ebc877;border-radius:8px;background:#182c38;font-size:14px;line-height:1.5;box-sizing:border-box;min-width:0}
.selection-guide .selection-card{width:64px;height:90px;object-fit:contain;flex:none;cursor:pointer}
.selection-message{display:flex;flex-direction:column;gap:4px;min-width:0;overflow-wrap:anywhere}
body.playing #processing .selection-message strong{flex-shrink:1;white-space:normal}
body.playing #table:has(.selection-guide){grid-template-rows:minmax(0,1fr) minmax(140px,auto) minmax(0,1fr)}
@media(max-width:800px){body.playing #table:has(.selection-guide){grid-template-rows:auto auto auto}body.playing #processing #choiceInfo.selection-guide{font-size:14px}.selection-guide .selection-card{width:56px;height:80px}}

.zone-owner-heading{flex-basis:100%;width:100%;margin:8px 0}

.public-hand-reveal{display:flex;align-items:center;gap:8px;padding:6px;border:2px solid #ebc877;border-radius:8px;background:#182c38;flex-wrap:wrap}
body.playing #processing .public-hand-reveal .card{width:72px;height:100px;flex:none}
body.playing #processing .public-hand-reveal .card img{width:100%;height:100%;object-fit:contain}
body.playing #table:has(.public-hand-reveal){grid-template-rows:minmax(0,1fr) minmax(140px,auto) minmax(0,1fr)}
@media(max-width:800px){body.playing #table:has(.public-hand-reveal){grid-template-rows:auto auto auto}}

.discard-sort-controls{display:flex;flex-wrap:wrap;gap:6px;margin:8px 0}.discard-sort-controls button[aria-pressed="true"]{background:#ad7342;border-color:#ffd259;font-weight:bold;outline:2px solid #ffd259}

.pending-effect span,#processing #actions button{white-space:pre-wrap}

#processing:has(.effect-description,.pending-effect) .card-detail-button{display:none}

/* Fill the pending card frame; the generic processing thumbnail is only 28px tall. */
body.playing #processing .pending-effect .card{padding:0;overflow:hidden}
body.playing #processing .pending-effect .card img{display:block;width:100%;height:100%;max-width:100%;max-height:100%;object-fit:contain;margin:0}

.mulligan-deck-footer{display:flex;align-items:stretch;gap:12px;margin-top:16px}.mulligan-deck-footer>button{margin:0}.mulligan-deck-footer>button:last-child{margin-left:auto}

#deckWait{white-space:pre-line}

.public-reveal-origin{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.public-reveal-origin span{white-space:pre-wrap;max-width:360px}

#noticeDialog .notice-player-name{font-size:14px;font-weight:normal;overflow-wrap:anywhere}

.selection-message > span{white-space:pre-line}

#victoryResult{flex:none;text-align:center;padding:10px;background:#263b35;border:1px solid #e1c36b;border-radius:8px;color:#ffe5a0}#victoryResult[hidden]{display:none}#victoryResult h2{margin:3px;font-size:22px}

#roomCaseColors{display:flex;flex-wrap:wrap;gap:.5rem;align-items:center;margin:1rem 0}
#roomCaseColors button{min-width:2.8rem}
#roomCaseColors button[aria-pressed="true"]{outline:3px solid #e6b94f;outline-offset:2px;font-weight:bold}
#roomCaseColors small{flex-basis:100%}
#roomDeckGrid [hidden]{display:none!important}

#privateBody .revealed-hand-cards{flex-direction:row;flex-wrap:nowrap;overflow-x:auto;max-width:100%}#privateBody .revealed-hand-cards .card{flex:0 0 120px}

.deck-pagination{display:flex;gap:.5rem;align-items:center;flex-wrap:wrap;margin:1rem 0}.deck-pagination button[aria-current="page"]{background:#246b88;color:white;border:2px solid #9be4ff;font-weight:bold}.deck-pagination select{width:auto}

.profile-link{margin-left:auto;display:inline-flex;align-items:center;justify-content:center;min-width:44px;min-height:44px;color:inherit;flex-shrink:0}.profile-link:focus-visible{outline:3px solid #9be4ff}

#table{position:relative}#table #logPanel{position:absolute;inset:0 0 0 auto;width:34%;min-width:240px;max-width:95%;z-index:200;background:rgba(15,29,38,.97);border:1px solid #7aa3b4;box-shadow:0 8px 32px #0009;padding:12px;display:flex;flex-direction:column;overflow:hidden}#table #logPanel[data-side="left"]{left:0;right:auto}#table #logPanel[hidden]{display:none!important}#table #logPanel #logs{overflow-y:auto;overscroll-behavior:contain;flex:1;min-height:0;max-height:none;font-size:13px}#logPanel>button{align-self:flex-end;flex:none}@media(max-width:800px){#table #logPanel{width:85%;min-width:0}}



/* Active tab shares the page surface and covers the header divider. */

/* Single header layout for lobby, match, account/settings and replay. */
body:has(>header.site-header){margin:0;padding:0;max-width:none;background:#182c3a}
body header.site-header{box-sizing:border-box;display:flex;position:relative;align-items:flex-end;justify-content:flex-start;flex-wrap:nowrap;gap:24px;width:100%;height:78px;min-height:78px;margin:0;padding:12px 20px 0;background:#101b22;border-bottom:1px solid #587584;overflow:visible;flex-shrink:0}
body header.site-header .site-brand{width:150px;flex:0 0 150px;align-self:center;margin:0 0 10px;padding:0}
body header.site-header .site-brand h1{font:700 18px/1.25 system-ui;margin:0;letter-spacing:.08em}
body header.site-header .site-brand small{font:11px/1.5 system-ui;letter-spacing:.22em;color:#83c4c6}
body header.site-header .site-tabs{display:flex;align-items:flex-end;gap:12px;margin:0 0 -1px;padding:8px 0 0;align-self:stretch}
body header.site-header .site-tabs :is(a,span){display:flex;align-items:center;box-sizing:border-box;position:relative;white-space:nowrap;font:14px/1.5 system-ui;color:#b5dce9;text-decoration:none;padding:12px 16px;margin:0;border:1px solid transparent;border-bottom-color:#587584;border-radius:12px 12px 0 0}
body header.site-header .site-tabs a:hover{background:#29414f}
body header.site-header .site-tabs span[aria-current="page"]{height:100%;background:#182c3a;color:#fff;font-weight:700;border-color:#587584;border-bottom-color:#182c3a;cursor:default;z-index:1}
body header.site-header .profile-link{margin:0 0 12px auto;min-width:44px;height:44px;align-self:flex-end;display:inline-flex;align-items:center;justify-content:center;color:inherit}
body header.site-header #connection{font-size:12px;align-self:center;margin:0}body header.site-header #connection:empty{display:none}
body.playing:has(>header.site-header) main{height:calc(100dvh - 78px)}
body:has(#profileSettings)>:is(section,main,p, .return-room){margin-left:20px;margin-right:20px}
.profile-logout{margin-top:32px;padding-top:20px;border-top:1px solid #577182}
@media(max-width:700px){body header.site-header{height:118px;min-height:118px;flex-wrap:wrap;gap:0 12px;padding:8px 12px 0}body header.site-header .site-brand{margin:0;align-self:flex-start}body header.site-header .profile-link{position:absolute;right:12px;top:4px;margin:0}body header.site-header .site-tabs{order:3;width:100%;height:58px;gap:4px;margin-bottom:-1px;align-self:flex-end}body header.site-header .site-tabs :is(a,span){font-size:12px;padding:12px 9px}body.playing:has(>header.site-header) main{height:calc(100dvh - 118px)}}

body.playing.replay-page:has(>header.site-header){margin:0;padding:0;max-width:none;background:#182c3a}

body:has(>header.site-header){min-height:100dvh}body header.site-header .site-tabs :is(a,span){width:166px;justify-content:center;flex:0 0 166px}@media(max-width:700px){body header.site-header .site-tabs :is(a,span){width:auto;flex:1 1 0;justify-content:center}}

/* Keep the joined tab surface full width, with gutters inside the page. */
body:has(>header.site-header){--page-gutter:20px}
body:has(>header.site-header)>.page-content{box-sizing:border-box;width:100%;min-width:0;padding:1px var(--page-gutter) 20px;overflow-wrap:anywhere}
body:has(>header.site-header)>main{padding-left:var(--page-gutter);padding-right:var(--page-gutter)}
body:has(#profileSettings)>:is(section,main,p,.return-room){margin-left:var(--page-gutter);margin-right:var(--page-gutter)}
@media(max-width:700px){body:has(>header.site-header){--page-gutter:12px}}

#mulliganDialog .mulligan-deck-toolbar{display:flex;justify-content:flex-start;margin-bottom:12px}
#mulliganDialog .mulligan-deck-toolbar>button{margin:0}
#mulliganDialog .mulligan-deck-footer{justify-content:flex-end}

/* Battle controls share the status row; the board owns the full width. */
body.playing #match>.layout{grid-template-columns:minmax(0,1fr)}
.match-toolbar{display:flex;align-items:center;gap:8px;flex:none;min-width:0;position:relative}
.match-toolbar #status{flex:1;min-width:0;overflow-wrap:anywhere}
.match-toolbar>button,.match-toolbar summary{min-width:44px;min-height:44px;margin:0}
#matchMenu{position:relative;flex:none}
#matchMenu summary{display:flex;align-items:center;justify-content:center;cursor:pointer;list-style:none;border:1px solid #577182;border-radius:5px;background:#213b4a;font-size:22px}
#matchMenu summary::-webkit-details-marker{display:none}
#matchMenu[open] summary{background:#365568}
#matchMenu #resignControls{position:absolute;right:0;top:100%;margin-top:4px;padding:8px;background:#182c3a;border:1px solid #577182;border-radius:6px;box-shadow:0 4px 16px #0008;z-index:100;min-width:110px}
#matchMenu #resignControls button{width:100%;margin:0;min-height:44px}
body.playing .match-toolbar #status{flex:1;min-width:0}

.match-toolbar>#resignControls{flex:none}.match-toolbar>#resignControls button{min-width:44px;min-height:44px;margin:0}

/* Keep decisions adjacent to the content-sized effect explanation. */
body.playing #processing #actions{flex:0 1 auto;min-width:0;max-width:100%}

#noticeDialog.deck-discard-notice{max-width:900px;width:90vw}
.deck-discard-cards{display:flex;gap:12px;justify-content:safe center;overflow-x:auto;padding:12px;perspective:1000px}
.deck-discard-flip{position:relative;flex:0 0 clamp(75px,18vw,150px);aspect-ratio:63/88;transform-style:preserve-3d;transition:transform .45s ease}
#noticeDialog .deck-discard-flip img{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;float:none;margin:0;backface-visibility:hidden}
#noticeDialog .deck-discard-flip .deck-discard-front{transform:rotateY(180deg)}
.deck-discard-flip.revealed{transform:rotateY(180deg)}

/* Content-sized guidance and adjacent decisions, independent of the full board width. */
body.playing #processing .processing-decisions{display:flex;align-items:center;justify-content:flex-start;gap:10px;flex:0 1 auto;min-width:0;max-width:100%;flex-wrap:wrap}
body.playing #processing #choiceInfo.selection-guide{flex:0 1 auto;width:max-content;max-width:min(440px,100%)}
body.playing #processing #actions{flex:0 1 auto;justify-content:flex-start}

.granted-effects{clear:both;margin-top:16px;padding:0;background:transparent}
.granted-effects h3{font-size:16px;margin:8px 0}
.granted-effect{display:flex;align-items:center;justify-content:space-between;gap:12px;border:2px solid #ef6262;border-radius:6px;padding:8px;margin:8px 0;overflow-wrap:anywhere}
.granted-effect>span{flex:1;min-width:0}
.granted-effect .effect-source{flex:none;padding:2px;margin:0;background:#142633}
#detailBody .effect-source img,.hover-card-detail .effect-source img{display:block;float:none;margin:0;width:58px;height:81px;object-fit:contain}
.hover-card-detail{pointer-events:auto}
.hover-card-text{overflow-y:auto;min-height:0}

#victoryResult{width:min(420px,90vw);max-height:80dvh;padding:24px;box-sizing:border-box;overflow:auto}#victoryResult::backdrop{background:rgba(0,0,0,.45)}#victoryResult button{min-height:44px;margin:12px 6px 0}#victoryError:empty{display:none}

/* Keep the cosmetic hand control clear of card drag targets. */
body.playing .own .zone-hand.shakapachi-enabled{--shakapachi-card-width:clamp(65px,8vw,105px);padding-right:calc(var(--shakapachi-card-width) + 10px)}
.shakapachi-button{position:absolute;right:4px;bottom:3px;width:var(--shakapachi-card-width);height:min(calc(100% - 17px),calc(var(--shakapachi-card-width)*1.4));box-sizing:border-box;margin:0;writing-mode:vertical-rl;text-orientation:upright;display:flex;align-items:center;justify-content:center;font-size:16px;letter-spacing:.12em;padding:4px;border-radius:6px;z-index:110}

body.playing .own .shakapachi-enabled .hand-fan .card{z-index:var(--shake-layer)}
body.playing .own .shakapachi-enabled .hand-fan .card:hover,body.playing .own .shakapachi-enabled .hand-fan .card:focus-visible{z-index:100}

body.playing .own .shakapachi-enabled .hand-fan .card{bottom:var(--shake-lift,0px);transition:bottom .14s ease,transform .14s ease}

/* Allow rapid taps without double-tap zoom; preserve pinch zoom. */
.shakapachi-button,.undo-action,.modal-undo{touch-action:manipulation}

body.playing .enemy .hand-fan.open-hand .card{position:absolute;bottom:0;left:calc(var(--hand-index)*(100% - var(--hand-width))/max(1,var(--hand-count) - 1));width:var(--hand-width);height:100%;min-height:0;padding:0;margin:0;z-index:var(--hand-index)}
body.playing .enemy .hand-fan.open-hand .card img{width:100%;height:100%;object-fit:contain}
body.playing .enemy .hand-fan.open-hand .card div{display:none}
body.playing .enemy .hand-fan.open-hand .card:hover{z-index:100}

#handMode{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:14px}
.hand-mode-toggle{position:relative;display:inline-flex;align-items:center;justify-content:space-around;width:112px;height:42px;padding:3px;border-radius:24px;background:#172630;touch-action:manipulation;isolation:isolate}
.hand-mode-toggle::before{content:'';position:absolute;left:3px;top:3px;bottom:3px;width:50px;border-radius:20px;background:#526875;z-index:-1;transition:transform .15s ease,background .15s ease}
.hand-mode-toggle[aria-checked="true"]::before{transform:translateX(54px);background:#17734f}
.hand-mode-toggle span{width:50px;text-align:center;font-weight:bold;color:#aab8c0}
.hand-mode-toggle[aria-checked="false"] .hand-mode-off,.hand-mode-toggle[aria-checked="true"] .hand-mode-on{color:#fff}
.hand-mode-toggle:focus-visible{outline:3px solid #f1c75c;outline-offset:3px}
