.textures { padding: 8px 12px 10px; }

.center:not(.bottom-shut):has(.pane[data-panel="build"]:not([hidden]) > .build-pane > .textures.painting) {
  grid-template-rows: auto minmax(0, 1fr) 4px max(var(--bottom, var(--bottom-default, 248px)), min(388px, 58vh));
}

.textures .tx-painter {
  display: grid;
  grid-template-columns: 232px auto 238px;
  grid-template-rows: 40px auto;
  grid-template-areas: "head canvas paint" "set canvas paint";
  gap: 6px 12px;
  justify-content: start;
  align-items: start;
}
.textures .tx-painter.narrow { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; grid-template-areas: "head" "canvas" "paint" "set"; gap: 8px; }
.textures .tx-painter.narrow .tx-paint, .textures .tx-painter.narrow .tx-set { width: 100%; max-width: 384px; }
.textures .tx-painter.narrow.beside { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "head head" "canvas paint" "set set"; gap: 8px 12px; }
.textures .tx-painter.narrow.beside .tx-paint { max-width: 300px; }

.textures .tx-head { grid-area: head; display: flex; align-items: center; gap: 10px; min-width: 0; }
.textures .tx-head .title { font-size: 16px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.textures .tx-set { grid-area: set; min-width: 0; }
.textures .tx-set .row { padding-left: 0; padding-right: 0; }
.textures .tx-set .row.stack > .label { color: var(--text); }
.textures .tx-set .choices { flex: 1 1 auto; }
.textures .tx-set .build .grid12 { grid-template-columns: repeat(12, 17px); }
.textures .tx-set .build .grid12 button { width: 17px; height: 17px; }
.textures .slider.off { pointer-events: none; }
.textures .slider.off .track { background: var(--disabled); }
.textures .slider.off .fill, .textures .slider.off .thumb { display: none; }
.textures .slider.off .readout { color: var(--disabled-text); }

.textures .tx-canvas-box { grid-area: canvas; padding: 4px; background: var(--button); line-height: 0; justify-self: start; }
.textures .tx-canvas { display: block; touch-action: none; cursor: crosshair; }
.textures .tx-canvas.locked { cursor: default; }

.textures .tx-paint { grid-area: paint; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.textures .tx-paint .choices { flex-wrap: nowrap; }
.textures .tx-paint .choices .btn { padding: 0 6px; }
.textures .tx-line { display: flex; align-items: center; gap: 4px; min-width: 0; }
.textures .tx-line .btn.small { height: 30px; background: var(--tile); }
.textures .tx-line .btn.small.on { background: var(--accent); }
.textures .tx-line .btn.small:disabled { background: var(--disabled); }
.textures .tx-line .field { flex: 1 1 0; }
.textures .tx-swatches { display: grid; grid-template-columns: repeat(12, 18px); gap: 2px; }
.textures .tx-swatches button { width: 18px; height: 18px; padding: 0; }
.textures .tx-swatches button.on { outline: 2px solid var(--text); outline-offset: 0; position: relative; z-index: 1; }
.textures .tx-swatches button:disabled { opacity: 0.35; }

.textures.tx-import { padding: 4px 0 0; display: grid; gap: 12px; justify-items: center; }
.textures.tx-import .tx-preview { width: 256px; height: 256px; display: block; image-rendering: pixelated; outline: 4px solid var(--button); }
.textures.tx-import .actions { justify-self: stretch; }

@media (max-width: 860px) {
  .center:not(.bottom-shut):has(.pane[data-panel="build"]:not([hidden]) > .build-pane > .textures.painting) {
    grid-template-rows: auto minmax(0, 1fr) 4px max(var(--bottom, var(--bottom-default, 248px)), min(444px, 58vh));
  }
}
#app.compact:not(.side) .center:not(.bottom-shut):has(.pane[data-panel="build"]:not([hidden]) > .build-pane > .textures.painting) {
  grid-template-rows: auto 0 0 minmax(0, 1fr);
}
#app.side .center:not(.bottom-shut):has(.pane[data-panel="build"]:not([hidden]) > .build-pane > .textures.painting) {
  grid-template-columns: minmax(0, 1fr) 4px min(74%, 680px);
}

#app.coarse .textures .tx-line .btn.small { height: 38px; }
#app.coarse .textures .tx-swatches { grid-template-columns: repeat(12, minmax(0, 26px)); }
#app.coarse .textures .tx-swatches button { width: auto; height: auto; aspect-ratio: 1; }
#app.coarse .textures .tx-set .build .grid12 { grid-template-columns: repeat(12, minmax(0, 26px)); }
#app.coarse .textures .tx-set .build .grid12 button { width: auto; height: auto; aspect-ratio: 1; }
