section {
    margin-bottom: 40px;
}

/* ── Skeleton loading placeholders ── */
@keyframes skeletonPulse {
    0%, 100% { opacity: 0.06; }
    50%      { opacity: 0.12; }
}

.skeleton-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 140px;
}

.skeleton-line {
    height: 14px;
    border-radius: 4px;
    background: var(--text-color);
    animation: skeletonPulse 1.5s ease-in-out infinite;
}

.skeleton-line-title {
    width: 60%;
    height: 18px;
}

.skeleton-line-short {
    width: 40%;
}

.skeleton-line-medium {
    width: 75%;
}

.skeleton-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.skeleton-btn {
    height: 32px;
    flex: 1;
    border-radius: var(--radius-sm);
    background: var(--text-color);
    animation: skeletonPulse 1.5s ease-in-out infinite;
}

.displays-grid,
.devices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.devices-grid > .loading,
.devices-grid > .loading-spinner {
    grid-column: 1 / -1;
}

.add-device-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 2px dashed var(--border-color);
    background: var(--card-bg);
    min-height: 160px;
    transition: border-color 0.25s ease, background 0.25s ease, transform 0.2s ease;
}

.add-device-card:hover {
    border-color: var(--primary-color);
    background: color-mix(in srgb, var(--primary-color) 5%, transparent); /* --primary-color tint */
    transform: translateY(-2px);
}

.add-device-icon {
    font-size: 2.5rem;
    font-weight: 400;
    color: var(--text-color);
    line-height: 1;
    transition: color 0.2s;
}

.add-device-card:hover .add-device-icon {
    color: var(--primary-text-color);
}

.add-device-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 8px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 20px 20px;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    display: flex;
    flex-direction: column;
}

.card:hover {
    box-shadow: 0 8px 24px var(--shadow-color);
    transform: translateY(-2px);
}

/* ── Card glare effect ── */
.card-glare::after,
.template-card.card-glare::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    background: radial-gradient(
        circle 200px at var(--glare-x, 50%) var(--glare-y, 50%),
        rgba(255, 255, 255, 0.035) 0%,
        transparent 70%
    );
    z-index: 1;
}

.card-glare::after,
.template-card.card-glare::after {
    opacity: 1;
}

[data-theme="light"] .card-glare::after,
[data-theme="light"] .template-card.card-glare::after {
    background: radial-gradient(
        circle 200px at var(--glare-x, 50%) var(--glare-y, 50%),
        rgba(255, 255, 255, 0.12) 0%,
        transparent 70%
    );
}

/* ── Running target: rotating gradient border ── */
@property --border-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

.card-running {
    border-color: transparent;
    background: linear-gradient(
        calc(var(--border-angle) + 45deg),
        var(--card-bg) 0%,
        color-mix(in srgb, var(--primary-color) 12%, var(--card-bg)) 40%,
        var(--card-bg) 60%,
        color-mix(in srgb, var(--primary-color) 8%, var(--card-bg)) 85%,
        var(--card-bg) 100%
    );
}

/* When card has a custom color stripe, keep it and shift the animated border away from the left edge */
.card-running[data-has-color]::before {
    inset: 0 0 0 3px;
    border-left: none;
    border-radius: 0 8px 8px 0;
}

