/* Page-specific layout; shared typography, inputs, buttons and tokens come from style.css. */
.paintings-tool { padding-bottom: 1.5rem; }
.painting-intro { text-align: center; color: var(--muted); margin: -1rem 0 2rem; }
.painting-settings { display: grid; grid-template-columns: 1fr 1fr 1.5fr; gap: 1rem; }
.paintings-tool .floating-lable-group { margin-bottom: 0; min-width: 0; }
.paintings-tool select, #painting-editor select { background-color: var(--background-color); color: var(--text-color); }
.paintings-tool .select-label, #painting-editor .select-label { top: 0; font-size: 12px; }
.painting-hint { color: var(--muted); font-size: .85rem; line-height: 1.5; }
.painting-pack-icon-settings { display: flex; gap: 1rem; align-items: center; margin: 1.25rem 0; }
.painting-pack-icon { display: grid; place-items: center; flex: 0 0 96px; width: 96px; height: 96px; padding: .4rem; border: 2px dashed var(--light-gray); border-radius: var(--row-radius); background: transparent; color: var(--text-color); cursor: pointer; }
.painting-pack-icon:hover { border-color: var(--accent-color); }
.painting-pack-icon img { width: 100%; height: 100%; object-fit: contain; min-height: 0; }
.painting-pack-icon svg { width: 32px; height: 32px; fill: currentColor; }
.painting-pack-icon-details { min-width: 0; }
.painting-pack-icon-details p { margin: .3rem 0; }
.painting-pack-icon-details .painting-actions { justify-content: flex-start; }
.painting-pack-icon-details .btn { font-size: .85rem; margin-top: .25rem; box-shadow: none; }
.painting-drop { display: flex; flex-direction: column; gap: .5rem; align-items: center; justify-content: center; width: 100%; padding: 1.5rem; margin-top: 1.5rem; border: 2px dashed var(--light-gray); border-radius: var(--row-radius); background: transparent; color: var(--text-color); cursor: pointer; font: inherit; transition: border-color .2s, background-color .2s; }
.painting-drop:hover, .painting-drop.is-dragging { border-color: var(--accent-color); background: rgba(127,127,127,.06); }
.painting-plus { font-size: 2rem; line-height: 1; color: var(--text-color-secondary); }
.painting-drop:hover .painting-plus, .painting-drop.is-dragging .painting-plus { color: var(--accent-color); }
.painting-drop > span:last-child { font-size: .9rem; color: var(--muted); }
.painting-toolbar { display: grid; grid-template-columns: 1.5fr auto 1fr; gap: .75rem; align-items: center; margin: 1.5rem 0; }
.painting-filter { display: flex; align-items: center; gap: .4rem; font-size: .9rem; white-space: nowrap; }
.painting-filter input { accent-color: var(--accent-color); width: 1rem; height: 1rem; }
.painting-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: .8rem; }
.painting-card { border: var(--input-border); border-radius: var(--row-radius); overflow: hidden; min-width: 0; }
.painting-card.is-custom { border-color: var(--text-color); }
.painting-card-select { display: flex; flex-direction: column; width: 100%; text-align: left; border: 0; background: transparent; color: inherit; padding: .7rem; gap: .5rem; cursor: pointer; font: inherit; }
.painting-card-select:hover { background: rgba(127,127,127,.07); }
.painting-art { height: 110px; display: flex; align-items: center; justify-content: center; width: 100%; background: repeating-conic-gradient(#8881 0% 25%, transparent 0% 50%) 0 0 / 16px 16px; }
.painting-art img { width: 92%; height: 92%; object-fit: contain; image-rendering: pixelated; }
.painting-card-name { font-weight: 600; font-size: .9rem; }
.painting-card-meta { font-size: .75rem; color: var(--muted); }
.painting-card-actions { display: flex; justify-content: space-between; gap: .25rem; padding: 0 .65rem .6rem; }
.painting-card-actions button { display: inline-flex; align-items: center; gap: .25rem; font: inherit; font-size: .75rem; color: inherit; background: transparent; border: 0; border-radius: .3rem; cursor: pointer; padding: .3rem; }
.painting-card-actions button:hover { background: #8882; }
.painting-card-actions svg { width: 16px; height: 16px; fill: currentColor; }
.painting-download-bar { position: sticky; bottom: .75rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; align-items: center; padding: 1rem; margin-top: 1.5rem; background: var(--background-color); border: var(--input-border); border-radius: var(--radius); box-shadow: 0 4px 16px #0002; z-index: 2; }
.painting-actions { display: flex; gap: .65rem; justify-content: flex-end; flex-wrap: wrap; }
.paintings-tool .btn, #painting-editor .btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; cursor: pointer; }
.paintings-tool .btn svg, #painting-editor .btn svg { width: 22px; height: 22px; fill: currentColor; }
.paintings-tool button:disabled, #painting-editor button:disabled { opacity: .55; cursor: not-allowed; }
.painting-warning { border-left: 3px solid var(--error-color); padding: .8rem; background: #ff747410; line-height: 1.5; }
/* Editor reference: the circle generator's pill inputs, raised tracks and green
   square thumbs, scaled down so the artwork remains the primary surface. */
#painting-editor { box-sizing: border-box; padding: 1.25rem; border: var(--input-border); border-radius: var(--radius); background: var(--background-color); color: var(--text-color); width: min(96vw, 1080px); max-width: none; height: min(94dvh, 820px); max-height: none; overflow: hidden; box-shadow: var(--shadow); }
#painting-editor::backdrop { background: #0008; }
.painting-editor-content { height: 100%; display: flex; flex-direction: column; gap: .6rem; min-height: 0; }
.painting-editor-content p, .painting-editor-content h2 { margin: 0; }
.painting-editor-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.painting-editor-heading h2 { font-size: 1.35rem; }
#editor-description { font-size: .85rem; color: var(--muted); }
.painting-editor-layout { display: grid; grid-template-columns: minmax(220px, .8fr) minmax(0, 1.6fr); gap: 1.5rem; flex: 1; min-height: 0; }
.painting-editor-workspace { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: .5rem; }
.painting-editor-tools { display: flex; align-items: center; gap: .25rem; flex-shrink: 0; }
.painting-editor-tools #replace-source { margin-left: auto; }
.painting-icon-button { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: transparent; border: 0; color: inherit; cursor: pointer; padding: .35rem; flex-shrink: 0; }
.painting-icon-button svg { fill: currentColor; width: 21px; height: 21px; }
.painting-icon-button:hover:not(:disabled) { background: #8882; }
.painting-editor-footer { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-shrink: 0; padding-top: .5rem; border-top: var(--input-border); }
.painting-editor-footer .btn { margin: 0; font-size: .85rem; padding: .6rem .9rem; }
.painting-editor-footer > .painting-hint { font-size: .75rem; }
.painting-picker { min-width: 0; min-height: 0; margin: 0; padding: .75rem; border: var(--input-border); border-radius: var(--row-radius); display: flex; flex-direction: column; gap: .65rem; }
.painting-picker legend { padding: 0 .35rem; font-weight: 600; font-size: .9rem; }
.painting-size-label { font-size: .8rem; color: var(--muted); }
#editor-size { box-sizing: border-box; padding: .55rem; width: 100%; border: var(--input-border); border-radius: var(--row-radius); font: inherit; font-size: .85rem; }
#picker-heading { margin: 0; font-size: .85rem; }
.painting-picker-options { display: grid; grid-template-columns: repeat(var(--picker-columns, 3), minmax(0, 1fr)); grid-template-rows: repeat(var(--picker-rows, 1), minmax(0, 1fr)); gap: .4rem; flex: 0 1 auto; min-height: 0; align-content: start; }
.painting-picker-option { position: relative; display: flex; flex-direction: column; gap: .25rem; padding: .3rem; border: var(--input-border); border-radius: var(--row-radius); cursor: pointer; min-width: 0; min-height: 0; overflow: hidden; }
.painting-picker-option input { position: absolute; top: .2rem; left: .2rem; width: .7rem; height: .7rem; margin: 0; accent-color: var(--accent-color); }
.painting-picker-option .painting-art { flex: 0 1 56px; min-height: 24px; height: 56px; background: transparent; }
.painting-picker-option .painting-card-name { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; font-size: .7rem; line-height: 1.15; min-height: 2.3em; overflow-wrap: anywhere; text-align: center; flex-shrink: 0; }
.painting-picker-option:has(input:checked) { border-color: var(--accent-color); box-shadow: inset 0 0 0 1px var(--accent-color); background: #8881; }
.painting-picker-option:has(input:focus-visible) { outline: 2px solid var(--text-color); outline-offset: 2px; }
.painting-picker-option:has(input:disabled) { opacity: .4; cursor: not-allowed; }
.painting-picker .painting-hint { font-size: .75rem; }
.painting-crop-stage { --preview-height: clamp(130px, 30dvh, 300px); display: grid; place-items: center; height: var(--preview-height); flex: 1 1 var(--preview-height); min-height: 100px; position: relative; background: repeating-conic-gradient(#8881 0% 25%, transparent 0% 50%) 0 0 / 16px 16px; border-radius: var(--row-radius); touch-action: none; user-select: none; }
.painting-crop-frame { position: relative; width: min(calc(100% - 48px), calc((var(--preview-height) - 72px) * var(--crop-ratio, 1))); aspect-ratio: var(--crop-ratio, 1); box-shadow: 0 0 0 1px var(--text-color), 0 2px 16px #0002; }
@supports (width: 1cqh) {
    .painting-crop-stage { container-type: size; }
    .painting-crop-frame { width: min(calc(100% - 48px), calc((100cqh - 64px) * var(--crop-ratio, 1))); }
}
#crop-preview { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; border-radius: 0; }
.is-dragging #crop-preview { cursor: grabbing; }
.painting-crop-handle, .painting-rotate-handle { position: absolute; box-sizing: border-box; width: 12px; height: 12px; border: 2px solid var(--background-color); border-radius: 3px; background: var(--accent-color); padding: 0; box-shadow: 0 0 0 1px var(--accent-color); touch-action: none; }
.painting-crop-handle::after, .painting-rotate-handle::after { content: ''; position: absolute; inset: -8px; }
.painting-crop-handle.nw { left: -6px; top: -6px; cursor: nwse-resize; }
.painting-crop-handle.ne { right: -6px; top: -6px; cursor: nesw-resize; }
.painting-crop-handle.sw { left: -6px; bottom: -6px; cursor: nesw-resize; }
.painting-crop-handle.se { right: -6px; bottom: -6px; cursor: nwse-resize; }
.painting-rotate-handle { left: calc(50% - 6px); top: -30px; border-radius: 50%; cursor: crosshair; }
.painting-rotate-handle::before { content: ''; position: absolute; width: 1px; height: 17px; background: var(--accent-color); top: 10px; left: 4px; }
/* Dashboard title-image upload surface; the editor has its own editing tools. */
.painting-crop-stage.is-empty { background: transparent; }
#crop-empty { position: absolute; inset: 0; display: flex; flex-direction: column; gap: .5rem; font: inherit; font-size: .85rem; color: var(--text-color-secondary); padding: .75rem; text-align: center; }
#crop-empty .add-photo-icon { flex-shrink: 0; }
#editor-upload-help { color: var(--muted); font-size: .7rem; }
#crop-empty.is-dragging { border-color: var(--accent-color); background-color: color-mix(in srgb, var(--accent-color) 5%, var(--background-color)); }
#slot-hint, #resolution-hint { font-size: .75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex-shrink: 0; }
.painting-crop-controls { display: grid; gap: .55rem; flex-shrink: 0; }
.painting-control-heading { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .25rem; font-size: .8rem; }
.painting-number { display: inline-flex; align-items: center; border-radius: 20px; background: var(--background-color); box-shadow: 0 1px 8px #0002; padding-right: .5rem; color: var(--muted); font-size: .75rem; }
.painting-number input { box-sizing: border-box; width: 60px; height: 26px; border: 0; border-radius: 20px; text-align: center; padding: 0 .2rem 0 .5rem; background: transparent; color: var(--text-color); font: inherit; font-weight: 600; }
.painting-control-range { display: flex; align-items: center; gap: .65rem; }
.painting-control-range button { display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 6px; font-size: 1.1rem; font-weight: bold; background: var(--accent-color); color: #000; box-shadow: 0 1px 8px #0002; cursor: pointer; flex-shrink: 0; }
.painting-control-range input[type=range] { appearance: none; -webkit-appearance: none; flex: 1; min-width: 0; width: 100%; height: 26px; background: transparent; padding: 0; margin: 0; cursor: pointer; }
.painting-control-range input::-webkit-slider-runnable-track { height: 10px; background: var(--background-color); border-radius: 12px; box-shadow: 0 1px 8px #0003; }
.painting-control-range input::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 22px; height: 22px; margin-top: -6px; border: 0; border-radius: 6px; background: var(--accent-color); box-shadow: 0 1px 8px #0002; }
.painting-control-range input::-moz-range-track { height: 10px; background: var(--background-color); border-radius: 12px; box-shadow: 0 1px 8px #0003; }
.painting-control-range input::-moz-range-thumb { width: 22px; height: 22px; border: 0; border-radius: 6px; background: var(--accent-color); box-shadow: 0 1px 8px #0002; }
@media (min-width: 900px) and (min-height: 481px) {
    .painting-crop-controls { grid-template-columns: 1fr 1fr; gap: .7rem 1.25rem; }
}
.is-icon-editor .painting-editor-layout { grid-template-columns: 1fr; }
.is-icon-editor .painting-editor-workspace { max-width: 650px; width: 100%; margin: auto; height: 100%; }
.paintings-tool :focus-visible, #painting-editor :focus-visible { outline: 2px solid var(--text-color); outline-offset: 3px; }
[hidden] { display: none !important; }
@media (max-width: 700px) {
    .painting-settings { grid-template-columns: 1fr; gap: 1.25rem; }
    .painting-toolbar { grid-template-columns: 1fr 1fr; }
    .painting-toolbar > .floating-lable-group:first-child { grid-column: 1 / -1; }
    .painting-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .painting-download-bar { bottom: 0; border-radius: .8rem; }
    .painting-download-bar .painting-actions { width: 100%; }
    .painting-download-bar .btn { flex: 1; padding: .6rem .8rem; }
    #painting-editor { padding: .75rem; width: 98vw; height: 96dvh; }
    .painting-editor-layout { grid-template-columns: minmax(110px, .7fr) minmax(0, 1.3fr); gap: .65rem; }
    .painting-picker { padding: .4rem; gap: .4rem; }
    .painting-picker-options { gap: .35rem; }
    .painting-picker-option { padding: .25rem; }
    .painting-picker-option .painting-card-name { font-size: .6rem; }
    .painting-picker-option .painting-art { height: 40px; flex-basis: 40px; }
    .painting-editor-heading h2 { font-size: 1.1rem; }
    .painting-editor-footer > .painting-hint, .painting-picker-note { display: none; }
    .painting-editor-footer { justify-content: flex-end; }
    .painting-editor-tools { gap: 0; flex-wrap: wrap; }
    .painting-icon-button { width: 28px; height: 30px; padding: .2rem; }
    .painting-icon-button svg { width: 18px; height: 18px; }
    .painting-number input { width: 45px; }
    .painting-control-range { gap: .35rem; }
    .painting-crop-stage { --preview-height: clamp(140px, 24dvh, 230px); }
}
@media (max-height: 700px) {
    .painting-crop-stage { --preview-height: clamp(100px, 24dvh, 170px); }
    .painting-crop-controls { gap: .3rem; }
    .painting-control-heading { margin-bottom: 0; }
    .painting-editor-content { gap: .35rem; }
    .painting-editor-footer { justify-content: flex-end; }
    .painting-editor-footer > .painting-hint, .painting-picker-note { display: none; }
}
@media (max-height: 480px) and (min-width: 700px) {
    .painting-editor-workspace { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 30px minmax(0, 1fr) 18px; gap: .35rem .75rem; }
    .painting-editor-tools { grid-column: 1; }
    .painting-crop-stage { grid-column: 1; grid-row: 2; height: 100%; }
    #slot-hint { grid-column: 1; grid-row: 3; }
    .painting-crop-controls { grid-column: 2; grid-row: 1 / 4; }
    #resolution-hint { display: none; }
}

@media (max-height: 480px) {
    .painting-picker { gap: .3rem; padding: .4rem; }
    .painting-size-label, #picker-heading, #picker-selected { display: none; }
    #editor-size { padding: .25rem; }
    .painting-picker-option { padding: .15rem; gap: .1rem; }
    .painting-picker-option .painting-card-name { -webkit-line-clamp: 1; min-height: 1.15em; font-size: .6rem; }
}
@media (max-width: 400px) {
    .painting-editor-tools .painting-icon-button { width: calc(100% / 6); height: 28px; flex-shrink: 1; }
    .painting-control-heading { font-size: .7rem; line-height: 1.2; }
    .painting-number input { width: 38px; }
    .painting-number { padding-right: .3rem; }
    .painting-control-range { gap: .3rem; }
    .painting-control-range button { width: 22px; height: 22px; }
    .painting-control-range input[type=range] { height: 22px; }
    .painting-crop-controls { gap: .2rem; }
    #editor-description { font-size: .75rem; line-height: 1.3; }
    .painting-editor-footer .btn { padding: .45rem .6rem; }
}
@media (max-width: 400px) and (max-height: 650px) {
    .painting-size-label, #picker-heading, #picker-selected { display: none; }
    .painting-picker-option .painting-card-name { -webkit-line-clamp: 2; }
    .painting-crop-stage { min-height: 80px; }
    #crop-empty { gap: .2rem; font-size: .7rem; padding: .4rem; }
    #crop-empty .add-photo-icon { width: 32px; height: 32px; }
    #editor-upload-help { font-size: .6rem; }
}
