:root{font-family:system-ui,-apple-system,"Segoe UI",sans-serif;background:#0e1116;color:#e8edf3}*{box-sizing:border-box}html,body{margin:0;min-height:100%;background:#0e1116}body{overflow-x:hidden}header{height:52px;padding:0 14px;display:flex;align-items:center;gap:12px;background:#171c24;border-bottom:1px solid #2a3340}header span{margin-left:auto}.hidden{display:none!important}main{max-width:1280px;margin:auto;padding:12px}.panel{background:#151b23;border:1px solid #2a3442;border-radius:10px;padding:14px;margin-top:10px}.narrow{max-width:520px;margin:60px auto}.row{display:flex;gap:6px;align-items:center;flex-wrap:wrap}input,select,textarea,button{background:#0f141b;color:#e8edf3;border:1px solid #364253;border-radius:7px;padding:8px}button{cursor:pointer;background:#243249}button:hover{filter:brightness(1.14)}button.ghost{background:transparent}button.danger{background:#5a2630}button.warn{background:#6a4a18}nav{display:flex;gap:6px}.grid{display:grid;grid-template-columns:repeat(3,1fr);gap:6px}.grid textarea{grid-column:1/-1}.check{display:block;margin:10px 0}.card-list{display:grid;grid-template-columns:repeat(auto-fill,minmax(190px,1fr));gap:6px;margin-top:8px}.card{border:1px solid #303b4b;border-radius:8px;padding:8px;background:#10161e}.card hr{border:none;border-top:1px solid #303b4b}.muted{color:#9aa7b6;font-size:12px}.builder{display:grid;grid-template-columns:1fr 1fr;gap:12px}.deckline{display:flex;justify-content:space-between;align-items:center;padding:5px;border-bottom:1px solid #26303c}.room{padding:8px;border-bottom:1px solid #26303c}.admin-grid{display:grid;grid-template-columns:1.2fr 1fr 1fr;gap:14px;align-items:start}.admin-grid>section{background:#10161e;border:1px solid #2a3442;border-radius:9px;padding:10px}.admin-grid h3{margin-top:0}.admin-line{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:7px 0;border-bottom:1px solid #26303c}.admin-badge{display:inline-block;margin-left:6px;padding:2px 6px;border-radius:999px;background:#364c32;font-size:11px}

/* v5 game layout */
.in-game{height:100dvh;overflow:hidden}.in-game>header{display:none}.in-game>main{max-width:none;padding:0;height:100dvh;overflow:hidden}.game-shell{height:100dvh;display:grid;grid-template-columns:280px minmax(0,1fr);background:#0b0f14}.sidebar{height:100dvh;overflow-y:auto;overscroll-behavior:contain;border-right:1px solid #2a3442;background:#121820;padding:8px;display:flex;flex-direction:column;gap:9px}.sidebar-block{background:#0e141c;border:1px solid #263242;border-radius:8px;padding:7px}.sidebar h3{margin:2px 0 6px;font-size:14px}.log{height:32vh;min-height:160px;overflow-y:auto;overscroll-behavior:contain;background:#080c11;border:1px solid #25303c;border-radius:7px;padding:7px;font-size:11px;line-height:1.45}.log time{color:#7f8d9d}.chatrow{display:grid;grid-template-columns:1fr auto;gap:5px;margin-top:5px}.sidebar input[type=number]{width:58px}.sidebar-block>button{width:100%;margin-top:5px}.shortcut-note{font-size:10px;color:#9aa7b6;line-height:1.5;padding:4px}
.game-main{height:100dvh;min-width:0;display:flex;flex-direction:column;padding:0;overflow:hidden}.game-topbar{flex:0 0 auto;min-height:46px;padding:6px 9px;display:flex;gap:10px;align-items:center;justify-content:space-between;border-bottom:1px solid #2a3442;background:#151b23}.actions{display:flex;gap:4px;align-items:center;justify-content:flex-end;flex-wrap:wrap}.actions button{padding:6px 8px;font-size:11px}.block-notice{font-size:11px;padding:4px 7px;border:1px solid #55708d;border-radius:7px;background:#111c28}.selection-bar{flex:0 0 auto;min-height:40px;padding:5px 9px;display:flex;align-items:center;gap:5px;background:#1b2430;border-bottom:1px solid #364253;flex-wrap:wrap}.selection-bar button{padding:5px 7px;font-size:11px}.stack-mode{background:#2a2114}.board-scroll{flex:1 1 auto;min-height:0;overflow:auto;overscroll-behavior:contain;padding:5px;scrollbar-gutter:stable;background:#090d12}.player-side{min-width:760px;background:#121820;border:1px solid #2c3542;border-radius:8px;padding:5px;margin-bottom:5px}.side-head{display:flex;gap:8px;align-items:center;justify-content:space-between;min-height:28px;font-size:12px}.counters{display:flex;align-items:center;gap:6px;flex-wrap:wrap}.counters>span{background:#0b1118;border:1px solid #2a3542;border-radius:999px;padding:2px 6px;font-size:10px}.direct-target{background:#6a2525;border-color:#a54d4d;animation:targetPulse .8s infinite alternate}.zone-row{display:grid;grid-template-columns:1fr 2.25fr 1.35fr;gap:4px}.zone{min-height:104px;background:#0c1117;border:1px dashed #3a4656;border-radius:6px;padding:3px;overflow-x:auto;overflow-y:hidden;white-space:nowrap}.zone h4{position:sticky;left:0;margin:0 0 3px;padding:1px 3px;width:max-content;background:#0c1117e8;color:#aab5c2;font-size:10px;z-index:3}.shield-zone,.hand-zone{min-height:95px;margin-top:4px}.hand-zone{min-height:110px}.hand-zone h4 em{font-style:normal;color:#f0c674}.grave-zone,.mana-zone{min-width:150px}.battle-zone{min-width:310px}
/* fixed slots prevent tapped cards from shifting the whole row */
.mini-slot{position:relative;display:inline-flex;width:76px;height:92px;margin:2px;vertical-align:top;align-items:center;justify-content:center;white-space:normal}.mini-card{position:relative;display:flex;flex-direction:column;justify-content:flex-start;width:68px;height:88px;padding:4px;border:1px solid #3a4656;border-radius:6px;background:#17202b;font-size:9px;cursor:pointer;overflow:hidden;transform-origin:center;transition:transform .12s ease,filter .12s ease}.mini-card b{line-height:1.15}.mini-card small{margin-top:3px;color:#aeb8c4}.mini-card em{font-style:normal;margin-top:auto;font-size:8px;background:#4b365f;border-radius:3px;padding:1px 3px;width:max-content}.mini-card.tap{transform:rotate(90deg) scale(.82)}.mini-card.back{background:repeating-linear-gradient(45deg,#202a37,#202a37 8px,#121821 8px,#121821 16px);color:transparent}.mini-card.selected{outline:2px solid #f0c674;outline-offset:1px}.target-slot{outline:2px dashed #d89b3c;border-radius:8px;animation:targetPulse .9s infinite alternate}@keyframes targetPulse{from{filter:brightness(1)}to{filter:brightness(1.35)}}.stack-badge,.faceup-badge{position:absolute;right:2px;bottom:2px;font-style:normal;background:#614619;color:#fff;border-radius:999px;padding:1px 4px;font-size:8px}.faceup-badge{right:auto;left:2px;background:#285b53}.effect-flash{animation:effectFlash .65s ease-in-out 3;box-shadow:0 0 0 3px #fff9,0 0 16px #fff7}@keyframes effectFlash{0%,100%{filter:brightness(1)}50%{filter:brightness(1.55)}}
.reveal-strip{min-height:102px;border:1px solid #665c3c;background:#18160f;border-radius:6px;padding:4px;margin-bottom:4px;overflow-x:auto;overflow-y:hidden;white-space:nowrap}.private-peek-strip{border-color:#536d8c;background:#101a25}.strip-head{position:sticky;left:0;display:flex;align-items:center;gap:6px;width:max-content;z-index:3;background:inherit;padding:1px 2px;font-size:10px}.strip-head button{font-size:9px;padding:3px 5px}
.move-menu{position:fixed;z-index:15000;right:14px;top:58px;width:205px;max-height:calc(100dvh - 72px);overflow-y:auto;background:#151b23;border:1px solid #49586b;border-radius:9px;padding:8px;box-shadow:0 10px 30px #0008}.move-menu b{display:block;margin-bottom:5px}.move-menu button{display:block;width:100%;margin:3px 0;text-align:left}
.break-overlay{position:fixed;inset:0;z-index:12000;background:#000a;display:flex;align-items:center;justify-content:center;padding:14px;overflow:hidden}.break-modal{width:min(760px,100%);max-height:calc(100dvh - 28px);display:flex;flex-direction:column;background:#151b23;border:1px solid #49586b;border-radius:12px;box-shadow:0 18px 60px #000c;overflow:hidden}.break-header{flex:0 0 auto;display:flex;justify-content:space-between;gap:10px;padding:12px 14px;border-bottom:1px solid #2a3442;background:#171e27}.break-header h3{margin:0 0 3px}.break-count{white-space:nowrap;border:1px solid #49586b;border-radius:999px;padding:4px 8px;font-size:12px}.break-scroll{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:10px}.break-card{border:1px solid #354153;border-radius:9px;background:#0f151d;padding:10px;margin-bottom:10px}.break-card-no{font-size:11px;color:#9aa7b6}.break-card-title{display:block;font-size:15px;margin-bottom:7px}.break-card-text{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.5;max-height:30vh;overflow-y:auto;padding:7px;background:#0b1016;border:1px solid #293442;border-radius:7px}.break-actions{display:flex;gap:7px;flex-wrap:wrap;margin-top:8px}.direct-footer{padding:9px 12px;border-top:1px solid #2a3442;text-align:right}.direct-hand{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:7px}.direct-card{border:1px solid #344152;border-radius:8px;padding:8px;background:#0e141c}.direct-card .row{margin-top:6px}.direct-card button{font-size:10px;padding:5px}
@media(max-width:1000px){.game-shell{grid-template-columns:230px minmax(0,1fr)}.admin-grid{grid-template-columns:1fr}.mini-slot{width:68px}.mini-card{width:61px}.player-side{min-width:680px}}
@media(max-width:700px){.game-shell{grid-template-columns:200px minmax(0,1fr)}.sidebar{padding:5px}.game-topbar{align-items:flex-start}.actions{max-width:70%}.player-side{min-width:640px}.zone-row{grid-template-columns:150px 300px 180px}.mini-slot{width:64px}.mini-card{width:58px;font-size:8px}}

/* v5.1 */
.mana-zone{scrollbar-gutter:stable both-edges}
.stack-view-overlay{position:fixed;inset:0;z-index:11800;background:#0008;display:flex;align-items:center;justify-content:center;padding:16px}
.stack-view-modal{width:min(760px,96vw);max-height:calc(100dvh - 32px);display:flex;flex-direction:column;background:#151b23;border:1px solid #49586b;border-radius:12px;box-shadow:0 18px 60px #000c;overflow:hidden}
.stack-view-scroll{overflow:auto;padding:10px;display:grid;gap:8px}
.stack-view-card{border:1px solid #354153;border-radius:9px;background:#0f151d;padding:10px}
.stack-index{font-size:11px;color:#9aa7b6;margin-bottom:3px}.stack-actions{display:flex;gap:6px;flex-wrap:wrap;margin-top:8px}.stack-actions button{font-size:11px;padding:5px 7px}
.direct-float{position:fixed;z-index:12500;right:18px;top:78px;width:min(520px,calc(100vw - 24px));max-height:min(70vh,620px);display:flex;flex-direction:column;background:#151b23;border:1px solid #7b5151;border-radius:11px;box-shadow:0 16px 50px #000b;overflow:hidden}
.direct-drag-handle{display:flex;justify-content:space-between;align-items:flex-start;gap:10px;padding:9px 11px;background:#29191b;border-bottom:1px solid #5b3337;cursor:move;user-select:none;touch-action:none}.direct-drag-handle b{font-size:13px}.drag-mark{font-size:18px;color:#d7a4a4}
.direct-float-body{padding:9px;overflow:auto;min-height:0}.direct-float .direct-hand{grid-template-columns:repeat(auto-fit,minmax(150px,1fr))}.direct-float .direct-footer{flex:0 0 auto;background:#151b23}
@media(max-width:700px){.direct-float{width:min(420px,calc(100vw - 12px));right:6px;top:60px;max-height:72vh}}

/* v6.0 card/deck management */
.name-list,.builder-name-list,.admin-card-list{margin-top:8px;border:1px solid #2a3442;border-radius:8px;overflow:hidden;background:#0e141c}.name-list{max-height:68vh;overflow-y:auto}.builder-name-list{max-height:55vh;overflow-y:auto}.admin-card-list{max-height:34vh;overflow-y:auto}.card-name-row,.builder-name-row{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:7px 9px;border-bottom:1px solid #26303c;min-height:34px}.card-name-row:last-child,.builder-name-row:last-child{border-bottom:none}.card-name-row:hover,.builder-name-row:hover{background:#151d27}.builder-name-row button{padding:4px 9px}.bulk-preview{max-height:180px;overflow:auto;border:1px solid #2a3442;border-radius:7px;padding:7px;margin:7px 0;background:#0b1016;font-size:12px}.bulk-preview>div{padding:2px 0}.admin-grid{grid-template-columns:minmax(360px,1.4fr) 1fr 1fr}#admin textarea{width:100%}

/* WonderDeck v6 responsiveness */
button,.card,.zone-card,.builder-name-row{touch-action:manipulation}
button:active,.zone-card:active{transform:scale(.98)}
#cardSearch,#deckCardSearch,#adminCardSearch,#deckCodeInput{min-height:42px;font-size:16px}
.builder-name-list,.name-list,.admin-card-list{contain:content}

.sync-box{margin-top:12px;padding:14px;border:1px solid #334154;border-radius:10px;background:#0b1119}.sync-box h4{margin:0 0 6px;color:#f0f5fb}.sync-progress{margin-top:10px;padding:12px;min-height:80px;border-radius:8px;background:#111923;border:1px solid #2d3a4b;line-height:1.5;color:#dce6f2}.sync-box label{font-size:12px;color:#aebdce}.sync-box label input{width:90px;margin-left:4px}.sync-title{display:flex;justify-content:space-between;gap:10px;border-bottom:1px solid #273344;padding-bottom:8px;margin-bottom:8px}.sync-stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:6px}.sync-stats span{background:#0b1119;border:1px solid #263344;border-radius:7px;padding:6px 8px}.sync-log{margin-top:10px;max-height:220px;overflow:auto;background:#080d13;border:1px solid #273344;border-radius:7px;padding:8px;font-size:12px}.sync-log>div{padding:3px 0;border-bottom:1px solid #17202b}.sync-error{margin-top:8px;padding:7px;background:#381820;border:1px solid #6c2c3c;border-radius:6px;color:#ffbdc8}.good{color:#7ee0a4}.bad{color:#ff8f9f}

.sync-log{overscroll-behavior:contain;scrollbar-gutter:stable;user-select:text;touch-action:pan-y}
.sync-log:hover{border-color:#526983}
.rebuild-box{border-color:#5d4650;background:#120e13}
.rebuild-box h4{color:#ffd7e0}
.rebuild-box .sync-progress{background:#100c11;border-color:#4b3740}

.mini-card.hyper-mode{box-shadow:0 0 0 2px #8f69ff,0 0 16px rgba(143,105,255,.45);border-color:#a98cff}
.hyper-badge{position:absolute;right:4px;bottom:4px;background:#7a52e8;color:#fff;border-radius:5px;padding:2px 5px;font-size:9px;font-style:normal;font-weight:800;letter-spacing:.4px}
.power-label{font-weight:800}

.admin-grid-two{grid-template-columns:minmax(520px,1.45fr) minmax(300px,.9fr)!important;gap:14px}
.admin-side-stack{display:flex;flex-direction:column;gap:14px;min-width:0}
.admin-side-stack>section{background:#10161e;border:1px solid #2a3442;border-radius:9px;padding:10px}
.admin-side-stack h3{margin-top:0}
.setting-line{display:flex;justify-content:space-between;align-items:center;gap:14px}
.setting-line p{margin:5px 0 0}
#registrationToggleBtn{min-width:145px}
@media(max-width:900px){.admin-grid-two{grid-template-columns:1fr!important}}

.opponent-side.mirror-side{border-bottom:2px solid #334252;padding-bottom:16px}
.opponent-side .hand-zone{margin-bottom:10px}
.opponent-side .shield-zone{margin-bottom:10px}
.opponent-zone-row{grid-template-columns:1fr 2fr 1fr}
.zone-title-row{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap}
.zone-title-row h4{margin:0}
.zone-actions{display:flex;gap:5px;flex-wrap:wrap}
.zone-actions button{padding:4px 7px;font-size:11px}
.opponent-side .mini-card:not(.back){cursor:pointer}