.card-running::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 2px solid transparent;
    background:
        conic-gradient(
            from var(--border-angle),
            var(--primary-color),
            rgba(255,255,255,0.1) 25%,
            var(--primary-color) 50%,
            rgba(255,255,255,0.1) 75%,
            var(--primary-color)
        ) border-box;
    -webkit-mask:
        linear-gradient(#fff 0 0) padding-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask:
        linear-gradient(#fff 0 0) padding-box,
        linear-gradient(#fff 0 0);
    mask-composite: exclude;
    pointer-events: none;
    z-index: 2;
    animation: rotateBorder 4s linear infinite;
}

/* Fallback for browsers without mask-composite support (older Firefox) */
@supports not (mask-composite: exclude) {
    .card-running::before {
        -webkit-mask: none;
        mask: none;
        background: none;
        border: 2px solid var(--primary-color);
        opacity: 0.7;
    }
}

@keyframes rotateBorder {
    to { --border-angle: 360deg; }
}

[data-theme="light"] .card-running {
    background: linear-gradient(
        calc(var(--border-angle) + 45deg),
        var(--card-bg) 0%,
        color-mix(in srgb, var(--primary-color) 18%, var(--card-bg)) 40%,
        var(--card-bg) 60%,
        color-mix(in srgb, var(--primary-color) 14%, var(--card-bg)) 85%,
        var(--card-bg) 100%
    );
}

[data-theme="light"] .card-running::before {
    background:
        conic-gradient(
            from var(--border-angle),
            var(--primary-color),
            rgba(0,0,0,0.12) 25%,
            var(--primary-color) 50%,
            rgba(0,0,0,0.12) 75%,
            var(--primary-color)
        ) border-box;
}

/* ── Card entrance animation ── */
@keyframes cardEnter {
    from { opacity: 0; transform: translateY(12px); }
    to { transform: translateY(0); }
}

.card-enter {
    animation: cardEnter 0.25s ease-out backwards;
}

/* ── Card drag-and-drop reordering ── */

.card-drag-handle {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    opacity: 0;
    color: var(--text-secondary);
    font-size: 10px;
    letter-spacing: 1px;
    line-height: 1;
    border-radius: 3px;
    transition: opacity 0.2s ease, background 0.15s ease;
    z-index: 2;
    touch-action: none;
    user-select: none;
}

.card:hover > .card-drag-handle,
.template-card:hover > .card-drag-handle {
    opacity: 0.5;
}

.card-drag-handle:hover {
    opacity: 1 !important;
    background: var(--border-color);
}

.card-drag-handle:active {
    cursor: grabbing;
}

/* Clone floating during drag */
.card-drag-clone {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.92;
    transform: scale(1.03) rotate(0.8deg);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
    transition: none;
    will-change: left, top;
}

/* Placeholder in grid */
.card-drag-placeholder {
    border: 2px dashed var(--primary-color);
    border-radius: 8px;
    background: color-mix(in srgb, var(--primary-color) 4%, transparent); /* --primary-color tint */
    min-height: 80px;
    transition: none;
}

/* Suppress hover effects globally during drag */
body.cs-drag-active .card,
body.cs-drag-active .template-card,
body.cs-drag-active .add-template-card {
    transition: none !important;
    transform: none !important;
}

body.cs-drag-active .add-template-card {
    pointer-events: none;
    border-color: var(--border-color) !important;
    background: transparent !important;
    box-shadow: none !important;
}

body.cs-drag-active .card-drag-handle {
    opacity: 0 !important;
}

/* Hide drag handles when filter is active or bulk selecting */
.cs-filtering .card-drag-handle,
.cs-selecting .card-drag-handle {
    display: none;
}

@media (prefers-reduced-motion: reduce) {
    .card-drag-clone {
        transform: none;
    }
}

.card-tutorial-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: none;
    border: 1.5px solid var(--border-color);
    color: var(--text-muted, #777);
    font-size: 0.7rem;
    font-weight: bold;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    transition: color 0.2s, background 0.2s, border-color 0.2s;
    padding: 0;
}

.card-tutorial-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-text-color);
}


.card-top-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    gap: 2px;
}

.card-top-actions .card-remove-btn {
    position: static;
}

.card-actions .color-picker-wrapper,
.template-card-actions .color-picker-wrapper {
    display: flex;
    align-items: center;
    margin-left: auto;
}

.card-actions .color-picker-popover,
.template-card-actions .color-picker-popover {
    top: auto;
    bottom: calc(100% + 8px);
    left: auto;
    right: 0;
}

.card.cp-elevated,
.template-card.cp-elevated {
    z-index: 10;
}

.card-autostart-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
}

.card-autostart-btn:hover {
    color: var(--warning-color, #ffc107);
    background: rgba(255, 193, 7, 0.1);
}

.card-autostart-btn.active {
    color: var(--warning-color, #ffc107);
}

.card-power-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
}

.card-power-btn:hover {
    color: var(--primary-text-color);
    background: color-mix(in srgb, var(--primary-color) 10%, transparent); /* --primary-color tint */
}

.card-remove-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
}

.card-remove-btn:hover {
    color: var(--danger-color);
    background: color-mix(in srgb, var(--danger-color) 10%, transparent); /* --danger-color tint */
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-right: 30px;
}

