/* Private building space; public placement remains a separate step. */
.studio-toolbar[hidden],.draft-placement[hidden]{display:none}
.studio-toolbar{padding:22px 30px;border-bottom:1px solid var(--line);display:grid;grid-template-columns:1fr auto auto;align-items:center;gap:12px 32px;background:var(--paper)}
.studio-back{font-size:11px;text-decoration:none;color:var(--muted)}
.studio-toolbar h1{font:34px var(--font-title);margin:10px 0 0}.studio-toolbar h1 span{font:12px var(--font-ui);display:inline-block;margin-left:18px;color:var(--muted)}
.studio-metrics{display:flex;flex-direction:column;gap:6px;font-size:12px}.studio-metrics strong{font:25px var(--font-title)}.studio-tools{display:flex;gap:8px;align-items:center}
.studio-tools button,.draft-placement button{min-height:44px;padding:12px 16px;width:auto;font-size:12px}
.studio-toolbar>p{grid-column:1/-1;margin:0;color:var(--muted);font-size:11px}
.studio-page .workspace{height:calc(100dvh - 270px);min-height:380px}.studio-page .world{min-height:0}
.studio-page .world-title,.studio-page .world-tag,.studio-page .world-location,.studio-page .world-note,.studio-page #area-status-chip,.studio-page #build-area,.studio-page #moderation{display:none!important}
.studio-page .build-choices{box-shadow:none}.studio-page .world-bottom{left:auto}.studio-page .build-dock{bottom:26px}.studio-page .hint{bottom:98px}.studio-page .draft-dock{display:none!important}
.draft-placement{width:min(460px,calc(100vw - 24px));padding:18px;background:var(--paper);border:1px solid var(--line);border-radius:9px;box-shadow:var(--shadow)}
.draft-placement strong{font:22px var(--font-title)}.draft-placement p{font-size:12px;line-height:1.55}.draft-placement>div{display:flex;gap:10px}.draft-placement .primary{flex:1}
.area-input-mode{display:flex;gap:6px;margin-top:10px}.area-input-mode button{flex:1;min-height:44px;background:transparent;border:1px solid var(--line);border-radius:4px;font-size:11px}.area-input-mode button[aria-pressed=true]{background:var(--deep);color:white}
@media(max-width:700px){
 .studio-page header{height:64px;flex-wrap:nowrap}.studio-page .header-left{width:auto}.studio-page .header-actions{width:auto}.studio-page #how{display:none}
 .studio-toolbar{padding:14px 16px;grid-template-columns:1fr auto;gap:12px}.studio-toolbar h1{font-size:28px}.studio-toolbar h1 span{display:none}.studio-tools{grid-column:1/-1;gap:8px}.studio-tools .primary{flex:1}.studio-toolbar>p{font-size:10px;line-height:1.4}.studio-metrics{font-size:10px;gap:4px;text-align:right}.studio-metrics strong{font-size:22px}
 .studio-page .workspace{height:calc(100dvh - 264px);min-height:320px}.studio-page .world{min-height:0;height:100%}.studio-page .world-bottom{left:12px;right:12px;bottom:12px;justify-content:flex-end}.studio-page .build-dock{bottom:78px}.studio-page .hint{bottom:170px;font-size:9px;max-width:90vw}.studio-page #start-building{min-width:170px;padding:13px 16px}
 .world:has(.draft-placement:not([hidden])) .world-title,.world:has(.draft-placement:not([hidden])) .world-location{display:none}
 .draft-placement{padding:14px}.draft-placement>div{gap:6px}.draft-placement button{padding:10px;font-size:11px}
}

.studio-tools .secondary,.draft-placement .secondary{background:var(--paper);border:1px solid var(--line);border-radius:4px;color:var(--ink)}

