/* Pixel art editor: drawing stage, option bars, palette, layer and frame lists. Loaded only on /tools/pixel-art/. */
.pa-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--matrix-space-8) var(--matrix-space-16); min-width: 0; }
.pa-field { display: grid; gap: 4px; min-width: 0; }
.pa-field > label { font-size: var(--matrix-type-caption); }
.pa-field--grow { flex: 1 1 220px; }
.pa-field--grow > .matrix-input { width: 100%; }
.pa-field input[type="color"] { width: 56px; height: var(--matrix-control-min-height); padding: 2px; border: 1px solid var(--matrix-control-border); border-radius: var(--matrix-radius-control); background: var(--matrix-surface); }
.pa-num { width: 6.5em; }
.pa-hex { width: 7.5em; font-family: var(--matrix-font-mono); }
#pa-alpha { width: 5em; }
.pa-view { gap: 0 var(--matrix-space-16); }
.pa-view > .pa-check-row { padding-bottom: 0; }
.pa-note { margin: 0; font-size: var(--matrix-type-caption); }
.pa-msg { margin: 0; min-height: 1.5em; font-size: var(--matrix-type-caption); font-weight: 500; }
.pa-msg.is-error { color: var(--matrix-danger); }
.pa-inline { display: flex; flex-wrap: wrap; align-items: center; gap: var(--matrix-space-4) var(--matrix-space-16); }
.pa-inline legend { width: 100%; }
.pa-inline .option-row { min-height: 0; }
.pa-inline > .pa-bar, .pa-inline > .pa-field { flex: 1 1 100%; }
/* A long label wraps beside its checkbox, and tokens.css's 40 px input min-height must not push the box down. */
#options .pa-check-row { flex-wrap: nowrap; align-items: flex-start; min-height: 0; }
#options .pa-check-row > input { flex: none; min-height: 0; margin-top: 3px; }
.pa-bar > .pa-check-row { padding-bottom: 9px; }

/* the canvas with its tools, colours and layers beside it on a wide screen, below it on a narrow one */
.pa-work { display: grid; gap: var(--matrix-space-16); min-width: 0; }
.pa-side { display: grid; gap: var(--matrix-space-16); min-width: 0; align-content: start; }
@media (min-width: 1000px) {
  .pa-work { grid-template-columns: minmax(0, 1fr) 360px; grid-template-rows: auto 1fr; align-items: start; }
  .pa-work > .pa-canvas-block { grid-column: 1; grid-row: 1; }
  .pa-work > .pa-side { grid-column: 2; grid-row: 1 / span 2; }
  .pa-work > #pa-frames-block { grid-column: 1; grid-row: 2; }
}

/* the drawing stage: the canvas never makes the page wider, a large zoom scrolls inside the stage */
.pa-canvas-block { display: grid; gap: var(--matrix-space-8); min-width: 0; }
.pa-stage { max-width: 100%; max-height: 76vh; overflow: auto; padding: 8px; border: 1px solid var(--matrix-border); border-radius: var(--matrix-radius-control); background: var(--matrix-surface-subtle); }
.pa-canvas { display: block; margin: 0 auto; image-rendering: pixelated; touch-action: none; cursor: crosshair; }
.pa-canvas--picker { cursor: copy; }

/* palette */
.pa-swatches { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px; }
.pa-swatch { width: 32px; height: 32px; min-height: 0; padding: 0; overflow: hidden; border: 1px solid var(--matrix-control-border); border-radius: 6px; background-color: #ffffff; background-image: conic-gradient(#d4d4da 25%, #ffffff 0 50%, #d4d4da 0 75%, #ffffff 0); background-size: 12px 12px; }
.pa-swatch-fill { display: block; width: 100%; height: 100%; }
.pa-swatch[aria-pressed="true"] { outline: 3px solid var(--matrix-text); outline-offset: 2px; }
@media (pointer: coarse) { .pa-swatch { width: 40px; height: 40px; } }

/* layers: the top of the list is in front */
.pa-layers { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.pa-layer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px var(--matrix-space-16); padding: 6px 10px; border: 1px solid var(--matrix-border); border-radius: var(--matrix-radius-control); }
.pa-layer.is-active { border-color: var(--matrix-brand); background: var(--matrix-selected); }
.pa-layer-name { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 140px; }
.pa-layer-name label { font-weight: 500; overflow-wrap: anywhere; }
.pa-layer-flags { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--matrix-space-16); }
.pa-check { display: inline-flex; align-items: center; gap: 6px; }
.pa-layer input[type="radio"], .pa-layer input[type="checkbox"] { width: 20px; height: 20px; min-height: 0; margin: 0; accent-color: var(--matrix-brand); }
.pa-opacity { display: inline-flex; align-items: center; gap: 4px; }
.pa-opacity .pa-num { width: 5em; }

/* frames: one strip that scrolls sideways */
.pa-frames { list-style: none; margin: 0; padding: 8px; display: flex; gap: 8px; max-width: 100%; overflow-x: auto; border: 1px solid var(--matrix-border); border-radius: var(--matrix-radius-control); }
.pa-frame { display: grid; justify-items: center; gap: 4px; min-width: 68px; padding: 6px; border: 1px solid var(--matrix-control-border); border-radius: var(--matrix-radius-control); background: var(--matrix-surface); }
.pa-frame[aria-current="true"] { border-color: var(--matrix-brand); background: var(--matrix-selected); box-shadow: inset 0 0 0 1px var(--matrix-brand); }
.pa-frame-caption { font-size: var(--matrix-type-caption); white-space: nowrap; }
.pa-thumb, .pa-preview { display: block; image-rendering: pixelated; background-color: #ffffff; background-image: conic-gradient(#d4d4da 25%, #ffffff 0 50%, #d4d4da 0 75%, #ffffff 0); background-size: 8px 8px; }
.pa-preview { border: 1px solid var(--matrix-border); }
.pa-preview-block { display: grid; gap: var(--matrix-space-8); justify-items: start; }
.pa-tags { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.pa-tag { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--matrix-space-8); }

.pa-details { border: 1px solid var(--matrix-border); border-radius: var(--matrix-radius-control); padding: 8px 12px; }
.pa-details > summary { cursor: pointer; font-weight: 500; }
.pa-details > * + * { margin-top: var(--matrix-space-8); }
.pa-files-note { margin: 0 0 var(--matrix-space-8); font-size: var(--matrix-type-caption); }
/* A choice's words stay beside its box at any width (Lucy's round 1, L02 and L07: at 390 px the shell's row wrapped a long
   label below its box, the dot alone on its line). */
#options .option-row:has(> input[type="checkbox"], > input[type="radio"]) { flex-wrap: nowrap; }
#options .option-row:has(> input[type="checkbox"], > input[type="radio"]) > label { min-width: 0; }
/* "Make the files" in reach on a phone (fb_e13cbb68): a bar kept at the bottom of the screen while the editor is on it; a wide
   screen shows the export beside the work and needs no bar */
.pa-dock { position: sticky; bottom: 0; z-index: 3; display: flex; justify-content: flex-end; padding: var(--matrix-space-8) 0; background: var(--matrix-surface); border-top: 1px solid var(--matrix-border); }
@media (min-width: 1000px) { .pa-dock { display: none; } }