.card-title {
    font-size: 1.05rem;
    font-weight: 600;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
}

.card-title-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.card-title > .icon {
    color: var(--primary-text-color);
    vertical-align: middle;
    margin-right: 6px;
    flex-shrink: 0;
}

.device-url-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--text-secondary);
    background: var(--border-color);
    padding: 2px 8px;
    border-radius: 10px;
    letter-spacing: 0.03em;
    font-family: monospace;
    text-decoration: none;
    transition: background 0.2s;
    white-space: nowrap;
    flex-shrink: 1;
    overflow: hidden;
    min-width: 0;
}

.device-url-text {
    overflow: hidden;
    text-overflow: ellipsis;
}

.device-url-badge:hover {
    background: var(--text-muted);
}

.device-url-icon {
    font-size: 0.6rem;
}

.device-url-badge .icon {
    color: var(--primary-text-color);
}

.card-subtitle {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.card-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.card-meta .icon {
    color: var(--primary-text-color);
}

.device-type-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.15);
    letter-spacing: 0.5px;
}

/* Device discovery */
.discovery-section {
    margin-bottom: 12px;
}
.btn-block {
    width: 100%;
}
.discovery-list {
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
}
.discovery-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--card-bg);
    cursor: pointer;
    transition: opacity 0.15s;
}
.discovery-item:not(.discovery-item--added):hover {
    opacity: 0.8;
}
.discovery-item--added {
    opacity: 0.5;
    cursor: default;
}
.discovery-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.discovery-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--border-color);
    white-space: nowrap;
}
.discovery-type-badge {
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 3px;
    background: var(--primary-color);
    color: var(--primary-contrast);
    font-weight: 600;
    vertical-align: middle;
    margin-right: 2px;
}
.modal-divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 12px 0;
}
.discovery-loading {
    display: flex;
    justify-content: center;
    padding: 12px;
}
.discovery-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* OpenRGB zone checkboxes */
.zone-checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 180px;
    overflow-y: auto;
    padding: 4px 0;
}
.zone-checkbox-list .zone-loading,
.zone-checkbox-list .zone-error {
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 4px 0;
}
.zone-checkbox-list .zone-error { color: var(--danger-color, #e53935); }
.zone-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8125rem;
    transition: background 0.15s;
}
.zone-checkbox-item:hover { background: var(--hover-bg, rgba(255,255,255,0.05)); }
.zone-checkbox-item input[type="checkbox"] { margin: 0; flex-shrink: 0; }
.zone-checkbox-item .zone-led-count {
    margin-left: auto;
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.zone-mode-radios {
    display: flex;
    gap: 16px;
}
.zone-mode-option {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.8125rem;
}
.zone-mode-option input[type="radio"] { margin: 0; }

.zone-badge {
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 3px;
    background: var(--border-color);
    font-weight: 600;
}

.channel-indicator {
    display: inline-flex;
    gap: 2px;
    align-items: center;
}

.channel-indicator .ch {
    width: 8px;
    height: 10px;
    border-radius: 1px;
}

.display-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 15px;
}

.display-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.display-index {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--info-color);
}

.primary-star {
    color: var(--primary-text-color);
    font-size: 1.2rem;
}

/* Display Layout Visualization */
.layout-container {
    position: relative;
    background: transparent;
}

.layout-display {
    position: absolute;
    border: 3px solid;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    transition: box-shadow 0.2s, border-color 0.2s;
}

.layout-display:hover {
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.layout-display.primary {
    border-color: var(--primary-color);
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--primary-color) 15%, transparent), /* --primary-color tint */
        color-mix(in srgb, var(--primary-color) 5%, transparent)   /* --primary-color tint */
    );
}

.layout-display.secondary {
    border-color: var(--border-color);
    background: linear-gradient(135deg, rgba(128, 128, 128, 0.1), rgba(128, 128, 128, 0.05));
}