/* The private workbench fills the screen; its controls belong to the canvas. */
.studio-page body{height:auto;min-height:max(100dvh, 580px);display:flex;flex-direction:column}
.studio-page header{flex:none;min-height:64px;height:72px}
.studio-page .studio-toolbar{flex:none;padding:16px 24px;gap:10px 24px}
.studio-page .workspace{flex:1;height:auto;min-height:280px}
.studio-page .workspace .world{height:100%;min-height:0}
.studio-page footer{display:none}
.studio-page .workspace .world .build-dock{position:absolute;bottom:24px}
.studio-page .workspace .world .world-bottom{position:absolute;right:18px;left:auto;bottom:18px}
.studio-page .workspace .world .hint{position:absolute;top:14px;bottom:auto;font-size:11px;max-width:90%;pointer-events:none}
.studio-toolbar>p{font-size:12px;line-height:1.5;overflow-wrap:anywhere}
.studio-metrics{font-size:12px;line-height:1.4;font-variant-numeric:tabular-nums}
#studio-balance{color:var(--deep)}
#studio-retry{grid-column:1/-1;justify-self:start;min-height:44px;text-decoration:underline}
.studio-empty{position:absolute;left:50%;top:38%;transform:translate(-50%,-50%);width:min(350px,85%);text-align:center;pointer-events:none}
.studio-empty[hidden]{display:none}
.studio-empty-mark{display:inline-grid;place-items:center;width:48px;height:48px;border:1px dashed #b5ab98;border-radius:8px;color:var(--muted);font-size:25px}
.studio-empty h2{font:26px var(--font-title);letter-spacing:-.5px;margin:16px 0 10px}
.studio-empty p{font-size:13px;line-height:1.6;color:var(--muted);margin:0 0 10px}
.studio-empty>span:last-child{font-size:11px;color:var(--muted)}
.studio-tools button:focus-visible,.zoom button:focus-visible,.draft-items button:focus-visible{outline:2px solid var(--deep);outline-offset:3px}
.studio-page #start-building .price{font-size:11px;font-weight:normal;opacity:.8}
.draft-items button{min-height:44px}.community-dialog .dialog-close{min-width:44px;min-height:44px}
@media(max-width:1150px){
 .studio-page .workspace .world .build-dock{bottom:80px}
 .studio-page .workspace .world .world-bottom{left:12px;right:12px;bottom:14px;justify-content:center}
}
@media(max-width:700px){
 .studio-page header{height:64px;min-height:64px;padding-block:8px!important}
 .studio-page .studio-toolbar{padding:12px 16px;gap:10px 12px}
 .studio-toolbar h1{margin-top:6px;font-size:26px}.studio-tools{gap:8px}
 .studio-tools button{font-size:12px;padding:10px 14px}
 .studio-metrics{font-size:11px;max-width:200px}.studio-metrics strong{font-size:23px}
 .studio-toolbar>p{font-size:11px;line-height:1.4}
 .studio-page .workspace .world .build-dock{bottom:calc(72px + env(safe-area-inset-bottom));width:auto;left:16px;right:16px;max-width:none;transform:none}
 .studio-page .build-choices,.studio-page #start-building{width:100%}
 .studio-page .workspace .world .world-bottom{bottom:calc(10px + env(safe-area-inset-bottom));left:8px;right:8px}
 .studio-page .zoom{gap:0;padding:3px;max-width:100%}
 .studio-page .zoom button{min-width:40px;min-height:44px;padding:0 5px}
 .studio-page .zoom #explore-mode{min-width:80px;font-size:10px}
 .studio-page .zoom .bearing,.studio-page .zoom .control-divider{display:none}
 .studio-page .zoom #zoom-value{min-width:30px}
 .studio-page .workspace .world .hint{font-size:10px;top:8px;padding:4px 8px}
 .studio-empty{top:36%;width:80%}.studio-empty h2{font-size:23px}.studio-empty p{font-size:12px}
}
@media(max-height:740px){.studio-empty-mark{display:none}.studio-empty h2{margin-top:0}.studio-empty>span:last-child{display:none}}

/* Keep the shared canvas visible below the actual mobile header height. */
@media(max-width:700px){
 html:not(.studio-page) body{height:100dvh;min-height:580px;display:flex;flex-direction:column}
 html:not(.studio-page) header{flex:none;height:auto}
 html:not(.studio-page) .workspace{flex:1;height:auto;min-height:0}
 html:not(.studio-page) .world{height:100%;min-height:0}
 html:not(.studio-page) footer{display:none}
}
@media(max-width:420px){
 .zoom{gap:0;max-width:100%}
 .zoom #rotate-left,.zoom #rotate-right,.zoom .bearing,.zoom .control-divider{display:none}
 .zoom button{min-width:44px;min-height:44px}
 .zoom #explore-mode{min-width:90px;white-space:nowrap}
 .zoom #zoom-value{min-width:32px}
}

/* A piece balance is visible independently from the price of a new purchase. */
.balance-button{display:flex;flex-direction:column;align-items:flex-start;gap:2px;border:1px solid #cbd4c7;border-radius:7px;background:#edf1e8;color:var(--deep);padding:7px 11px;min-height:44px;white-space:nowrap}
.balance-button[hidden]{display:none}.balance-button span{font-size:10px}.balance-button strong{font-size:12px;font-weight:600;font-variant-numeric:tabular-nums}
.balance-button:hover{background:#e2e9db}.balance-button:focus-visible{outline:2px solid var(--deep);outline-offset:3px}
.balance-breakdown{display:grid;grid-template-columns:1fr 1fr;gap:10px 18px;padding:14px 16px;margin:12px 0;border:1px solid var(--line);border-radius:8px;background:#f5f3eb;font-variant-numeric:tabular-nums}
.balance-breakdown[hidden]{display:none}.balance-breakdown>div{min-width:0}.balance-breakdown dt{font-size:11px;line-height:1.4;color:var(--muted)}.balance-breakdown dd{font-size:18px;line-height:1.4;font-weight:600;margin:2px 0 0;color:var(--ink)}
.balance-breakdown .covered dd{color:#395941}.balance-breakdown .amount-due dd{font-weight:700}
.balance-breakdown .balance-after{grid-column:1/-1;border-top:1px solid var(--line);padding-top:8px;display:flex;justify-content:space-between;align-items:center;gap:8px}.balance-breakdown .balance-after dd{font-size:12px;margin:0}
.balance-breakdown>p{grid-column:1/-1;font-size:11px;line-height:1.45;margin:0;color:var(--muted)}
.studio-coverage{grid-column:1/-1;grid-template-columns:repeat(4,1fr) 1.2fr;margin:0;padding:10px 14px;gap:8px 20px}.studio-coverage .balance-after{grid-column:auto;border-top:0;border-left:1px solid var(--line);padding:0 0 0 16px;display:block}.studio-coverage .balance-after dd{font-size:18px;margin-top:2px}
.placement-coverage{margin:0;background:var(--paper);border:1px solid var(--line);border-radius:6px;padding:7px 12px;font-size:12px;color:var(--deep);text-align:center;max-width:360px;line-height:1.5}.placement-coverage[hidden]{display:none}
@media(max-width:700px){
 .balance-button{padding:5px 8px}.balance-button strong{font-size:11px}
 .studio-page header{height:auto;flex-wrap:wrap;padding-block:8px!important;gap:6px!important}
 .studio-page .header-actions{width:auto;flex:1;justify-content:flex-end;gap:8px!important;flex-wrap:nowrap}
 .studio-coverage{grid-template-columns:repeat(4,1fr);padding:10px;gap:8px}.studio-coverage dt{font-size:10px}.studio-coverage dd{font-size:16px}.studio-coverage .balance-after{grid-column:1/-1;display:flex;border-left:0;border-top:1px solid var(--line);padding:6px 0 0}.studio-coverage .balance-after dd{font-size:12px;margin:0}
 .world:has(.placement-coverage:not([hidden])) .hint{visibility:hidden}
 .area-selection .balance-breakdown{padding:10px 12px;margin:8px 0;gap:6px 12px}.area-selection .balance-breakdown dd{font-size:16px}
}

.draft-remove{display:block;min-height:44px;padding:9px 12px;margin:12px 0 8px;border:1px solid #d8bcb1;border-radius:6px;background:#fff5f0;color:#8c412d;font:inherit;font-size:12px}.draft-remove[hidden]{display:none}.draft-remove:hover{background:#fae9df}.draft-remove:focus-visible{outline:2px solid #8c412d;outline-offset:3px}

/* Editing tools keep the selected piece identifiable and removal reversible. */
.draft-edit-toolbar{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:14px 0 10px;padding:8px 12px;border:1px solid var(--line);border-radius:8px;background:var(--control)}
.draft-edit-toolbar[hidden],.draft-undo-bar[hidden]{display:none}.draft-edit-toolbar>span{font-size:12px;font-weight:600;color:var(--deep)}
.draft-edit-toolbar .draft-remove{margin:0;min-height:40px;padding:8px 10px;border:0;background:transparent;text-decoration:underline;text-underline-offset:3px}
.draft-undo-bar{grid-column:1/-1;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:8px 12px;background:#eaf0e3;border:1px solid #c6d4ba;border-radius:7px;font-size:12px;color:var(--deep)}
.draft-undo-bar button,.draft-list-heading button{min-height:44px;padding:8px 12px;border:1px solid var(--line);background:var(--paper);border-radius:5px;color:var(--deep);font-weight:600;font-size:12px;white-space:nowrap}
.draft-list-heading{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-top:22px}.draft-list-heading h3{font:21px var(--font-title);margin:0}
.draft-items{max-height:300px;margin-top:8px}.draft-items li{display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:8px;flex-wrap:nowrap;padding:12px 0}
.draft-items li .draft-piece-identity{display:flex;align-items:center;gap:12px;min-width:0}.draft-items li .draft-piece-thumbnail{display:block;width:48px;min-width:48px;height:48px;flex:none;background:var(--control);border-radius:6px}.draft-piece-thumbnail svg{width:100%;height:100%}
.draft-items li .draft-piece-label{min-width:0;font-size:12px;line-height:1.5}.draft-items li>button:last-child{color:#8c412d;background:transparent;border-color:transparent}
.draft-items-empty{padding:18px 0;border-bottom:1px solid var(--line)}
@media(max-width:600px){.draft-items li{grid-template-columns:1fr auto}.draft-items li .draft-piece-identity{grid-column:1/-1}.draft-items li>button{font-size:12px}.draft-undo-bar{font-size:11px}.draft-edit-toolbar{padding:6px 8px}}

.draft-name-row{display:flex;gap:8px;align-items:stretch}.draft-name-row input{flex:1;min-width:0}.draft-name-row #draft-save{width:auto;flex:none;margin:0;padding:10px 14px;font-size:12px}.draft-cost-details{border-top:1px solid var(--line);border-bottom:1px solid var(--line);padding:10px 0}.draft-cost-details summary{cursor:pointer;font-size:12px;color:var(--deep);min-height:24px;line-height:24px}
