.site-main:has([data-drawer]) { animation: none; }
.drawer-page { padding-top: 18px; font-family: Arial, Helvetica, sans-serif; }
.drawer-page *, .drawer-page button { letter-spacing: 0; box-sizing: border-box; }
.drawer-page [hidden] { display: none !important; }
.drawer-page .tool-heading h1 { font-size: 24px; margin: 4px 0; }
.drawer-page .tool-heading { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:16px; padding-bottom:14px; }
.drawer-header-actions { display:grid; justify-items:end; gap:8px; }
.drawer-page .tool-heading-actions > * { flex:none; white-space:nowrap; }
.drawer-header-actions .guide-link { font-size:12px; margin:0; }
.drawer-page .tool-heading-actions { display:flex; align-items:center; justify-content:flex-end; }
.drawer-page .tool-heading .section-label { display: none; }
.drawer-page .tool-heading > * { min-width: 0; max-width: 100%; }
.drawer-page .tool-heading-actions .guide-link { white-space: normal; overflow-wrap: anywhere; }
.drawer-page .tool-heading-actions { min-width: 0; max-width: 100%; flex-wrap: wrap; gap: 8px; }
.drawer-page .tool-heading-actions > * { min-width: 0; max-width: 100%; }
.drawer-page .transform-grid { grid-template-columns: repeat(auto-fit,minmax(100px,1fr)); }
.drawer-page .transform-grid label { min-width: 0; }
.drawer-layout { grid-template-columns: 240px minmax(0,1fr) 228px; height: 660px; min-height: 0; gap: 8px; }
.drawer-tools,.drawer-inspector { min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 10px; }
.drawer-tools { gap: 10px; }
.drawer-tools .tool-group { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 4px; margin: 0; }
.drawer-tools .tool-group { align-content: start; align-self: start; width: 100%; }
.drawer-tools [data-tool] { height: 42px; min-width: 0; }
.drawer-tools [data-tool="line"], .drawer-tools [data-tool="quad"] { display: none !important; }
.tool-options h2,.tool-options h3 { font-family: inherit; }
.tool-group h2 { grid-column: 1/-1; }
.drawer-tools button { font-size: 11px; padding: 7px 6px; min-height: 32px; }
.drawer-tools [data-tool] { display: flex; align-items: center; gap: 4px; }
.drawer-tools [data-tool] svg { width: 14px; height: 14px; flex: 0 0 14px; }
.drawer-tools [data-tool] .tool-name { min-width: 0; white-space: nowrap; text-transform: none; line-height: 1.15; }
.drawer-tools [data-tool] kbd { margin-left: auto; flex: 0 0 auto; }
.drawer-page .drawer-icon-button { width: 32px; height: 32px; padding: 6px; display: inline-flex; align-items: center; justify-content: center; }
.drawer-icon-button svg { width: 18px; height: 18px; }
.drawer-tools .tool-group:first-child button { grid-column: 1/-1; }
.drawer-tools hr { display: none; }
.tool-options { border-top: 1px solid var(--border); padding-top: 10px; }
.tool-options h2,.document-settings summary { font-size: 12px; margin: 0 0 10px; }
.tool-options h3 { font-size: 12px; margin: 8px 0; color: #b7d8e8; }
.tool-options section { display: grid; gap: 8px; }
.tool-options label,.document-settings label { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 5px; font-size: 11px; }
.drawer-page input,.drawer-page select,.drawer-page textarea { max-width: 100%; min-width: 0; color: #ddd; background: #111; border: 1px solid #444; border-radius: 3px; padding: 5px; font-size: 12px; }
.drawer-page input[type=checkbox] { width: auto; }
.drawer-page input[type=range] { width: 100%; padding: 0; }
.drawer-page input[type=number] { width: 76px; }
.drawer-page textarea { width: 100%; }
.drawer-tools .document-settings { border-top: 1px solid var(--border); padding-top: 10px; }
.document-settings label { margin-top: 8px; }
.shape-gallery { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 4px; max-height: 210px; overflow: auto; }
.drawer-tools .shape-gallery button { padding: 0; height: 46px; min-height: 46px; text-align: center; }
.shape-gallery canvas { width: 100%; height: 44px; display: block; }
.canvas-shell,.canvas-shell canvas { min-height: 0; height: 100%; }
.canvas-shell canvas { position: absolute !important; inset: 0; }
.canvas-hint { display: none; }
.drawer-preview-mode .drawer-tools,
.drawer-preview-mode .drawer-inspector,
.drawer-preview-mode .drawer-shortcuts,
.drawer-preview-mode .transform-panel,
.drawer-preview-mode .reference-panel,
.drawer-preview-mode .tools-help { display: none; }
.drawer-preview-toolbar { position:relative; z-index:20; display:flex; align-items:center; justify-content:flex-end; min-height:44px; margin:0 0 10px; }
.drawer-preview-toolbar button { position:relative; z-index:21; }
.drawer-preview-mode .drawer-layout { display:block; height:auto; min-height:0; }
.drawer-page.drawer-preview-mode .tool-heading, .drawer-preview-mode .drawer-footer { display:none; }
.drawer-preview-toolbar { scroll-margin-top:90px; }
.drawer-preview-mode .canvas-shell { position:relative; z-index:1; width:min(100%,calc(72vh * var(--preview-ratio,1.777778))); height:auto; aspect-ratio:var(--preview-ratio,1.777778); min-height:0; margin-inline:auto; overflow:hidden; }
.drawer-preview-mode .canvas-shell canvas { position:absolute !important; inset:0; min-height:0; height:100%; z-index:1; }
.drawer-processing { display:flex; align-items:center; gap:8px; font-size:12px; }
.drawer-processing::before { content: ''; width: 14px; height: 14px; flex: 0 0 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: drawer-spin .75s linear infinite; }
.drawer-page.is-processing .canvas-shell { pointer-events:none; }
.drawer-page.is-processing .file-button { opacity:.5; cursor:wait; }
@keyframes drawer-spin { to { transform: rotate(360deg); } }
.drawer-inspector { gap: 18px; }
.drawer-inspector h2 { font-size: 12px; }
.element-list { max-height: 190px; }
.element-list button { min-height: 28px; font-size: 11px; }
.property-list { gap: 9px; }
.property-list label { font-size: 11px; }
.property-list details { border-top: 1px solid #333; padding-top: 8px; }
.property-list details label { margin-top: 8px; }
.property-list summary { font-size: 12px; cursor: pointer; }
.property-list button { background: #222; border: 1px solid #444; color: #ddd; padding: 6px; }
.drawer-footer { flex-wrap: wrap; }
.drawer-page .geometry-error { color: #f87171; font-size: 12px; margin: 0; }
.drawer-footer > div { flex-wrap: wrap; }
.drawer-footer button { font-size: 10px; padding: 8px; }
.drawer-page .property-note { font-size: 11px; line-height: 1.4; color: #999; margin: 4px 0; }
.drawer-page .import-hint { width: 100%; max-width: 340px; margin: 4px 0; color: #999; font-size: 11px; line-height: 1.35; overflow-wrap: anywhere; }
.save-status { color: #9db7c4; font-size: 11px; min-width: 62px; }
@media (max-width: 1100px) {
  .drawer-layout { grid-template-columns: 240px minmax(0,1fr); height: auto; grid-template-rows: 620px auto; }
  .drawer-inspector { grid-column: 1/-1; display: grid; grid-template-columns: 1fr 1fr; max-height: 400px; }
}
@media (max-width: 720px) {
  body:has([data-drawer]) .site-header { position: static; }
  .drawer-layout { display: grid; grid-template-columns: minmax(0,1fr); grid-template-rows: auto 450px auto; }
  .drawer-tools { display: grid; grid-template-columns: minmax(0,1fr); max-height: 360px; }
  .drawer-tools .tool-options,.drawer-tools .document-settings { grid-column: 1/-1; }
  .drawer-tools .tool-group { margin-bottom: 6px; }
  .drawer-inspector { grid-template-columns: minmax(0,1fr); }
  .drawer-footer > div { gap: 5px; }
  .drawer-page .tool-heading h1 { font-size: 20px; }
  .drawer-page .import-hint { max-width: 100%; font-size: 10px; }
  .drawer-page .tool-heading { grid-template-columns:minmax(0,1fr); align-items:start; }
  .drawer-page .tool-heading-actions { justify-content:flex-start; }
  .drawer-header-actions { justify-items:start; }
  .drawer-preview-mode .canvas-shell { width:100%; height:auto; min-height:0; }
}
.drawer-blk-stats { display:grid; grid-template-columns:auto auto minmax(0,1fr); grid-template-rows:32px 17px 34px; align-items:center; gap:4px 24px; padding:8px 0; border-bottom:1px solid #303030; font-size:12px; letter-spacing:0; }
.drawer-blk-stats > span { font-variant-numeric:tabular-nums; min-width:110px; }
.drawer-blk-stats [data-blk-object-count] { display:inline-block; min-width:48px; text-align:right; }
.drawer-blk-stats button { display:inline-flex; align-items:center; justify-self:start; gap:6px; min-height:32px; }
.drawer-blk-stats button svg, .drawer-brush-warning svg { width:16px; height:16px; flex-shrink:0; }
.drawer-blk-stats p { grid-column:1 / -1; margin:0; font-size:12px; line-height:17px; overflow-wrap:anywhere; }
.drawer-blk-stats [data-blk-limit-warning] { grid-row:2; }
.drawer-blk-stats [data-blk-result] { grid-row:3; }
.drawer-optimize-controls { display:flex; gap:8px; min-width:0; align-items:center; }
.drawer-optimize-controls select { min-width:0; max-width:160px; height:32px; }
.drawer-optimization-result { width:min(480px,calc(100% - 24px)); max-height:80vh; overflow:auto; padding:20px; color:#eee; background:#111; border:1px solid #555; border-radius:4px; }
.drawer-optimization-result::backdrop { background:#0009; }
.drawer-optimization-result header { display:flex; align-items:center; justify-content:space-between; gap:16px; }
.drawer-optimization-result h2 { font-size:18px; margin:0; }
.drawer-optimization-result button { width:32px; height:32px; flex-shrink:0; }
.drawer-optimization-result svg { width:18px; height:18px; }
.drawer-optimization-result dl { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:12px; font-size:14px; }
.drawer-optimization-result dd { margin:0; font-variant-numeric:tabular-nums; }
[data-blk-diagnostics] { max-height:300px; overflow:auto; font-size:12px; }
@media(max-width:700px) {
  .drawer-blk-stats { grid-template-columns:minmax(0,1fr) minmax(0,1fr); grid-template-rows:minmax(32px,auto) 32px 51px 68px; gap:4px 8px; }
  .drawer-optimize-controls { grid-column:1 / -1; grid-row:2; gap:4px; }
  .drawer-optimize-controls select { flex:1; max-width:140px; }
  .drawer-optimize-controls button { padding:6px; }
  .drawer-blk-stats [data-blk-limit-warning] { grid-row:3; }
  .drawer-blk-stats [data-blk-result] { grid-row:4; }
}
.drawer-blk-stats[data-limit-state="near"] [data-blk-object-count], .drawer-blk-stats[data-limit-state="near"] [data-blk-limit-warning] { color:#efcf56; }
.drawer-blk-stats[data-limit-state="reached"] [data-blk-object-count], .drawer-blk-stats[data-limit-state="reached"] [data-blk-limit-warning] { color:#ff7474; font-weight:700; }
.drawer-brush-warning { padding:8px; border-left:2px solid #efcf56; font-size:11px; color:#dedede; overflow-wrap:anywhere; }
.drawer-brush-warning p { margin:0 0 6px; }
.drawer-brush-warning button { width:28px; height:28px; padding:4px; }
