@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');
:root{font-family:'DM Sans',sans-serif;color:#ededef;background:#111216;font-synthesis:none;color-scheme:dark;--line:#303138;--muted:#9698a4;--accent:#c5f277;--panel:#1b1c22}*{box-sizing:border-box}body{margin:0}button,input,select{font:inherit}button,a,input,select{outline-offset:4px}button{border:1px solid #393a43;background:#24252c;color:#e6e6e9;border-radius:7px;padding:10px 15px;cursor:pointer;font-size:14px;font-weight:500;white-space:nowrap;transition:background .15s,transform .15s}button:hover{background:#34363e}button:active{transform:translateY(1px)}button:disabled{opacity:.35;cursor:not-allowed}button.primary{background:var(--accent);border-color:var(--accent);color:#202916;font-weight:700}button.primary:hover{background:#d4ff91}.app-header{height:78px;border-bottom:1px solid var(--line);padding:0 36px;display:flex;align-items:center;justify-content:space-between}.brand{display:flex;align-items:center;gap:10px;color:white;text-decoration:none;font-family:'Space Grotesk',sans-serif;font-size:30px;font-weight:600;letter-spacing:-1px}.brand-mark{color:var(--accent);font-size:42px;line-height:1;transform:rotate(-10deg)}.brand-divider{height:23px;width:1px;background:#41424c;margin:0 12px}.brand-sub{font-family:'DM Sans',sans-serif;font-size:12px;font-weight:500;letter-spacing:2px;color:#a7a9b4}.header-actions,.project-actions{display:flex;align-items:center;gap:10px}.save-status{font-size:12px;color:var(--muted);margin-right:12px}main{max-width:1700px;margin:auto;padding:30px 36px 18px}.project-heading{display:flex;justify-content:space-between;align-items:center;margin-bottom:26px}.eyebrow{font-size:12px;letter-spacing:1.7px;color:var(--accent);font-weight:600;margin-bottom:10px}#sequence-title{font-family:'Space Grotesk',sans-serif;font-size:clamp(24px,2.5vw,34px);font-weight:500;letter-spacing:-1px;color:#f4f4f5;background:transparent;border:0;width:min(720px,58vw);padding:0;border-bottom:1px solid transparent}#sequence-title:focus{border-color:var(--accent);outline:none}.project-heading p{color:var(--muted);font-size:14px;margin:9px 0 0}.studio{display:grid;grid-template-columns:282px minmax(0,1fr);gap:18px}.panel{border:1px solid var(--line);border-radius:12px;background:var(--panel);overflow:hidden}.library{padding:20px 17px 12px;display:flex;flex-direction:column;height:538px}.panel-title,.stage-toolbar,.stage-title{display:flex;align-items:center;justify-content:space-between;gap:10px}h2{font-family:'Space Grotesk',sans-serif;font-size:16px;font-weight:500;margin:0}.tiny-label{font-size:10px;letter-spacing:1.5px;color:#747782}.search-wrap{display:flex;align-items:center;gap:8px;border:1px solid #3b3d47;border-radius:7px;background:#14151a;margin:19px 0 14px;padding:0 9px}.search-wrap>span{font-size:25px;color:#afb0b9}.search-wrap input{width:100%;min-width:0;padding:12px 0;background:none;border:0;color:white;font-size:14px;outline:none}.search-wrap button{padding:2px 5px;background:transparent;border:0;color:var(--muted)}.library-caption{display:flex;justify-content:space-between;font-size:12px;color:var(--muted);margin-bottom:14px}.library-caption span:first-child{color:#ddd}#search-status{font-size:13px;color:var(--accent)}#search-status:not(:empty){padding-bottom:10px}.card-grid{display:grid;grid-template-columns:1fr 1fr;gap:15px 12px;overflow:auto;align-content:start;padding:2px 3px 8px;flex:1}.library-card{padding:0;background:transparent;border:0;text-align:left;white-space:normal}.library-card:hover{background:transparent}.card-face{position:relative;aspect-ratio:488/680;border-radius:8px;border:4px solid #0c0c0e;background:linear-gradient(145deg,#445146,#1d2522);overflow:hidden;box-shadow:0 4px 10px #0005;display:flex;flex-direction:column;justify-content:space-between;padding:9px;color:#efe9d5}.card-face img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;z-index:1}.fallback-name{font-family:Georgia,serif;font-weight:bold;font-size:13px;line-height:1.3}.fallback-type{font-size:10px}.library-card .card-face{transition:transform .18s}.library-card:hover .card-face{transform:translateY(-3px)}.library-card .card-name{display:block;margin-top:7px;font-size:12px;color:#c9cbd2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.scryfall-credit{color:#777a88;font-size:11px;text-decoration:none;margin-top:10px}.stage-panel{display:flex;flex-direction:column}.stage-toolbar{height:57px;padding:0 20px;border-bottom:1px solid var(--line)}.stage-title{justify-content:flex-start}.live-dot{width:6px;height:6px;border-radius:100%;background:var(--accent)}.badge{color:#a3a5b0;background:#2b2d35;border-radius:4px;font-size:11px;padding:3px 7px}.small{font-size:12px;padding:7px 10px;background:transparent}.stage-toolbar>div:last-child{display:flex;gap:8px}.battlefield{height:410px;position:relative;isolation:isolate;overflow:hidden;background:radial-gradient(ellipse at 50% 60%,#24352c80,transparent 70%),radial-gradient(#ffffff09 1px,transparent 1px),#171d1c;background-size:auto,22px 22px,auto}.battlefield.drag-over{box-shadow:inset 0 0 0 2px var(--accent)}.zone-label{position:absolute;top:20px;left:21px;font-size:10px;letter-spacing:2px;color:#727f78}.board-watermark{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;font-family:'Space Grotesk',sans-serif;font-weight:700;font-size:85px;letter-spacing:16px;color:#b2c4b505;pointer-events:none}.board-watermark span{font-size:9px;letter-spacing:5px}.empty-board{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;pointer-events:none}.empty-board>span{width:52px;height:52px;display:grid;place-items:center;border:1px dashed #566255;border-radius:50%;color:var(--accent);font-size:26px}.empty-board h3{font-family:'Space Grotesk',sans-serif;font-size:19px;margin:15px 0 6px;font-weight:500}.empty-board p{font-size:14px;color:#929c95;margin:0}.board-bottom{position:absolute;bottom:14px;left:20px;right:20px;display:flex;gap:18px;align-items:center;color:#7f8c84;font-size:11px;pointer-events:none}kbd{font:10px 'DM Sans',sans-serif;border:1px solid #48534c;border-radius:3px;padding:2px 4px;margin-right:4px}.board-bottom span:last-child{margin-left:auto}.board-card{position:absolute;width:91px;padding:0;border:0;background:transparent;transform:translate(-50%,-50%);touch-action:none;user-select:none;transition:left .45s ease,top .45s ease;z-index:2}.board-card:hover{background:transparent}.board-card .card-face{transition:transform .4s,box-shadow .2s;width:100%}.board-card.tapped .card-face{transform:rotate(90deg)}.board-card.selected .card-face{box-shadow:0 0 0 2px var(--accent),0 7px 18px #0009}.board-card.dragging{transition:none;z-index:10}.board-card.dragging .card-face{box-shadow:0 15px 25px #0009}.step-editor{min-height:70px;display:flex;align-items:center;gap:12px;padding:12px 17px;border-top:1px solid var(--line)}.step-symbol{color:var(--muted);font-size:22px}.step-editor>input{border:0;background:transparent;min-width:0;flex:1;font-size:14px;color:#ddd;padding:8px 0}.duration-control{display:flex;align-items:center;color:#979ba5;font-size:12px;gap:4px}.duration-control input{width:48px;border:1px solid #3e404a;border-radius:5px;padding:6px 4px;background:#22232a;color:#eee;font-size:13px}.record-dot{display:inline-block;background:#364720;border:2px solid #364720;border-radius:50%;width:9px;height:9px;margin-right:6px}.timeline{margin-top:19px}.timeline-heading{padding:17px 20px 13px;display:flex;align-items:center;justify-content:space-between}.timeline-heading>div{display:flex;align-items:center;gap:14px}.timeline-heading span{font-size:12px;color:var(--muted)}.text-button{background:transparent;border:0;color:var(--accent);font-size:12px;padding:6px}.timeline-steps{display:flex;gap:9px;overflow:auto;padding:0 20px 16px;min-height:88px}.step-tile{flex:0 0 168px;min-width:0;background:#23252c;border:1px solid #373a43;padding:10px 12px;border-radius:7px;text-align:left;white-space:normal;position:relative}.step-tile.active{border-color:#a8c979;background:#30392c}.step-tile span{display:block;font-size:11px;color:#a7abae;margin-bottom:7px}.step-tile strong{display:block;font-size:12px;font-weight:500;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.step-tile em{position:absolute;right:10px;top:10px;font-style:normal;color:#8e9594;font-size:11px}.timeline-empty{font-size:14px;color:var(--muted);padding:19px 0}.player{border-top:1px solid var(--line);background:#18191f;display:flex;align-items:center;gap:22px;padding:12px 20px}.transport{display:flex;align-items:center;gap:8px}.transport button{border:0;background:none;padding:3px 7px;color:#adadb9;font-size:19px}.transport .play-button{border-radius:50%;background:var(--accent);color:#202916;width:36px;height:36px;font-size:14px}.transport #play-time{font-size:12px;color:#a2a4b0;margin-left:7px;white-space:nowrap;font-variant-numeric:tabular-nums}#scrubber{flex:1;min-width:40px;height:4px;accent-color:var(--accent)}#speed{background:#25262e;border:1px solid #373944;border-radius:5px;padding:6px;color:#c9cbd2;font-size:12px}#mode-label{font-size:10px;letter-spacing:1.5px;color:#8d919b}.play-caption{font-size:14px;color:var(--accent);text-align:center;background:#20251e}.play-caption:not(:empty){padding:10px 20px}footer{display:flex;justify-content:space-between;color:#777a86;font-size:11px;margin-top:21px;gap:16px}#toast{position:fixed;bottom:25px;left:50%;transform:translateX(-50%);padding:12px 20px;border:1px solid #546a3f;border-radius:8px;background:#27331f;color:#e8f7d5;font-size:14px;z-index:50;box-shadow:0 10px 40px #0008;display:none}dialog{background:#202128;color:#eee;border:1px solid #454852;border-radius:16px;max-width:510px;width:calc(100% - 32px);padding:30px;box-shadow:0 20px 100px #0008}dialog::backdrop{background:#000a;backdrop-filter:blur(5px)}dialog h2{font-size:25px;margin-top:18px}dialog p{font-size:14px;line-height:1.6;color:#a8abb6}.dialog-close{float:right;padding:0;border:0;background:none;font-size:25px;color:#aaa}.dialog-actions{display:flex;gap:10px;margin-top:15px}#share-url{width:100%;border:1px solid #444650;border-radius:6px;background:#14151a;color:#dce2d6;padding:12px;font-size:13px}.dialog-hint{font-size:12px!important;margin-bottom:0}[hidden]{display:none!important}
@media(min-width:1500px){.library{height:610px}.battlefield{height:482px}.studio{grid-template-columns:310px minmax(0,1fr)}.board-card{width:106px}}
@media(max-width:1000px){main{padding:25px 20px}.app-header{padding:0 20px}.studio{grid-template-columns:230px minmax(0,1fr)}.step-editor{gap:8px;padding:12px}.step-editor .primary{font-size:12px;padding:10px}.step-symbol{display:none}.stage-toolbar{padding:0 12px}.stage-toolbar .small{font-size:11px;padding:6px}.board-bottom span:last-child{display:none}.board-card{width:76px}.timeline-heading span{display:none}.brand-sub{display:none}.brand-divider{display:none}.save-status{display:none}}
@media(max-width:700px){.app-header{height:66px;padding:0 15px}.brand{font-size:27px}.header-actions{gap:7px}.header-actions button{font-size:12px;padding:9px 11px}main{padding:23px 13px}.eyebrow{font-size:10px}.project-heading{display:block;margin-bottom:18px}#sequence-title{width:100%;font-size:25px;letter-spacing:-.7px}.project-heading p{font-size:13px}.project-actions{margin-top:17px}.project-actions button{padding:7px 11px;font-size:12px}.studio{display:flex;flex-direction:column;gap:12px}.library{height:auto;padding:13px}.panel-title h2{font-size:15px}.search-wrap{margin:12px 0}.library-caption{margin-bottom:10px}.card-grid{display:flex;gap:12px;max-height:175px;min-height:130px}.library-card{flex:0 0 85px}.library-card .card-name{max-width:85px;font-size:11px}.scryfall-credit{font-size:10px}.battlefield{height:365px}.board-card{width:65px}.stage-title h2{font-size:14px}.badge{font-size:10px}.stage-toolbar{height:50px}.stage-toolbar>div:last-child{gap:3px}.stage-toolbar .small{padding:5px;font-size:10px}.step-editor{flex-wrap:wrap;min-height:90px}.step-editor>input{flex-basis:65%;font-size:13px}.step-editor .primary{margin-left:auto}.timeline-heading{padding:15px 13px;gap:10px}.timeline-heading h2{font-size:14px}.timeline-heading>div{gap:5px}.timeline-actions button{font-size:11px;padding:5px}.timeline-steps{padding:0 13px 13px}.player{padding:11px 12px;gap:10px;flex-wrap:wrap}.transport{gap:4px}.transport #play-time{font-size:11px}.player #mode-label{display:none}#scrubber{order:4;flex-basis:100%}#speed{margin-left:auto}.empty-board p{max-width:240px;text-align:center;line-height:1.6}footer{font-size:10px;line-height:1.5}footer span:first-child{max-width:60%}}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;transition:none!important}}
@media(max-width:700px){.stage-toolbar{height:auto;min-height:66px;padding:10px 12px;flex-wrap:wrap}.stage-toolbar>div:last-child{margin-left:auto}.stage-toolbar .small{font-size:12px;padding:6px 8px}}
.background-settings{padding:14px 18px;margin-bottom:18px;overflow:visible}.background-options{display:flex;align-items:center;gap:12px;flex-wrap:wrap}.background-options>label{font-size:14px;font-weight:600}.background-options select,.background-options input[type=text]{background:#14151a;border:1px solid #454852;border-radius:6px;color:#eee;padding:9px;font-size:14px}.background-options select{min-width:160px}#custom-background{display:flex;align-items:center;gap:8px}#background-color{width:40px;height:36px;padding:2px;border:1px solid #454852;border-radius:5px;background:transparent;cursor:pointer}#background-hex{width:96px;font-family:monospace}#capture-button{margin-left:auto}.background-settings p{font-size:13px;color:var(--muted);margin:9px 0 0;line-height:1.5}.battlefield[data-background=solid]{background:var(--battlefield-color,#00ff00)}.battlefield[data-background=transparent]{background:repeating-conic-gradient(#303138 0% 25%,#41434b 0% 50%) 0 0/24px 24px}.battlefield:not([data-background=tabletop]) .board-watermark,.battlefield:not([data-background=tabletop]) .zone-label,.battlefield:not([data-background=tabletop]) .board-bottom,.battlefield:not([data-background=tabletop]) .empty-board{display:none}.battlefield:not([data-background=tabletop]) .card-face{box-shadow:none}.battlefield:not([data-background=tabletop]) .selected .card-face{outline:2px solid #c5f277;outline-offset:2px}.capture-link{display:inline-block;border-radius:7px;padding:10px 14px;background:var(--accent);color:#202916;text-decoration:none;font-size:14px;font-weight:700}#capture-url{width:100%;padding:12px;border:1px solid #454852;border-radius:6px;background:#14151a;color:#eee;font-size:13px}
html.capture-view,html.capture-view body{background:transparent!important;margin:0!important;padding:0!important;width:100%;height:100%;overflow:hidden}.capture-view .app-header,.capture-view .project-heading,.capture-view .background-settings,.capture-view .library,.capture-view .stage-toolbar,.capture-view .step-editor,.capture-view .timeline,.capture-view footer,.capture-view dialog,.capture-view #toast{display:none!important}.capture-view main,.capture-view .studio,.capture-view .stage-panel{display:block;position:static;margin:0;padding:0;width:100%;height:100%;max-width:none;background:transparent;border:0;border-radius:0;box-shadow:none}.capture-view .battlefield{width:100%;height:100%;border:0;border-radius:0;box-shadow:none;pointer-events:none}.capture-view .battlefield[data-background=transparent]{background:transparent!important}.capture-view .board-watermark,.capture-view .zone-label,.capture-view .board-bottom,.capture-view .empty-board{display:none!important}.capture-view .board-card{width:10.5%;outline:none!important}.capture-view .board-card .card-face{outline:none!important;box-shadow:none!important}.capture-view .board-card:focus{outline:none!important}
@media(max-width:700px){.background-settings{padding:12px}.background-options{gap:8px}.background-options select{min-width:0;flex:1}#capture-button{margin-left:0}.dialog-actions{flex-wrap:wrap}}
.play-area{display:flex;position:relative;min-width:0;background:#171d1c}.play-area>.battlefield{flex:1;min-width:0}.graveyard{flex:0 0 42px;width:42px;max-height:410px;position:relative;border-right:1px solid #3d4240;background:#181b1d;z-index:3;overflow:hidden}.graveyard.expanded{flex-basis:142px;width:142px}.graveyard .zone-toggle{display:flex;align-items:center;gap:8px;width:100%;padding:13px 8px;border:0;border-radius:0;background:transparent;font-size:13px}.graveyard:not(.expanded) .zone-toggle{flex-direction:column;height:100%;justify-content:flex-start}.graveyard:not(.expanded) .graveyard-label{writing-mode:vertical-rl;letter-spacing:1px;margin:6px 0}.graveyard.expanded .graveyard-chevron{transform:rotate(180deg)}.graveyard-chevron{font-size:21px;line-height:1;color:#c5f277}.graveyard-label{font-weight:600}.zone-count{background:#33383b;color:#e5e7e9;min-width:20px;padding:2px 5px;border-radius:4px;font-size:12px}.zone-content{height:calc(100% - 49px);max-height:361px;overflow-y:auto;padding:0 14px 14px}.zone-empty{color:#949b9a;font-size:12px;text-align:center;margin-top:20px}.zone-cards{display:flex;flex-direction:column;gap:13px;align-items:center}.graveyard-card{width:86px;flex:none}.graveyard-card-name{display:block;color:#c9cbd2;font-size:11px;margin-top:5px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.sacrifice-button{display:inline-flex;align-items:center;gap:5px;color:#ffdc55}.sacrifice-button img{width:21px;height:21px}.stage-toolbar{flex-wrap:wrap;height:auto;min-height:57px;padding-top:7px;padding-bottom:7px;gap:7px}.stage-toolbar>div:last-child{flex-wrap:wrap}.battlefield.has-sacrifice{overflow:visible;z-index:4}.board-card.sacrifice-animating{z-index:20;pointer-events:none;transition:none}.sacrifice-emoji{position:absolute;left:50%;top:50%;width:82px;height:82px;transform:translate(-50%,-50%) rotate(-12deg);z-index:5;filter:drop-shadow(0 4px 2px #0008);pointer-events:none}.sr-only{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}
.play-area[data-background=solid],.play-area[data-background=solid] .graveyard{background:var(--battlefield-color)}.play-area[data-background=transparent]{background:repeating-conic-gradient(#303138 0% 25%,#41434b 0% 50%) 0 0/24px 24px}.play-area[data-background=transparent] .graveyard{background:transparent}.play-area:not([data-background=tabletop]) .graveyard-card .card-face{box-shadow:none}.play-area:not([data-background=tabletop]) .zone-toggle{background:#1b1c22;color:#ededef}.play-area:not([data-background=tabletop]) .sacrifice-emoji{filter:none}
.capture-view .play-area{display:flex;width:100%;height:100%;background:transparent;border:0}.capture-view .play-area[data-background=solid]{background:var(--battlefield-color)}.capture-view .graveyard{max-height:none;height:100%;border:0;background:transparent;flex-basis:0;width:0}.capture-view .graveyard.expanded{flex-basis:18%;width:18%}.capture-view .zone-toggle,.capture-view .zone-empty,.capture-view .graveyard-card-name{display:none!important}.capture-view .zone-content{height:100%;max-height:none;padding:24px 14px;scrollbar-width:none}.capture-view .graveyard-card{width:65%;max-width:160px}.capture-view .graveyard-card .card-face{box-shadow:none!important}.capture-view .play-area>.battlefield{width:auto}.capture-view .sacrifice-emoji{width:90%;height:auto;filter:none}
@media(min-width:1500px){.graveyard{max-height:482px}.zone-content{max-height:433px}}
@media(max-width:700px){.graveyard{max-height:365px;flex-basis:33px;width:33px}.graveyard.expanded{flex-basis:105px;width:105px}.graveyard .zone-toggle{padding:10px 5px;gap:4px;font-size:11px}.zone-content{max-height:320px;padding:0 10px 10px}.graveyard-card{width:67px}.stage-toolbar>div:last-child{margin-left:0}.stage-toolbar .small{font-size:11px;padding:6px}.sacrifice-button img{width:18px;height:18px}.sacrifice-emoji{width:64px;height:64px}}
.graveyard-card[draggable=true]{cursor:grab;touch-action:none;user-select:none;border-radius:8px}.graveyard-card[draggable=true]:active{cursor:grabbing}.graveyard-card:focus-visible{outline:2px solid var(--accent);outline-offset:4px}.graveyard-help{font-size:11px;line-height:1.4;color:#a4aaa7;margin:0 0 12px;text-align:center}.sacrifice-emoji[data-effect=reanimate]{height:98px;object-fit:contain;filter:none}.capture-view .graveyard-help{display:none}.capture-view .sacrifice-emoji[data-effect=reanimate]{height:auto;width:90%}.graveyard-drag-ghost{position:fixed;width:86px;pointer-events:none;z-index:100;transform:translate(-50%,-50%)}

.exile-button{display:inline-flex;align-items:center;gap:5px;color:#d4a5ff}.exile-button img{width:21px;height:21px}.exile .graveyard-chevron{color:#c88dff}.sacrifice-emoji[data-effect=exile]{top:-5px;width:75px;height:60px;object-fit:contain;filter:none}.card-menu{position:fixed;z-index:200;width:245px;max-width:calc(100vw - 16px);max-height:calc(100vh - 16px);overflow:auto;padding:6px;border:1px solid #53505e;border-radius:10px;background:#24232b;box-shadow:0 12px 40px #0009}.card-menu-title{padding:8px 10px;color:#b5b2bf;font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.card-menu button{display:flex;flex-wrap:wrap;align-items:center;gap:7px;width:100%;text-align:left;border:0;background:transparent;padding:9px 10px;font-size:13px;white-space:normal}.card-menu button:hover,.card-menu button:focus-visible{background:#403746;outline:1px solid #bd8bed;outline-offset:-1px}.card-menu button img{width:21px;height:21px;object-fit:contain}.card-menu button small{display:block;flex-basis:100%;font-size:11px;color:#b4a9c2}.card-menu button:disabled{opacity:.55}.capture-view .card-menu{display:none!important}.capture-view .graveyard{pointer-events:none}.capture-view .sacrifice-emoji[data-effect=exile]{width:85%;height:auto}.capture-view .graveyard.expanded{flex-basis:15%;width:15%}@media(max-width:700px){.graveyard.expanded{flex-basis:88px;width:88px}.graveyard-card{width:60px}.zone-content{padding:0 7px 10px}.graveyard.expanded .zone-toggle{flex-wrap:wrap;gap:3px}.graveyard-help{font-size:10px}.sacrifice-emoji[data-effect=exile]{width:60px;height:48px}}

.tap-button{display:inline-flex;align-items:center;gap:5px}.tap-button img{width:20px;height:20px}.snap-grid{position:absolute;inset:0;pointer-events:none;z-index:1}.snap-point{position:absolute;width:14px;height:14px;border:1px solid #d6f7a8;border-radius:50%;background:#17231ccc;transform:translate(-50%,-50%);box-shadow:0 0 0 3px #0c100d55}.snap-point::before,.snap-point::after{content:"";position:absolute;background:#c5f27788;left:50%;top:50%;transform:translate(-50%,-50%)}.snap-point::before{width:24px;height:1px}.snap-point::after{width:1px;height:24px}.snap-point.snap-target{width:40px;height:40px;background:#c5f27755;border:2px solid #e1ffb8;box-shadow:0 0 0 5px #131f16cc}.capture-view .snap-grid{display:none!important}

.piece-tray{flex:0 0 38px;width:38px;max-height:410px;background:#1c1c25;border-left:1px solid #45414d;overflow:hidden}.piece-tray.expanded{flex-basis:190px;width:190px}#piece-tray-toggle{display:flex;align-items:center;gap:8px;width:100%;padding:13px 9px;border:0;border-radius:0;background:transparent;font-size:12px}.piece-tray:not(.expanded) #piece-tray-toggle{flex-direction:column;height:100%;justify-content:flex-start}.piece-tray:not(.expanded) .piece-tray-label{writing-mode:vertical-rl;letter-spacing:1px}.piece-tray-chevron{color:#c5f277}.piece-tray.expanded .piece-tray-chevron{transform:rotate(180deg)}#piece-tray-content{height:calc(100% - 45px);overflow-y:auto;padding:0 10px 12px}.piece-help{font-size:11px;line-height:1.5;color:#aca8b5;margin:2px 0 12px}.piece-preset-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}#piece-presets h3{font-size:12px;font-weight:600;margin:16px 0 9px;color:#dbd5e7}.piece-preset{padding:0;border:0;background:none;white-space:normal;cursor:grab;touch-action:none}.piece-face{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;width:54px;height:54px;padding:4px;border:2px solid #bfb0d2;border-radius:50%;background:#4a355e;color:#fff;box-shadow:0 3px 5px #0007;line-height:1.05}.piece-symbol{font-size:10px;font-weight:700;overflow-wrap:anywhere;max-width:100%;text-align:center}.piece-face strong{font-size:20px;line-height:1}.piece-face.dice{border-radius:9px;background:#eee8dc;border-color:#a5a0aa;color:#24202b}.piece-face.mana[data-color=W]{background:#f4e6bb;border-color:#fff9df;color:#443411}.piece-face.mana[data-color=U]{background:#3287cb;border-color:#a2ddff;color:#fff}.piece-face.mana[data-color=B]{background:#2b2631;border-color:#a99fb6;color:#fff}.piece-face.mana[data-color=R]{background:#c54b3f;border-color:#ffb2a2;color:#fff}.piece-face.mana[data-color=G]{background:#287443;border-color:#98e8ac;color:#fff}.piece-face.mana[data-color=C]{background:#787e86;border-color:#e1e6ee;color:#fff}.piece-face.mana .piece-symbol{font-size:13px}.piece-preset .piece-face{width:100%;height:auto;aspect-ratio:1;box-shadow:none}.piece-layer{position:absolute;inset:0;z-index:300;pointer-events:none}.battlefield-piece{position:absolute;transform:translate(-50%,-50%);padding:0;background:none!important;border:0;pointer-events:auto;touch-action:none;user-select:none}.battlefield-piece.selected .piece-face{outline:2px solid #c5f277;outline-offset:3px}.battlefield-piece:focus-visible{outline:2px solid #c5f277}.piece-menu{z-index:600}#piece-inspector{border:1px solid #5b4b6d;border-radius:8px;padding:8px;margin:8px 0;background:#292330}#piece-inspector strong{font-size:12px;display:block;margin-bottom:8px}#piece-inspector label{display:flex;align-items:center;justify-content:space-between;gap:5px;font-size:11px;margin:7px 0}#piece-inspector input{min-width:0;width:90px;padding:5px;background:#15131b;color:#fff;border:1px solid #665773;border-radius:4px}.piece-editor-actions{display:flex;flex-wrap:wrap;gap:4px}.piece-editor-actions button{font-size:11px;padding:5px 7px}.piece-drag-ghost{position:fixed;z-index:700;pointer-events:none;transform:translate(-50%,-50%)}.capture-view .piece-tray,.capture-view .piece-menu{display:none!important}.capture-view .battlefield-piece{pointer-events:none}.capture-view .battlefield-piece .piece-face{outline:none;box-shadow:none}.play-area:not([data-background=tabletop]) .battlefield-piece .piece-face{box-shadow:none}@media(min-width:1500px){.piece-tray{max-height:482px}}@media(max-width:700px){.piece-tray{max-height:365px;flex-basis:30px;width:30px}.piece-tray.expanded{flex-basis:155px;width:155px}#piece-tray-toggle{font-size:11px;padding:10px 5px;gap:5px}.piece-preset-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.battlefield-piece .piece-face{width:44px;height:44px}.battlefield-piece .piece-symbol{font-size:9px}.battlefield-piece strong{font-size:17px}}
.piece-preset-grid.counter-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.piece-preset .counter{border-radius:9px;aspect-ratio:auto;min-height:50px}.piece-preset .counter .piece-symbol{overflow-wrap:normal;font-size:10px}@media(max-width:700px){.piece-tray.expanded{position:absolute;right:0;top:0;height:100%;z-index:400;box-shadow:-5px 0 18px #0008}}
.board-watermark,.board-watermark *{-webkit-user-select:none;user-select:none}
.board-watermark{font-size:clamp(28px,5vw,72px);letter-spacing:8px}.board-watermark span{max-width:90%;text-align:center;letter-spacing:2px;line-height:1.8}

.sequence-title-row{display:flex;align-items:center;gap:8px;max-width:100%}.sequence-title-row #sequence-title{min-width:0}.sequence-title-row.untitled #sequence-title{width:280px;max-width:calc(100% - 44px)}.edit-title-button{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:36px;height:36px;padding:6px;border:1px dashed #778958;color:var(--accent);background:transparent}.edit-title-button:hover{background:#c5f27718;border-color:var(--accent)}

.graveyard.zone-drop-target{box-shadow:inset 0 0 0 3px #c5f277;background:#30412b}.graveyard.exile.zone-drop-target{box-shadow:inset 0 0 0 3px #d6a2ff;background:#3a274d}.battlefield.zone-dragging{overflow:visible;z-index:4}.board-card.dragging{pointer-events:none}

.sacrifice-emoji>img{position:absolute;inset:0;width:100%;height:100%;object-fit:contain}.sacrifice-emoji[data-effect=reanimate]{overflow:hidden}.sacrifice-emoji[data-effect=sacrifice]>img:last-child{transform-origin:57% 69%}.capture-view .sacrifice-emoji{aspect-ratio:1;height:auto}.capture-view .sacrifice-emoji[data-effect=reanimate]{aspect-ratio:5/6}.capture-view .sacrifice-emoji[data-effect=exile]{aspect-ratio:5/4}.card-menu [aria-checked=true]::after{content:"✓";margin-left:auto;color:var(--accent)}

#media-dialog{max-width:720px}#media-preview{display:block;width:100%;height:auto;margin-top:18px;border:1px solid var(--line);border-radius:8px}#media-progress{width:100%;margin-top:14px;accent-color:var(--accent)}.media-check{display:flex;gap:9px;align-items:center;font-size:14px}#media-result{display:inline-block;margin-top:8px}.header-actions{flex-wrap:wrap}.app-header{min-height:76px;height:auto;padding-top:12px;padding-bottom:12px}

@media(min-width:1001px){.app-header{position:sticky;top:0;z-index:150;background:#111216;box-shadow:0 5px 18px #0003}}

.coffee-link{display:inline-flex;align-items:center;gap:7px;padding:5px 10px;border:1px solid #806c2b;border-radius:7px;color:#ffda28;text-decoration:none;font-size:14px;font-weight:600;white-space:nowrap}.coffee-link img{flex:none;transform:rotate(-8deg)}.coffee-link:hover{background:#342e1b;border-color:#ffda28}.coffee-link:focus-visible{outline:2px solid #ffda28;outline-offset:3px}.app-header{gap:18px}.header-actions{justify-content:flex-end}@media(max-width:1250px){.coffee-link span{display:none}.coffee-link{padding:4px 7px}}@media(max-width:700px){.app-header{flex-wrap:wrap}.header-actions{justify-content:flex-start;width:100%}}

/* Keep background selection beside the battlefield title. */
.stage-title{justify-content:flex-start;flex-wrap:wrap;min-width:0}.stage-title h2,.stage-title .badge{white-space:nowrap}.stage-title .background-options{gap:7px;margin-left:8px}.stage-title .background-options>label{font-size:12px;color:var(--muted);font-weight:500}.stage-title .background-options select{min-width:0;max-width:175px;padding:6px 8px;font-size:12px}.stage-title #background-color{width:30px;height:29px}.stage-title #background-hex{width:80px;padding:6px;font-size:12px}@media(max-width:700px){.stage-title{width:100%;gap:8px}.stage-title .background-options{margin-left:0;flex-wrap:wrap}.stage-title .background-options select{flex:none}}

#embed-code{display:block;width:100%;margin-top:12px;padding:10px;background:#14151a;color:#c9cbd2;border:1px solid #444650;border-radius:6px;resize:vertical;font-size:12px}
#embed-overlay{position:fixed;inset:0;z-index:100;pointer-events:none}.embed-controls{position:absolute;top:14px;left:14px;right:14px;display:flex;gap:8px;align-items:center;opacity:0;transition:opacity .2s;pointer-events:auto}.embed-view body:hover .embed-controls,.embed-controls:focus-within{opacity:1}.embed-controls a{margin-left:auto;background:#17181ded;color:#c5f277;padding:10px 14px;border:1px solid #52613b;border-radius:7px;text-decoration:none;font-size:13px}.embed-controls button{background:#17181ded}.embed-view .play-area{pointer-events:none}#embed-caption{position:absolute;bottom:14px;left:50%;transform:translateX(-50%);max-width:85%;margin:0;padding:9px 14px;background:#111216db;border-radius:7px;color:#c5f277;text-align:center;font-size:14px}#embed-caption:empty{display:none}#embed-message{position:absolute;inset:35% 10%;text-align:center;color:#eee;background:#17181d;padding:20px;border-radius:12px}.embed-view .board-card{max-width:140px}@media(hover:none){.embed-controls{opacity:1}}@media(max-width:480px){.embed-controls{top:7px;left:7px;right:7px;gap:5px}.embed-controls button,.embed-controls a{padding:7px 9px;font-size:11px}#embed-caption{font-size:12px;bottom:8px}}

.brand-copy{display:flex;flex-direction:column;gap:5px;max-width:305px;min-width:0}.brand-copy .brand-sub{display:block}.brand-tagline{font-family:DM Sans,sans-serif;font-size:11px;font-weight:400;letter-spacing:0;line-height:1.45;color:var(--muted)}.app-header .brand{min-width:0}.brand-divider{flex-shrink:0}.app-header{height:auto;min-height:70px;padding-top:10px;padding-bottom:10px}.header-actions{flex-wrap:wrap}@media(max-width:1000px){.brand-copy{max-width:230px}.brand-copy .brand-sub{font-size:10px;letter-spacing:1.5px}.brand-tagline{font-size:10px}}@media(max-width:700px){.brand-copy{max-width:240px}.app-header .brand{width:100%;font-size:25px;gap:9px}.brand-copy .brand-sub{font-size:10px}.brand-tagline{font-size:10px}}

/* Shared players keep a wide stage in portrait and reserve space for touch controls. */
.embed-bottom{position:absolute;bottom:max(12px,env(safe-area-inset-bottom));left:max(14px,env(safe-area-inset-left));right:max(14px,env(safe-area-inset-right));display:grid;grid-template-columns:1fr auto;gap:6px 12px;align-items:center;pointer-events:auto}.embed-bottom #embed-caption{position:static;transform:none;grid-column:1/-1;justify-self:center;max-width:100%;max-height:4.5em;overflow:auto;font-size:13px}.embed-bottom input{width:100%;min-width:0;height:28px;margin:0;accent-color:#c5f277}.embed-bottom #embed-time{font-size:12px;padding:5px 8px;border-radius:5px;background:#17181ded;color:#eee;font-variant-numeric:tabular-nums}.embed-controls{top:max(10px,env(safe-area-inset-top));left:max(12px,env(safe-area-inset-left));right:max(12px,env(safe-area-inset-right))}.embed-controls button,.embed-controls a{min-height:44px;display:inline-flex;align-items:center;justify-content:center;touch-action:manipulation}.embed-view .battlefield{container-type:inline-size}.embed-view .battlefield-piece .piece-face{width:clamp(22px,5cqw,54px);height:clamp(22px,5cqw,54px);padding:2px;border-width:1px}.embed-view .battlefield-piece .piece-symbol{font-size:clamp(5px,1cqw,10px)}.embed-view .battlefield-piece strong{font-size:clamp(9px,2cqw,20px)}
@media(max-width:900px),(pointer:coarse){html.embed-view,html.embed-view body{height:100dvh;background:#111216!important}.embed-view main{height:100%!important;padding:64px 0 112px!important;display:flex!important;align-items:center;justify-content:center}.embed-view .studio{width:100%;height:auto!important;max-height:100%;aspect-ratio:16/10}.embed-view .stage-panel{height:100%!important}.embed-view .play-area{height:100%;min-height:0}.embed-view .board-card{width:13%;max-width:none}.embed-view .card-face{border-width:2px;border-radius:5px;padding:3px}.embed-view .graveyard.expanded{flex-basis:14%;width:14%}.embed-view .zone-content{padding:8px 3px}.embed-view .graveyard-card{width:90%}.embed-view .zone-cards{gap:7px}.embed-controls{opacity:1}.embed-controls button,.embed-controls a{font-size:12px;padding:8px 10px}.embed-bottom input{height:36px}.embed-bottom #embed-caption{font-size:13px;line-height:1.4}}
@media(max-height:500px) and (orientation:landscape){.embed-view main{padding-top:54px!important;padding-bottom:70px!important}.embed-view .studio{height:100%!important;width:auto!important;max-width:100%;aspect-ratio:16/9}.embed-bottom{bottom:4px;gap:0 8px}.embed-bottom input{height:24px}.embed-bottom #embed-caption{padding:3px 8px;font-size:11px;max-height:2.8em}.embed-controls{top:4px}.embed-controls button,.embed-controls a{min-height:40px}}

.studio-sidebar{min-width:0}.capture-view .studio-sidebar{display:none!important}
@media(min-width:1001px){html:not(.capture-view) .studio{--desktop-board-height:clamp(480px,calc(100dvh - 280px),720px);align-items:stretch}html:not(.capture-view) .studio-sidebar{display:flex;flex-direction:column;gap:18px}html:not(.capture-view) .project-heading{margin:0;min-width:0;display:block}html:not(.capture-view) .project-heading .eyebrow{font-size:10px;line-height:1.5;letter-spacing:1px;margin-bottom:9px}html:not(.capture-view) .project-heading>div{min-width:0}html:not(.capture-view) #sequence-title{width:100%;font-size:25px;letter-spacing:-.7px}html:not(.capture-view) .sequence-title-row.untitled #sequence-title{width:100%;max-width:calc(100% - 44px)}html:not(.capture-view) .project-actions{display:none}html:not(.capture-view) .library{flex:1;height:0;min-height:380px}html:not(.capture-view) .battlefield{height:var(--desktop-board-height)}html:not(.capture-view) .graveyard,html:not(.capture-view) .piece-tray{height:var(--desktop-board-height);max-height:none}html:not(.capture-view) .zone-content{max-height:none}html:not(.capture-view) .stage-toolbar{min-height:57px}html:not(.capture-view) .stage-title #new-button{font-size:12px;padding:7px 10px;margin-left:4px}html:not(.capture-view) .step-editor{flex:1}}
@media(max-width:1000px){html:not(.capture-view) .studio-sidebar{display:contents}html:not(.capture-view) .project-heading{grid-column:1/-1;margin-bottom:0}}

/* Allocate desktop height to the board AND timeline; scroll cards inside the database. */
@media(min-width:1001px){
html:not(.capture-view) main{height:calc(100dvh - var(--app-header-height,78px));min-height:560px;padding-top:16px;padding-bottom:12px;display:grid;grid-template-rows:minmax(280px,1fr) auto auto;gap:12px}
html:not(.capture-view) .studio{height:100%;min-height:0}
html:not(.capture-view) .studio-sidebar{height:100%;min-height:0;gap:12px}
html:not(.capture-view) .project-heading{flex:none}
html:not(.capture-view) .library{height:auto;min-height:0;flex:1;overflow:hidden}
html:not(.capture-view) .card-grid{min-height:0;grid-template-columns:repeat(2,minmax(0,1fr));overflow-y:scroll;overflow-x:hidden;scrollbar-gutter:stable;scrollbar-color:#777a86 #24252c;scrollbar-width:auto}
html:not(.capture-view) .library-card{min-width:0}
html:not(.capture-view) .stage-panel{height:100%;min-height:0}
html:not(.capture-view) .stage-toolbar{flex:none}
html:not(.capture-view) .play-area{flex:1;min-height:0}
html:not(.capture-view) .battlefield,html:not(.capture-view) .graveyard,html:not(.capture-view) .piece-tray{height:100%;max-height:none;min-height:0}
html:not(.capture-view) .step-editor{flex:none;min-height:54px;padding-top:8px;padding-bottom:8px}
html:not(.capture-view) .timeline{margin:0;min-width:0}
html:not(.capture-view) .timeline-heading{padding:10px 16px 8px}
html:not(.capture-view) .timeline-steps{min-height:72px;padding:0 16px 10px}
html:not(.capture-view) .player{padding:8px 16px}
html:not(.capture-view) .play-caption:not(:empty){padding:5px 16px;max-height:46px;overflow:auto}
html:not(.capture-view) footer{margin:0}
}
@media(min-width:701px){.app-header .header-actions{flex:0 0 auto;flex-wrap:nowrap}.app-header .brand{flex:1 1 0;white-space:nowrap}.app-header .brand-copy{flex:0 1 305px;white-space:normal}.app-header .save-status{white-space:nowrap}}@media(min-width:701px) and (max-width:900px){.app-header{gap:12px}.app-header .brand{font-size:25px;gap:8px}.app-header .brand-copy{max-width:190px}.header-actions{gap:7px}.header-actions button{font-size:12px;padding:9px 11px}}

#database-content{display:flex;flex-direction:column;flex:1;min-height:0}#database-toggle{flex:none;width:28px;height:28px;padding:0;font-size:23px;line-height:1;background:transparent;color:var(--accent)}.library .panel-title{flex:none}.database-collapsed .library{padding:8px}.database-collapsed .library .panel-title{justify-content:center}
@media(min-width:1001px){html:not(.capture-view) .studio.database-collapsed{grid-template-columns:44px minmax(0,1fr)}.database-collapsed .library .panel-title{flex-direction:column-reverse;gap:14px}.database-collapsed .library h2{writing-mode:vertical-rl;font-size:13px;letter-spacing:.5px}.database-collapsed .stage-title>.project-heading{width:180px;padding:0 12px 0 0;border-right:1px solid var(--line)}.database-collapsed .stage-title>.project-heading .eyebrow{display:none}.database-collapsed .stage-title>.project-heading #sequence-title{font-size:20px}.database-collapsed .stage-title>.project-heading .sequence-title-row{max-width:420px}}
@media(max-width:1000px){.database-collapsed .library{height:auto;min-height:0;align-self:start}.database-collapsed .library .panel-title{justify-content:space-between}}@media(max-width:700px){.database-collapsed .library{width:100%}}
@media(max-width:1000px){html:not(.capture-view) .studio.database-collapsed{display:grid;grid-template-columns:40px minmax(0,1fr);gap:12px}html:not(.capture-view) .studio.database-collapsed .studio-sidebar{display:contents}.database-collapsed #database-content{display:none!important}html:not(.capture-view) .studio.database-collapsed .library{grid-column:1;width:40px;height:100%;min-height:0;align-self:stretch;padding:6px 4px}html:not(.capture-view) .studio.database-collapsed .stage-panel{grid-column:2;min-width:0}.database-collapsed .library .panel-title{flex-direction:column-reverse;justify-content:flex-start;gap:14px}.database-collapsed .library h2{writing-mode:vertical-rl;font-size:12px;letter-spacing:.5px}.database-collapsed .project-heading{grid-column:1/-1}}

#battlefield-layout{font-family:'Space Grotesk',sans-serif;font-size:14px;font-weight:500;color:#ededef;background:#24252c;border:1px solid #454852;border-radius:6px;padding:6px 24px 6px 8px;max-width:245px;cursor:pointer}.combat-area{position:absolute;inset:0 0 auto;height:33.333%;background:linear-gradient(180deg,#c43e4c44,#c43e4c28);border-bottom:1px dashed #ed6f7d99;pointer-events:none;z-index:0}.combat-area span{position:absolute;top:12px;left:20px;color:#f3a7ad;font-size:10px;letter-spacing:2px;font-weight:600}.with-combat .zone-label{top:calc(33.333% + 12px)}@media(max-width:700px){#battlefield-layout{font-size:12px;max-width:220px}.combat-area span{top:8px;left:10px;font-size:9px}}

/* Separate combat row; normal card coordinates remain relative to the main area. */
.with-combat{container-type:size}.with-combat .combat-area{height:35%;background:#612f36;border-bottom:2px solid #ac5560;box-shadow:inset 0 -5px 12px #0003}.with-combat .zone-label{top:calc(35% + 10px)}.with-combat .board-card{width:min(91px,22cqh)!important;max-width:none}.with-combat .board-watermark,.with-combat .empty-board{top:35%}.with-combat .card-face{border-width:2px}.with-combat .combat-area span{top:5px;font-size:9px}.with-combat .battlefield-piece .piece-face{width:min(44px,16cqh);height:min(44px,16cqh)}

#media-preview{background:repeating-conic-gradient(#24242a 0% 25%,#383840 0% 50%) 0 / 20px 20px}

#media-dialog .dialog-actions{flex-wrap:wrap}

/* The hand opens over the lower board without moving existing cards. */
.hand-zone{position:absolute;bottom:0;left:50%;transform:translateX(-50%);width:104px;height:52px;z-index:210;isolation:isolate}
:is(#hand-toggle,#opponent-hand-toggle){position:absolute;bottom:0;left:50%;transform:translateX(-50%);width:104px;height:52px;border-radius:104px 104px 0 0;border:1px solid #899f60;border-bottom:0;background:#242e20;color:#d4f89a;font-size:13px;padding:18px 6px 4px;white-space:nowrap}
:is(#hand-count,#opponent-hand-count){display:inline-block;margin-left:4px;font-variant-numeric:tabular-nums}
.hand-zone.expanded{width:min(92%,var(--hand-width,680px));height:min(210px,65%);background:none;border:0;pointer-events:none}
:is(#hand-content,#hand-cards,#opponent-hand-content,#opponent-hand-cards){position:absolute;inset:0}
.hand-zone .hand-card{position:absolute;left:50%;top:auto;bottom:calc(58px - var(--hand-card-width)*1.4);width:var(--hand-card-width);max-width:none;margin:0;transform:translateX(-50%) translate(var(--fan-x),var(--fan-y)) rotate(var(--fan-angle));transform-origin:50% 100%;touch-action:none;cursor:grab;transition:transform .16s ease}
.hand-card .graveyard-card-name{display:none}.hand-card.selected,.hand-card:focus-visible{z-index:100!important;transform:translateX(-50%) translate(var(--fan-x),calc(var(--fan-y) - 28px)) rotate(var(--fan-angle)) scale(1.15);outline:2px solid #c5f277;border-radius:8px}
.hand-zone.zone-drop-target :is(#hand-toggle,#opponent-hand-toggle){background:#3c502d;box-shadow:0 0 0 2px #c5f277}
.capture-view .hand-zone{pointer-events:none}.capture-view .hand-zone:not(.expanded){display:none}
.embed-view .hand-zone.expanded{height:42%;width:min(85%,680px)}.embed-view .hand-card{top:auto;bottom:calc(40px - var(--hand-card-width)*1.4)}.embed-view :is(#hand-toggle,#opponent-hand-toggle){height:28px;width:80px;padding:5px 3px 0;font-size:10px}

.hand-zone :is(#hand-toggle,#opponent-hand-toggle),.hand-zone .hand-card{pointer-events:auto}

.hand-zone.expanded :is(#hand-toggle,#opponent-hand-toggle){height:26px;width:80px;padding:5px 3px 0;font-size:11px;z-index:200}
@media(hover:hover){.hand-card:hover{z-index:100!important;transform:translateX(-50%) translate(var(--fan-x),calc(var(--fan-y) - 28px)) rotate(var(--fan-angle)) scale(1.15)}}
@media(max-width:700px){.hand-zone .hand-card{bottom:calc(68px - var(--hand-card-width)*1.4)}.embed-view .hand-card{bottom:calc(40px - var(--hand-card-width)*1.4)}}
@media(prefers-reduced-motion:reduce){.hand-zone .hand-card{transition:none}}
.hand-zone.expanded{overflow:clip}

.opponent-area{position:absolute;inset:0 0 auto;height:30%;background:#28323d;border-bottom:2px solid #596a7d;pointer-events:none}.opponent-area span{position:absolute;top:5px;left:20px;color:#b5c9e1;font-size:9px;letter-spacing:2px}.with-opponent .combat-area{top:30%;height:25%}.with-opponent .zone-label{top:calc(55% + 10px)}.with-opponent .board-watermark,.with-opponent .empty-board{top:55%}.with-opponent .board-card{width:min(78px,17cqh)!important}.board-card.opponent-card .card-face{transform:rotate(180deg)}.board-card.opponent-card.tapped .card-face{transform:rotate(270deg)}

#welcome-dialog{width:min(520px,calc(100vw - 32px));max-height:calc(100dvh - 32px);padding:32px;border:1px solid #697c43;border-top:4px solid var(--accent);border-radius:12px;background:#1b1c22;color:#ededef;box-shadow:0 24px 90px #0009}#welcome-dialog::backdrop{background:#080a0dd9}#welcome-dialog .welcome-kicker{font-size:11px;letter-spacing:1.8px;color:var(--accent);font-weight:700}#welcome-dialog h2{font-size:32px;letter-spacing:-1px;margin:12px 0 20px}#welcome-dialog p{font-size:16px;line-height:1.6;color:#c6c8d0;margin:0 0 18px}#welcome-dialog button{margin-top:8px}@media(max-width:480px){#welcome-dialog{padding:24px}#welcome-dialog h2{font-size:28px}#welcome-dialog button{width:100%}}

.opponent-hand-zone{top:0;bottom:auto;transform:translateX(-50%) rotate(180deg)}
.board-card .card-face{scale:1;transition:transform .4s,scale .3s,box-shadow .2s}.board-card.highlighted .card-face{scale:var(--card-magnification,1.8);box-shadow:0 0 0 2px #c5f277,0 12px 30px #0009}.capture-view .board-card.highlighted .card-face{scale:var(--card-magnification,1.8)}
@media(prefers-reduced-motion:reduce){.board-card .card-face{transition:none}}

/* Compact titles, familiar mana symbols, and a face-down deck cascade. */
html:not(.capture-view) #sequence-title{font-size:23px}html:not(.capture-view) .database-collapsed .stage-title>.project-heading #sequence-title{font-size:18px}
.piece-face.mana{position:relative;padding:0;border:0;background:transparent!important;box-shadow:none}.piece-face.mana .piece-symbol{width:100%;height:100%;max-width:none}.piece-face.mana .piece-symbol img{display:block;width:100%;height:100%;object-fit:contain}.piece-face.mana strong{position:absolute;right:-3px;bottom:-3px;background:#15171d;color:#fff;border:1px solid #9a9caa;border-radius:12px;min-width:21px;padding:2px 4px;font-size:13px;line-height:1;text-align:center}
.deck-zone{border-right:0;border-left:1px solid #3d4240}.deck-zone.expanded{flex-basis:142px;width:142px}.deck-zone .zone-content{padding:10px;overflow:auto}.deck-zone #deck-cards{position:relative;display:block;min-height:140px}.deck-zone .graveyard-card{position:absolute;left:0;top:0;width:86px;cursor:grab}.deck-zone .graveyard-card-name{display:none}.deck-zone .graveyard-card:focus-visible{outline:2px solid #c5f277;border-radius:8px}.deck-zone.zone-drop-target{background:#30412b;box-shadow:inset 0 0 0 3px #c5f277}
@media(max-width:700px){.deck-zone.expanded{flex-basis:112px;width:112px}.deck-zone .graveyard-card{width:70px}.deck-zone .zone-content{padding:6px}}
.capture-view .deck-zone:not(.expanded){display:none}.capture-view .deck-zone.expanded{display:block}.capture-view .deck-zone .zone-toggle,.capture-view .deck-zone .zone-empty{display:none}.capture-view .deck-zone .zone-content{height:100%;max-height:none}

.capture-view .deck-zone .zone-content{padding:12px 4px}.capture-view .deck-zone .graveyard-card{width:calc(100% - 10px);max-width:100px}
/* One compact column, with horizontal dividers between independent zones. */
.deck-column{display:flex;flex-direction:column;flex:0 0 42px;width:42px;min-height:0;border-left:1px solid #3d4240;background:#181b1d;z-index:3}
.deck-column:has(.expanded){flex-basis:152px;width:152px}
html:not(.capture-view) .deck-column>.graveyard{width:100%;height:auto;max-height:none;min-height:0;flex:0 0 46px;border:0;border-bottom:1px solid #3d4240}
html:not(.capture-view) .deck-column>.graveyard.expanded{flex:1 1 0}
.deck-column>.graveyard .zone-toggle{height:46px;flex-direction:row;justify-content:flex-start;flex-wrap:nowrap;padding:8px;gap:5px;font-size:12px}
.deck-column>.graveyard .graveyard-label{writing-mode:horizontal-tb;letter-spacing:0;margin:0;white-space:nowrap}
.deck-column:not(:has(.expanded))>.graveyard{flex:1 1 0!important}
.deck-column:not(:has(.expanded))>.graveyard .zone-toggle{height:100%;flex-direction:column}
.deck-column:not(:has(.expanded))>.graveyard .graveyard-label{writing-mode:vertical-rl}
.deck-column .zone-content{height:calc(100% - 46px);max-height:none;padding:6px 10px 12px;overflow:auto}
.deck-column .auxiliary-zone .zone-content{container-type:size}
.deck-column .auxiliary-zone .graveyard-card{width:min(76px,max(32px,calc((100cqh - 24px)/1.4)))}
.deck-column .graveyard-card{touch-action:none;user-select:none}
.deck-tools{display:flex;gap:4px;align-items:center;margin-bottom:8px}
.deck-tools button{padding:4px;font-size:12px}
.auxiliary-zone .graveyard-card{width:76px}

.deck-tools #deck-shuffle{flex:1;white-space:nowrap}

#command-cards{flex-direction:row;align-items:flex-start;justify-content:center;gap:6px}
.deck-import-empty{padding:12px 0;text-align:center}.deck-import-empty button{width:100%;padding:9px 3px;font-size:12px}.deck-import-empty p{font-size:11px;color:#aaa;line-height:1.4;margin:8px 0}
#deck-import-dialog{width:min(520px,calc(100vw - 28px));max-height:85dvh;overflow:auto;padding:22px;border:1px solid #545b46;border-radius:14px;background:#1b1c22;color:#eee}
#deck-import-dialog::backdrop{background:#000a}.import-dialog-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}.import-dialog-heading h2{margin:0;font-size:22px}
#deck-import-dialog p{font-size:14px;line-height:1.5}#deck-import-dialog label{display:block;font-size:14px;margin:16px 0 8px}
#deck-import-file{max-width:100%;font-size:13px}#deck-import-dialog .import-help{color:#aaa;font-size:12px}#deck-import-status{min-height:42px;color:#d2eea5;overflow-wrap:anywhere}#deck-import-confirm{width:100%}
.capture-view .deck-import-empty{display:none}
.card-size-control{display:inline-flex;align-items:center;gap:6px;font-size:12px;white-space:nowrap}.card-size-control input{width:86px;accent-color:#c5f277}.card-size-control output{min-width:32px;font-variant-numeric:tabular-nums}.menu-size-control{display:flex;align-items:center;gap:7px;padding:10px;font-size:13px}.menu-size-control input{min-width:0;width:95px;accent-color:#c5f277}.menu-size-control output{min-width:34px}.capture-view .hand-card{outline:none!important}
.deck-zone:has(#deck-import-empty:not([hidden])) .deck-tools,.deck-zone:has(#deck-import-empty:not([hidden])) #deck-cards{display:none}
.deck-column #command-cards:has(>:nth-child(2)) .graveyard-card{width:min(48px,calc((100cqw - 6px)/2),max(32px,calc((100cqh - 24px)/1.4)))}
.capture-view .deck-column{width:0;flex-basis:0;border:0;background:transparent}
.capture-view .deck-column:has(.expanded){width:15%;flex-basis:15%}
.capture-view .deck-column>.graveyard{height:auto;width:100%;flex:0 0 0;display:none}
.capture-view .deck-column>.graveyard.expanded{display:block;flex:1 1 0;min-height:0}
.capture-view .deck-tools{display:none}
.capture-view .deck-column .zone-content{height:100%}
@media(max-width:700px){.deck-column{flex-basis:30px;width:30px}.deck-column:has(.expanded){flex-basis:120px;width:120px}.deck-column>.graveyard .zone-toggle{font-size:10px;padding:5px;gap:3px}.deck-column .zone-count{min-width:16px;padding:2px 3px}.deck-column .zone-content{padding:5px}.auxiliary-zone .graveyard-card{width:65px}}

/* A persistent copy badge travels with the card in every zone. */
.card-face .copy-badge{position:absolute;top:5px;right:5px;width:23px;height:23px;border-radius:5px;background:#17191f;border:1px solid #c5f477;box-shadow:0 2px 5px #0009;display:grid;place-items:center;z-index:5;pointer-events:none}
.card-face .copy-badge img{position:static!important;display:block;width:17px!important;height:17px!important;object-fit:contain;border-radius:0}
.left-zone-column{display:contents}
.right-zone-column{display:contents}.tray-mana-wheel{display:none}
#deck-cards .deck-insert-target{outline:3px solid #c5f277;outline-offset:1px;filter:brightness(1.35)}
#deck[data-insert-label]::after{content:attr(data-insert-label);position:absolute;bottom:4px;left:3px;right:3px;padding:5px 2px;border-radius:4px;background:#c5f277;color:#17200e;font-size:11px;font-weight:700;text-align:center;pointer-events:none;z-index:500}
@media(max-width:700px){
html:not(.capture-view) .right-zone-column{display:flex;flex-direction:column;flex:0 0 30px;width:30px;min-height:0;z-index:3}
html:not(.capture-view) .right-zone-column:has(.expanded){flex-basis:120px;width:120px}
html:not(.capture-view) .right-zone-column:has(.piece-tray.expanded){flex-basis:155px;width:155px}
html:not(.capture-view) .right-zone-column .deck-column{display:contents}
html:not(.capture-view) .right-zone-column .graveyard,html:not(.capture-view) .right-zone-column .piece-tray{position:relative;inset:auto;display:flex;flex-direction:column;width:100%;height:0;min-height:0;max-height:none;flex:1 1 0!important;border-left:1px solid #3d4240;border-bottom:1px solid #3d4240;box-shadow:none}
html:not(.capture-view) .right-zone-column:has(.expanded) .graveyard:not(.expanded),html:not(.capture-view) .right-zone-column:has(.expanded) .piece-tray:not(.expanded){flex:0 0 38px!important}
html:not(.capture-view) .right-zone-column .zone-toggle,html:not(.capture-view) .right-zone-column #piece-tray-toggle{flex:none}
html:not(.capture-view) .right-zone-column:has(.expanded) .zone-toggle,html:not(.capture-view) .right-zone-column:has(.expanded) #piece-tray-toggle{height:38px;flex-direction:row;justify-content:flex-start;flex-wrap:nowrap;padding:5px;gap:4px}
html:not(.capture-view) .right-zone-column:has(.expanded) .graveyard-label{writing-mode:horizontal-tb;letter-spacing:0}
html:not(.capture-view) .right-zone-column .zone-content,html:not(.capture-view) .right-zone-column #piece-tray-content{flex:1;min-height:0;height:auto;overflow-y:auto}
html:not(.capture-view) .right-zone-column .tray-mana-wheel{display:block;flex:none;width:22px;height:22px}
html:not(.capture-view) .right-zone-column .piece-tray:not(.expanded) :is(.piece-tray-label,.piece-tray-chevron){display:none}
html:not(.capture-view) .right-zone-column .piece-tray:not(.expanded) #piece-tray-toggle{align-items:center;justify-content:center}
html:not(.capture-view) .right-zone-column .piece-tray.expanded .tray-mana-wheel{display:none}
}
.brand .brand-mark{display:block;width:52px;height:43px;flex:0 0 52px;transform:none;object-fit:contain}
.zone-label,.combat-area span,.opponent-area span,#hand-toggle,#hand-toggle *,#opponent-hand-toggle,#opponent-hand-toggle *{-webkit-user-select:none;user-select:none}
@media(max-width:700px){
html:not(.capture-view) .left-zone-column{display:flex;flex-direction:column;flex:0 0 33px;width:33px;min-height:0;align-self:stretch;position:relative;z-index:3}
html:not(.capture-view) .left-zone-column:has(.expanded){flex-basis:104px;width:104px}
html:not(.capture-view) .left-zone-column>.graveyard{display:flex;flex-direction:column;flex:1 1 0;width:100%;height:0;min-height:0;max-height:none;border-bottom:1px solid #3d4240}
html:not(.capture-view) .left-zone-column>.graveyard:last-child{border-bottom:0}
html:not(.capture-view) .left-zone-column .zone-toggle{flex:none}
html:not(.capture-view) .left-zone-column:has(.expanded) .zone-toggle{height:40px;flex-direction:row;justify-content:flex-start;flex-wrap:nowrap;padding:6px 4px;gap:3px;font-size:11px}
html:not(.capture-view) .left-zone-column:has(.expanded) .graveyard-label{writing-mode:horizontal-tb;letter-spacing:0;margin:0}
html:not(.capture-view) .left-zone-column:has(.expanded)>.graveyard:not(.expanded){flex:0 0 40px}
html:not(.capture-view) .left-zone-column .zone-content{flex:1;min-height:0;height:auto;max-height:none;overflow-y:auto;padding:0 6px 8px}
html:not(.capture-view) .left-zone-column .zone-count{min-width:16px;padding:2px 3px;font-size:11px}
html:not(.capture-view) .left-zone-column .graveyard-card{width:66px;max-width:100%}
}

.deck-tools #deck-shuffle,.deck-tools #deck-search{flex:1;white-space:nowrap;font-size:11px;padding:5px 2px}.deck-tools #deck-shuffle span{display:inline}.library-search-modal{position:fixed;inset:0;z-index:650;background:#0009;display:flex;align-items:center;justify-content:center;padding:20px}.library-search-modal[hidden]{display:none}.library-search-panel{width:min(780px,100%);max-height:85dvh;overflow:auto;background:#1b1c24;border:1px solid #5f654d;border-radius:14px;padding:20px;box-shadow:0 20px 70px #0009}.library-search-panel header{display:flex;align-items:center;justify-content:space-between}.library-search-panel h2{margin:0;font-size:22px}.library-search-panel p{color:#b9bac4;font-size:13px}.library-search-panel input{width:100%;margin:8px 0 12px}.library-search-panel #library-search-count{font-size:12px;color:#c5f277}.library-fan-row{display:flex;justify-content:center;padding:35px 20px 20px;min-height:210px}.library-fan-card{width:140px;flex:0 0 140px;padding:0;border:0;background:none;transform:rotate(var(--fan-angle));transform-origin:50% 110%;touch-action:none;position:relative;cursor:grab}.library-fan-card+.library-fan-card{margin-left:-45px}.library-fan-card .card-face{width:100%;aspect-ratio:63/88}.library-fan-card:hover,.library-fan-card:focus-visible{z-index:10;transform:translateY(-16px);outline:2px solid #c5f277}.library-search-modal.dragging-card{opacity:0;pointer-events:none}.library-search-ghost{z-index:800!important;pointer-events:none}.library-search-ghost .card-face{width:100px;aspect-ratio:63/88}@media(max-width:700px){.library-search-modal{padding:10px}.library-search-panel{padding:12px}.library-fan-card{width:86px;flex-basis:86px}.library-fan-card+.library-fan-card{margin-left:-43px}.library-fan-row{padding:25px 0 15px;min-height:145px}.piece-preset-grid{gap:12px;padding:3px}.piece-preset .piece-face{width:44px;height:44px;margin:3px auto;font-size:11px}.piece-preset .piece-face strong{font-size:16px}.piece-preset .counter{min-height:44px;width:100%;padding:4px}.piece-preset .counter .piece-symbol{font-size:9px}.piece-preset .piece-face.mana strong{font-size:11px}}

.library-search-panel input{background:#111218;color:#f4f4f6;border:1px solid #555762;border-radius:6px;padding:10px;font-size:14px}
.empty-board .inline-deck-link{pointer-events:auto;padding:0;border:0;background:none;color:var(--accent);font:inherit;text-decoration:underline;text-underline-offset:3px;cursor:pointer}.empty-board .inline-deck-link:hover{color:#e1ffaf}.empty-board .inline-deck-link:focus-visible{outline:2px solid var(--accent);outline-offset:4px}

.battlefield-viewport{display:contents}@media(max-width:700px),(pointer:coarse){html:not(.capture-view) .battlefield-viewport{display:block;position:relative;flex:1;min-width:0;height:365px;overflow:hidden;touch-action:none;cursor:grab}html:not(.capture-view) .battlefield-viewport.panning{cursor:grabbing}html:not(.capture-view) .battlefield-viewport>.battlefield{width:700px;min-width:700px;height:560px;min-height:560px;flex:none;touch-action:none}html:not(.capture-view) .battlefield-viewport .board-card{width:96px}html:not(.capture-view) .battlefield-viewport .board-bottom{user-select:none}.battlefield-viewport.panning *{user-select:none!important}}
.battlefield-viewport>.battlefield{flex:1;min-width:0}.capture-view .battlefield-viewport>.battlefield{width:auto}
@media(max-width:700px),(pointer:coarse){html:not(.capture-view) .battlefield-viewport .hand-zone{left:var(--hand-pan-center,50%);bottom:var(--hand-pan-bottom,0px);z-index:350}html:not(.capture-view) .battlefield-viewport .opponent-hand-zone{top:var(--hand-pan-top,0px);bottom:auto}html:not(.capture-view) .battlefield-viewport .hand-zone.expanded{width:min(calc(var(--hand-viewport-width,300px) - 12px),var(--hand-width,680px))}}
@media(max-width:700px),(pointer:coarse){html:not(.capture-view) .battlefield-viewport>.battlefield{width:max(100%,calc(700px * var(--battlefield-zoom,1)));min-width:0;height:max(365px,calc(var(--mobile-board-height,560px) * var(--battlefield-zoom,1)));min-height:365px}html:not(.capture-view) .battlefield-viewport .board-card{width:calc(96px * var(--battlefield-zoom,1))}html:not(.capture-view) .battlefield-viewport .battlefield-piece .piece-face{width:calc(44px * var(--battlefield-zoom,1));height:calc(44px * var(--battlefield-zoom,1))}}
/* Library reveal and comfortable mobile marker scrolling. */
#deck-reveal{display:grid;place-items:center;flex:0 0 32px;padding:4px;color:var(--accent)}
#deck-reveal-dialog{max-width:780px;max-height:88dvh;overflow-y:auto}
.reveal-heading{display:flex;align-items:center;justify-content:space-between;gap:16px}.reveal-heading h2{margin:0}#deck-reveal-dialog label{display:flex;justify-content:space-between;margin-top:24px}#deck-reveal-count{width:100%;accent-color:var(--accent);min-height:44px}#deck-reveal-fan .library-fan-card{cursor:default;touch-action:pan-y}#deck-reveal-fan .library-fan-row{padding-inline:0}#deck-reveal-status{margin:8px 0}
@media(max-width:700px){#piece-tray-content{padding:12px 20px 32px;touch-action:pan-y;overscroll-behavior:contain;scrollbar-gutter:stable}.piece-preset-grid{gap:20px 12px;padding:8px 0}#deck-reveal-dialog{padding:16px}#deck-reveal-fan .library-fan-card{width:78px;flex-basis:78px}#deck-reveal-fan .library-fan-card+.library-fan-card{margin-left:-40px}}
#deck-reveal-fan .library-fan-card{touch-action:none;cursor:grab;user-select:none}#deck-reveal-fan .swap-source{opacity:.45}#deck-reveal-fan .swap-target{outline:3px solid var(--accent);outline-offset:3px;z-index:12}.reveal-drag-ghost{position:fixed;pointer-events:none;z-index:1000;width:100px;transform:translate(-50%,-50%) rotate(-5deg);filter:drop-shadow(0 8px 12px #0009)}#deck-reveal-fan .library-fan-row{touch-action:pan-y}
.reveal-actions{position:sticky;bottom:-16px;display:flex;justify-content:flex-end;padding:14px 0;background:#202128}
#deck-reveal-notice{position:sticky;top:-16px;z-index:30;background:#303c26;color:#d7ffa2;padding:12px;border:1px solid #78924e;border-radius:7px;min-height:44px}.reveal-instructions{line-height:1.7}.reveal-drag-ghost[data-destination=graveyard]{filter:drop-shadow(0 0 8px #e67c64)}.reveal-drag-ghost[data-destination=hand],.reveal-drag-ghost[data-destination=battlefield]{filter:drop-shadow(0 0 8px #c5f277)}
.reveal-choice{position:absolute;left:0;right:0;bottom:0;z-index:3;padding:7px 3px;white-space:normal;font-size:12px;background:#d0f69b;color:#18230e;border-color:#839c60;min-height:36px}

/* Keep every mobile board layout roomy and pannable; recorded coordinates stay normalized. */
@media(max-width:700px),(pointer:coarse){html:not(.capture-view) .battlefield-viewport{overscroll-behavior:contain}html:not(.capture-view) .battlefield-viewport>.with-combat{--mobile-board-height:860px}html:not(.capture-view) .battlefield-viewport>.with-opponent{--mobile-board-height:1240px}html:not(.capture-view) .battlefield-viewport .board-card{width:calc(96px * var(--battlefield-zoom,1))!important}}

/* Native keyboard-accessible range controls with the Misplay magnifying glass thumb. */
.card-size-control input,.menu-size-control input{appearance:none;-webkit-appearance:none;height:28px;background:transparent;cursor:pointer}
.card-size-control input::-webkit-slider-runnable-track,.menu-size-control input::-webkit-slider-runnable-track{height:4px;background:#666b59;border-radius:4px}
.card-size-control input::-webkit-slider-thumb,.menu-size-control input::-webkit-slider-thumb{appearance:none;-webkit-appearance:none;width:26px;height:26px;margin-top:-11px;border:0;background:url('search-punk.svg') center/24px 24px no-repeat;cursor:grab}
.card-size-control input::-moz-range-track,.menu-size-control input::-moz-range-track{height:4px;background:#666b59;border-radius:4px}
.card-size-control input::-moz-range-thumb,.menu-size-control input::-moz-range-thumb{width:26px;height:26px;border:0;border-radius:0;background:url('search-punk.svg') center/24px 24px no-repeat;cursor:grab}
.card-size-control input:disabled{opacity:.35;cursor:default}

#deck-reveal-dialog label[for="deck-reveal-count"]{justify-content:flex-start;gap:.35em}

/* Recording controls belong beside the timeline title. */
.timeline .timeline-heading{gap:16px;flex-wrap:wrap}
.timeline .timeline-heading>div:first-child{flex:none}
html:not(.capture-view) .timeline .step-editor{flex:1;min-width:280px;min-height:44px;padding:0;border:0;gap:10px;flex-wrap:nowrap}
.timeline .step-editor>input{flex:1;min-width:0;width:auto}
.timeline .step-editor .duration-control,.timeline .step-editor #record-button{flex:none}
.timeline .timeline-actions{flex:none}
@media(max-width:1100px){html:not(.capture-view) .timeline .step-editor{order:3;flex-basis:100%;min-width:0}}
@media(max-width:700px){html:not(.capture-view) .timeline .step-editor{flex-wrap:wrap;gap:8px;padding-top:4px}.timeline .step-editor>input{flex-basis:100%;min-height:40px}.timeline .step-editor .record-dot{display:inline-block}.timeline .step-editor .primary{margin-left:auto}}

.step-tile .step-select{position:absolute;inset:0;width:100%;height:100%;border:0;background:transparent;border-radius:6px;padding:0}
.step-tile>span,.step-tile>em{pointer-events:none;position:relative}
.step-tile>em{position:absolute}
.step-tile .step-note-edit{position:relative;z-index:1;display:block;width:100%;min-width:0;border:0;border-bottom:1px solid transparent;border-radius:0;padding:0;background:transparent;color:inherit;font-size:12px;font-weight:500;line-height:18px;text-overflow:ellipsis;cursor:text}
.step-tile .step-note-edit:hover{border-bottom-color:#788565}
.step-tile .step-note-edit:focus{outline:none;border-bottom-color:var(--accent);text-overflow:clip}

/* Both hands: fan/count at the crown, editable life in the inner semicircle. */
.hand-zone{width:104px;height:52px}
.hand-zone :is(#hand-toggle,#opponent-hand-toggle),.hand-zone.expanded :is(#hand-toggle,#opponent-hand-toggle){width:104px;height:52px;border-radius:104px 104px 0 0;padding:3px 0 25px;display:flex;align-items:center;justify-content:center;gap:5px;font-size:12px;z-index:200}
.hand-fan-icon{width:24px;height:20px;object-fit:contain}
.hand-life{position:absolute;bottom:0;left:50%;transform:translateX(-50%);z-index:201;width:48px;height:24px;min-width:0;padding:4px 0 0;border-radius:48px 48px 0 0;border:1px solid #c5f277;border-bottom:0;background:#111810;color:#c5f277;text-align:center;font-size:14px;font-weight:700;pointer-events:auto;appearance:textfield;touch-action:manipulation}
.hand-life::-webkit-inner-spin-button,.hand-life::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}
.hand-life:focus{outline:2px solid #c5f277;outline-offset:2px}
.capture-view .hand-zone:not(.expanded){display:block}.capture-view .hand-life{pointer-events:none}

/* Compact hand controls; only the fills are translucent. */
.hand-zone:not(.expanded){width:93.6px;height:46.8px}
.hand-zone :is(#hand-toggle,#opponent-hand-toggle),.hand-life{transform:translateX(-50%) scale(.9);transform-origin:50% 100%}
.hand-zone :is(#hand-toggle,#opponent-hand-toggle){background:rgb(36 46 32 / 80%)}
.hand-life{background:rgb(17 24 16 / 80%)}
.hand-zone.zone-drop-target :is(#hand-toggle,#opponent-hand-toggle){background:rgb(60 80 45 / 80%)}

/* Recording settings affect viewers only; the editor retains every zone. */
#recording-view{display:block;width:100%;margin:12px 0;padding:12px}
.capture-view.recording-battlefield-only :is(.left-zone-column,.right-zone-column,.hand-zone,.battlefield-label,.combat-label,.opponent-label,.board-label,.area-label){display:none!important}
.embed-view.recording-hide-captions #embed-caption{display:none}

.capture-view.recording-battlefield-only .zone-label{display:none!important}
.capture-view.recording-battlefield-only :is(.combat-area,.opponent-area) span{display:none}

/* Keep the hand slot while its single visible card follows the pointer. */
.hand-zone .hand-card.hand-drag-source{opacity:0!important}

#timeline-toggle{color:var(--accent);width:32px;min-height:32px;padding:0;font-size:22px;flex:none}
.timeline.collapsed :is(.step-editor,.timeline-actions,.timeline-steps,.player,.play-caption){display:none!important}
html:not(.capture-view) .timeline.collapsed .timeline-heading{padding:8px 16px}
@media(max-width:700px){#timeline-toggle{width:40px;min-height:40px}.timeline.collapsed .timeline-heading>div:first-child{flex-wrap:wrap}}

/* Card anchors stay centered while pressed; do not inherit button press translation. */
.board-card:active{transform:translate(-50%,-50%)}

/* Mobile keeps the collapsed database above the battlefield. */
@media(max-width:700px){
  html:not(.capture-view) .studio.database-collapsed{display:flex;flex-direction:column}
  html:not(.capture-view) .studio.database-collapsed .library{width:100%;height:auto;align-self:stretch;padding:10px 13px}
  html:not(.capture-view) .studio.database-collapsed .library .panel-title{flex-direction:row;justify-content:space-between;gap:10px}
  html:not(.capture-view) .studio.database-collapsed .library h2{writing-mode:horizontal-tb;font-size:15px;letter-spacing:normal}
  html:not(.capture-view) .studio.database-collapsed .stage-panel{width:100%}
}

/* Lay out enlarged artwork at its true size instead of scaling a small raster layer. */
.board-card.highlighted .card-face,.capture-view .board-card.highlighted .card-face{scale:1;width:calc(100% * var(--card-magnification,1.8));margin-left:calc((1 - var(--card-magnification,1.8)) * 50%)}

#card-details{position:fixed;z-index:2000;width:min(340px,calc(100vw - 16px));max-height:calc(100dvh - 16px);overflow:auto;padding:16px;background:rgba(20,23,25,.92);border:1px solid #71874e;border-radius:10px;box-shadow:0 10px 30px #0008;color:#f0f1ed;font-size:13px;line-height:1.5;backdrop-filter:blur(5px)}
#card-details[hidden]{display:none}#card-details h3{margin:0 0 8px;color:var(--accent);font-size:17px}#card-details h4{margin:12px 0 6px}#card-details p{margin:6px 0;white-space:pre-wrap;overflow-wrap:anywhere}#card-details small{display:block;margin-top:12px;color:#afb5ac;overflow-wrap:anywhere}#card-details a{display:block;margin-top:8px;color:var(--accent)}.capture-view #card-details{display:none!important}
#card-details .detail-number-icon{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:1.85em;height:1.85em;margin:2px 3px;vertical-align:middle;border:1.5px solid #b68ace99;border-radius:50%;background:rgba(255,255,255,.04);color:#bd8edb;font-family:Arial,sans-serif;font-size:12px;font-weight:800;line-height:1;letter-spacing:-.04em;text-shadow:none;box-shadow:none;white-space:nowrap}

#card-details .detail-mana-icon{display:inline-flex;width:24px;height:24px;margin:2px 3px;vertical-align:middle}#card-details .detail-mana-icon img{display:block;width:100%;height:100%;object-fit:contain}

.piece-face.counter.illustrated-counter{position:relative;background:transparent;border:0;border-radius:0;padding:0;box-shadow:none;aspect-ratio:1}.piece-face.illustrated-counter>img{display:block;width:100%;height:100%;object-fit:contain}.piece-face.illustrated-counter>strong{position:absolute;bottom:0;right:0;min-width:22px;padding:3px;border-radius:8px;background:#15171d;color:#d5ff8a;font-size:14px;line-height:1}.piece-preset .piece-face.counter.illustrated-counter{width:54px;height:54px;margin:auto}@media(max-width:700px){.piece-preset .piece-face.counter.illustrated-counter{width:44px;height:44px}.piece-face.illustrated-counter>strong{font-size:12px}}

.piece-preset .piece-face.illustrated-counter::after{content:'Poison';position:absolute;left:50%;top:48%;transform:translate(-50%,-50%);padding:2px 4px;border-radius:3px;background:#15171ded;color:#d5ff8a;font-size:11px;font-weight:700;line-height:1.2;white-space:nowrap;pointer-events:none}


.piece-preset .piece-face.flying::after{content:'Flying'}

.board-card .card-face{translate:0 0;transition:transform .4s,scale .3s,box-shadow .2s,translate .25s,filter .25s}.board-card.flying-hover .card-face{translate:0 -6px;filter:drop-shadow(0 9px 5px #0009)}@media(prefers-reduced-motion:reduce){.board-card.flying-hover .card-face{transition:none}}

#card-details .card-details-heading{display:flex;align-items:flex-start;flex-wrap:wrap;gap:4px 10px;margin-bottom:8px}#card-details .card-details-heading h3{flex:1 1 140px;min-width:0;margin:0;overflow-wrap:anywhere}#card-details .card-details-cost{display:flex;align-items:center;flex-wrap:wrap;max-width:100%;gap:0}


.battlefield-piece:active{transform:translate(-50%,-50%)}


@media(max-width:700px),(pointer:coarse){html:not(.capture-view) .battlefield-viewport .hand-zone.expanded{width:var(--hand-viewport-width,100%);max-width:none}}

/* The collapsed library exposes only its actual top card as a draw handle. */
html:not(.capture-view) #deck.deck-peeking{position:relative;overflow:visible}
html:not(.capture-view) #deck.deck-peeking #deck-content{position:absolute;left:-55px;top:32px;width:86px;height:130px;max-height:none;padding:0;overflow:visible;clip-path:inset(-100px 31px -100px -100px)}
#deck.deck-peeking .deck-tools,#deck.deck-peeking .graveyard-help{display:none}
#deck.deck-peeking #deck-cards{height:130px!important;min-height:0;pointer-events:none}
#deck.deck-peeking .graveyard-card{width:86px;pointer-events:auto;transform-origin:center;touch-action:none}
#deck.deck-peeking .graveyard-card[hidden]{display:none}
#deck.deck-peeking .zone-toggle{position:relative;z-index:2;background:#181b1d}
html:not(.capture-view) #deck.deck-peeking #deck-content{left:-12px;clip-path:inset(-100px 74px -100px -100px)}
@media(max-width:700px),(pointer:coarse){html:not(.capture-view) #deck.deck-peeking #deck-content{left:-5px;top:14px;clip-path:inset(-100px 81px -100px -100px)}}
@media(min-width:701px) and (pointer:fine){
 html:not(.capture-view):not(.embed-view) .hand-zone.expanded{width:min(94%,900px);height:min(250px,70%)}
 html:not(.capture-view):not(.embed-view) .hand-zone .hand-card{bottom:calc(94px - var(--hand-card-width)*1.4)}
}
.hand-pull-hint{position:fixed;left:50%;transform:translateX(-50%);z-index:1200;max-width:calc(100vw - 24px);padding:10px 14px;border:1px solid #c5f277;border-radius:8px;background:#191e19f2;color:#d4f89a;font-size:13px;text-align:center;pointer-events:none}

/* Centered vertical pull handle, shared by the closed and open combat views. */
:is(#combat-pull-tab,#opponent-pull-tab){position:absolute;top:3px;left:50%;transform:translate(-50%,var(--pull-distance,0px));transition:box-shadow .15s;z-index:210;display:flex;flex-direction:row;justify-content:center;align-items:center;gap:6px;width:104px;min-height:28px;padding:5px 9px;border:1px solid #c5f277;border-radius:10px;background:transparent;color:#c5f277;box-shadow:0 0 5px #c5f27770,0 0 10px #a855f760,inset 0 0 5px #a855f740;font-family:'Space Grotesk',sans-serif;font-size:9px;font-weight:700;letter-spacing:.3px;text-transform:uppercase;line-height:1.2;cursor:ns-resize;touch-action:none;user-select:none}
:is(#combat-pull-tab,#opponent-pull-tab):is(:hover,:active){background:transparent;transform:translate(-50%,var(--pull-distance,0px));box-shadow:0 0 7px #c5f277a0,0 0 15px #a855f790,inset 0 0 6px #a855f750}
:is(#combat-pull-tab,#opponent-pull-tab):focus-visible{outline:2px solid #a855f7;outline-offset:4px}
.combat-pull-grip{display:none}
:is(#combat-pull-tab,#opponent-pull-tab)>span:last-child{font-size:17px;line-height:12px;font-weight:900;color:#c88dff}
.with-combat #combat-pull-tab{top:35%}
.with-combat #combat-pull-tab>span:last-child{rotate:180deg}
:is(#combat-pull-tab,#opponent-pull-tab)[hidden],.capture-view :is(#combat-pull-tab,#opponent-pull-tab){display:none!important}

/* Extend the actual canvas, reserving its outer edges for the hands. */
html:not(.capture-view) .battlefield{--hand-clearance:120px;min-height:660px;height:660px}
html:not(.capture-view) .battlefield.with-combat{min-height:660px;height:660px}
html:not(.capture-view) .battlefield.with-opponent{min-height:660px;height:660px}
html:not(.capture-view) .with-combat .combat-area{height:calc(35% - var(--hand-clearance)*.35)}
html:not(.capture-view) .with-combat .zone-label{top:calc(35% - var(--hand-clearance)*.35 + 10px)}
html:not(.capture-view) .with-combat #combat-pull-tab{top:calc(35% - var(--hand-clearance)*.35)}
html:not(.capture-view) .with-combat :is(.board-watermark,.empty-board){top:calc(35% - var(--hand-clearance)*.35);bottom:var(--hand-clearance)}
html:not(.capture-view) .with-opponent .opponent-area{height:calc(30% + var(--hand-clearance)*.4)}
html:not(.capture-view) .with-opponent .opponent-area span{top:calc(var(--hand-clearance) + 5px)}
html:not(.capture-view) .with-opponent .combat-area{top:calc(30% + var(--hand-clearance)*.4);height:calc(25% - var(--hand-clearance)*.5)}
html:not(.capture-view) .with-opponent .zone-label{top:calc(55% - var(--hand-clearance)*.1 + 10px)}
html:not(.capture-view) .with-opponent :is(.board-watermark,.empty-board){top:calc(55% - var(--hand-clearance)*.1)}
@media(min-width:1001px){html:not(.capture-view) main{height:auto;display:block}html:not(.capture-view) .studio{height:auto;align-items:stretch}html:not(.capture-view) .studio-sidebar{height:auto}html:not(.capture-view) .library{max-height:900px;min-height:380px}html:not(.capture-view) .timeline{margin-top:16px}}
@media(max-width:700px),(pointer:coarse){
 html:not(.capture-view) .battlefield-viewport{height:500px}
 html:not(.capture-view) .battlefield-viewport>.battlefield{--hand-clearance:90px;--mobile-board-height:800px;height:max(500px,calc(var(--mobile-board-height)*var(--battlefield-zoom,1)));min-height:500px}
 html:not(.capture-view) .battlefield-viewport>.with-combat{--mobile-board-height:800px}
 html:not(.capture-view) .battlefield-viewport>.with-opponent{--mobile-board-height:800px}
 html:not(.capture-view) .battlefield-viewport .hand-zone{bottom:0}
 html:not(.capture-view) .battlefield-viewport .opponent-hand-zone{top:0;bottom:auto}
}

html:not(.capture-view) .with-opponent #opponent-pull-tab{top:calc(30% + var(--hand-clearance)*.4)}
.with-opponent #opponent-pull-tab>span:last-child{rotate:180deg}

/* Short touch screens: place the play surface first and fit its full height. */
@media(orientation:landscape) and (max-height:600px) and (pointer:coarse){
 html:not(.capture-view) .app-header{height:44px;padding:4px 12px}
 html:not(.capture-view) .app-header .brand-copy,html:not(.capture-view) .app-header .brand-sub{display:none}
 html:not(.capture-view) .header-actions button{padding:5px 8px;font-size:11px}
 html:not(.capture-view) main{display:block;height:auto;min-height:0;padding:4px 8px}
 html:not(.capture-view) .studio,html:not(.capture-view) .studio.database-collapsed{display:flex;flex-direction:column;height:auto;gap:8px}
 html:not(.capture-view) .studio .stage-panel{order:-1;width:100%;height:auto;flex:none}
 html:not(.capture-view) .studio-sidebar{display:block;height:auto}
 html:not(.capture-view) .studio>.project-heading{order:1}
 html:not(.capture-view) .stage-toolbar{height:56px;min-height:56px;max-height:56px;flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;padding:4px 8px;gap:10px}
 html:not(.capture-view) .stage-toolbar>div{flex-shrink:0;flex-wrap:nowrap}
 html:not(.capture-view) .stage-toolbar .stage-title>.project-heading{display:none}
 html:not(.capture-view) .battlefield-viewport{height:var(--landscape-field-height,calc(100dvh - 110px));min-height:0;flex:none}
 html:not(.capture-view) .battlefield-viewport>.battlefield{--hand-clearance:calc(90px * var(--battlefield-zoom,1));min-height:0;height:max(var(--landscape-field-height,calc(100dvh - 110px)),calc(800px * var(--battlefield-zoom,1)))}
 html:not(.capture-view) .hand-zone{scale:.65;transform-origin:50% 100%}
 html:not(.capture-view) .opponent-hand-zone{transform-origin:50% 50%;translate:0 -17.5%}
 html:not(.capture-view) .timeline{margin-top:8px}
}

@media(orientation:landscape) and (max-height:600px) and (pointer:coarse){html:not(.capture-view) .stage-panel .play-area{flex:none;height:auto;min-height:0}html:not(.capture-view) .battlefield-viewport{flex:1 1 auto;align-self:flex-start}}

.stack-button{display:inline-flex;align-items:center;gap:5px;color:var(--accent)}.stack-button img{width:22px;height:22px}.board-card.on-stack .card-face{translate:0 -28px;filter:drop-shadow(0 30px 14px #000c);box-shadow:0 0 0 2px #c5f277,0 0 18px #ac68e777}.card-face .stack-badge{position:absolute;top:5px;left:5px;width:25px;height:25px;border:1px solid #b47aff;border-radius:7px;background:#17181d;z-index:6;pointer-events:none}.card-face .stack-badge img{position:static!important;width:100%!important;height:100%!important;border-radius:6px;object-fit:contain}
