/* Fine Tabletop — Studio, cards and the table. Owned by the Studio window (see HANDOFF-STUDIO.md);
   uses the tokens of build/style.css (--bg, --surface, --amber, …), loaded after it on /studio/ and /play/. */
/* ── studio ── */
.steps{display:grid;grid-template-columns:repeat(6,1fr);gap:6px;padding:18px 0 0}
.step{border:0;background:none;padding:0;text-align:left;color:var(--mut2);font-size:11px;letter-spacing:.1em;text-transform:uppercase;min-width:0}
.step i{display:block;height:2px;border-radius:1px;background:var(--line2);margin-bottom:7px}
.step b{font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block}
.step b span{margin-right:5px}
.step[aria-current="step"]{color:var(--tx)}
.step[aria-current="step"] b span,.step.done b span{color:var(--amber)}
.step[aria-current="step"] i,.step.done i{background:var(--amber)}
.step.done{color:var(--mut)}
@media (max-width:560px){.step{letter-spacing:.03em;font-size:10px}.step b{font-size:0}.step b span{font-size:10px}.step[aria-current="step"] b{font-size:10px}}
.scr{display:none}.scr.on{display:block}
.sl{display:grid;grid-template-columns:minmax(0,1fr) minmax(300px,420px);gap:16px;align-items:start;margin-top:8px}
@media (max-width:900px){.sl{grid-template-columns:1fr}.pv{order:-1}}
.tpl{display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));gap:10px}
.tp{border:1px solid var(--line);border-radius:6px;background:var(--surface);padding:12px 13px;text-align:left;display:flex;flex-direction:column;gap:5px;cursor:pointer;transition:border-color .13s}
.tp:hover{border-color:var(--rim)}
.tp.on{border-color:var(--amber);background:var(--tint)}
.tp .fam{font-size:10px;letter-spacing:.12em;text-transform:uppercase;color:var(--amber)}
.tp h3{font-size:13.5px;font-weight:700}
.tp p{font-size:11.5px;color:var(--mut);line-height:1.5}
.tp .m{font-size:11px;color:var(--mut2);margin-top:auto;padding-top:4px}
.uni{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:8px}
.un{border:1px solid var(--line);border-radius:6px;background:var(--surface);padding:0;overflow:hidden;text-align:left;cursor:pointer;display:flex;flex-direction:column}
.un i{display:block;height:44px;background:var(--t)}
.un b{padding:8px 10px 9px;font-size:12px;font-weight:600}
.un.on{border-color:var(--amber);box-shadow:0 0 0 1px var(--amber) inset}
.rows{display:flex;flex-direction:column;gap:8px}
.row{display:grid;grid-template-columns:auto 1fr;gap:10px;align-items:center}
.row .th{width:44px;height:44px;border-radius:5px;background:var(--surface2);border:1px solid var(--line2);overflow:hidden;display:grid;place-items:center;font-size:10px;color:var(--mut2)}
.row .th img{width:100%;height:100%;object-fit:cover}
.opts{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:8px}
.op{border:1px solid var(--line);border-radius:6px;padding:10px 12px;cursor:pointer;background:var(--surface);display:flex;flex-direction:column;gap:3px}
.op b{font-size:12.5px}.op span{font-size:11.5px;color:var(--mut);line-height:1.45}
.op.on{border-color:var(--amber);background:var(--tint)}
.drop{border:1px dashed var(--line2);border-radius:6px;padding:20px;text-align:center;color:var(--mut);font-size:12.5px;background:var(--surface)}
.drop.over{border-color:var(--amber);background:var(--tint)}
.drop input{display:none}
.thumbs{display:grid;grid-template-columns:repeat(auto-fill,minmax(84px,1fr));gap:8px;margin-top:10px}
.thumbs figure{margin:0;position:relative;aspect-ratio:1;border-radius:5px;overflow:hidden;border:1px solid var(--line2);background:var(--surface2)}
.thumbs img{width:100%;height:100%;object-fit:cover}
.thumbs button{position:absolute;right:4px;top:4px;width:22px;height:22px;border-radius:4px;border:0;background:rgba(0,0,0,.6);color:#fff;font-size:12px;line-height:1}
.nav2{display:flex;justify-content:space-between;gap:10px;margin-top:18px}

/* preview */
.pv{position:sticky;top:72px;max-height:calc(100dvh - 84px);overflow:auto;padding-bottom:4px}
@media (max-width:900px){.pv{position:static;max-height:none;overflow:visible}.rules{max-height:200px}}
.pvh{display:flex;align-items:center;gap:10px;font-size:11px;letter-spacing:.13em;text-transform:uppercase;color:var(--mut2)}
.pvh b{color:var(--amber)}
.box{margin-top:10px;border:1px solid var(--line2);border-radius:8px;overflow:hidden;background:var(--t,#3a4356);aspect-ratio:4/3;position:relative;display:flex;align-items:flex-end;padding:16px;color:#fff}
.box img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;opacity:.9}
.box::before{content:"";position:absolute;inset:0;background:linear-gradient(180deg,transparent 30%,rgba(0,0,0,.75))}
.box .t{position:relative;font-size:clamp(18px,3vw,24px);font-weight:700;letter-spacing:-.02em;line-height:1.15;text-shadow:0 1px 2px rgba(0,0,0,.5)}
.box .s{position:relative;font-size:11px;letter-spacing:.1em;text-transform:uppercase;opacity:.85;margin-top:5px}
.box .n{position:absolute;top:12px;right:12px;font-size:10px;letter-spacing:.1em;text-transform:uppercase;background:rgba(0,0,0,.45);padding:3px 7px;border-radius:4px}
.hand{display:grid;grid-template-columns:repeat(4,1fr);gap:6px;margin-top:10px}
.pc{aspect-ratio:5/7;border-radius:6px;border:1px solid var(--line2);background:var(--surface);overflow:hidden;display:flex;flex-direction:column;font-size:9px;position:relative}
.pc .im{flex:1;background:var(--t,#3a4356);position:relative;overflow:hidden}
.pc .im img{width:100%;height:100%;object-fit:cover}
.pc .im span{position:absolute;inset:0;display:grid;place-items:center;color:#fff;font-size:18px;font-weight:700;opacity:.8}
.pc .nm{padding:4px 5px 2px;font-weight:700;font-size:9px;line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pc .st{padding:0 5px 5px;display:flex;gap:4px;flex-wrap:wrap;font-size:8px;color:var(--mut2)}
.pc .st b{color:var(--amber)}
.bd{margin-top:10px;border:1px solid var(--line2);border-radius:6px;background:var(--surface);overflow:hidden}
.bd svg{width:100%;height:auto;display:block}
.rules{margin-top:10px;font-size:12px;color:var(--mut);line-height:1.65;border:1px solid var(--line);border-radius:6px;padding:12px 13px;background:var(--surface);max-height:260px;overflow:auto}
.rules h4{color:var(--tx);font-size:12px;margin-bottom:6px}
.rules p+p{margin-top:8px}
#rulesText{max-height:none;margin-top:0}
.ex{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:12px}
.ex .full{grid-column:1/-1}

/* ── Studio (card game constructor) ── */
.wld{display:grid;grid-template-columns:repeat(auto-fill,minmax(170px,1fr));gap:8px}
.wl{border:1px solid var(--line);border-radius:6px;background:var(--surface);padding:0;overflow:hidden;text-align:left;cursor:pointer;display:flex;flex-direction:column}
.wl i{display:block;height:auto;aspect-ratio:16/9;position:relative}
.wl i s{position:absolute;left:0;right:0;bottom:0;height:4px}
.wl b{padding:8px 10px 0;font-size:12.5px}
.wl span{padding:2px 10px 9px;font-size:11px;color:var(--mut2)}
.wl.on{border-color:var(--amber);box-shadow:0 0 0 1px var(--amber) inset}
.duo{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-top:16px}
.duo .panel{margin-top:0}
@media (max-width:820px){.duo{grid-template-columns:1fr}}
.arch{display:grid;grid-template-columns:1fr 1fr;gap:6px}
.arch .op.on,.opts .op.on{border-color:var(--amber);background:var(--tint)}
.fan{display:grid;grid-template-columns:repeat(5,1fr);gap:5px;margin-top:12px}
.tabs{display:flex;gap:6px;margin-bottom:12px}
.tab{border:1px solid var(--line2);border-radius:6px;background:var(--surface2);padding:8px 14px;font-weight:700;font-size:12.5px;color:var(--mut);min-height:40px}
.tab.on{border-color:var(--amber);color:var(--amber);background:var(--tint)}
.stu .drop{cursor:pointer;display:flex;flex-direction:column;gap:4px;margin-bottom:12px}
.stu .drop b{color:var(--tx);font-size:13px}
.deck{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:10px}
@media (max-width:560px){.deck{grid-template-columns:repeat(2,1fr)}}
.dk{border:0;background:none;padding:0;position:relative;cursor:pointer;text-align:left;border-radius:8px}
.dk:hover .cc{outline:2px solid var(--amber);outline-offset:2px}
.dk em{position:absolute;top:-6px;right:-4px;font-style:normal;font-size:10px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;padding:3px 7px;border-radius:4px;background:var(--cat);color:#fff}
.dk.weak em{background:var(--mut2)}
.modal .panel.edp,.modal #ed .panel{width:min(760px,100%)}
#ed .panel{width:min(760px,100%)}
.edb{display:grid;grid-template-columns:220px 1fr;gap:18px;align-items:start}
.edc{width:100%}
@media (max-width:620px){.edb{grid-template-columns:1fr}.edc{width:160px;margin:0 auto}}
.edf{display:flex;flex-direction:column;gap:10px}
.edf .btn.sm{align-self:flex-start}
.stp,.nums{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:8px}
@media (max-width:560px){.stp,.nums{grid-template-columns:1fr}}
.stp1{display:grid;grid-template-columns:minmax(0,1fr) auto auto auto;align-items:center;gap:6px;border:1px solid var(--line);border-radius:6px;padding:6px 6px 6px 10px;background:var(--surface);min-width:0}
.stp1 span{font-size:11px;letter-spacing:.06em;text-transform:uppercase;color:var(--mut2);min-width:0;line-height:1.25;overflow-wrap:anywhere}
.stp1 b{min-width:26px;text-align:center;font-size:16px}
.stp1 button{width:36px;height:36px;border-radius:6px;border:1px solid var(--line2);background:var(--surface2);font-size:18px;font-weight:700;color:var(--tx)}
.stp1 button:hover{border-color:var(--amber);color:var(--amber)}
.stp1.chg{border-color:var(--cat)}
.kws{display:flex;flex-wrap:wrap;gap:6px}
.kws small{color:var(--mut2);font-size:10px}
.meter{border:1px solid var(--line);border-radius:6px;padding:10px 12px;background:var(--surface)}
.meter .mh{display:flex;justify-content:space-between;font-size:12px;color:var(--mut)}
.meter .bar{height:6px;border-radius:3px;background:var(--line);margin:8px 0;overflow:hidden}
.meter .bar i{display:block;height:100%;background:var(--green)}
.meter.strong{border-color:var(--cat)}.meter.strong .bar i{background:var(--cat)}
.meter.weak .bar i{background:var(--mut2)}
.meter p{font-size:12px;color:var(--mut)}
.panel>.ph .r.bad{color:var(--cat)}
.warn{margin-top:12px;border:1px solid var(--cat);border-radius:6px;padding:10px 12px;font-size:12.5px;color:var(--tx);background:color-mix(in srgb,var(--cat) 10%,transparent)}
.grid2c{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-top:16px}
.grid2c .panel{margin-top:0}
@media (max-width:820px){.grid2c{grid-template-columns:1fr}}
.ptext{font-size:12.5px;color:var(--mut);line-height:1.6}
.spec{margin-top:12px;white-space:pre-wrap;font:12px/1.6 var(--mono);color:var(--mut);border:1px solid var(--line);border-radius:6px;padding:10px 12px;background:var(--bg)}
.rules p+p{margin-top:8px}


/* ── simple vs advanced ── */
.advbar{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:14px;flex-wrap:wrap}
.advbar .hint{margin:0}
.advbar .btn.on{border-color:var(--amber);color:var(--amber);background:var(--tint)}
body:not(.adv) .adv{display:none!important}
.deckbar{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:12px;border:1px solid var(--line);border-radius:6px;padding:10px 12px;background:var(--surface)}
.deckbar .dm{display:flex;flex-direction:column;gap:2px;font-size:12px;color:var(--mut)}
.deckbar .dm b{font-size:14px;color:var(--tx)}
.deckbar .dm .st{font-weight:700}
.deckbar .dm .st.strong,.deckbar .dm .st.large,.deckbar .dm .st.small{color:var(--cat)}
.deckbar .dm .st.weak{color:var(--mut2)}
.deckbar .dm .st.fair{color:var(--green)}
.curve{display:flex;align-items:flex-end;gap:3px;height:36px;margin-left:auto}
.curve i{display:flex;flex-direction:column;align-items:center;justify-content:flex-end;width:16px;height:100%;font-size:9px;color:var(--mut2);font-style:normal;gap:2px}
.curve i s{display:block;width:100%;border-radius:2px 2px 0 0;background:var(--amber);text-decoration:none;min-height:1px}
.deckbar .frow{flex-basis:100%;gap:8px}
.dk u{position:absolute;left:-4px;bottom:-6px;text-decoration:none;font-size:10px;font-weight:700;padding:3px 7px;border-radius:4px;background:var(--surface2);border:1px solid var(--line2);color:var(--tx)}
.dk.add{border:1px dashed var(--line2);border-radius:8px;aspect-ratio:63/88;display:grid;place-items:center;color:var(--mut);font-size:12px;text-align:center;padding:10px;background:var(--surface)}
.dk.add:hover{border-color:var(--amber);color:var(--amber)}
.dk.add:hover .cc{outline:0}
.pick{display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:10px;max-height:60dvh;overflow:auto;padding:2px}
@media (max-width:560px){.pick{grid-template-columns:repeat(3,1fr)}}
.pick button{border:0;background:none;padding:0;cursor:pointer;border-radius:8px;text-align:left}
.pick button:hover .cc{outline:2px solid var(--amber);outline-offset:2px}
#pick .panel{width:min(820px,100%)}
.edq{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.edq .stp1{flex:1 1 150px}
.sw{display:flex;gap:6px;flex-wrap:wrap}
.sw .op{flex:1 1 150px}
.lookg{display:grid;grid-template-columns:minmax(0,1fr) 420px;gap:16px;align-items:start}
@media (max-width:820px){.lookg{grid-template-columns:1fr}}
.lookpv{display:grid;grid-template-columns:1fr 1fr 1fr;gap:8px}
.lookpv canvas{width:100%;height:auto;border-radius:5%/3.6%;display:block}
.colors{display:grid;grid-template-columns:repeat(auto-fill,minmax(140px,1fr));gap:8px}
.color{display:flex;align-items:center;gap:8px;border:1px solid var(--line);border-radius:6px;padding:6px 8px;background:var(--surface);font-size:11px;letter-spacing:.06em;text-transform:uppercase;color:var(--mut2)}
.color input[type=color]{width:34px;height:34px;border:1px solid var(--line2);border-radius:6px;background:none;padding:0;cursor:pointer}
.color .x{margin-left:auto;border:0;background:none;color:var(--mut2);font-size:14px;cursor:pointer;padding:4px}
.toggles{display:flex;gap:6px;flex-wrap:wrap}
.chip{display:inline-flex;align-items:center;gap:6px;border:1px solid var(--line2);border-radius:6px;padding:7px 11px;font-size:12px;cursor:pointer;background:var(--surface2);min-height:36px}
.chip.on{border-color:var(--amber);color:var(--amber);background:var(--tint)}
.chip input{accent-color:var(--amber)}
.lbl{font-size:11px;letter-spacing:.1em;text-transform:uppercase;color:var(--mut2);margin:12px 0 6px}
.lbl:first-child{margin-top:0}

/* ── Clash card (build/cardgame/render.js) — 63×88, scales with its box via container units.
   Look variables set inline by cardHTML(): --t faction, --paper/--ink/--soft paper, --cost/--atk/--hp badges, --cf font. ── */
.cc{container-type:inline-size;aspect-ratio:63/88;border-radius:5%/3.6%;background:var(--t);position:relative;color:var(--ink,#1c1a17);font-family:var(--cf,inherit);user-select:none;-webkit-user-select:none}
.cc.fr-square{border-radius:1.5%/1.1%}
.cc-in{position:absolute;inset:4cqw;border-radius:2.8cqw;background:var(--paper,#fbf9f5);display:flex;flex-direction:column;overflow:hidden}
.fr-square .cc-in{border-radius:.8cqw}
.cc-top{display:flex;align-items:center;gap:2cqw;padding:1.2cqw 2cqw;background:color-mix(in srgb,var(--t) 18%,var(--paper,#fbf9f5));min-height:12.5cqw}
.cc-cost{flex:none;width:12cqw;height:12cqw;border-radius:50%;background:var(--cost,#f0b429);border:.8cqw solid #1c1a17;color:#1c1a17;display:grid;place-items:center;font-weight:800;font-size:7cqw;line-height:1}
.cc-nm{font-weight:700;font-size:5.6cqw;line-height:1.1;overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
.cc-pic{position:relative;flex:0 0 44%;background:linear-gradient(135deg,var(--t),#111);display:grid;place-items:center;overflow:hidden}
.cc-pic img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.fit-contain .cc-pic{background:var(--paper,#fbf9f5)}
.fit-contain .cc-pic img{object-fit:contain}
.cc-ini{font-weight:800;font-size:26cqw;color:rgba(255,255,255,.85)}
.cc-sh{position:absolute;inset:0;box-shadow:inset 0 0 0 1.6cqw #5b8bd0,inset 0 0 6cqw rgba(91,139,208,.8)}
.cc-type{padding:2cqw 3.5cqw .5cqw;font-size:3.9cqw;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--t);filter:brightness(.8)}
.cc-tx{padding:0 3.5cqw;font-size:4.2cqw;line-height:1.3;color:var(--soft,#3a372f);flex:1;overflow:hidden}
.cc-st{display:flex;justify-content:space-between;padding:0 2.5cqw 2.5cqw;margin-top:auto}
.cc-st span{min-width:17cqw;padding:1cqw 2cqw;border-radius:2.4cqw;color:#fff;font-weight:800;font-size:7cqw;text-align:center;line-height:1.2}
.cc-atk{background:var(--atk,#b4552f)}.cc-hp{background:var(--hp,#3d7a4a)}.cc-hp.hurt{background:#a3342b}
.cc-spell .cc-tx{font-size:4.8cqw}
.cc.no-type .cc-type,.cc.no-text .cc-tx{display:none}
/* poster: the picture is the whole face; bands over it */
.lay-poster .cc-pic{position:absolute;inset:0;flex:none}
.lay-poster .cc-top,.lay-poster .cc-type,.lay-poster .cc-st{position:absolute;left:0;right:0;background:rgba(12,10,8,.72);color:#fff}
.lay-poster .cc-top{bottom:calc(var(--sb,0cqw) + var(--tb,0cqw));min-height:14cqw}
.lay-poster .cc-nm{color:#fff}
.lay-poster .cc-type{bottom:var(--sb,0cqw);padding:1.2cqw 3.5cqw;color:rgba(255,255,255,.8);filter:none}
.lay-poster.cc-unit{--sb:14cqw}
.lay-poster:not(.no-type){--tb:7cqw}
.lay-poster .cc-tx{display:none}
.lay-poster .cc-st{bottom:0;padding:2.5cqw;height:var(--sb);box-sizing:border-box}
/* plain: no picture, big name, long text */
.lay-plain .cc-pic{display:none}
.lay-plain .cc-top{min-height:22cqw;border-bottom:1cqw solid var(--t)}
.lay-plain .cc-nm{font-size:7.5cqw}
.lay-plain .cc-tx{font-size:5cqw;line-height:1.35;padding-top:2cqw}
.lay-plain .cc-type{padding-top:3.5cqw}

/* ── the table (/play/) ── */
.tbl{padding-bottom:12px}
.tbar{display:flex;align-items:center;gap:10px;margin-top:14px;flex-wrap:wrap}
.tbar b{font-size:14px}
.side{display:flex;flex-direction:column;gap:8px;margin-top:10px}
.hbox{display:flex;align-items:center;gap:10px;flex-wrap:wrap;border:1px solid var(--line2);border-left:6px solid var(--t);border-radius:6px;background:var(--surface);padding:8px 12px;cursor:default}
.hbox.turn{border-color:var(--amber);border-left-color:var(--t)}
.hbox .hn{font-weight:700}
.hbox .hhp{font-weight:800;font-size:18px;color:#fff;background:#3d7a4a;border-radius:5px;padding:1px 9px}
.hbox .hmeta{font-size:11.5px;color:var(--mut2);margin-left:auto}
.hbox.tgt{outline:2px solid var(--cat);outline-offset:2px;cursor:pointer}
.board{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:8px;min-height:92px;align-items:start;padding:6px;border:1px dashed var(--line2);border-radius:6px}
@media (max-width:620px){.board{grid-template-columns:repeat(3,minmax(0,1fr))}}
.board .cc{aspect-ratio:4/5}
.board .cc .cc-top{min-height:0;padding:3px 5px}
.board .cc .cc-cost{display:none}
.board .cc .cc-nm{font-size:10px;-webkit-line-clamp:1}
.board .cc .cc-st{position:absolute;left:0;right:0;bottom:0;padding:4px}
.board .cc .cc-st span{font-size:15px;min-width:28px;padding:1px 6px;border-radius:5px}
.board .cc .cc-ini{font-size:30px}
.board .empty-b{grid-column:1/-1;align-self:center;text-align:center;font-size:12px;color:var(--mut2)}
.board .cc .cc-tx,.board .cc .cc-type{display:none}
.board .cc .cc-pic{flex:1 1 auto;display:grid;position:relative;inset:auto}
.board .cc .cc-top{position:static;background:color-mix(in srgb,var(--t) 18%,var(--paper,#fbf9f5));color:var(--ink,#1c1a17);min-height:0}
.board .lay-poster .cc-nm{color:var(--ink,#1c1a17)}
.board .cc.rdy{outline:2px solid var(--green);outline-offset:1px;cursor:pointer}
.board .cc.sel{outline:3px solid var(--amber);outline-offset:1px;transform:translateY(-3px)}
.board .cc.tgt{outline:2px solid var(--cat);outline-offset:1px;cursor:pointer}
.board .cc.grd::after{content:"";position:absolute;inset:-3px;border:2px solid #5b8bd0;border-radius:7%/5%;pointer-events:none}
.mid{display:flex;align-items:center;gap:10px;margin-top:10px}
.logl{flex:1;min-height:40px;font-size:11.5px;color:var(--mut);line-height:1.45}
.hand{display:flex;gap:8px;overflow-x:auto;padding:12px 2px 6px;margin-top:10px;scroll-snap-type:x mandatory}
.hand .cc{flex:0 0 150px;scroll-snap-align:start;cursor:default;opacity:.55}
.hand .cc.ok{opacity:1;cursor:pointer}
.hand .cc.ok:hover{transform:translateY(-4px)}
.hand .cc.sel{outline:3px solid var(--amber);outline-offset:2px;transform:translateY(-6px);opacity:1}
body.hide-hand .hand,body.hide-hand .board[data-board="0"]{visibility:hidden}
@media (min-width:821px){.hand .cc{flex-basis:140px}.board{min-height:120px}}

/* print & play */
@media print{
  .sys,.foot,.steps,.nav2,.sl>*:not(.pv),.ex,.pvh,.hint{display:none!important}
  body{background:#fff;color:#000}
  .pv{position:static}
  .sl{display:block}
  .hand{grid-template-columns:repeat(3,1fr);gap:4mm}
  .pc{aspect-ratio:63/88;border:1px solid #000;font-size:9pt;break-inside:avoid}
  .pc .nm{font-size:9pt}
  .box{aspect-ratio:auto;height:80mm}
  .bd,.rules{break-before:page;max-height:none;border-color:#000}
}

/* ── publication, invites, the public game page /p/<slug>/ (Studio window, 01.10.2026) ── */
.invite{margin-top:10px;padding:10px 12px;border:1px solid var(--line2);border-radius:6px;background:var(--surface2)}
.invite input{flex:1 1 220px;min-width:0;padding:8px 10px;border:1px solid var(--line2);border-radius:6px;background:var(--surface);color:var(--tx);font:inherit;font-size:12px}
.chip.terms{margin-top:12px}
.chip.terms:has(input:checked){border-color:var(--amber);background:var(--tint);color:var(--tx)}
.termsx p{font-size:13px;line-height:1.55;color:var(--mut);margin:0 0 10px}
.termsx p b{color:var(--tx)}
.pghero .pb.pgtop{display:grid;grid-template-columns:minmax(150px,230px) minmax(0,1fr);gap:22px;align-items:start}
.pgtop canvas{width:100%;height:auto;aspect-ratio:63/88;border-radius:5%/3.6%;box-shadow:0 10px 30px rgba(0,0,0,.35)}
.pgmeta h1{margin:6px 0 4px}
@media (max-width:620px){.pghero .pb.pgtop{grid-template-columns:1fr}.pgtop canvas{max-width:200px;margin:0 auto}}
.pgdeck{display:grid;grid-template-columns:repeat(auto-fill,minmax(130px,1fr));gap:10px}
.pgc{position:relative}
.pgc u{display:block;text-align:center;text-decoration:none;font-size:11px;font-weight:700;color:var(--mut);margin-top:4px}
.olbar{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-top:8px;font-size:12px;color:var(--mut)}
.olbar .dot{width:8px;height:8px;border-radius:50%;background:var(--mut2)}
.olbar .dot.on{background:var(--green)}

/* ── music & sound player mount points: .ftm itself lives in build/cardgame/music.css;
   these two rules only size the slot so the Advanced bar doesn't jump when it mounts (music, Studio window 01.10.2026) ── */
.advbar #ftMusic,.tbar #ftMusic{min-height:38px}

/* ── immersion: world backdrop on the Studio (music, Studio window 01.10.2026).
   studio.js sets body's own background to transparent so this fixed layer shows through the gaps
   between panels; the wash <b> keeps every theme's text contrast since real text always sits on an
   opaque .panel anyway — this only tints the margins. Two <i> layers crossfade on a world change. ── */
.stu-bg{position:fixed;inset:0;overflow:hidden;pointer-events:none;z-index:-1}   /* under the page content: positioned layers paint above in-flow text otherwise */
.stu-bg i{position:absolute;inset:-6%;background-size:cover;background-position:center;filter:blur(40px) saturate(1.2) brightness(.85);opacity:0;transition:opacity 1.1s ease}
.stu-bg i.on{opacity:.5}
html[data-theme="winterlight"] .stu-bg i.on{opacity:.22}
.stu-bg b{position:absolute;inset:0;background:color-mix(in srgb,var(--bg) 78%,transparent);transition:background-color .6s ease}
@media (prefers-reduced-motion:reduce){.stu-bg i{transition:none}.stu-bg b{transition:none}}

/* ── immersion: lore lines (data/cardgame/worlds.json → world_names() → WN[w].lore / WN[w][side].lore) ── */
.lore{margin:8px 0 0;font-size:12px;line-height:1.55;color:var(--mut);font-style:italic;border-left:2px solid var(--line2);padding-left:10px}
.lore:empty{display:none}
.duo .lore{margin:0 0 12px}

/* ── immersion: cards dealt in with a short stagger, a gentle reveal on step change.
   Pure CSS (nth-child delay), so renderDeck()/renderDecks() need no extra markup: any fresh set of
   cards they draw re-triggers the entrance the moment the nodes are inserted. ── */
@media (prefers-reduced-motion:no-preference){
  .fan .cc,.deck .dk{animation:ftDeal .36s cubic-bezier(.16,1,.3,1) both}
  .fan .cc:nth-child(1),.deck .dk:nth-child(1){animation-delay:0ms}
  .fan .cc:nth-child(2),.deck .dk:nth-child(2){animation-delay:28ms}
  .fan .cc:nth-child(3),.deck .dk:nth-child(3){animation-delay:56ms}
  .fan .cc:nth-child(4),.deck .dk:nth-child(4){animation-delay:84ms}
  .fan .cc:nth-child(5),.deck .dk:nth-child(5){animation-delay:112ms}
  .fan .cc:nth-child(6),.deck .dk:nth-child(6){animation-delay:140ms}
  .fan .cc:nth-child(7),.deck .dk:nth-child(7){animation-delay:168ms}
  .fan .cc:nth-child(8),.deck .dk:nth-child(8){animation-delay:196ms}
  .fan .cc:nth-child(9),.deck .dk:nth-child(9){animation-delay:224ms}
  .fan .cc:nth-child(10),.deck .dk:nth-child(10){animation-delay:252ms}
  .deck .dk:nth-child(n+11){animation-delay:280ms}
  .scr.enter{animation:ftReveal .3s ease both}
}
@keyframes ftDeal{from{opacity:0;transform:translateY(9px) scale(.96)}to{opacity:1;transform:none}}
@keyframes ftReveal{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}

/* ── table FX (build/play.js): attack lunge, floating damage/heal numbers, hit shake, shield
   break flash, a fade on unit death. Numbers and the death fade stay (only lose their motion) under
   reduced motion; the lunge and the shake are motion only, so they turn off entirely. ── */
.fx-float{position:fixed;z-index:200;pointer-events:none;font:800 15px/1 var(--mono,monospace);transform:translate(-50%,-30%);text-shadow:0 1px 2px rgba(0,0,0,.55);animation:fxFloat .9s ease-out forwards}
.fx-float.dmg{color:#ff6b57}
.fx-float.heal{color:#6fd68a}
.fx-float.buff{color:var(--amber)}
@keyframes fxFloat{0%{opacity:0;transform:translate(-50%,-6%) scale(.85)}18%{opacity:1;transform:translate(-50%,-55%) scale(1)}100%{opacity:0;transform:translate(-50%,-150%) scale(1)}}
@media (prefers-reduced-motion:reduce){.fx-float{animation:fxFadeOnly .6s ease-out forwards;transform:translate(-50%,-50%)}}
@keyframes fxFadeOnly{0%{opacity:0}20%{opacity:1}100%{opacity:0}}
.fx-die{position:fixed!important;z-index:150;pointer-events:none;opacity:1;transform:scale(1);transition:opacity .4s ease,transform .4s ease}
.fx-die.go{opacity:0;transform:scale(.75) translateY(6px)}
@media (prefers-reduced-motion:reduce){.fx-die{transition:opacity .3s ease}.fx-die.go{transform:none}}
@media (prefers-reduced-motion:no-preference){
  .fx-shake{animation:fxShake .32s ease}
  .fx-lunge{animation:fxLunge .34s cubic-bezier(.3,.7,.4,1)}
}
@keyframes fxShake{0%,100%{transform:translateX(0)}20%{transform:translateX(-4px)}40%{transform:translateX(4px)}60%{transform:translateX(-3px)}80%{transform:translateX(3px)}}
@keyframes fxLunge{0%{transform:translate(0,0) scale(1)}45%{transform:translate(var(--lx,0),var(--ly,0)) scale(1.06)}100%{transform:translate(0,0) scale(1)}}
.fx-shieldbreak{animation:fxShield .4s ease}
@keyframes fxShield{0%{box-shadow:0 0 0 0 rgba(91,139,208,.9)}100%{box-shadow:0 0 0 14px rgba(91,139,208,0)}}

/* ── world atmosphere visible at every width (audit 01.10.2026): the hero banner shows the chosen world, panels let the backdrop through ── */
.stu .hero.panel{background:linear-gradient(90deg,var(--surface) 38%,color-mix(in srgb,var(--surface) 55%,transparent) 62%,color-mix(in srgb,var(--surface) 10%,transparent)),var(--wimg,none) right center/cover no-repeat,var(--surface);transition:background-image .6s ease}
.stu .hero.panel .ph{background:color-mix(in srgb,var(--surface) 88%,transparent)}
@media (max-width:760px){.stu .hero.panel{background:linear-gradient(180deg,color-mix(in srgb,var(--surface) 35%,transparent),color-mix(in srgb,var(--surface) 82%,transparent) 34%,color-mix(in srgb,var(--surface) 94%,transparent) 60%,var(--surface)),var(--wimg,none) center top/cover no-repeat,var(--surface)}}
.stu .scr .panel{background:color-mix(in srgb,var(--surface) 91%,transparent);-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px)}
.stu .scr .panel{border-color:color-mix(in srgb,var(--wtone,var(--line)) 22%,var(--line))}
