:root{color-scheme:dark}html,body{margin:0;min-height:100%;background:#202020;color:#dedede;font-family:Inter,system-ui,'Segoe UI',sans-serif;font-size:12px}body.wvd-studio{display:flex;flex-direction:column;min-height:100dvh}*,*:before,*:after{box-sizing:border-box}button,input,select{font:inherit}button{cursor:pointer}button:disabled{opacity:.5;cursor:wait}a{color:#82ceff}button:focus-visible,input:focus-visible,select:focus-visible,summary:focus-visible{outline:2px solid #82ceff;outline-offset:2px}[hidden]{display:none!important}.muted,.hint{color:#a9a9a9}.hint{font-size:11px;line-height:1.5}.overline,.pane-kicker{font-size:10px;color:#82ceff;font-weight:800;letter-spacing:.13em}h1,h2,h3,p{margin-top:0}.topbar{height:53px;flex-shrink:0;padding:0 20px;background:#1a1a1a;border-bottom:1px solid #424242;display:flex;justify-content:space-between;align-items:center;gap:12px}.brand{display:flex;align-items:center;gap:10px}.brand img{width:30px;height:30px;object-fit:contain}.brand-name{font-size:14px;font-weight:800;white-space:nowrap}.brand-name b{font-size:11px;color:#82ceff}.brand-label{font-size:10px;color:#858585;border-left:1px solid #484848;padding-left:12px;white-space:nowrap}.topactions{display:flex;gap:12px;align-items:center}.local-chip{font-size:10px;color:#84bca7}.site-link{color:#b6b6b6;text-decoration:none;font-size:11px}.wvd-btn,.small-btn{border:1px solid #565656;border-radius:4px;background:#414141;color:#dedede;padding:8px 10px}.small-btn:hover,.wvd-btn:hover{background:#515151}.small-btn{font-size:11px}.small-btn.stretch{width:100%}.primary-btn{background:#347dab;color:white;border:1px solid #458fbf;border-radius:4px;padding:11px 13px;font-weight:700;font-size:12px}.primary-btn:hover{background:#3f96c5}.full{width:100%}.text-btn{padding:5px;color:#a7ddff;background:none;border:0}.push{margin-left:auto}.app-footer{height:31px;background:#1a1a1a;border-top:1px solid #424242;display:flex;align-items:center;justify-content:center;color:#858585;font-size:10px}.app-footer a{margin:0 4px;text-decoration:none}main{flex:1;min-height:0;display:flex;flex-direction:column}.start-view,.process-view{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:28px;gap:25px}.start-header{text-align:center}.start-header h1{font-size:36px;margin:8px 0;font-weight:800;letter-spacing:-.05em}.start-header p{font-size:15px;color:#acacac}.dropzone{width:min(700px,100%);min-height:290px;border:2px dashed #5b5b5b;background:#292929;border-radius:6px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:11px;color:#ddd}.dropzone:hover,.dropzone.drag{border-color:#82ceff;background:#263e4d}.drop-icon{width:64px;height:64px;display:grid;place-items:center;border:1px solid #6187a0;background:#263e4d;color:#82ceff;border-radius:5px;font-size:46px;font-weight:300}.dropzone strong{font-size:19px}.dropzone span{font-size:13px;color:#c7c7c7}.dropzone small{font-size:11px;color:#969696;text-align:center;padding:0 14px}.start-note{display:flex;gap:28px;color:#858585;font-size:10px;flex-wrap:wrap;justify-content:center}.error-text{color:#e89191}.processing-card{background:#292929;border:1px solid #424242;border-radius:7px;width:min(580px,100%);padding:30px}.processing-card h1{margin:8px 0;font-size:24px}.processing-card>p{color:#b1b1b1;line-height:1.6}.progress-meta{display:flex;justify-content:space-between;font-size:12px;margin:24px 0 8px}.progress-meta strong{color:#82ceff}.large-progress{height:8px;border-radius:5px;background:#484848;overflow:hidden}.large-progress>div{background:#82ceff;width:0;height:100%;transition:width .2s}.processing-steps{display:grid;gap:12px;margin:22px 0}.process-step{color:#858585;font-size:12px;display:flex;align-items:center;gap:11px}.process-step i{border:1px solid #666;width:13px;height:13px;border-radius:50%;display:block}.process-step.active{color:#e3e3e3}.process-step.active i{border-color:#82ceff;box-shadow:inset 0 0 0 3px #292929;background:#82ceff}.process-step.done{color:#8bd0b2}.process-step.done i{background:#8bd0b2;border-color:#8bd0b2}.processing-card .processing-note{font-size:11px;color:#858585;margin-bottom:0}.workspace{flex:1;min-height:0;display:grid;grid-template-columns:245px minmax(320px,1fr) 300px}.sprites-panel,.settings-panel{background:#292929;display:flex;flex-direction:column;min-width:0;min-height:0}.sprites-panel{border-right:1px solid #424242}.settings-panel{border-left:1px solid #424242}.pane-head{height:62px;flex-shrink:0;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid #424242;padding:10px 13px;gap:10px}.pane-head h2{font-size:13px;margin:4px 0 0}.pane-head h2 span{font-size:11px;color:#82ceff}.panel-actions{display:flex;align-items:center;padding:7px 12px;gap:6px;border-bottom:1px solid #424242}.panel-actions .muted{font-size:9px}.sprites-list{overflow:auto;flex:1;padding:10px;display:flex;flex-direction:column;gap:6px}.sprite-tile{display:flex;align-items:center;gap:9px;padding:8px;border:1px solid #444;border-radius:4px;background:#333;min-height:76px}.sprite-tile.active{background:#263e4d;border-color:#82ceff}.sprite-tile input{accent-color:#82ceff}.sprite-thumb{width:68px;height:60px;flex-shrink:0;background-color:#444;border:1px solid #555;border-radius:3px;display:grid;place-items:center;padding:3px;background-image:linear-gradient(45deg,#4e4e4e 25%,transparent 25%,transparent 75%,#4e4e4e 75%),linear-gradient(45deg,#4e4e4e 25%,transparent 25%,transparent 75%,#4e4e4e 75%);background-size:12px 12px;background-position:0 0,6px 6px}.sprite-thumb img{max-width:100%;max-height:100%;object-fit:contain}.sprite-text{min-width:0}.sprite-name{font-size:11px;font-weight:700;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sprite-info{font-size:10px;color:#a7a7a7;margin-top:6px}.sidebar-foot{padding:11px 12px;border-top:1px solid #424242;display:grid;gap:10px}.gpu-indicator{font-size:10px;color:#8bd0b2}.stage-panel{min-width:0;min-height:0;background:#242424;display:flex;flex-direction:column}.stage-head{height:52px}.stage-tabs,.stage-nav{display:flex;gap:5px}.stage-tab{background:none;color:#a8a8a8;border:none;padding:9px 10px;font-weight:600;border-bottom:2px solid transparent;font-size:11px}.stage-tab.active{color:#82ceff;border-color:#82ceff}.stage-body{flex:1;min-height:180px;position:relative;overflow:hidden}.preview-holder{position:absolute;inset:0;overflow:hidden;cursor:grab}.preview-holder.dragging{cursor:grabbing}.preview-holder img{position:absolute;transform-origin:0 0;max-width:none;max-height:none;display:block}.preview-holder.inner-preview{position:absolute;inset:0}.checker{background-color:#3d3d3d;background-image:linear-gradient(45deg,#484848 25%,transparent 25%,transparent 75%,#484848 75%),linear-gradient(45deg,#484848 25%,transparent 25%,transparent 75%,#484848 75%);background-size:24px 24px;background-position:0 0,12px 12px}.zoom-chip{position:absolute;right:12px;bottom:11px;pointer-events:none;font-size:10px;background:#1a1a1adf;color:#82ceff;border-radius:3px;padding:5px 7px}.stage-foot{min-height:35px;border-top:1px solid #424242;display:flex;justify-content:space-between;align-items:center;gap:8px;padding:8px 12px;font-size:10px}.stage-foot span:first-child{max-width:48%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.settings-scroll{flex:1;overflow:auto;padding:14px 12px}.settings-scroll>label,.dialog-scroll>label,.details-body label{display:block;color:#bdbdbd;font-size:11px;font-weight:600;margin:8px 0}.field{background:#363636;border:1px solid #5b5b5b;color:#ededed;border-radius:4px;padding:9px 10px;width:100%;min-width:0;outline:none}.field:focus{border-color:#82ceff}.small-status{font-size:10px;margin:8px 0 20px}.settings-scroll .primary-btn{margin-bottom:8px}.settings-scroll .small-btn{margin-bottom:3px}.section-title{border-top:1px solid #414141;margin:18px 0 10px;padding-top:13px;font-weight:800;font-size:10px;letter-spacing:.06em;text-transform:uppercase;color:#c7c7c7}.color-row{display:flex;gap:10px;align-items:center}.round-color{width:25px;height:25px;border-radius:4px;border:1px solid #686868}.round-color.active{outline:2px solid #82ceff;outline-offset:2px}.settings-details{background:#303030;border:1px solid #474747;border-radius:4px;margin:12px 0}.settings-details summary{cursor:pointer;font-size:11px;font-weight:700;padding:11px}.settings-details[open] summary{border-bottom:1px solid #474747}.details-body{padding:12px}.ctrl{margin:0 0 12px}.ctrl label{display:flex;justify-content:space-between;margin-bottom:5px}.ctrl output{color:#82ceff}.ctrl input,.dialog-scroll input[type=range]{width:100%;accent-color:#82ceff}.toggle-label{display:flex!important;align-items:center;gap:8px}.toggle-sw{width:28px;height:17px;border-radius:9px;background:#555;border:1px solid #777;display:inline-block;cursor:pointer}.toggle-sw.on{background:#347dab}.logbox{font-size:10px;white-space:pre-wrap;max-height:110px;overflow:auto;color:#a1a1a1}.settings-foot{padding:12px;border-top:1px solid #424242;display:grid;gap:8px}.overlay{position:fixed;inset:0;background:#090b0ddb;z-index:100;display:grid;place-items:center;padding:12px}.export-dialog{width:min(480px,100%);max-height:95dvh;background:#303030;border:1px solid #565656;border-radius:8px;display:flex;flex-direction:column;box-shadow:0 24px 80px #0009}.dialog-head,.dialog-foot{padding:15px 18px;border-bottom:1px solid #4c4c4c;display:flex;justify-content:space-between;align-items:center;gap:12px}.dialog-head h2{font-size:16px;margin:0}.dialog-foot{border-top:1px solid #4c4c4c;border-bottom:0}.dialog-scroll{padding:16px 20px;overflow:auto}.dialog-scroll>label{margin-top:13px}.two-fields{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin:12px 0}.two-fields label{font-size:11px;display:block;color:#bdbdbd;margin:0 0 7px}.export-status{padding-top:8px}.toast{position:fixed;bottom:50px;left:50%;transform:translateX(-50%);z-index:400;background:#263e4d;border:1px solid #82ceff;color:#eee;padding:12px 20px;border-radius:4px;max-width:90vw;box-shadow:0 8px 30px #000a}.toast.error{background:#4d2929;border-color:#e89191}
@media(max-width:1120px){.workspace{grid-template-columns:205px minmax(320px,1fr) 255px}.local-chip{display:none}}@media(max-width:820px){.workspace{grid-template-columns:1fr;display:flex;flex-direction:column;min-height:auto}.sprites-panel{order:2;min-height:200px;max-height:260px;border-right:0;border-top:1px solid #424242}.settings-panel{order:3;min-height:230px;border-left:0;border-top:1px solid #424242}.settings-scroll{overflow:visible}.stage-panel{order:1;height:52vh;min-height:350px}.stage-foot{flex-wrap:wrap}.sprites-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr))}.topbar{padding:0 10px}.brand-label{display:none}.start-view,.process-view{padding:20px}}@media(max-width:540px){.site-link{display:none}.start-header h1{font-size:28px}.dropzone{min-height:260px}.start-note{gap:8px;flex-direction:column;align-items:center}.brand-name{font-size:12px}.topactions{gap:5px}.topbar{height:50px}.processing-card{padding:18px}.stage-panel{min-height:330px}.stage-foot{font-size:9px}}

/* 2.0.2 — desktop panes stay inside the viewport; each sidebar scrolls independently. */
@media (min-width:821px) {
  html,body.wvd-studio{height:100%;min-height:0;overflow:hidden}
  body.wvd-studio{height:100dvh}
  body.wvd-studio>main{flex:1 1 0;min-height:0;overflow:hidden}
  .workspace{min-height:0;height:100%;min-width:0;overflow:hidden;grid-template-rows:minmax(0,1fr)}
  .sprites-panel,.settings-panel,.stage-panel{height:100%;max-height:100%;min-height:0;overflow:hidden}
  .sprites-list,.settings-scroll{flex:1 1 0;min-height:0;overflow-y:auto;overscroll-behavior:contain}
  .stage-body{flex:1 1 0;min-height:0;overflow:hidden}
}
/* Preview supports pan/zoom, never native browser image dragging or text selection. */
.preview-holder,.preview-holder img{user-select:none;-webkit-user-select:none;-webkit-user-drag:none;touch-action:none}
.preview-holder img{pointer-events:none}
/* Normal scrolling on small/touch screens; panel itself remains scrollable. */
@media(max-width:820px){
 html,body.wvd-studio{height:auto;min-height:100dvh;overflow:auto}
 body.wvd-studio>main{overflow:visible}
 .settings-scroll{overflow:visible}
 .sprites-list{overflow-y:auto;max-height:245px}
}

/* v2.0.3: force strict viewport containment, regardless of user font sizing. */
@media(min-width:821px){
  html:has(body.wvd-studio){height:100%;overflow:hidden}
  body.wvd-studio{position:fixed;inset:0;width:100%;height:100dvh;min-height:0;overflow:hidden}
  body.wvd-studio>main{display:flex;flex-direction:column;min-height:0;min-width:0;flex:1 1 0%;overflow:hidden}
  body.wvd-studio .workspace{flex:1 1 0%;height:auto!important;min-height:0!important;grid-template-rows:minmax(0,1fr);overflow:hidden}
  body.wvd-studio .sprites-panel{display:flex;flex-direction:column;min-height:0;overflow:hidden}
  body.wvd-studio .sprites-list{display:block;min-height:0!important;height:0;flex:1 1 0%;overflow-y:scroll!important;overflow-x:hidden;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:#82ceff #303030}
  body.wvd-studio .sprite-tile{display:flex;min-height:76px;margin-bottom:6px;flex-shrink:0}
  body.wvd-studio .settings-scroll{min-height:0;overflow-y:auto;scrollbar-width:thin;scrollbar-color:#82ceff #303030}
  body.wvd-studio .stage-panel{min-height:0;overflow:hidden}
}
body.wvd-studio .sprites-list::-webkit-scrollbar,body.wvd-studio .settings-scroll::-webkit-scrollbar{width:9px}
body.wvd-studio .sprites-list::-webkit-scrollbar-thumb,body.wvd-studio .settings-scroll::-webkit-scrollbar-thumb{background:#5f9bc0;border:2px solid #303030;border-radius:4px}

/* v2.1: manual controls and capture-mode overlay */
.tool-grid{display:grid;grid-template-columns:1fr 1fr;gap:6px}.tool-grid .small-btn{min-height:37px;text-align:center}.tool-grid .small-btn.active{background:#245877;border-color:#82ceff;color:#e7f6ff}
.preview-holder.tool-active{cursor:crosshair!important;touch-action:none}.preview-holder.tool-active img{pointer-events:none}
.manual-guide{position:absolute;inset:0;pointer-events:none;z-index:7}.manual-guide svg{width:100%;height:100%;overflow:visible}.manual-guide line,.manual-guide rect{stroke:#82ceff;stroke-width:2;stroke-dasharray:7 4;fill:#82ceff13}
@media(max-width:820px){.tool-grid{grid-template-columns:1fr 1fr}}