.layout-position-label {
    position: absolute;
    top: 4px;
    left: 6px;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.layout-index-label {
    position: absolute;
    bottom: 6px;
    left: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color);
    background: var(--display-badge-bg);
    padding: 1px 6px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.layout-display-label {
    text-align: center;
    padding: 5px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.layout-display-label strong {
    font-size: 0.9rem;
    color: var(--text-color);
    font-weight: 600;
}

.layout-display-label small {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.primary-indicator {
    position: absolute;
    top: 2px;
    right: 4px;
    color: var(--primary-text-color);
    font-size: 1.5rem;
    line-height: 1;
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.4);
}


/* Card brightness slider */
.brightness-control {
    padding: 0;
    margin-bottom: 12px;
}

.brightness-slider {
    width: 100%;
}

.brightness-loading .brightness-slider {
    opacity: 0.3;
    pointer-events: none;
}

/* Static color picker — inline in card-subtitle */
.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.section-header h2 {
    margin-bottom: 0;
}

.section-tip {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin: 0 0 15px 0;
    line-height: 1.5;
    padding: 8px 12px;
    background: color-mix(in srgb, var(--info-color, #2196F3) 8%, transparent); /* --info-color tint */
    border-left: 3px solid var(--info-color, #2196F3);
    border-radius: 0 6px 6px 0;
}

.section-tip a {
    color: var(--info-color, #2196F3);
    text-decoration: underline;
}

ul.section-tip {
    list-style: disc;
    padding-left: 28px;
}

ul.section-tip li {
    margin: 2px 0;
}

.metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 12px;
    margin-top: 8px;
}

.metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 8px;
    background: var(--bg-color);
    border-radius: 4px;
}

.metric-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-text-color);
    font-family: var(--font-mono, monospace);
}

.metric-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Target FPS sparkline row */
.target-fps-row {
    display: flex;
    align-items: center;
    gap: 8px;
    grid-column: 1 / -1;
    padding: 3px 8px;
    background: var(--bg-color);
    border-radius: 4px;
}

.target-fps-sparkline {
    position: relative;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    height: 36px;
}

.target-fps-label {
    flex-shrink: 0;
    text-align: right;
}

.target-fps-target {
    font-weight: 400;
    opacity: 0.5;
    font-size: 0.75rem;
}

.target-fps-avg {
    display: block;
    font-size: 0.65rem;
    font-weight: 400;
    opacity: 0.45;
    line-height: 1.1;
    color: var(--primary-color);
}

.fps-unreachable {
    color: #ff5252;
}

/* Error indicator next to target name */
.target-error-indicator {
    display: none;
    color: var(--danger-color);
    margin-left: 4px;
    vertical-align: middle;
}
.target-error-indicator .icon {
    width: 14px;
    height: 14px;
}
.target-error-indicator.visible {
    display: inline-flex;
    align-items: center;
}

/* Collapsible target pipeline metrics */
.target-metrics-collapse {
    margin-top: 4px;
}
.target-metrics-toggle {
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 4px 0;
    user-select: none;
    background: none;
    border: none;
    font-family: inherit;
}
.target-metrics-toggle::before {
    content: '▸ ';
}
.target-metrics-collapse.open .target-metrics-toggle::before {
    content: '▾ ';
}
.target-metrics-animate {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.25s ease;
}
.target-metrics-collapse.open .target-metrics-animate {
    grid-template-rows: 1fr;
}
.target-metrics-animate > .target-metrics-expanded {
    overflow: hidden;
}

/* Timing breakdown bar */
.timing-breakdown {
    margin-top: 8px;
    padding: 6px 8px;
    background: var(--bg-color);
    border-radius: 4px;
}

.timing-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.timing-total {
    font-size: 0.8rem;
    color: var(--primary-text-color);
}

.timing-bar {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin: 4px 0;
    gap: 1px;
}

.timing-seg {
    min-width: 2px;
    transition: flex 0.3s ease;
}

.timing-extract { background: var(--primary-color); }
.timing-map { background: #FF9800; }
.timing-smooth { background: var(--info-color, #2196F3); }
.timing-send { background: #E91E63; }
.timing-audio-read { background: var(--primary-color); }
.timing-audio-fft { background: #FF9800; }
.timing-audio-render { background: var(--info-color, #2196F3); }

.timing-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.timing-legend-item {
    display: flex;
    align-items: center;
    gap: 3px;
}

.timing-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 2px;
}

.timing-dot.timing-extract { background: var(--primary-color); }
.timing-dot.timing-map { background: #FF9800; }
.timing-dot.timing-smooth { background: var(--info-color, #2196F3); }
.timing-dot.timing-send { background: #E91E63; }
.timing-dot.timing-audio-read { background: var(--primary-color); }
.timing-dot.timing-audio-fft { background: #FF9800; }
.timing-dot.timing-audio-render { background: var(--info-color, #2196F3); }

@media (max-width: 768px) {
    .displays-grid,
    .devices-grid {
        grid-template-columns: 1fr;
    }
}

/* ── LED Preview Panel ────────────────────────────────────────── */

.led-preview-panel {
    padding: 4px 0 0;
    position: relative;
}

.led-preview-canvas {
    display: block;
    width: 100%;
    height: 32px;
    border-radius: 3px;
    image-rendering: pixelated;
    background: #111;
}

.led-preview-brightness {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8rem;
    font-family: var(--font-mono, monospace);
    color: #fff;
    text-shadow: 0 0 3px rgba(0,0,0,0.8);
    pointer-events: none;
    opacity: 0.8;
}

/* Per-zone LED preview (OpenRGB separate mode) */
.led-preview-zones {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.led-preview-zone {
    position: relative;
}

.led-preview-zone-canvas {
    display: block;
    width: 100%;
    height: 18px;
    border-radius: 2px;
    image-rendering: pixelated;
    background: #111;
}

.led-preview-zone-label {
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.65rem;
    font-family: var(--font-mono, monospace);
    color: #fff;
    text-shadow: 0 0 3px rgba(0,0,0,0.9), 0 0 6px rgba(0,0,0,0.6);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    white-space: nowrap;
}

.led-preview-zones:hover .led-preview-zone-label {
    opacity: 1;
}

/* Per-layer LED preview (composite sources) */
.led-preview-layers {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.led-preview-layer {
    position: relative;
}

.led-preview-layer-canvas {
    display: block;
    width: 100%;
    height: 24px;
    border-radius: 3px;
    image-rendering: pixelated;
    background: #111;
}

.led-preview-layer-label {
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.6rem;
    font-family: var(--font-mono, monospace);
    color: #fff;
    text-shadow: 0 0 3px rgba(0,0,0,0.9), 0 0 6px rgba(0,0,0,0.6);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    white-space: nowrap;
}

.led-preview-layers:hover .led-preview-layer-label {
    opacity: 1;
}

/* ── Bulk selection ────────────────────────────────────────── */

/* Toggle button in section header */
.cs-bulk-toggle {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.75rem;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s, border-color 0.2s;
    flex-shrink: 0;
    line-height: 1;
}

.cs-bulk-toggle:hover {
    border-color: var(--primary-color);
    color: var(--primary-text-color);
}

.cs-bulk-toggle.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--primary-contrast, #fff);
}

/* Checkbox inside card — hidden unless selecting */
.card-bulk-check {
    display: none;
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary-color);
    flex-shrink: 0;
}

.cs-selecting .card-bulk-check {
    display: block;
}

/* Selected card highlight */
.cs-selecting .card-selected,
.cs-selecting .card-selected.template-card {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 1px var(--primary-color), 0 4px 12px color-mix(in srgb, var(--primary-color) 15%, transparent);
}

/* Make cards visually clickable in selection mode */
.cs-selecting .card,
.cs-selecting .template-card {
    cursor: pointer;
}

/* Suppress hover lift during selection */
.cs-selecting .card:hover,
.cs-selecting .template-card:hover {
    transform: none;
}

/* ── Bulk toolbar ──────────────────────────────────────────── */

#bulk-toolbar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(calc(100% + 30px));
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md, 8px);
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: var(--z-bulk-toolbar);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.3);
    transition: transform 0.25s ease;
    white-space: nowrap;
}

#bulk-toolbar.visible {
    transform: translateX(-50%) translateY(0);
}

.bulk-select-all-wrap {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.bulk-select-all-cb {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.bulk-count {
    font-size: 0.85rem;
    color: var(--text-secondary);
    min-width: 80px;
}

.bulk-actions {
    display: flex;
    gap: 4px;
}

.bulk-action-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bulk-action-btn .icon {
    width: 16px;
    height: 16px;
}

.bulk-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.2s;
    line-height: 1;
}

.bulk-close:hover {
    color: var(--text-color);
}
