.post-draw-body {
    padding: 18px;
    display: grid;
    grid-template-columns: minmax(280px, 320px) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
    max-height: min(78vh, 860px);
}

.post-draw-sidebar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
    max-height: 100%;
    overflow: auto;
    padding-right: 4px;
    scrollbar-gutter: stable;
}

.post-draw-canvas-column {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

.post-draw-section {
    margin-bottom: 0;
    border: 1px solid #30343c;
    background: #1d2026;
    border-radius: 18px;
    overflow: hidden;
}

.post-draw-section[open] {
    box-shadow: inset 0 1px 0 #2b3038;
}

.post-draw-section-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    list-style: none;
    cursor: pointer;
    padding: 14px 16px;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.01em;
    user-select: none;
    background: #1d2026;
}

.post-draw-section-summary::-webkit-details-marker {
    display: none;
}

.post-draw-section-value {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 12px;
    font-weight: 600;
}

.post-draw-section-value::after {
    content: '';
    width: 8px;
    height: 8px;
    border-right: 2px solid rgba(255, 255, 255, 0.45);
    border-bottom: 2px solid rgba(255, 255, 255, 0.45);
    transform: rotate(45deg) translateY(-2px);
    transition: transform 0.2s ease;
}

.post-draw-section[open] .post-draw-section-value::after {
    transform: rotate(-135deg) translateY(2px);
}

.post-draw-section-panel {
    padding: 0 18px 18px;
    max-height: 220px;
    overflow: auto;
    scrollbar-gutter: stable;
    background: #1d2026;
}

.post-draw-toolbar-tools,
.post-draw-toolbar-backgrounds {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.post-draw-section-panel::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.post-draw-section-panel::-webkit-scrollbar-track {
    background: #191c21;
}

.post-draw-section-panel::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
}

.post-draw-toolbar-tools {
    justify-content: flex-start;
}

.post-draw-tool,
.post-draw-background {
    appearance: none;
    border: 1px solid #3a3f49;
    background: #252a31;
    color: rgba(255, 255, 255, 0.8);
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
    font-family: inherit;
}

.post-draw-tool:active,
.post-draw-background:active,
.post-draw-action:active,
.post-draw-size-btn:active,
.post-draw-swatch:active {
    transform: translateY(0) scale(0.98);
}

.post-draw-tool:hover,
.post-draw-background:hover {
    transform: none;
    border-color: #fbbf24;
    background: #252a31;
    color: #fff;
    box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.14);
}

.post-draw-tool.active,
.post-draw-background.active {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #000;
    border-color: rgba(251, 191, 36, 0.3);
}

.post-draw-control-stack {
    display: grid;
    gap: 14px;
}

.post-draw-control-row {
    display: grid;
    gap: 8px;
}

.post-draw-control-row label,
.post-draw-control-row > span,
label.post-draw-range {
    color: rgba(255, 255, 255, 0.82);
    font-size: 12px;
    font-weight: 700;
}

.post-draw-control-row label,
label.post-draw-range span {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

label.post-draw-range {
    display: grid;
    gap: 8px;
}

.post-draw-control-row label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

label.post-draw-range input[type="range"],
input.post-draw-range {
    width: 100%;
    accent-color: #fbbf24;
    cursor: pointer;
}

.post-draw-size-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.post-draw-size-btn {
    appearance: none;
    border: 1px solid #3a3f49;
    background: #252a31;
    color: rgba(255, 255, 255, 0.82);
    border-radius: 999px;
    padding: 7px 10px;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.post-draw-size-btn:hover {
    transform: none;
    border-color: #fbbf24;
    background: #252a31;
    color: #fff;
    box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.14);
}

.post-draw-size-btn.active {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #000;
    border-color: rgba(251, 191, 36, 0.3);
}

.post-draw-tool {
    padding-inline: 14px;
}

.post-draw-custom-color {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    grid-column: 1 / -1;
    width: 100%;
    margin-top: 4px;
    border: 1px solid #3a3f49;
    background: #252a31;
    color: rgba(255, 255, 255, 0.8);
    border-radius: 14px;
    padding: 9px 12px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.post-draw-custom-color span {
    white-space: nowrap;
}

.post-draw-custom-color input[type="color"] {
    width: 42px;
    height: 30px;
    border: 1px solid #3a3f49;
    background: #252a31;
    padding: 2px;
    border-radius: 10px;
    cursor: pointer;
}

.post-draw-custom-color input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.post-draw-custom-color input[type="color"]::-webkit-color-swatch {
    border: 0;
    border-radius: 8px;
}

.post-draw-toolbar-backgrounds {
    margin-top: 4px;
}

.post-draw-toolbar-backgrounds .post-draw-background {
    min-width: 100px;
}

.post-draw-stage {
    position: relative;
    border-radius: 22px;
    overflow: auto;
    border: 1px solid #30343c;
    background: #15181d;
    flex: 1 1 auto;
    max-height: min(62vh, 720px);
    scrollbar-gutter: stable;
    text-align: center;
}

.post-draw-stage canvas {
    display: block;
    margin: 0 auto;
    width: 100%;
    height: auto;
    max-width: none;
    touch-action: none;
    cursor: crosshair;
}

.post-draw-swatches {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(32px, max-content));
    align-items: center;
    gap: 12px;
    padding: 4px 4px 6px;
}

.post-draw-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    padding: 0;
    border: 2px solid rgba(255, 255, 255, 0.12);
    background: var(--swatch-color);
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.08), 0 0 0 0 rgba(251, 191, 36, 0);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.post-draw-swatch:hover {
    transform: none;
    border-color: rgba(251, 191, 36, 0.34);
}

