.paint-container {
    color-scheme: light dark;
    --paint-bg: #ffffff;
    --paint-text: #111827;
    --paint-border: #d1d5db;
    --paint-toolbar-bg: #f9fafb;
    --paint-btn-bg: #ffffff;
    --paint-btn-hover: #f3f4f6;
    --paint-btn-active: #e5e7eb;
    --paint-focus-ring: 0 0 0 2px rgba(59, 130, 246, 0.5);
    --paint-shadow: rgba(0, 0, 0, 0.1);
}

:where(.dark, .dark-theme, [data-theme="dark"]) .paint-container {
    --paint-bg: #1f2937;
    --paint-text: #f9fafb;
    --paint-border: #4b5563;
    --paint-toolbar-bg: #111827;
    --paint-btn-bg: #374151;
    --paint-btn-hover: #4b5563;
    --paint-btn-active: #6b7280;
    --paint-focus-ring: 0 0 0 2px rgba(96, 165, 250, 0.6);
    --paint-shadow: rgba(0, 0, 0, 0.5);
}

.paint-container {
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    box-sizing: border-box;
    border: 1px solid var(--paint-border);
    border-radius: 0.5rem;
    overflow: hidden;
    background-color: var(--paint-bg);
    color: var(--paint-text);
    display: flex;
    flex-direction: column;
}

.paint-toolbar {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.5rem;
    background-color: var(--paint-toolbar-bg);
    border-bottom: 1px solid var(--paint-border);
    flex-shrink: 0;
}

.paint-tool-group,
.paint-action-group {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.paint-toolbar button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 0.375rem;
    background-color: transparent;
    color: var(--paint-text);
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.paint-toolbar button:hover {
    background-color: var(--paint-btn-hover);
    border-color: var(--paint-border);
}

.paint-toolbar button:focus {
    outline: none;
    box-shadow: var(--paint-focus-ring);
}

.paint-toolbar button:active {
    background-color: var(--paint-btn-active);
}

.paint-toolbar button.active {
    background-color: var(--paint-btn-active);
    border-color: var(--paint-border);
    box-shadow: inset 0 1px 2px var(--paint-shadow);
}

.paint-toolbar button:disabled {
    opacity: 0.35;
    pointer-events: none;
}

.paint-toolbar button svg {
    width: 18px;
    height: 18px;
}

.paint-divider {
    width: 1px;
    height: 1.5rem;
    background-color: var(--paint-border);
    margin: 0 0.25rem;
    flex-shrink: 0;
}

.paint-toolbar input[type="color"] {
    width: 2rem;
    height: 2rem;
    padding: 0.125rem;
    border: 1px solid var(--paint-border);
    border-radius: 0.375rem;
    background-color: var(--paint-btn-bg);
    cursor: pointer;
}

.paint-toolbar input[type="color"]:focus {
    outline: none;
    box-shadow: var(--paint-focus-ring);
}

.paint-canvas-area {
    overflow: hidden;
    background-color: var(--paint-bg);
}

.paint-canvas-area canvas {
    display: block;
    cursor: crosshair;
    box-shadow: 0 0 0 1px var(--paint-border);
}
