.crest{display:grid;place-items:center;width:39px;height:41px;border-radius:12px;background:#e8bd77;color:#192837;font:700 29px Georgia,serif}
.brand small{font-size:.7rem;color:#9db3bf;margin-bottom:2px}
.lobby{max-width:1050px;margin:clamp(22px,9vh,110px) auto;padding:16px}
.welcome{display:grid;grid-template-columns:1.1fr 1fr;align-items:center;gap:2rem;min-height:450px;overflow:hidden}
.opening-art{height:330px;position:relative;isolation:isolate}
.opening-art img{position:absolute;top:18%;width:39%;border-radius:9px;box-shadow:0 12px 24px #0007}
.opening-art img:nth-child(1){left:4%;transform:rotate(-15deg)}
.opening-art img:nth-child(2){left:28%;width:43%;top:8%;z-index:1;transform:rotate(-2deg)}
.opening-art img:nth-child(3){right:3%;transform:rotate(13deg)}
.opening-copy h2{font-size:clamp(32px,5vw,55px);color:#f2dcad;letter-spacing:-.07em}
.opening-copy label,.opening-copy small{display:block;margin-top:1em}.opening-copy select{border:1px solid #536878;background:#152935;color:#eff5ee;border-radius:7px;padding:.45em;min-width:140px}
.start-actions{display:flex;gap:8px;margin-top:1rem}.start-actions button{min-height:44px}
.leaderline,.selection-head{display:flex;align-items:center;gap:.5rem}.leaderline small{display:block;font-size:.69rem;color:var(--muted)}.leadericon{width:40px;height:42px;background-image:url('/cards/1.webp');background-size:150%;background-position:center 9%;border-color:#807250}.leadericon.awake{background-position:center 65%}
.selection{margin-top:.75rem;border-top:1px solid var(--line);padding-top:.6rem}.selection-head{justify-content:space-between}
.selection p,.console p.guide{margin:.5rem 0}.console p.guide{padding:.65rem .75rem;border-radius:8px}.gearlink{margin-top:3px;padding:2px 4px;font-size:.65rem}
.log b{color:#a6c8c7;font-size:.72rem;margin-right:.3rem}
#message{position:fixed;bottom:12px;left:50%;transform:translateX(-50%);z-index:5;background:#632e32;color:white;border-radius:8px;padding:10px 16px}
@media(max-width:760px){.welcome{grid-template-columns:1fr;gap:.2rem}.opening-art{width:min(100%,340px);height:225px;margin:auto}.lobby{margin:8px auto}.opening-art img{width:31%}.opening-art img:nth-child(1){left:13%}.opening-art img:nth-child(2){width:35%;left:32%}.opening-art img:nth-child(3){right:10%}.opening-copy h2{font-size:32px}.opening-copy p{margin:.3rem 0}.console{scroll-margin-top:12px}}


.wait-card{padding:clamp(20px,5vw,48px);max-width:660px;margin:auto;border:1px solid var(--line);border-radius:16px;background:var(--panel)}
.wait-card h2{margin:.5rem 0}.wait-card p,.wait-card label{display:block;margin:.65rem 0}.wait-card strong{color:var(--gold);letter-spacing:.1em}
#join-form{margin-top:1.1rem;border-top:1px solid var(--line)}#join-form .start-actions,.wait-card .start-actions{margin-top:.4rem}
input{min-width:0;border:1px solid var(--line);background:#0c1824;color:var(--text);border-radius:7px;padding:.55rem .7rem}
#code{text-transform:uppercase;width:11em}#invite{flex:1}#connection,#copy-status{font-size:.75rem}

#entry{width:min(360px,92vw);padding:1.6rem}
#entry h2{margin:.7rem 0 1rem}#entry input,#entry button{display:block;width:100%;margin-top:.45rem}
#entry-error{color:#ffb9a8}#entry label{font-size:.85rem}
.board{--accent:var(--mint);padding:.35rem 0}.board.opponent{--accent:var(--gold)}
.board-head{display:flex;align-items:center;flex-wrap:wrap;gap:.55rem;margin-bottom:.4rem}
.board-head strong{color:var(--accent)}.board-head small{color:var(--muted)}.board-head .chip{margin-left:auto}
.zones{display:grid;grid-template-columns:minmax(65px,1fr) minmax(0,4fr) minmax(62px,.88fr);grid-template-rows:auto auto;gap:6px;align-items:stretch}
.leader-slot{grid-column:1;grid-row:1/3;align-self:center;display:grid;gap:2px;justify-items:center;padding:.35rem;background:#0e1e2c;color:var(--accent);min-width:0}
.leader-face{display:block;width:100%;aspect-ratio:1.43;background:url('/cards/1.webp') center top/100% 200% no-repeat;border-radius:4px}
.leader-face.awake{background-position:center bottom}.leader-slot span:last-child{font-size:.78rem}
.zones .lanes{grid-column:2;grid-row:1;gap:5px}.zones .lane{padding:3px;align-content:start}
.zones .unit,.zones .empty{width:min(100%,108px);height:auto;aspect-ratio:.716}
.draw-slot,.trash-slot{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;border:1px solid var(--line);border-radius:8px;background:#10202d;font-size:.76rem}
.draw-slot{grid-area:1/3}.deck-back{display:grid;place-items:center;width:min(80%,55px);aspect-ratio:.715;border:3px double #ae9672;color:#e9c380;border-radius:5px;font:italic bold 28px Georgia;background:repeating-linear-gradient(45deg,#1d3542 0 4px,#29424b 4px 5px)}
.trash-slot{grid-area:2/3;padding:2px;position:relative;overflow:hidden}.trash-slot img{height:49px;border-radius:3px}.trash-slot span{font-size:.72rem}
.damage-slot{grid-area:2/2;display:flex;align-items:center;justify-content:center;gap:1rem;min-height:67px;padding:3px;background:#101f2c;border:1px dashed #667d86}
.damage-slot small{display:block;color:var(--muted)}.fan{display:flex;align-items:center;max-width:100%}.damage-slot{flex-wrap:wrap;row-gap:2px}.fan img{flex:none}.fan:empty{display:none}
.fan img{width:43px;aspect-ratio:.716;object-fit:contain;border-radius:3px;box-shadow:-2px 0 4px #0006}.fan img+img{margin-left:-21px}
@media(max-width:580px){.zones{grid-template-columns:minmax(52px,.95fr) minmax(0,3.7fr) minmax(43px,.72fr);gap:3px}.zones .lanes{gap:2px}.zones .lane{padding:1px}.damage-slot{min-height:45px;gap:.4rem;font-size:.73rem}.fan img{width:clamp(19px,6vw,27px)}.fan img+img{margin-left:clamp(-16px,-3.5vw,-10px)}.draw-slot,.trash-slot,.leader-slot{font-size:.68rem}.deck-back{width:30px;font-size:18px}.trash-slot img{height:30px}.board-head small{font-size:.68rem}.leader-slot{padding:2px}}

.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.history{padding:.6rem .85rem;color:var(--muted);font-size:.83rem}
.history summary{cursor:pointer}
#card-preview{position:fixed;inset:auto;z-index:10000;object-fit:contain;border-radius:10px;pointer-events:none;filter:drop-shadow(0 8px 18px #000b);margin:0;max-width:none;max-height:none}
.dialog-card img{max-height:78dvh;max-width:min(100%,430px);width:auto}
button img[data-art]{-webkit-touch-callout:none;user-select:none}
.layout{row-gap:.5rem}
.hand-area{grid-column:1/-1;container-type:inline-size;border:0;background:none;padding:0;margin:0}
.hand{--card-w:clamp(76px,9vw,125px);--step:clamp(18px,calc((100cqw - var(--card-w) - 30px) / var(--gaps)),calc(var(--card-w) * .72));width:100%;justify-content:safe center;align-items:center;gap:0;padding:20px 12px 18px;scroll-snap-type:none}
.hand-card{flex:0 0 var(--card-w);aspect-ratio:63/88;transform:translateY(calc(var(--offset) * var(--offset) * 5px)) rotate(calc(var(--offset) * 5deg));transform-origin:50% 80%;border-radius:7px;box-shadow:0 3px 9px #0009;transition:transform .14s ease}
.hand-card+.hand-card{margin-left:calc(var(--step) - var(--card-w))}
.hand-card img{width:100%;height:100%;object-fit:contain}
.hand-card:focus-visible,.hand-card.chosen{z-index:2;transform:translateY(-7px)}
@media(hover:hover){.hand-card:hover{z-index:3;transform:translateY(-8px) scale(1.05)}}
.choice-list:has(.choice-card){display:flex;flex-wrap:wrap}
.choice-card{flex:0 1 72px;padding:0!important}.choice-card img{width:100%;height:auto;display:block;border-radius:5px}.choice-card span{display:block;padding:.25rem}
.unit .caption{font-size:.69rem;line-height:1.2;padding:.25rem;background:#102132e8}.zones .unit img{object-fit:contain}
@media(max-width:760px){.hand{padding-block:14px}.hand-card{scroll-snap-align:none}}

.gearlink{display:inline-flex;align-items:center;justify-content:center;padding:0;border:0;background:none}.gearlink img{display:block;width:20px;height:28px;object-fit:contain;border-radius:2px}.gearlink img+img{margin-left:-4px}

.leader-slot{overflow:hidden;padding:0;border-radius:7px}
.leader-slot .game-face{display:block;width:100%;height:auto}
.zones .unit[data-spent="true"]{filter:saturate(.55);border-color:#78878b}
.zones .unit img.game-face{object-fit:fill}
.zones .unit,.zones .empty{width:min(100%,116px)}

.zones{grid-template-columns:minmax(62px,1fr) minmax(0,4fr) minmax(62px,1fr)}
@media(max-width:580px){.zones{grid-template-columns:minmax(44px,.9fr) minmax(0,3.7fr) minmax(44px,.9fr)}}

.zones .unit img.game-face,.hand-card .game-face{object-fit:contain}
.leader-slot{position:relative}.leader-slot span{position:absolute;bottom:.15rem;right:.2rem;background:#102032db;padding:.05rem .3rem;border-radius:.25rem}

.stat-tile{display:block;position:relative;width:100%;aspect-ratio:63/88;container-type:inline-size}
.unit .stat-tile{position:absolute;inset:0;height:100%;aspect-ratio:auto}
.hand-card .stat-tile{height:100%}
.card-stats{position:absolute;inset:0;pointer-events:none}
.stat-tile .card-stat{position:absolute;box-sizing:border-box;display:block;margin:0;padding:.12em .36em;border:1px solid #ffffff65;border-radius:999px;color:#fff;line-height:1.05;font:800 clamp(10px,13cqw,17px)/1.05 Arial,sans-serif;font-variant-numeric:tabular-nums;white-space:nowrap;box-shadow:0 1px 3px #000a}
.stat-tile .stat-cost{color:#231a0a;background:#ffd38c}
.stat-tile .stat-ex{background:#28406b;font-size:clamp(8px,11cqw,16px)}
.stat-tile .stat-power{background:#123f3b}
.choice-card .stat-tile,.choice-card .card-stats{padding:0}
.hand-card+.hand-card{margin-left:-2px}

/* 상대 진영은 영역의 위치만 반대로 배치해 카드와 표시 글자를 정방향으로 유지합니다. */
.opponent .level-track{grid-column:3}
.opponent .lanes{grid-row:2}
.opponent .draw-slot{grid-area:2/1}
.trash-area{grid-area:2/3;display:grid;gap:5px;align-self:center;min-width:0;grid-template-columns:minmax(0,1fr)}
.opponent .trash-area{grid-area:1/1}
.trash-area .trash-slot{grid-area:1/1}
.player-vitals{flex:1;display:flex;align-items:center;gap:clamp(4px,.8vw,12px);min-width:0}
.player-vitals strong{max-width:clamp(45px,15vw,200px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:none}
.meter-pair{display:flex;flex:1;align-items:center;gap:clamp(5px,1vw,14px);min-width:0;container-type:inline-size}
.damage-area{grid-area:2/2;display:grid;align-content:center;gap:4px;min-width:0}
.opponent .damage-area{grid-area:1/2}
.damage-area .damage-slot{grid-area:auto;width:100%}
.board-head{min-height:32px;gap:.65rem}
.board-head .chip{margin-left:0}
.meter{display:flex;align-items:center;gap:.4rem;font-size:.72rem;color:#d4e2e8;font-variant-numeric:tabular-nums}
.meter{white-space:nowrap}
.cells{
  display:flex;align-items:stretch;overflow:hidden;background:#18242d;
  border:1px solid #627481;border-radius:3px;
}
.cells i{
  width:clamp(2px,calc((100cqw - 9.5rem) / var(--cell-count)),24px);
  height:14px;flex:none;border:0;border-radius:0;
}
.cells i+i{border-left:1px solid #526775}
.cells .filled+.filled{border-left-color:#23404a8c}
.size-meter .filled{background:#76cebf}
.health-meter .filled{background:#ed9395}
.opposing-hand{min-width:0;container-type:inline-size}
.backs{
  --width:clamp(52px,6vw,84px);
  --step:min(calc(var(--width)*.78),calc((100cqw - var(--width) - 20px)/var(--gaps)));
  display:flex;align-items:center;justify-content:center;padding:8px 0;overflow:hidden;
}
.backs i{
  box-sizing:border-box;flex:0 0 var(--width);aspect-ratio:63/88;border:3px double #af966f;border-radius:6px;
  background:repeating-linear-gradient(45deg,#1b3240 0 4px,#304855 4px 5px);
  transform:rotate(calc(var(--tilt) * -4deg));box-shadow:0 2px 4px #08121a80;
}
.backs i+i{margin-left:calc(var(--step) - var(--width))}
.backs:empty{padding:0}
.turn-strip{display:flex;justify-content:center;align-items:center;gap:.65rem;min-height:44px;margin:.55rem 0;border-block:1px solid #43606e;background:#0d1c28;color:#e4ebed;font-size:.86rem}
.turn-strip small{color:var(--muted)}.turn-strip.my-turn strong{color:var(--mint)}.turn-strip.their-turn strong{color:var(--gold)}.turn-strip button{padding:.35rem .7rem;font-size:.8rem}
@media(max-width:580px){.board-head{gap:.35rem;flex-wrap:wrap}.meter{gap:.2rem;font-size:.66rem}.turn-strip{flex-wrap:wrap;gap:.35rem}}

#decision{min-width:0;padding:.6rem .9rem;border:1px solid var(--line);border-radius:12px;background:var(--panel)}
#decision:not([hidden]){display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:.45rem .85rem}
#decision h2{font-size:1rem}
#decision .choice-list{display:flex;flex-wrap:wrap;justify-content:center;gap:.4rem;margin:0}
#decision .choice-card{width:72px;flex:none}
#history-dialog .log{max-height:65dvh}
/* 한 진영에 나란히 놓인 다섯 장이 같은 실물 카드 규격을 사용합니다. */
.zones{
  container-type:inline-size;
  --field-card:min(174px,calc((100cqw - 24px) / 6.12));
  grid-template-columns:minmax(0,1.56fr) minmax(0,3fr) minmax(0,1.56fr);
}
.zones .lane,.zones .lane.legal{
  padding:0;border:0;border-radius:0;background:none;box-shadow:none;
}
.zones .unit,.zones .empty,.damage-slots>*,
.zones .draw-slot,.zones .trash-slot{
  box-sizing:border-box;width:var(--field-card);height:auto;aspect-ratio:63/88;
  padding:0;justify-self:center;align-self:center;
}
.level-track{
  min-height:calc(var(--field-card) + 9 * clamp(17px,2cqw,29px) + 12px);
  grid-area:1/1/3/2;position:relative;align-self:stretch;justify-self:center;
  width:calc(var(--field-card) * 88 / 63);max-width:100%;min-width:0;
}
.level-path{
  position:absolute;inset:0;margin-block:auto;
  height:min(calc(100% - 8px),calc(4 * var(--field-card)));
  border:1px dashed #7492a5;border-radius:5px;
}
.level-rail{position:absolute;inset:0 0 var(--field-card)}
.opponent .level-rail{inset:var(--field-card) 0 0}
.level-mark{
  position:absolute;top:calc(var(--step) * 10%);height:10%;width:100%;
  display:flex;align-items:center;justify-content:flex-end;border-top:1px dashed #607989;
  padding-inline:clamp(3px,1cqw,12px);pointer-events:none;
}
.level-mark i{font:700 clamp(10px,1.75cqw,23px)/1 Arial,sans-serif;color:#a7bbc8;white-space:nowrap;font-variant-numeric:tabular-nums}
.level-mark.current{background:#253c48}
.level-mark.current i{color:var(--accent);font-weight:800}
.level-path .leader-slot{
  position:absolute;z-index:1;left:-1px;top:calc(var(--step) * 10%);width:calc(100% + 2px);
  height:var(--field-card);min-width:0;max-width:none;padding:0;display:block;
  overflow:hidden;border:1px solid var(--accent);border-radius:6px;background:#112330;
}
.opponent .level-path .leader-slot{top:calc(var(--step) * 10% - var(--field-card))}
.pile::before{
  content:attr(data-tab);position:absolute;top:3px;left:2px;z-index:2;pointer-events:none;
  padding:.1em .8em .12em .45em;background:#223745f0;color:#f2e8ce;
  clip-path:polygon(0 0,100% 0,calc(100% - .48em) 100%,0 100%);
  font-size:clamp(9px,1cqw,13px);font-weight:700;line-height:1.3;
}
.zones .leader-slot img{width:100%;height:100%;object-fit:contain}
.zones .draw-slot,.zones .trash-slot{position:relative;display:grid;place-items:center;border:0;background:none;overflow:visible}
.zones .draw-slot .deck-back{box-sizing:border-box;width:100%;height:100%;font-size:clamp(24px,4cqw,56px)}
.zones .trash-slot img{display:block;width:100%;height:100%;border-radius:6px;object-fit:contain}
.zones .trash-slot:empty{border:1px dashed #70869785}
.pile::after{
  content:attr(aria-label);position:absolute;z-index:4;bottom:5px;left:50%;transform:translateX(-50%);
  padding:.2rem .45rem;border-radius:5px;background:#08131bf2;color:#f1f5f2;white-space:nowrap;
  font-size:.75rem;line-height:1.3;pointer-events:none;visibility:hidden;
}
.pile:focus-visible::after{visibility:visible}
@media(hover:hover){.pile:hover::after{visibility:visible}}
@media(hover:none){.draw-slot:focus::after{visibility:visible}}
.damage-area{align-content:start}
.damage-slots{
  display:grid;grid-template-columns:repeat(9,minmax(0,1fr)) var(--field-card);
  align-items:start;isolation:isolate;
}
.damage-slots>*{justify-self:start;grid-row:1;display:block;padding:0;border-radius:6px;min-width:0}
.damage-slots .vacant{position:relative;border:1.5px dashed #728594;background:#172b38}
.damage-slots .damage-card{position:relative;overflow:hidden;border:1px solid #b4a68a;box-shadow:-1px 1px 3px #08121988}
.damage-card .game-face{display:block;width:100%;height:100%;object-fit:contain}
.damage-card:focus-visible{outline-offset:-3px}
.opponent .damage-slots{direction:rtl}

.trash-slot{isolation:isolate}
.trash-sheet{
  position:absolute;inset:0;overflow:hidden;
  transform:translateX(calc(var(--step) * clamp(2px,.4cqw,6px)));
  border:1px dashed #7690a0;border-radius:6px;background:#172b38;
}
.trash-slot .trash-sheet:not(.vacant){border:0}
.trash-slot.pile::before,.trash-slot.pile::after{z-index:5}

html:has(#game:not([hidden])){scrollbar-gutter:auto}
body:has(#game:not([hidden])){min-height:0}
.match-tools{
  position:fixed;top:max(5px,env(safe-area-inset-top));right:max(6px,env(safe-area-inset-right));
  display:flex;gap:4px;z-index:10;
}
.match-tools a,.match-tools button{
  display:grid;place-items:center;width:clamp(32px,4.6dvh,42px);height:clamp(32px,4.6dvh,42px);
  padding:6px;border:1px solid #516475;border-radius:50%;background:#142634;color:#eef4f4;
}
.match-tools :is(a,button):hover{background:#294451}
.match-tools svg{width:100%;height:100%;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
#connection:not(:empty){position:fixed;top:3rem;right:.4rem;z-index:10;background:#172c37;padding:.2rem .4rem}
#game{
  display:flex;flex-direction:column;align-items:stretch;gap:0;
  width:100%;height:100vh;height:100dvh;margin:0;padding:0;background:#142635;
}
#game .table{flex:1;min-height:0}
#mat{
  display:grid;height:100%;grid-template-rows:minmax(0,1fr) auto minmax(0,1fr);
  padding:0 clamp(4px,1vw,14px);border:0;border-radius:0;box-shadow:none;
}
#mat .board{display:grid;min-height:0;grid-template-rows:auto minmax(0,1fr);padding:0}
#mat .board-head{min-height:22px;margin:0;padding:2px 0}
#mat .zones{
  container-type:size;min-height:0;gap:3px;
  grid-template-rows:repeat(2,minmax(0,1fr));
  --field-card:min(174px,calc((100cqw - 24px)/6.12),calc((50cqh - 25px)*63/88));
}
#mat .level-track{min-height:0}
#mat .level-mark i{font-size:clamp(9px,4cqh,22px)}
#mat .gearlink img{height:min(22px,7cqh);width:auto}
#mat .damage-area{align-content:center}
#mat .turn-strip{
  display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);
  align-items:center;min-height:36px;margin:2px 0;padding:2px 0;gap:4px;
}
.turn-strip>:first-child{grid-column:2;text-align:center}
.turn-strip .turn-owner{max-width:50vw;overflow-wrap:anywhere}
.turn-strip button{grid-column:3;justify-self:end}
#opposing-hand{flex:none;min-height:clamp(42px,7.5dvh,84px);padding-inline:min(32vw,150px)}
.backs{--width:clamp(20px,4.6dvh,78px);padding:3px 0}
#game .hand-area{flex:none}
#hand{--card-w:min(9.4dvh,125px);padding:clamp(4px,1dvh,12px) 10px}
#decision:not([hidden]){flex:none;max-height:17dvh;overflow:auto;border-radius:0;padding:.25rem .5rem}
#decision .choice-card{width:clamp(32px,5.5dvh,65px)}
@media(max-width:540px){
  .match-tools{gap:2px}.match-tools a,.match-tools button{width:30px;height:30px}
  #opposing-hand{padding-inline:100px}
  #mat .turn-strip{font-size:.78rem}
  .turn-strip button{font-size:.7rem;padding:.35rem}
}

/* 마우스용 대전판은 창 높이 대신 카드의 인쇄 비율과 보드 너비를 기준으로 배치합니다. */
html[data-layout="desktop"] #game{height:auto;min-height:100dvh}
html[data-layout="desktop"] #game .table{flex:1 0 auto}
html[data-layout="desktop"] #mat{height:auto;grid-template-rows:auto auto auto;padding-inline:clamp(8px,1.45vw,24px)}
html[data-layout="desktop"] #mat .board{grid-template-rows:auto auto;padding-block:5px}
html[data-layout="desktop"] #mat .board-head{margin-bottom:4px;min-height:28px}
html[data-layout="desktop"] #mat .zones{
  container-type:inline-size;grid-template-rows:auto auto;gap:6px;
  --field-card:min(174px,calc((100cqw - 24px)/6.12));
}
html[data-layout="desktop"] #mat .level-track{min-height:calc(var(--field-card) + 9 * clamp(17px,2cqw,29px) + 12px)}
html[data-layout="desktop"] #mat .level-mark i{font-size:clamp(14px,1.75cqw,23px)}
html[data-layout="desktop"] #mat .gearlink img{width:20px;height:28px}
html[data-layout="desktop"] #mat .turn-strip{min-height:44px;margin:6px 0}
html[data-layout="desktop"] .backs{--width:clamp(52px,6vw,84px);padding-block:10px}
html[data-layout="desktop"] #hand{--card-w:clamp(90px,9vw,125px);padding-block:18px}
html[data-layout="desktop"] #decision:not([hidden]){max-height:none}
html[data-layout="desktop"] .zones .unit,html[data-layout="desktop"] .hand-card,html[data-layout="desktop"] .leader-slot{background:transparent}
html[data-layout="desktop"] .game-face{border-radius:5px}

#decision-home:empty,#decision-home:has(>#decision[hidden]){display:none}
#cue-dialog{
  position:fixed;inset:0;width:100vw;height:100dvh;max-width:none;max-height:none;
  margin:0;padding:0;border:0;border-radius:0;overflow:hidden;background:transparent;box-shadow:none;
}
#cue-dialog::backdrop{background:rgb(3 10 17 / 68%)}
#cue-dialog.spotlight::backdrop{background:transparent}
#cue-target{display:none}
.spotlight #cue-target{
  position:fixed;display:block;border:2px solid #ffdb89;border-radius:9px;
  box-shadow:0 0 0 300vmax rgb(3 10 17 / 77%),0 0 22px #ffd99188;
}
#cue-panel{
  position:fixed;left:50%;top:50%;transform:translate(-50%,-50%);z-index:2;
  width:min(420px,calc(100vw - 24px));max-height:85dvh;overflow:auto;
  padding:clamp(16px,2vw,24px);border:1px solid #55717d;border-top:3px solid #79dfc9;
  border-radius:14px;background:linear-gradient(145deg,#203745,#12212f 80%);box-shadow:0 18px 60px #0008;
}
#cue-dialog.spotlight #cue-panel{transform:none;border-top-color:#efc879}
#cue-panel #decision{display:block;padding:0;border:0;background:none;max-height:none;overflow:visible}
#cue-panel #decision h2{font-size:clamp(16px,2vw,21px);margin:0 0 .65rem;line-height:1.35}
#cue-panel #decision p{margin:0 0 1rem;color:#d1dfdf}
#cue-panel #decision p b{color:#f8d696;white-space:nowrap}
#cue-panel .cue-kicker{display:block;margin-bottom:.35rem;font-size:.75rem;color:#e6c183}
#cue-panel #decision .choice-list{justify-content:flex-start;gap:.45rem}
#cue-panel #decision .choice-list button{flex:1 0 auto;min-height:38px;text-align:center}
#cue-panel #decision .choice-list .choice-card{flex:0 1 66px}
.opening-cards{display:flex;justify-content:center;gap:4px;margin:1rem 0}
.opening-cards img{width:calc((100% - 16px)/5);object-fit:contain;border-radius:3px}
#motion-layer{position:fixed;inset:0;z-index:15;overflow:hidden;pointer-events:none}
.flying-card{position:absolute;width:clamp(32px,4vw,62px);aspect-ratio:63/88;overflow:hidden;
  border-radius:5px;border:2px solid #a7c5bb;box-shadow:0 4px 12px #0006;
  background:repeating-linear-gradient(45deg,#1b3240 0 4px,#304855 4px 5px)}
.flying-card img{display:block;width:100%;height:100%;object-fit:contain}
@media (prefers-reduced-motion: no-preference){
  dialog:not(#cue-dialog)[open]{animation:arena-appear .16s ease-out}
  button:active:not(:disabled){filter:brightness(1.17)}
  @keyframes arena-appear{from{opacity:0;scale:.97}to{opacity:1;scale:1}}
}

/* 선택 팝업의 실제 입력 영역은 패널 크기만 차지합니다. */
#cue-dialog{inset:50% auto auto 50%;width:min(400px,calc(100vw - 24px));height:auto;transform:translate(-50%,-50%);overflow:visible;z-index:32}
#cue-dialog:not(.spotlight) #cue-panel{position:relative;inset:auto;width:100%;transform:none}
#cue-dialog.spotlight{inset:0 auto auto 0;width:0;height:0;transform:none}
#cue-dialog:not(.spotlight)::backdrop{background:transparent}
#card-tools{position:fixed;z-index:33;display:flex;gap:4px;padding:3px;border-radius:24px;background:#10232feb;border:1px solid #537a80;box-shadow:0 4px 14px #0008}
#card-tools .card-command{width:34px;height:34px;display:grid;place-items:center;border-radius:50%;padding:6px;color:#c2ffeb;background:#203e48}
.card-command svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.card-stats .stat-row{
  position:absolute;inset:2% 2% auto;display:grid;align-items:center;
  grid-template-columns:minmax(max-content,1fr) max-content minmax(max-content,19%);column-gap:.8%;padding:0;
}
.stat-row .stat-cost{grid-column:1;justify-self:start}
.stat-row .stat-power{grid-column:2}
.stat-row .stat-hit{grid-column:3;justify-self:end}
.card-stats .stat-ex{top:auto;bottom:2%;right:2%}
.stat-tile .stat-cost,.stat-tile .stat-power,.stat-tile .stat-hit{font-size:clamp(5px,calc(14cqw - 1px),21px)}
#card-preview{container-type:inline-size}
#card-preview img{width:100%;height:100%;display:block;object-fit:contain;border-radius:9px}
.dialog-card{position:relative;container-type:inline-size;width:fit-content;max-width:100%;margin:auto}
#card-preview .card-stat,.dialog-card .card-stat{position:absolute;padding:.08em .32em;border-radius:100px;color:white;font:800 clamp(14px,7cqw,36px)/1.1 Arial,sans-serif;white-space:nowrap}
:is(#card-preview,.dialog-card) .stat-cost{background:#b7731e}
:is(#card-preview,.dialog-card) .stat-power{background:#245747}

:is(#card-preview,.dialog-card) .stat-ex{background:#30496b}
.opening-cards .stat-tile{width:calc((100% - 16px)/5)}
.opening-cards .stat-tile img{width:100%}

#dialog[open]:not(:modal),#history-dialog[open]:not(:modal){position:fixed;inset:50% auto auto 50%;margin:0;transform:translate(-50%,-50%);z-index:34}
#cue-dialog.spotlight #cue-panel{min-width:0}

#card-preview .zoom-face{display:block;position:relative;width:100%;height:100%}
#card-preview .keywords{position:absolute;left:calc(100% + 8px);top:0;width:var(--note-width);max-height:min(100%,70dvh);overflow:auto}
.keyword-note{box-sizing:border-box;padding:.75rem;margin:0;color:#deebe9;background:#142a36f7;border:1px solid #57747e;border-radius:9px;font-size:clamp(11px,1vw,14px);line-height:1.55;text-shadow:none}
.keywords dt{font-weight:750;color:#a4f4d8}
.keywords dd{margin:2px 0 .6rem}
.keywords dd:last-child{margin-bottom:0}
.keywords{display:grid;gap:7px;padding:0;margin:0;align-content:start}
.keyword-note small{display:block;margin-top:.45rem;color:#ffdc99;line-height:1.4}
.detail-layout{display:flex;align-items:flex-start;gap:8px}
.detail-layout .dialog-card{flex:1;min-width:0;margin:0}
.detail-layout .dialog-card img{width:100%;max-width:100%;height:auto}
.detail-layout .keywords{flex:0 0 29%;max-height:65dvh;overflow:auto}
#dialog:has(.detail-layout){width:min(730px,95vw)}

/* 인쇄 카드의 큰 네 꼭짓점과 작은 대각선 꼭짓점을 히트 표식에 사용합니다. */
.card-stats .card-stat.stat-hit{
  width:1.78em;height:1.78em;padding:0;border:none;border-radius:0;box-shadow:none;
  display:grid;place-items:center;line-height:1;color:#fff;text-shadow:0 1px 1px #000;
  background:transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M50 2 64 29 77 21 70 37 98 50 70 64 77 79 62 72 50 98 37 72 23 79 29 64 2 50 30 36 23 21 37 29Z' fill='%23121920' stroke='%23fff1d5' stroke-width='3' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat;
}
#card-preview .card-stats .stat-hit,.dialog-card .card-stats .stat-hit{width:1.78em;height:1.78em;padding:0;border-radius:0}

/* 매트의 인쇄층은 고정하고 카드만 위층에서 이동합니다. */
.printed-edges{position:absolute;inset:0;pointer-events:none}
.printed-outline{position:absolute;top:calc(var(--step) * 10%);width:100%;height:var(--field-card);border:1px dashed #607989;border-radius:5px}
.opponent .printed-outline{top:calc(var(--step) * 10% - var(--field-card))}
.level-mark{z-index:1;border:0}
.level-mark i{background:#162a37;padding-inline:2px}
.level-mark.current i{background:#253c48}
.level-path .leader-slot{z-index:2;background:#112330!important}
.card-stats .card-stat,.dialog-card .card-stats .card-stat,#card-preview .card-stats .card-stat{
  display:grid;place-items:center;box-sizing:border-box;line-height:1;padding:.18em .34em;
}
.stat-tile .stat-row .card-stat,#card-preview .stat-row .card-stat,.dialog-card .stat-row .card-stat{position:static}
.badge-ink{display:block;height:.83em;width:calc(.83em * var(--ink-ratio));flex:none;overflow:visible}
.badge-ink text{font:bold 100px Consolas,"Liberation Mono",monospace;fill:currentColor;stroke:none;text-shadow:none}
@container (max-width:90px){
  .stat-tile .stat-row{column-gap:.5%}
  .stat-tile .stat-row .card-stat{font-size:clamp(5px,16cqw,14px)}
  .stat-tile .stat-row :is(.stat-cost,.stat-power){padding-inline:.08em;border:0}
}
.card-stats .card-stat.stat-hit,#card-preview .card-stats .stat-hit,.dialog-card .card-stats .stat-hit{padding:0}
.stat-hit .badge-ink{height:.72em;width:calc(.72em * var(--ink-ratio))}
#close-dialog{display:block;margin:0 0 .35rem auto;width:30px;height:30px;padding:0;border-radius:50%;font-size:20px;line-height:1}
#dialog{overflow:visible}
#dialog-body>.zone-grid{max-height:calc(100dvh - 110px);overflow-y:auto}
.detail-layout .dialog-card{flex:0 1 auto;width:min(430px,calc((100dvh - 112px)*.715),100%)}
.detail-layout .keywords{min-width:0;flex:1 1 28%;max-height:calc(100dvh - 110px)}
#turn-announcement{position:fixed;inset:0;z-index:31;display:grid;place-content:center;text-align:center;pointer-events:none;
 background:linear-gradient(transparent 27%,#092534e8 48%,#092534e8 52%,transparent 73%);color:#adffe6}
#turn-announcement.away{color:#ffda9e;background:linear-gradient(transparent 27%,#2e291de8 48%,#2e291de8 52%,transparent 73%)}
#turn-announcement strong{font:bold clamp(28px,6vw,76px)/1.15 system-ui,sans-serif;letter-spacing:.08em}
#turn-announcement small{margin-top:.3rem;font-size:1rem}
.hand-card.dealing,.backs i.dealing{visibility:hidden}