.post-draw-swatch.active {
    outline: 0;
    border-color: #f8fafc;
    box-shadow: inset 0 0 0 2px rgba(15, 23, 42, 0.2), 0 0 0 3px #fbbf24;
}

@media (max-width: 640px) {
    .post-draw-modal {
        align-items: stretch;
        padding: 8px;
    }

    .post-draw-panel {
        width: 100%;
        max-height: calc(100dvh - 16px);
        border-radius: 16px;
        display: flex;
        flex-direction: column;
    }

    .post-draw-header {
        padding: 14px;
        flex: 0 0 auto;
    }

    .post-draw-header h3 {
        font-size: 16px;
    }

    .post-draw-body {
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(0, 1fr);
        gap: 10px;
        padding: 10px;
        max-height: none;
        min-height: 0;
        overflow: auto;
    }

    .post-draw-sidebar {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        max-height: none;
        overflow: visible;
        padding-right: 0;
        order: 2;
    }

    .post-draw-tool,
    .post-draw-background {
        flex: 1 1 auto;
        text-align: center;
        min-height: 38px;
        padding: 9px 10px;
    }

    .post-draw-custom-color {
        width: 100%;
        justify-content: space-between;
    }

    .post-draw-section-summary {
        padding: 11px 12px;
        font-size: 12px;
    }

    .post-draw-section-panel {
        max-height: 180px;
        padding: 0 12px 12px;
    }

    .post-draw-section {
        border-radius: 14px;
    }

    .post-draw-section[open] {
        grid-column: 1 / -1;
    }

    .post-draw-canvas-column {
        order: 1;
        gap: 10px;
        min-height: 0;
    }

    .post-draw-stage {
        max-height: 42dvh;
        border-radius: 16px;
        min-height: 210px;
    }

    .post-draw-actions {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    .post-draw-action,
    .post-draw-zoom-value {
        width: 100%;
        min-width: 0;
        min-height: 38px;
        padding: 9px 8px;
        font-size: 12px;
    }

    .post-draw-action.primary {
        grid-column: 1 / -1;
    }

    .post-draw-swatches {
        grid-template-columns: repeat(auto-fit, minmax(36px, 1fr));
        gap: 12px;
    }

    .post-draw-swatch {
        justify-self: center;
        width: 30px;
        height: 30px;
    }
}

@media (max-width: 420px) {
    .post-draw-sidebar {
        grid-template-columns: 1fr;
    }

    .post-draw-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .post-draw-zoom-value {
        order: -1;
        grid-column: 1 / -1;
    }

    .post-draw-stage {
        max-height: 38dvh;
    }
}

.post-draw-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 0;
}

.post-draw-zoom-value {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 58px;
    height: 36px;
    border: 1px solid #3a3f49;
    border-radius: 10px;
    background: #1d2026;
    color: rgba(255, 255, 255, 0.78);
    font-size: 12px;
    font-weight: 800;
}

.post-draw-action.secondary {
    background: #252a31;
    border-color: #3a3f49;
}

.post-draw-action.secondary:hover {
    background: #252a31;
    border-color: #fbbf24;
    box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.14);
    transform: none;
}

.post-draw-action.primary:hover {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    transform: none;
}

.post-draw-close {
    background: #252a31;
    border-color: #3a3f49;
}

.post-draw-close:hover {
    background: #252a31;
    border-color: #ef4444;
    transform: none;
}

.post-draw-action:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    transform: none;
}

@media (max-width: 640px) {
    .post-draw-modal {
        align-items: center;
        padding: 6px;
    }

    .post-draw-panel {
        height: auto;
        max-height: calc(100dvh - 12px);
    }

    .post-draw-body {
        display: flex;
        flex-direction: column;
        overflow: auto;
    }

    .post-draw-stage {
        min-height: 0;
        max-height: 36dvh;
    }

    .post-draw-actions {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    .post-draw-action,
    .post-draw-zoom-value {
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 420px) {
    .post-draw-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .post-draw-zoom-value,
    .post-draw-action.primary {
        grid-column: 1 / -1;
    }
}
